:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-soft: #eef2ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --blue-soft: #eff6ff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Bengali", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
p { margin: .35rem 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.6rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; gap: .75rem; align-items: center; }
.flex-between { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: 0 0 236px; background: #0f172a; color: #cbd5e1;
  padding: 1.1rem .85rem; display: flex; flex-direction: column; gap: .2rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em;
  display: flex; align-items: center; gap: .55rem; padding: .3rem .5rem 1rem;
}
.sidebar .brand .dot {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; font-size: 14px; font-weight: 800;
}
.sidebar .ws {
  font-size: 11.5px; color: #94a3b8; padding: .5rem; background: #1e293b;
  border-radius: 8px; margin-bottom: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar a.nav {
  color: #cbd5e1; padding: .55rem .65rem; border-radius: 8px; font-size: 13.5px;
  display: flex; align-items: center; gap: .55rem; text-decoration: none;
}
.sidebar a.nav:hover { background: #1e293b; color: #fff; text-decoration: none; }
.sidebar a.nav.active { background: var(--brand); color: #fff; }
.sidebar .nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #64748b;
  padding: 1rem .65rem .35rem; font-weight: 700;
}
.sidebar .spacer { flex: 1; }
.sidebar .nav svg { width: 16px; height: 16px; opacity: .9; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line); padding: .8rem 1.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.topbar .who { display: flex; align-items: center; gap: .6rem; font-size: 13px; color: var(--muted); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.content { padding: 1.4rem; max-width: 1240px; margin: 0 auto; }
.page-head { margin-bottom: 1.1rem; }
.page-head p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: var(--shadow);
}
.card.tight { padding: .85rem 1rem; }
.card h2 { font-size: 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 1.4rem; font-weight: 700; margin-top: .25rem; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border-bottom: 1px solid var(--line); padding: .6rem .6rem; font-weight: 700;
  background: #fafbfc; white-space: nowrap;
}
table.data td { padding: .65rem .6rem; border-bottom: 1px solid #f1f3f7; vertical-align: middle; }
table.data tbody tr:hover { background: #fafbff; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.total-row td { font-weight: 700; border-top: 2px solid var(--line); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  padding: .5rem .85rem; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--red); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: .3rem .6rem; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-block; padding: .16rem .5rem; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--blue-soft); color: #1d4ed8; }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-grey { background: #f3f4f6; color: #4b5563; }
.badge-purple { background: #f5f3ff; color: #6d28d9; }

/* ---------------------------------------------------------------- forms */
label.field { display: block; margin-bottom: .8rem; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: .3rem; color: #374151; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=search], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid #d1d5db; border-radius: 8px;
  font: inherit; font-size: 13.5px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--brand-soft); border-color: var(--brand); outline-offset: 1px;
}
textarea { min-height: 74px; resize: vertical; }
.form-row { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.hint { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------- alerts */
.alert { padding: .65rem .85rem; border-radius: 9px; font-size: 13px; margin-bottom: .7rem; border: 1px solid; }
.alert-success { background: var(--green-soft); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--red-soft); border-color: #fecaca; color: #991b1b; }
.alert-info { background: var(--blue-soft); border-color: #bfdbfe; color: #1e40af; }

/* ----------------------------------------------------------- document */
.doc-sheet {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow);
}
.doc-head { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; padding-bottom: 1.2rem; border-bottom: 2px solid var(--line); }
.doc-title { font-size: 1.7rem; font-weight: 800; letter-spacing: .04em; color: var(--brand-dark); }
.doc-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
table.items { width: 100%; border-collapse: collapse; margin-top: 1.2rem; font-size: 13.5px; }
table.items th { background: #f3f4fb; color: #312e81; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; padding: .55rem .6rem; text-align: left; }
table.items td { padding: .6rem; border-bottom: 1px solid #f1f3f7; }
table.items td.num, table.items th.num { text-align: right; font-variant-numeric: tabular-nums; }
.totals { margin-left: auto; width: min(320px, 100%); margin-top: 1rem; font-size: 13.5px; }
.totals .row { display: flex; justify-content: space-between; padding: .32rem 0; }
.totals .grand { background: var(--brand-dark); color: #fff; padding: .55rem .7rem; border-radius: 8px; font-weight: 700; margin-top: .3rem; }

/* ---------------------------------------------------------------- misc */
.chart { width: 100%; height: auto; display: block; }
.pill { display: inline-block; background: #f3f4f6; border-radius: 999px; padding: .1rem .5rem; font-size: 11.5px; color: #4b5563; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { padding: .35rem .7rem; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--line); background: #fff; color: var(--muted); text-decoration: none; }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
  background: radial-gradient(1100px 500px at 15% -10%, #e0e7ff 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #fae8ff 0%, transparent 55%), var(--bg); }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.8rem; width: min(430px, 100%); box-shadow: 0 24px 60px -24px rgba(16,24,40,.28); }
.auth-card h1 { font-size: 1.35rem; }
.brandline { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.1rem; margin-bottom: .35rem; }
.brandline .dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; font-size: 14px; }
.demo-box { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 9px; padding: .6rem .75rem; font-size: 12.5px; color: #475569; margin-top: .9rem; }
.hero { max-width: 1100px; margin: 0 auto; padding: 3rem 1.2rem; }
.hero h1 { font-size: 2.4rem; letter-spacing: -.03em; }
.hero p.lead { font-size: 1.05rem; color: var(--muted); max-width: 640px; }
.footer-note { color: var(--muted); font-size: 12px; padding: 1.4rem; text-align: center; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar .spacer { display: none; }
  .sidebar .nav-label { display: none; }
  .sidebar .ws { display: none; }
  .content { padding: 1rem; }
  .doc-sheet { padding: 1.1rem; }
  table.data th, table.data td { padding: .5rem .4rem; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .doc-sheet { border: 0; box-shadow: none; padding: 0; }
}
