/* PoishaPOS — design system. Brand: deep green #0E5A3A, forest #0B3B2A, gold #F2B32A. No external dependencies. */
:root {
  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-2: #f8f9f5;
  --line: #e3e6de;
  --line-strong: #cdd3c6;
  --ink: #17231d;
  --ink-2: #47554d;
  --ink-3: #78857d;
  --brand: #0E5A3A;
  --brand-600: #0B4A30;
  --brand-ink: #ffffff;
  --brand-soft: #e4f1ea;
  --gold: #F2B32A;
  --gold-600: #D99A12;
  --gold-soft: #fdf3dc;
  --accent: #F2B32A;
  --ok: #1e7a46;
  --ok-soft: #e4f3ea;
  --warn: #8f5c00;
  --warn-soft: #fbf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --info: #22577a;
  --info-soft: #e5eef5;
  --side: #0B3B2A;
  --side-2: #0F4733;
  --side-line: rgba(255,255,255,.08);
  --side-ink: #b9cdc2;
  --side-ink-dim: #9fbbac;
  --side-w: 256px;
  --rail-w: 72px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 40, 28, .06), 0 4px 16px rgba(15, 40, 28, .05);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans Bengali", "Hind Siliguri", "Nirmala UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--ink-3); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- App shell & sidebar ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; transition: grid-template-columns .2s ease; }
html.side-rail .shell { grid-template-columns: var(--rail-w) 1fr; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; border-right: 1px solid rgba(0,0,0,.15); }
.side .ico { flex-shrink: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 12px 4px 18px; }
.side-logo { display: flex; align-items: center; min-height: 36px; }
.side-logo img { display: block; }
.side-logo .logo-mark { display: none; }
.side-tagline { padding: 0 18px 12px; font-size: 11.5px; color: var(--gold); letter-spacing: .02em; font-style: italic; opacity: .9; }
.side-toggle, .icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.side-toggle { color: var(--side-ink-dim); }
.side-toggle:hover { background: var(--side-line); color: #fff; }
.side-toggle .ico { transition: transform .2s; }
.side-primary { display: flex; align-items: center; gap: 10px; margin: 2px 12px 10px; padding: 10px 12px; border-radius: 10px; background: var(--gold); color: #10301f; font-weight: 700; font-size: 14px; text-decoration: none !important; box-shadow: 0 2px 0 var(--gold-600); }
.side-primary:hover { background: #f5be45; }
.side-primary kbd { margin-left: auto; font-family: var(--mono); font-size: 10.5px; background: rgba(16,48,31,.12); border-radius: 4px; padding: 1px 5px; font-weight: 600; }
.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-mod { position: relative; margin-bottom: 2px; }
.mod-btn { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--side-ink); font: inherit; font-size: 13.8px; font-weight: 550; text-align: left; cursor: pointer; text-decoration: none !important; position: relative; }
.mod-btn:hover { background: var(--side-line); color: #fff; }
.mod-btn.active, .nav-mod.has-active > .mod-btn { color: #fff; }
.mod-btn.active { background: rgba(242,179,42,.14); }
.mod-btn.active::before, .nav-mod.has-active > .mod-btn::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.mod-btn .lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-btn .chev { flex: 0 0 auto; display: inline-grid; color: var(--side-ink-dim); transition: transform .18s ease; }
.nav-mod.open > .mod-btn .chev { transform: rotate(90deg); color: #fff; }
.dot-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: #10301f; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.mod-items { display: block; max-height: 0; overflow: hidden; transition: max-height .22s ease; }
.nav-mod.open > .mod-items { max-height: 420px; }
.mod-items a { display: flex; align-items: center; justify-content: space-between; margin-left: 20px; padding: 6.5px 10px 6.5px 21px; border-left: 1px solid var(--side-line); color: var(--side-ink-dim); font-size: 13.3px; text-decoration: none !important; border-radius: 0 7px 7px 0; }
.mod-items a:first-of-type { margin-top: 2px; }
.mod-items a:last-of-type { margin-bottom: 6px; }
.mod-items a:hover { color: #fff; background: rgba(255,255,255,.04); }
.mod-items a.active { color: #fff; font-weight: 600; border-left: 2px solid var(--gold); padding-left: 20px; background: rgba(255,255,255,.05); }
.mod-items .pill { background: var(--gold); color: #10301f; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 0 6px; }
.flyout-title { display: none; }
.side-foot { border-top: 1px solid var(--side-line); padding: 8px 10px 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 6px 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #10301f; font-weight: 700; font-size: 13px; display: grid; place-items: center; flex-shrink: 0; }
.user-chip .who { flex: 1; min-width: 0; line-height: 1.25; }
.user-chip .who b { display: block; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who small { color: var(--side-ink-dim); font-size: 11.5px; }
.user-chip .icon-btn { color: var(--side-ink-dim); }
.user-chip .icon-btn:hover { background: var(--side-line); color: #fff; }
.logout-f { margin: 0; }

/* Rail (collapsed) mode */
html.side-rail .side-head { flex-direction: column; padding: 14px 0 6px; gap: 6px; }
html.side-rail .side-logo .logo-full, html.side-rail .side-tagline, html.side-rail .side .lbl { display: none; }
html.side-rail .side-logo .logo-mark { display: block; }
html.side-rail .side-toggle .ico { transform: rotate(180deg); }
html.side-rail .side-primary { justify-content: center; margin: 4px 12px 10px; padding: 10px 0; }
html.side-rail .side-nav { overflow: visible; padding: 4px 12px; }
html.side-rail .mod-btn { justify-content: center; padding: 10px 0; }
html.side-rail .mod-btn::before { left: -12px !important; }
html.side-rail .dot-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; }
html.side-rail .mod-items { position: absolute; left: calc(100% + 10px); top: -4px; max-height: none; min-width: 210px; padding: 6px; background: var(--side-2); border: 1px solid var(--side-line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.3); opacity: 0; visibility: hidden; transform: translateX(-4px); transition: opacity .12s, transform .12s, visibility .12s; }
html.side-rail .mod-items::before { content: ""; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px; }
html.side-rail .nav-mod:hover > .mod-items, html.side-rail .nav-mod:focus-within > .mod-items { opacity: 1; visibility: visible; transform: none; }
html.side-rail .flyout-title { display: block; padding: 6px 10px 6px; color: #fff; font-weight: 700; font-size: 13px; }
html.side-rail .mod-items a { margin: 0; border-left: 0; padding: 7px 10px; border-radius: 7px; }
html.side-rail .mod-items a.active { padding-left: 10px; border-left: 0; background: rgba(242,179,42,.16); }
html.side-rail [data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); background: var(--side-2); color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 7px; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 5; }
html.side-rail .side-foot { padding: 8px 12px 12px; }
html.side-rail .user-chip { flex-direction: column; padding: 8px 0 0; gap: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; min-height: 58px; }
.topbar .spacer { flex: 1; }
.topbar form { margin: 0; }
.topbar select { min-width: 170px; min-height: 36px; }
.biz-name { font-size: 15px; }
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 600; }
.lang-switch { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.content { padding: 24px 28px 56px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--ink-3); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; color: var(--ink-2); }
.side-scrim { display: none; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stat { padding: 14px 16px; }
.stat .label { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfcf9; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
.empty { text-align: center; padding: 36px 16px; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 550; font-size: 13px; margin-bottom: 5px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--bad); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 38px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 90, 58, .16); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); margin: 0; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 140px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 13.5px; padding: 8px 14px; min-height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-600); }
.btn-danger { background: #fff; border-color: #e7b6b2; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 12.5px; }
.btn-lg { padding: 12px 20px; min-height: 48px; font-size: 16px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }

/* ---------- Feedback ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; font-size: 13.5px; }
.alert-success { background: var(--ok-soft); border-color: #b9dfc8; color: #14532d; }
.alert-error { background: var(--bad-soft); border-color: #f0c2bd; color: #7f1d1d; }
.alert-warn { background: var(--warn-soft); border-color: #ecd49f; color: #6b4500; }
.alert-info { background: var(--info-soft); border-color: #c4d7e6; color: #1e3a5f; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eceee8; color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 16px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; }

/* ---------- Dialogs ---------- */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(17, 24, 21, .45); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog .dlg-head h2 { margin: 0; }
dialog .dlg-body { padding: 16px 18px; max-height: 70vh; overflow-y: auto; }
dialog .dlg-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
.auth-brand { background: radial-gradient(900px 500px at 20% 10%, #13704a 0%, transparent 60%), var(--side); color: #d7e6dd; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 40px solid rgba(242,179,42,.06); }
.auth-brand .tag { font-size: 30px; line-height: 1.2; font-weight: 700; color: #fff; letter-spacing: -.02em; max-width: 420px; }
.auth-brand .tag em { color: var(--gold); font-style: normal; }
.auth-brand ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; font-size: 14.5px; }
.auth-brand li::before { content: "●"; color: var(--gold); margin-right: 10px; font-size: 10px; vertical-align: 2px; }
.auth-brand .foot { font-size: 12.5px; color: var(--side-ink-dim); position: relative; z-index: 1; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(420px, 100%); }
.auth-card.wide { width: min(560px, 100%); }
.auth-card .mobile-logo { display: none; margin: 0 auto 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell, html.side-rail .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .side { transform: none; }
  body.nav-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(10,30,20,.45); z-index: 39; }
  .side-toggle { display: none; }
  /* rail mode never applies on small screens */
  html.side-rail .side .lbl, html.side-rail .side-tagline { display: revert; }
  html.side-rail .side-logo .logo-full { display: block; } html.side-rail .side-logo .logo-mark { display: none; }
  html.side-rail .side-head { flex-direction: row; padding: 16px 12px 4px 18px; }
  html.side-rail .mod-btn { justify-content: flex-start; padding: 8px 10px; }
  html.side-rail .side-nav { overflow-y: auto; padding: 4px 10px 8px; }
  html.side-rail .mod-items { position: static; opacity: 1; visibility: visible; transform: none; max-height: 0; min-width: 0; padding: 0; background: none; border: 0; box-shadow: none; }
  html.side-rail .nav-mod.open > .mod-items { max-height: 420px; }
  html.side-rail .flyout-title { display: none; }
  html.side-rail .user-chip { flex-direction: row; }
  html.side-rail .side-primary { justify-content: flex-start; padding: 10px 12px; }
  .menu-btn { display: inline-grid; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card .mobile-logo { display: block; }
}
@media (max-width: 600px) { .grid-4, .form-grid { grid-template-columns: 1fr; } .topbar select { min-width: 0; max-width: 140px; } .biz-name { display: none; } }

@media print {
  .side, .topbar, .no-print, .page-head .actions { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}
