/* =========================================================================
   SuperPOS design system — every colour comes from theme tokens (theme.js)
   ========================================================================= */
:root {
  --primary: #7357f6; --primary-2: #6366f1; --accent: #f2541b; --accent-2: #ff8a3d;
  --success: #16a34a; --warning: #d97706; --danger: #dc2626; --info: #0891b2;
  --bg: #f4f5fb; --surface: #fff; --surface-2: #f8f9fd; --border: #e6e8f0; --text: #1e2235; --muted: #6b7088;
  --sidebar-bg: #fff; --sidebar-text: #2b3045; --sidebar-active: #7357f6; --topbar-bg: #fff;
  --on-primary: #fff; --on-accent: #fff; --on-sidebar-active: #fff; --on-topbar: var(--text);
  --radius: 12px; --fs: 14px; --font: 'Inter', 'Hind Siliguri', system-ui, sans-serif;
  --r-sm: calc(var(--radius) * .6); --r-lg: calc(var(--radius) * 1.35); --r-pill: 999px;
  --grad: linear-gradient(135deg, var(--primary), var(--primary-2));
  --grad-accent: linear-gradient(135deg, var(--accent-2), var(--accent));
  --line-grad: linear-gradient(90deg, var(--accent-2), #ec4899 30%, var(--primary) 65%, var(--primary-2));
  --primary-soft: color-mix(in srgb, var(--primary) 12%, transparent);
  --primary-softer: color-mix(in srgb, var(--primary) 6%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --success-soft: color-mix(in srgb, var(--success) 13%, transparent);
  --warning-soft: color-mix(in srgb, var(--warning) 14%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 12%, transparent);
  --info-soft: color-mix(in srgb, var(--info) 13%, transparent);
  --text-2: color-mix(in srgb, var(--text) 78%, var(--bg));
  --hover: color-mix(in srgb, var(--text) 5%, transparent);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 6px 20px -8px rgba(30, 34, 70, .12);
  --shadow-lg: 0 18px 50px -12px rgba(30, 34, 70, .28);
  --pad: 20px; --gap: 18px; --row-h: 42px; --ctl-h: 40px;
  --sidebar-w: 264px; --topbar-h: 64px;
}
[data-density="compact"] { --pad: 14px; --gap: 12px; --row-h: 34px; --ctl-h: 34px; }
[data-density="spacious"] { --pad: 26px; --gap: 22px; --row-h: 50px; --ctl-h: 44px; }
[data-mode="dark"] {
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.6); --shadow-lg: 0 20px 60px -10px rgba(0,0,0,.7);
  --hover: color-mix(in srgb, var(--text) 7%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
::selection { background: var(--primary-soft); }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.ic-lg { width: 1.5em; height: 1.5em; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 35%, transparent); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- boot ---------- */
.boot-splash { display: grid; place-items: center; height: 100vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
[data-layout="mini"] .shell { grid-template-columns: 76px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; border-right: 1px solid var(--border); z-index: 40; }
[data-sidebar="dark"] .sidebar { border-right-color: transparent; }
[data-sidebar="gradient"] .sidebar { background: linear-gradient(180deg, var(--sidebar-bg), color-mix(in srgb, var(--sidebar-bg) 55%, var(--primary-2))); border-right: 0; }
[data-sidebar="glass"] .sidebar { background: color-mix(in srgb, var(--sidebar-bg) 70%, transparent); backdrop-filter: blur(16px) saturate(1.4); }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; height: var(--topbar-h); flex: none; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; color: var(--on-primary); flex: none; box-shadow: 0 6px 16px -6px var(--primary); overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-logo .ic { width: 22px; height: 22px; }
.brand-text { min-width: 0; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-tag { font-size: .7rem; opacity: .65; white-space: nowrap; letter-spacing: .02em; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 20px; }
.nav-sec { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; margin: 2px 0; border-radius: var(--r-sm); color: inherit; cursor: pointer; font-weight: 500; position: relative; user-select: none; text-decoration: none !important; border: 1px solid transparent; }
[data-sidebar="light"] .nav-item, [data-sidebar="glass"] .nav-item { border-color: color-mix(in srgb, var(--border) 70%, transparent); background: color-mix(in srgb, var(--surface) 60%, transparent); margin: 5px 0; }
.nav-item:hover { background: color-mix(in srgb, var(--sidebar-text) 8%, transparent); }
.nav-item .ic { width: 18px; height: 18px; opacity: .8; }
.nav-item .chev { margin-left: auto; transition: transform .2s; width: 15px; height: 15px; opacity: .55; }
.nav-item.open .chev { transform: rotate(90deg); }
.nav-item.active { background: color-mix(in srgb, var(--sidebar-active) 14%, transparent); color: var(--sidebar-active); font-weight: 600; border-color: color-mix(in srgb, var(--sidebar-active) 35%, transparent); }
[data-sidebar="light"] .nav-item.active, [data-sidebar="glass"] .nav-item.active { box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--sidebar-active) 60%, transparent); }
.nav-item.active::before { content: ''; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--sidebar-active); }
[data-sidebar="dark"] .nav-item.active, [data-sidebar="gradient"] .nav-item.active { background: color-mix(in srgb, var(--sidebar-active) 18%, transparent); color: var(--sidebar-active); }
.nav-item.active .ic { opacity: 1; }
.nav-sub { display: none; padding: 2px 0 6px 18px; position: relative; }
.nav-sub::before { content: ''; position: absolute; left: 20px; top: 4px; bottom: 8px; width: 1px; background: color-mix(in srgb, var(--sidebar-text) 15%, transparent); }
.nav-sub.open { display: block; }
.nav-sub a { display: block; padding: 6px 12px 6px 18px; border-radius: var(--r-sm); color: inherit; opacity: .78; font-size: .93rem; text-decoration: none !important; position: relative; }
.nav-sub a:hover { opacity: 1; background: color-mix(in srgb, var(--sidebar-text) 7%, transparent); }
.nav-sub a.active { opacity: 1; color: var(--sidebar-active); font-weight: 600; }
.nav-sub a.active::before { content: ''; position: absolute; left: 1px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--sidebar-active); }
.nav .badge { margin-left: auto; }
.side-foot { padding: 12px; border-top: 1px solid color-mix(in srgb, var(--sidebar-text) 10%, transparent); font-size: .75rem; opacity: .6; text-align: center; }
[data-layout="mini"] .brand-text, [data-layout="mini"] .nav-sec, [data-layout="mini"] .nav-item span, [data-layout="mini"] .nav-item .chev, [data-layout="mini"] .side-foot, [data-layout="mini"] .nav-sub { display: none !important; }
[data-layout="mini"] .nav-item { justify-content: center; padding: 11px; }
[data-layout="mini"] .brand { justify-content: center; padding: 14px 0; }
[data-layout="mini"] .nav-item .ic { width: 20px; height: 20px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 var(--pad); background: color-mix(in srgb, var(--topbar-bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); color: var(--on-topbar); }
[data-topbar="colored"] .topbar { background: var(--topbar-bg); border-bottom: 0; }
[data-topbar="transparent"] .topbar { background: color-mix(in srgb, var(--bg) 70%, transparent); border-bottom-color: transparent; }
.topbar .spacer { flex: 1; }
.tb-btn { height: 40px; min-width: 40px; padding: 0 11px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font: inherit; font-weight: 600; font-size: .9rem; position: relative; transition: transform .12s, box-shadow .15s; white-space: nowrap; }
.tb-btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
[data-topbar="colored"] .tb-btn { background: color-mix(in srgb, var(--on-topbar) 12%, transparent); color: var(--on-topbar); border-color: color-mix(in srgb, var(--on-topbar) 22%, transparent); }
.tb-btn.soft-violet { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.tb-btn.soft-green { background: var(--success-soft); border-color: transparent; color: var(--success); }
.tb-btn.soft-amber { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.tb-btn.soft-red { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.tb-btn.soft-blue { background: var(--info-soft); border-color: transparent; color: var(--info); }
.tb-btn.tb-pos { background: var(--grad-accent); color: var(--on-accent); border: 0; padding: 0 16px; box-shadow: 0 6px 18px -6px var(--accent); letter-spacing: .02em; }
.tb-btn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }
.tb-btn .count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; display: grid; place-items: center; padding: 0 4px; }
.tb-search { position: relative; max-width: 360px; width: 100%; }
.tb-search input { padding-left: 38px; height: 40px; background: var(--surface-2); }
.tb-search > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.tb-search .kbd-hint { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.search-pop { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 60; max-height: 420px; overflow-y: auto; }
.search-pop a { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.search-pop a:hover, .search-pop a.sel { background: var(--primary-softer); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; flex: none; border: 2px solid var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; }
.avatar.sm { width: 30px; height: 30px; font-size: .8rem; }
.content { padding: var(--pad); flex: 1; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: var(--gap); }
.page-head .titles { flex: 1; min-width: 200px; }
.page-head h1 { font-size: 1.45rem; }
.crumbs { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.crumbs a { color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero { position: relative; background: var(--surface); border-radius: var(--r-lg); padding: 24px 26px; box-shadow: var(--shadow); margin-bottom: var(--gap); overflow: hidden; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--line-grad); }
.hero h1 { font-size: 1.7rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.hero .sub { color: var(--muted); margin-top: 4px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); position: relative; min-width: 0; }
[data-card="shadow"] .card { box-shadow: var(--shadow); }
[data-card="bordered"] .card { border: 1px solid var(--border); }
[data-card="flat"] .card { background: var(--surface); }
[data-card="glass"] .card { background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(14px) saturate(1.3); border: 1px solid color-mix(in srgb, var(--surface) 60%, var(--border)); box-shadow: var(--shadow-sm); }
[data-accentline="1"] .card.accent::before { content: ''; position: absolute; top: 0; left: 18px; right: 18px; height: 3px; border-radius: 0 0 3px 3px; background: var(--line-grad); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px var(--pad); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h3 { font-size: 1.02rem; flex: 1; min-width: 120px; display: flex; align-items: center; gap: 10px; }
.card-head .sub { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.card-body { padding: var(--pad); }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px var(--pad); border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-3-1 { grid-template-columns: minmax(0, 3fr) minmax(300px, 1fr); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
.mb { margin-bottom: var(--gap); } .mt { margin-top: var(--gap); } .mt-s { margin-top: 8px; } .mb-s { margin-bottom: 8px; }

/* ---------- KPI cards (Posify-style) ---------- */
.kpi { background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, box-shadow .2s; min-width: 0; cursor: default; }
[data-card="shadow"] .kpi { box-shadow: var(--shadow); }
[data-card="bordered"] .kpi { border: 1px solid var(--border); }
[data-card="glass"] .kpi { background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(14px); border: 1px solid color-mix(in srgb, var(--surface) 60%, var(--border)); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi .tag { font-size: .62rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 9px; border-radius: var(--r-pill); }
.kpi .label { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi .value.sm { font-size: 1.05rem; }
.kpi .delta { font-size: .78rem; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.kpi .delta.up { color: var(--success); } .kpi .delta.down { color: var(--danger); }
.kpi .spark { position: absolute; right: 0; bottom: 0; width: 46%; height: 42px; opacity: .55; }
.tile { width: 42px; height: 42px; border-radius: calc(var(--radius) * .85); display: grid; place-items: center; color: #fff; flex: none; }
.tile .ic { width: 20px; height: 20px; }
.tile.sm { width: 34px; height: 34px; } .tile.sm .ic { width: 17px; height: 17px; }
.tile.lg { width: 54px; height: 54px; } .tile.lg .ic { width: 26px; height: 26px; }
.g-violet { --c1: #8b5cf6; --c2: #6366f1; } .g-green { --c1: #34d399; --c2: #059669; } .g-pink { --c1: #f472b6; --c2: #db2777; }
.g-orange { --c1: #fdba74; --c2: #f97316; } .g-cyan { --c1: #67e8f9; --c2: #0891b2; } .g-red { --c1: #fb7185; --c2: #e11d48; }
.g-amber { --c1: #fcd34d; --c2: #d97706; } .g-blue { --c1: #60a5fa; --c2: #2563eb; } .g-teal { --c1: #5eead4; --c2: #0d9488; }
.g-primary { --c1: var(--primary-2); --c2: var(--primary); } .g-accent { --c1: var(--accent-2); --c2: var(--accent); }
[data-icons="gradient"] .tile { background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 8px 18px -8px var(--c2); }
[data-icons="soft"] .tile { background: color-mix(in srgb, var(--c2) 14%, transparent); color: var(--c2); }
[data-icons="solid"] .tile { background: var(--c2); }

/* ---------- buttons ---------- */
.btn { height: var(--ctl-h); padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; white-space: nowrap; transition: transform .1s, box-shadow .15s, background .15s, filter .15s; text-decoration: none !important; user-select: none; }
.btn:hover { background: var(--surface-2); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--grad); color: var(--on-primary); border-color: transparent; box-shadow: 0 6px 16px -8px var(--primary); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.07); box-shadow: 0 8px 20px -8px var(--primary); }
.btn-accent { background: var(--grad-accent); color: var(--on-accent); border-color: transparent; box-shadow: 0 6px 16px -8px var(--accent); }
.btn-accent:hover { background: var(--grad-accent); filter: brightness(1.07); }
.btn-success { background: var(--success); color: #fff; border-color: transparent; } .btn-success:hover { background: var(--success); filter: brightness(1.08); }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; } .btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-warning { background: var(--warning); color: #fff; border-color: transparent; }
.btn-soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; } .btn-soft:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; } .btn-ghost:hover { background: var(--hover); box-shadow: none; }
.btn-sm { height: 32px; padding: 0 11px; font-size: .84rem; }
.btn-xs { height: 26px; padding: 0 8px; font-size: .78rem; border-radius: calc(var(--r-sm) * .8); }
.btn-lg { height: 50px; padding: 0 22px; font-size: 1.02rem; }
.btn-icon { width: var(--ctl-h); padding: 0; } .btn-icon.btn-sm { width: 32px; } .btn-icon.btn-xs { width: 26px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; } .btn-group .btn { border-radius: 0; margin-left: -1px; } .btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); } .btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* ---------- forms ---------- */
.input, select.input, textarea.input { width: 100%; height: var(--ctl-h); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s; min-width: 0; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7088' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input.err, .field.err .input { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.input.sm { height: 32px; font-size: .86rem; padding: 0 9px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input[type="color"] { padding: 3px; width: 48px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--danger); }
.field .help { font-size: .76rem; color: var(--muted); }
.field .errmsg { font-size: .76rem; color: var(--danger); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .form-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .form-grid.c1 { grid-template-columns: 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.input-group { display: flex; align-items: stretch; }
.input-group > .input { border-radius: 0; } .input-group > :first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); } .input-group > :last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input-group > * + * { margin-left: -1px; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .9rem; white-space: nowrap; }
.input-icon { position: relative; } .input-icon > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; } .input-icon > .input { padding-left: 38px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 23px; border-radius: 20px; background: color-mix(in srgb, var(--muted) 35%, transparent); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; padding: 6px 13px; border-radius: calc(var(--r-sm) - 2px); font: inherit; font-size: .86rem; font-weight: 600; color: var(--muted); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.seg .on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--gap); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 7px; align-items: center; }
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); }
.card > .tabs { padding: 0 var(--pad); margin: 0; }

/* ---------- table ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl th.sortable { cursor: pointer; user-select: none; } .tbl th.sortable:hover { color: var(--text); }
.tbl th .sort { opacity: .4; margin-left: 4px; } .tbl th.sorted .sort { opacity: 1; color: var(--primary); }
.tbl td { padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--primary-softer); }
.tbl tbody tr.click { cursor: pointer; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.tbl .r, .r { text-align: right; } .tbl .c, .c { text-align: center; }
.tbl td.num, .num { font-variant-numeric: tabular-nums; }
.tbl .acts { white-space: nowrap; text-align: right; width: 1%; }
.tbl .title { font-weight: 600; }
.tbl .sub { font-size: .78rem; color: var(--muted); }
.tbl-tools { display: flex; gap: 10px; align-items: center; padding: 14px var(--pad); flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tbl-tools .grow { flex: 1; min-width: 180px; max-width: 340px; }
.tbl-foot { display: flex; align-items: center; gap: 12px; padding: 12px var(--pad); color: var(--muted); font-size: .85rem; flex-wrap: wrap; }
.tbl-foot .spacer { flex: 1; }
.pager { display: flex; gap: 4px; }
.pager button { min-width: 32px; height: 32px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm); cursor: pointer; font: inherit; font-size: .85rem; color: var(--text); padding: 0 8px; }
.pager button.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pager button:disabled { opacity: .4; cursor: default; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ic { width: 42px; height: 42px; opacity: .35; margin-bottom: 10px; }
.empty h4 { color: var(--text); margin-bottom: 4px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input { width: auto; min-width: 140px; }

/* ---------- badges, chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill); font-size: .72rem; font-weight: 700; letter-spacing: .02em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; text-transform: capitalize; }
.badge.b-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.b-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.b-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.b-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.b-primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge.b-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); font-size: .86rem; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--text); transition: all .15s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on { background: var(--grad); color: var(--on-primary); border-color: transparent; box-shadow: 0 4px 12px -5px var(--primary); }
.kbd, kbd { font-family: ui-monospace, monospace; font-size: .72rem; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface-2); color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .82rem; } .xs { font-size: .74rem; } .bold { font-weight: 700; } .semi { font-weight: 600; }
.t-success { color: var(--success); } .t-danger { color: var(--danger); } .t-warning { color: var(--warning); } .t-primary { color: var(--primary); } .t-info { color: var(--info); }
.nowrap { white-space: nowrap; } .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flex { display: flex; align-items: center; gap: 10px; } .flex.wrap { flex-wrap: wrap; } .flex.col { flex-direction: column; align-items: stretch; } .flex.top { align-items: flex-start; } .flex.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.progress { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--grad); border-radius: 6px; transition: width .4s; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px var(--pad); border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.stat-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.stat-row:last-child { border-bottom: 0; }
.stat-row.total { font-weight: 800; font-size: 1.1rem; border-top: 2px solid var(--text); border-bottom: 0; padding-top: 10px; margin-top: 4px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); background: var(--info-soft); color: var(--text); font-size: .9rem; margin-bottom: var(--gap); }
.notice .ic { color: var(--info); margin-top: 2px; }
.notice.warn { background: var(--warning-soft); } .notice.warn .ic { color: var(--warning); }
.notice.danger { background: var(--danger-soft); } .notice.danger .ic { color: var(--danger); }
.notice.ok { background: var(--success-soft); } .notice.ok .ic { color: var(--success); }

/* ---------- dropdown ---------- */
.dd { position: relative; display: inline-block; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 70; display: none; color: var(--text); }
.dd.open .dd-menu { display: block; animation: pop .14s ease-out; }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-sm); font: inherit; font-size: .9rem; color: inherit; cursor: pointer; text-align: left; text-decoration: none !important; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--hover); }
.dd-menu .sep { height: 1px; background: var(--border); margin: 5px 0; }
.dd-menu .head { padding: 8px 10px; font-size: .78rem; color: var(--muted); }
.dd-menu .danger { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 18, 35, .48); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; position: relative; animation: rise .2s ease-out; display: flex; flex-direction: column; max-height: 90vh; color: var(--text); }
.modal.sm { max-width: 420px; } .modal.lg { max-width: 860px; } .modal.xl { max-width: 1140px; } .modal.full { max-width: 96vw; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex: none; }
.modal-head h3 { flex: 1; font-size: 1.1rem; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex: none; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(400px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-lg); border-left: 4px solid var(--success); animation: rise .2s; font-weight: 500; }
.toast.error { border-left-color: var(--danger); } .toast.warn { border-left-color: var(--warning); } .toast.info { border-left-color: var(--info); }
.toast .ic { margin-top: 2px; } .toast.success .ic { color: var(--success); } .toast.error .ic { color: var(--danger); } .toast.warn .ic { color: var(--warning); } .toast.info .ic { color: var(--info); }

/* ---------- autocomplete ---------- */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 80; max-height: 320px; overflow-y: auto; }
.ac-item { padding: 9px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--border); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.sel { background: var(--primary-softer); }
.ac-item .meta { margin-left: auto; text-align: right; font-size: .8rem; color: var(--muted); white-space: nowrap; }

/* ---------- charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: .78rem; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; box-shadow: var(--shadow); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap .chart { max-width: 190px; }
.donut-legend { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 7px; font-size: .85rem; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend span:last-child { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat td { text-align: center; font-size: .75rem; padding: 0 4px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
[data-login="center"] .login { grid-template-columns: 1fr; place-items: center; }
[data-login="center"] .login-art { display: none; }
.login-art { background: var(--grad); color: var(--on-primary); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::before, .login-art::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); }
.login-art::before { width: 420px; height: 420px; right: -120px; top: -120px; }
.login-art::after { width: 300px; height: 300px; left: -90px; bottom: -90px; }
.login-art .brand-logo { background: rgba(255,255,255,.18); box-shadow: none; width: 52px; height: 52px; border-radius: 15px; }
.login-art h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; margin: 16px 0 8px; }
.login-art .feats { display: grid; gap: 14px; position: relative; z-index: 1; max-width: 420px; }
.login-art .feat { display: flex; gap: 14px; align-items: center; background: rgba(255,255,255,.1); padding: 14px 16px; border-radius: var(--radius); backdrop-filter: blur(6px); }
.login-art .feat .ic { width: 22px; height: 22px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 400px; }
.login-box h2 { font-size: 1.7rem; margin-bottom: 6px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.pinpad button { height: 58px; font-size: 1.35rem; font-weight: 700; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; }
.pinpad button:hover { background: var(--primary-softer); border-color: var(--primary); }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 14px 0; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--primary); }
.pin-dots i.on { background: var(--primary); }
.user-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.user-pick button { padding: 14px 8px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; font: inherit; color: var(--text); }
.user-pick button:hover { border-color: var(--primary); }

/* ---------- POS ---------- */
.pos { height: 100vh; display: grid; grid-template-rows: auto 1fr; background: var(--bg); overflow: hidden; }
.pos-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pos-top .brand-logo { width: 36px; height: 36px; }
.pos-body { display: grid; grid-template-columns: minmax(0, 1fr) 440px; min-height: 0; }
.pos-left { display: flex; flex-direction: column; min-height: 0; padding: 14px 16px; gap: 12px; }
.pos-search { position: relative; }
.pos-search input { height: 50px; font-size: 1.05rem; padding-left: 46px; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.pos-search > .ic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--primary); width: 20px; height: 20px; }
.pos-cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; flex: none; }
.pos-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start; padding: 2px 2px 20px; }
.pcard { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: transform .12s, box-shadow .15s, border-color .15s; position: relative; user-select: none; min-height: 118px; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.pcard:active { transform: scale(.98); }
.pcard .pimg { height: 74px; border-radius: calc(var(--radius) * .7); background: var(--primary-softer); display: grid; place-items: center; overflow: hidden; color: var(--primary); font-weight: 800; font-size: 1.4rem; }
.pcard .pimg img { width: 100%; height: 100%; object-fit: cover; }
.pcard .pname { font-weight: 600; font-size: .86rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .pmeta { display: flex; justify-content: space-between; align-items: center; margin-top: auto; gap: 6px; }
.pcard .pprice { font-weight: 800; color: var(--primary); font-size: .95rem; }
.pcard .pstock { font-size: .7rem; color: var(--muted); }
.pcard.out { opacity: .5; } .pcard.out .pstock { color: var(--danger); font-weight: 700; }
.pcard .promo { position: absolute; top: 8px; left: 8px; background: var(--grad-accent); color: var(--on-accent); font-size: .65rem; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
[data-pos-images="0"] .pcard .pimg { display: none; } [data-pos-images="0"] .pcard { min-height: 84px; }
.pos-right { background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.pos-cust { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.pos-cart { flex: 1; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.cart-line.flash { animation: flash .6s; }
@keyframes flash { from { background: var(--primary-soft); } }
.cart-line .nm { font-weight: 600; font-size: .9rem; line-height: 1.3; cursor: pointer; }
.cart-line .nm small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.qty button { width: 30px; height: 32px; border: 0; background: var(--surface-2); cursor: pointer; color: var(--text); display: grid; place-items: center; }
.qty button:hover { background: var(--primary-soft); color: var(--primary); }
.qty input { width: 52px; height: 32px; border: 0; text-align: center; font: inherit; font-weight: 700; background: transparent; color: var(--text); }
.qty input:focus { outline: none; background: var(--primary-softer); }
.cart-line .lt { font-weight: 700; text-align: right; min-width: 78px; font-variant-numeric: tabular-nums; }
.cart-line .rm { grid-column: 3; justify-self: end; }
.pos-totals { border-top: 1px solid var(--border); padding: 10px 14px; background: var(--surface-2); font-size: .9rem; }
.pos-totals .row { display: flex; justify-content: space-between; padding: 3px 0; align-items: center; gap: 8px; }
.pos-totals .row a { cursor: pointer; }
.pos-totals .grand { font-size: 1.5rem; font-weight: 800; color: var(--text); padding-top: 8px; border-top: 1px dashed var(--border); margin-top: 6px; }
.pos-pay { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.pos-pay .btn { height: 52px; flex-direction: column; gap: 2px; font-size: .78rem; padding: 0 4px; }
.pos-pay .btn .ic { width: 18px; height: 18px; }
.pos-pay .btn.big { grid-column: span 2; font-size: 1rem; flex-direction: row; gap: 8px; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pay-methods button { padding: 12px 6px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; font: inherit; font-weight: 700; font-size: .85rem; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); }
.pay-methods button.on { border-color: var(--primary); background: var(--primary-softer); color: var(--primary); }
.quick-cash { display: flex; gap: 8px; flex-wrap: wrap; }
.big-total { text-align: center; padding: 14px; border-radius: var(--radius); background: var(--grad); color: var(--on-primary); }
.big-total .v { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.pos-mobile-tabs { display: none; }

/* ---------- theme manager ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--gap); }
.theme-card { border-radius: var(--r-lg); border: 2px solid var(--border); background: var(--surface); overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .2s, border-color .15s; position: relative; }
.theme-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.theme-card.on { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.theme-card .tc-body { padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.theme-card .tc-body .name { font-weight: 700; flex: 1; min-width: 0; }
.theme-card .tc-flag { position: absolute; top: 10px; right: 10px; z-index: 2; }
.mini-ui { height: 132px; display: grid; grid-template-columns: 30% 1fr; overflow: hidden; border-bottom: 1px solid var(--border); }
.mini-ui .ms { padding: 8px 6px; display: flex; flex-direction: column; gap: 5px; }
.mini-ui .ms i { display: block; height: 7px; border-radius: 4px; opacity: .35; background: currentColor; }
.mini-ui .ms i.a { opacity: 1; height: 9px; }
.mini-ui .mm { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.mini-ui .mt { height: 12px; border-radius: 4px; }
.mini-ui .mk { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
.mini-ui .mk span { height: 30px; border-radius: 5px; position: relative; }
.mini-ui .mk span::after { content: ''; position: absolute; left: 5px; top: 5px; width: 9px; height: 9px; border-radius: 3px; background: var(--mini-tile, #888); }
.mini-ui .mc { flex: 1; border-radius: 5px; display: flex; align-items: flex-end; gap: 3px; padding: 5px; }
.mini-ui .mc b { flex: 1; border-radius: 2px 2px 0 0; }
.swatches { display: flex; gap: 4px; }
.swatches i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.1); }
.builder { display: grid; grid-template-columns: 380px 1fr; gap: var(--gap); align-items: start; }
.builder .controls { position: sticky; top: calc(var(--topbar-h) + 14px); max-height: calc(100vh - var(--topbar-h) - 28px); overflow-y: auto; }
.color-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.color-row label { flex: 1; font-size: .86rem; font-weight: 500; }
.color-row .input { width: 96px; height: 34px; font-family: ui-monospace, monospace; font-size: .82rem; }
.color-row input[type="color"] { width: 38px; height: 34px; border-radius: 8px; border: 1px solid var(--border); padding: 2px; background: var(--surface); cursor: pointer; }
.preview-frame { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.preview-frame .pv { display: grid; grid-template-columns: 210px 1fr; min-height: 560px; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs); }
.assign-row { display: grid; grid-template-columns: minmax(0, 1fr) 260px auto; gap: 12px; align-items: center; padding: 10px var(--pad); border-bottom: 1px solid var(--border); }
.src-badge { font-size: .68rem; }

/* ---------- misc pages ---------- */
.report-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.report-link { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius); color: var(--text); text-decoration: none !important; transition: background .1s; }
.report-link:hover { background: var(--primary-softer); }
.report-link .t { font-weight: 600; } .report-link .d { font-size: .8rem; color: var(--muted); }
.memo-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.memo { border-radius: var(--radius); padding: 14px 16px; min-height: 150px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm); color: #2d2a1e; }
.memo.yellow { background: #fef9c3; } .memo.green { background: #dcfce7; } .memo.blue { background: #dbeafe; } .memo.pink { background: #fce7f3; } .memo.purple { background: #ede9fe; }
.memo h4 { font-size: .98rem; } .memo p { font-size: .88rem; white-space: pre-wrap; flex: 1; margin: 0; }
.memo .foot { display: flex; gap: 6px; align-items: center; font-size: .72rem; opacity: .7; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.msg.me { align-self: flex-end; background: var(--primary-soft); border-color: transparent; }
.msg .who { font-size: .72rem; color: var(--muted); margin-bottom: 2px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.perm-group h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .92rem; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.coa-tree .lvl1 td:first-child { padding-left: 34px; } .coa-tree .lvl2 td:first-child { padding-left: 54px; }
.coa-tree .grp td { font-weight: 700; background: var(--surface-2); }
.calc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc button { height: 52px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 1.15rem; font-weight: 600; cursor: pointer; color: var(--text); }
.calc button.op { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.calc button.eq { background: var(--grad); color: var(--on-primary); border: 0; }
.calc-screen { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; text-align: right; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.calc-screen .expr { font-size: .85rem; color: var(--muted); min-height: 1.3em; word-break: break-all; }
.calc-screen .res { font-size: 1.9rem; font-weight: 700; word-break: break-all; }
.mod-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; }
.inv-lines td .input { height: 34px; }
.sticky-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px var(--pad); display: flex; gap: 10px; justify-content: flex-end; z-index: 5; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.ledger-head { display: flex; gap: 18px; flex-wrap: wrap; }
.ledger-head .box { padding: 12px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); min-width: 150px; }
.ledger-head .box .l { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.ledger-head .box .v { font-size: 1.2rem; font-weight: 700; }
.mobile-only { display: none; }
.backdrop { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pos-body { grid-template-columns: minmax(0, 1fr) 390px; } }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2-1, .g-1-2, .g-3-1 { grid-template-columns: 1fr; } .builder { grid-template-columns: 1fr; } .builder .controls { position: static; max-height: none; } }
@media (max-width: 960px) {
  .shell, [data-layout="mini"] .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-105%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  [data-layout="mini"] .brand-text, [data-layout="mini"] .nav-sec, [data-layout="mini"] .nav-item span, [data-layout="mini"] .nav-item .chev, [data-layout="mini"] .side-foot { display: revert !important; }
  [data-layout="mini"] .nav-item { justify-content: flex-start; } [data-layout="mini"] .nav-sub.open { display: block !important; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-md { display: none !important; }
  .mobile-only { display: revert; }
  .tb-search { display: none; }
  .pos-body { grid-template-columns: 1fr; }
  .pos-right { position: fixed; inset: auto 0 0 0; top: 64px; transform: translateY(100%); transition: transform .25s; z-index: 50; }
  .pos.show-cart .pos-right { transform: none; }
  .pos-mobile-tabs { display: flex; position: fixed; bottom: 14px; right: 14px; z-index: 60; }
}
@media (max-width: 640px) {
  :root { --pad: 14px; --gap: 12px; }
  .g2, .g3, .g4, .g5, .form-grid, .form-grid.c3, .form-grid.c4 { grid-template-columns: 1fr; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2, .span3 { grid-column: auto; }
  .kpi .value { font-size: 1.2rem; }
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .hide-sm { display: none !important; }
  .page-head h1 { font-size: 1.2rem; }
  .modal-back { padding: 0; align-items: flex-end; } .modal { max-height: 94vh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .assign-row { grid-template-columns: 1fr; }
  .tb-btn .tb-label { display: none; }
  .pos-pay { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .page-head .actions, .tbl-tools, .tbl-foot .pager, .no-print, #toasts { display: none !important; }
  .shell { display: block; } .content { padding: 0; } .card { box-shadow: none !important; border: 0 !important; }
}
.preview-frame .kpi .value { font-size: 1.12rem; }
.preview-frame .kpi { padding: 13px 14px; }
.preview-frame .tbl td { padding: 0 9px; white-space: nowrap; }
.preview-frame .grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Bangla script: no letter-spacing / uppercase on small labels */
:lang(bn) .kpi .label, :lang(bn) .kpi .tag, :lang(bn) .tbl th, :lang(bn) .nav-sec, :lang(bn) .card-head .sub, :lang(bn) .ledger-head .l { letter-spacing: 0; text-transform: none; font-size: .8rem; }
:lang(bn) body { line-height: 1.6; }
