/* =========================================================================
   Pharmacy ERP — design system
   Deep-green navigation, calm light workspace, one strong accent.
   No external fonts or CDNs: works offline on the pharmacy counter PC.
   ========================================================================= */

:root {
    --g-950: #05231a;
    --g-900: #082d21;
    --g-800: #0c3b2c;
    --g-700: #12503b;
    --g-300: #6ee7b7;
    --brand: #10a56f;
    --brand-600: #0b8a5a;
    --brand-700: #08724a;
    --brand-50: #e9f8f1;
    --brand-100: #cdf0e0;

    --ink: #10201a;
    --ink-2: #44574d;
    --ink-3: #75867d;
    --line: #e3eae6;
    --line-2: #eef3f0;
    --bg: #f2f6f4;
    --card: #ffffff;

    --blue: #2f6fed;   --blue-50: #eaf1ff;
    --amber: #d98a06;  --amber-50: #fff4dc;
    --red: #dc3b41;    --red-50: #feecec;
    --violet: #7352f0; --violet-50: #f0ecff;
    --green: #0f9d63;  --green-50: #e6f7ee;

    --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px;
    --shadow-xs: 0 1px 2px rgba(16, 32, 26, .05);
    --shadow-sm: 0 1px 3px rgba(16, 32, 26, .06), 0 1px 2px rgba(16, 32, 26, .04);
    --shadow-md: 0 8px 24px -6px rgba(16, 32, 26, .12), 0 2px 6px rgba(16, 32, 26, .05);
    --shadow-lg: 0 24px 60px -12px rgba(16, 32, 26, .28);

    --sidebar-w: 256px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 68px;
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

    /* legacy aliases (older views) */
    --teal-600: var(--brand-600); --teal-500: var(--brand); --teal-50: var(--brand-50);
    --green-600: var(--green); --red-600: var(--red); --amber-600: var(--amber); --blue-600: var(--blue);
    --border-subtle: var(--line); --text-primary: var(--ink); --text-secondary: var(--ink-2); --text-muted: var(--ink-3);
    --bg-card: var(--card); --bg-app: var(--bg);
    --radius-sm: var(--r-sm); --radius-md: var(--r-md); --radius-lg: var(--r-lg);
    --shadow-md-legacy: var(--shadow-md);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
code { background: var(--line-2); padding: 1px 6px; border-radius: 5px; font-size: .92em; }
img { max-width: 100%; }

.ic { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -0.22em; }
.ic-lg { width: 1.6em; height: 1.6em; }
.muted, .hint { color: var(--ink-3); font-size: 12.5px; }
.negative { color: var(--red) !important; }
.positive { color: var(--green) !important; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------------
   Shell
   --------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(16, 165, 111, .22), transparent 60%),
        linear-gradient(180deg, var(--g-800) 0%, var(--g-900) 55%, var(--g-950) 100%);
    color: #b5d3c6;
    display: flex; flex-direction: column; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh; z-index: 60;
    transition: width .22s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; object-fit: contain; background: #fff; padding: 3px; flex-shrink: 0; box-shadow: 0 6px 18px -6px rgba(0,0,0,.5); }
.brand-name { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; flex: 1; min-width: 0; }
.brand-name small { display: block; font-size: 11px; font-weight: 500; color: #7fb59d; letter-spacing: .01em; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-toggle { background: rgba(255,255,255,.07); border: 0; color: #9ccab6; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.sidebar-toggle:hover { background: rgba(255,255,255,.14); color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-section { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: #5f9780; padding: 12px 12px 4px; text-transform: uppercase; white-space: nowrap; }
.nav-item {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 8px 12px; margin: 1px 0; border-radius: 11px;
    color: #b5d3c6; font-size: 13.5px; font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.nav-item .ic { width: 19px; height: 19px; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(110, 231, 183, .20), rgba(110, 231, 183, .07)); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--g-300); box-shadow: 0 0 14px rgba(110,231,183,.7); }
.nav-item.active .ic { color: var(--g-300); opacity: 1; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }

.sidebar-card { margin: 8px 14px 12px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.sidebar-card .t { color: #fff; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.sidebar-card .t .ic { color: var(--g-300); }
.sidebar-card p { margin: 6px 0 10px; font-size: 12px; color: #8fbcaa; line-height: 1.45; }
.sidebar-card .btn { width: 100%; background: rgba(255,255,255,.1); color: #fff; border: 0; }
.sidebar-card .btn:hover { background: rgba(255,255,255,.18); }
.sidebar-footer { padding: 6px 12px 16px; border-top: 1px solid rgba(255,255,255,.07); }

.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .brand-name, .sidebar.collapsed .nav-label, .sidebar.collapsed .nav-section, .sidebar.collapsed .nav-badge, .sidebar.collapsed .sidebar-card { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding-inline: 10px; flex-wrap: wrap; gap: 8px; }
.sidebar.collapsed .nav-item { justify-content: center; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Topbar */
.topbar {
    height: var(--topbar-h); background: rgba(255,255,255,.86); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 14px; padding: 0 28px;
    position: sticky; top: 0; z-index: 50;
}
.mobile-menu-btn { display: none; background: none; border: 0; color: var(--ink); padding: 6px; }
.search-trigger {
    flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    padding: 0 8px 0 14px; height: 42px; color: var(--ink-3); font-size: 13.5px; text-align: left;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-trigger:hover { background: #fff; border-color: #cfe0d7; box-shadow: var(--shadow-xs); }
.search-trigger span.ph { flex: 1; }
kbd { font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink-3); background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); display: grid; place-items: center; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 10px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; box-sizing: content-box; transform: translate(30%, -30%); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.user-chip:hover { background: var(--brand-50); }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--g-700)); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; flex-shrink: 0; }
.user-chip .who { line-height: 1.2; text-align: left; }
.user-chip .who b { display: block; font-size: 13px; font-weight: 600; }
.user-chip .who small { font-size: 11.5px; color: var(--ink-3); }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); padding: 6px; display: none; z-index: 80; }
.dropdown.open .dropdown-menu { display: block; animation: pop .14s ease; }
.dropdown-menu a, .dropdown-menu button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px; border: 0; background: none; font-size: 13.5px; color: var(--ink); text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button.item:hover { background: var(--brand-50); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 0; }
.notif-menu { width: 360px; padding: 0; overflow: hidden; }
.notif-head { padding: 14px 16px; font-weight: 700; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); align-items: flex-start; border-radius: 0 !important; }
.notif-item:last-child { border-bottom: 0; }
.notif-item .ni { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.notif-item b { font-size: 13px; display: block; }
.notif-item span { font-size: 12.5px; color: var(--ink-3); }
.ni.red { background: var(--red-50); color: var(--red); } .ni.amber { background: var(--amber-50); color: var(--amber); } .ni.blue { background: var(--blue-50); color: var(--blue); } .ni.green { background: var(--green-50); color: var(--green); }

.content { padding: 28px 28px 48px; flex: 1; max-width: 1560px; width: 100%; margin: 0 auto; }

/* Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 13.5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a:hover { color: var(--brand-700); }

/* ---------------------------------------------------------------------
   Cards, KPI
   --------------------------------------------------------------------- */
.card, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); padding: 22px; }
.card-header, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title, .panel-title { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.panel-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.link-more { font-size: 13px; font-weight: 600; color: var(--brand-600); display: inline-flex; align-items: center; gap: 4px; }
.link-more:hover { color: var(--brand-700); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi, .kpi-card {
    position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 18px 18px 16px; box-shadow: var(--shadow-xs);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s;
}
.kpi:hover, .kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #d3e3da; }
.kpi-top { display: flex; align-items: center; gap: 12px; }
.kpi-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-ic .ic { width: 22px; height: 22px; }
.kpi-ic.green { background: var(--green-50); color: var(--green); }
.kpi-ic.blue { background: var(--blue-50); color: var(--blue); }
.kpi-ic.amber { background: var(--amber-50); color: var(--amber); }
.kpi-ic.red { background: var(--red-50); color: var(--red); }
.kpi-ic.violet { background: var(--violet-50); color: var(--violet); }
.kpi-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.kpi-value { font-size: 25px; font-weight: 750; letter-spacing: -.02em; margin-top: 12px; line-height: 1.15; }
.kpi-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi .spark { width: 92px; height: 38px; flex-shrink: 0; margin-bottom: -2px; }
.kpi .spark path.line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi .spark path.fill { opacity: .14; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.trend.up { background: var(--green-50); color: var(--green); }
.trend.down { background: var(--red-50); color: var(--red); }
.trend.flat { background: var(--line-2); color: var(--ink-3); }
.trend .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.meter { height: 6px; background: var(--line-2); border-radius: 6px; overflow: hidden; margin-top: 12px; }
.meter > i { display: block; height: 100%; border-radius: 6px; background: var(--brand); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.meter.amber > i { background: var(--amber); } .meter.red > i { background: var(--red); } .meter.violet > i { background: var(--violet); } .meter.blue > i { background: var(--blue); }
.kpi-alert-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: pulseUrgent 1.8s infinite; }

/* Welcome hero + date card (dashboard) */
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.welcome h1 { font-size: 26px; font-weight: 750; letter-spacing: -.025em; }
.welcome p { margin: 5px 0 0; color: var(--ink-3); }
.date-card { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px 20px 12px 14px; box-shadow: var(--shadow-xs); }
.date-card .cal { width: 50px; height: 54px; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; text-align: center; line-height: 1; }
.date-card .cal b { display: block; font-size: 20px; } .date-card .cal small { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.date-card .d1 { font-weight: 700; } .date-card .d2 { color: var(--ink-3); font-size: 12.5px; }
.date-card svg.pills { width: 74px; height: 54px; }

/* Health banner */
.banner {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    border-radius: var(--r-lg); padding: 22px 28px; color: #fff;
    background: radial-gradient(90% 160% at 100% 0%, rgba(110,231,183,.30), transparent 55%), linear-gradient(120deg, var(--g-800), var(--g-700));
}
.banner h3 { font-size: 18px; font-weight: 700; }
.banner p { margin: 4px 0 0; color: #b9dccd; max-width: 560px; }
.banner .btn { background: #fff; color: var(--g-800); }
.banner .btn:hover { background: var(--brand-50); }
.banner .stats { display: flex; gap: 26px; }
.banner .stats div b { display: block; font-size: 22px; } .banner .stats div small { color: #9fcdb9; font-size: 12px; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: 11px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; line-height: 1.2; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(16, 165, 111, .7); }
.btn-primary:hover { background: var(--brand-600); }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { background: var(--brand-50); border-color: var(--brand-100); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c22f35; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.is-loading { opacity: .85; cursor: wait; }
.btn.is-loading::before { content: ""; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
.btn-secondary.is-loading::before { border-color: rgba(16,32,26,.2); border-top-color: var(--ink); }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-group label, label.lbl { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.form-group .hint { margin-top: 5px; }
.form-group .error-text, .error-text { font-size: 12.5px; color: var(--red); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 10px 13px; border: 1px solid #d6e2dc; border-radius: 11px;
    font: inherit; font-size: 13.5px; color: var(--ink); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #9aaaa1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(16, 165, 111, .14); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--red); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }
input[type=file] { padding: 8px; background: var(--bg); }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 18px; }
.input-group { display: flex; } .input-group > * { border-radius: 0; } .input-group > :first-child { border-radius: 11px 0 0 11px; } .input-group > :last-child { border-radius: 0 11px 11px 0; }
.input-addon { display: grid; place-items: center; padding: 0 12px; background: var(--line-2); border: 1px solid #d6e2dc; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: all .15s; }
.seg input:checked + span { background: #fff; color: var(--brand-700); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; }
.card > .table-wrap, .panel > .table-wrap { border: 0; border-radius: 0; margin: 0 -22px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
    text-align: left; padding: 12px 16px; background: #f7faf8; font-weight: 600; color: var(--ink-3);
    font-size: 12px; letter-spacing: .02em; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data-table tbody tr:last-child td { border-bottom: 0; }
table.data-table tbody tr { transition: background .12s; }
table.data-table tbody tr:hover td { background: #f9fcfa; }
table.data-table td.num, table.data-table th.num { text-align: right; }
table.data-table tfoot td { font-weight: 700; background: #f7faf8; border-top: 1px solid var(--line); }
table.data-table.compact td, table.data-table.compact th { padding: 9px 12px; }
.row-link { cursor: pointer; }
.cell-prod { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-prod b { display: block; font-weight: 600; }
.cell-prod small { color: var(--ink-3); font-size: 12px; }
.thumb { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; background: var(--brand-50); flex-shrink: 0; border: 1px solid var(--line-2); }
.thumb-lg { width: 100%; aspect-ratio: 1; border-radius: var(--r-lg); object-fit: cover; border: 1px solid var(--line); background: var(--brand-50); display: block; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty-state-icon { font-size: 38px; margin-bottom: 10px; opacity: .55; }
.empty-state p { margin: 4px 0; }

.pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line); font-size: 13px; background: #fff; }
.pagination a:hover { background: var(--brand-50); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.badge-success { background: var(--green-50); color: var(--green); }
.badge-danger { background: var(--red-50); color: var(--red); }
.badge-warning { background: var(--amber-50); color: #b27204; }
.badge-info { background: var(--blue-50); color: var(--blue); }
.badge-neutral { background: var(--line-2); color: var(--ink-2); }
.badge-violet { background: var(--violet-50); color: var(--violet); }
.badge-danger.badge-urgent { animation: pulseUrgent 1.8s ease-in-out infinite; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; animation: pop .2s ease; }
.alert-success { background: var(--green-50); color: #0a7a4c; border-color: #bfe9d3; }
.alert-danger { background: var(--red-50); color: #b42b30; border-color: #f8c6c8; }
.alert-warning { background: var(--amber-50); color: #8f5d05; border-color: #f6dca1; }
.alert-info { background: var(--blue-50); color: #2557c4; border-color: #c4d8fb; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(6, 28, 21, .55); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-overlay.open { display: flex; animation: fadeIn .15s ease; }
.modal-box { background: #fff; border-radius: var(--r-xl); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: var(--line-2); border: 0; width: 32px; height: 32px; border-radius: 9px; font-size: 18px; color: var(--ink-2); }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }

/* Filters bar */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filters-bar select, .filters-bar input { width: auto; min-width: 150px; }
.filters-bar .search-input { min-width: 240px; flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { background: var(--brand-50); }
.chip.active { background: var(--g-800); color: #fff; border-color: var(--g-800); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 16px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--brand-700); border-color: var(--brand); }

/* Detail lists */
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px 24px; }
.dl .k { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 3px; }
.dl .v { font-size: 14px; font-weight: 600; }
.sum-list { display: flex; flex-direction: column; }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; color: var(--ink-2); border-bottom: 1px dashed var(--line); }
.sum-row:last-child { border-bottom: 0; }
.sum-row b { color: var(--ink); font-weight: 650; }
.sum-row.total { font-size: 18px; color: var(--ink); font-weight: 750; border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 6px; padding-top: 12px; }
.sum-row.total b { font-weight: 800; }

/* ---------------------------------------------------------------------
   Charts
   --------------------------------------------------------------------- */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tip { position: absolute; pointer-events: none; background: var(--g-900); color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 12.5px; box-shadow: var(--shadow-md); opacity: 0; transform: translate(-50%, -110%); transition: opacity .12s; white-space: nowrap; z-index: 5; }
.chart-tip b { display: block; font-size: 15px; margin-bottom: 2px; }
.chart-tip small { color: #9fcdb9; }
.chart-tip.show { opacity: 1; }
.ch-grid line { stroke: #e8efeb; stroke-dasharray: 3 4; }
.ch-axis text { fill: #8a9b92; font-size: 11.5px; }
.ch-area { animation: fadeIn .8s ease both; }
.ch-line { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); animation: draw 1.1s ease-out forwards; }
.ch-dot { fill: #fff; stroke: var(--brand); stroke-width: 2.5; opacity: 0; transition: opacity .12s; }
.ch-dot.on { opacity: 1; }
.ch-bar { transition: opacity .15s; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.stat-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-tile { background: var(--bg); border-radius: 14px; padding: 14px 16px; }
.stat-tile small { color: var(--ink-3); font-weight: 600; font-size: 12px; display: block; }
.stat-tile b { font-size: 19px; letter-spacing: -.02em; display: block; margin-top: 2px; white-space: nowrap; }
.rank { display: flex; flex-direction: column; gap: 14px; }
.rank-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; }
.rank-row .bar { height: 6px; background: var(--line-2); border-radius: 6px; margin-top: 5px; overflow: hidden; }
.rank-row .bar i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.rank-no { width: 28px; height: 28px; border-radius: 9px; background: var(--brand-50); color: var(--brand-700); font-weight: 700; display: grid; place-items: center; font-size: 12.5px; }

/* ---------------------------------------------------------------------
   Product catalogue
   --------------------------------------------------------------------- */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; }
.view-toggle a { padding: 8px 12px; color: var(--ink-3); display: grid; place-items: center; }
.view-toggle a.active { background: var(--brand-50); color: var(--brand-700); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.pcard { position: relative; display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s; }
.pcard:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: #cfe3d8; }
.pcard img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--brand-50); }
.pcard .pb { padding: 12px 14px 14px; }
.pcard .pn { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .pg { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .pr { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.pcard .pr b { font-size: 15px; }
.pcard .tag { position: absolute; top: 10px; left: 10px; }
.image-pick { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.image-pick img { width: 150px; height: 150px; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); background: var(--brand-50); }

/* ---------------------------------------------------------------------
   POS
   --------------------------------------------------------------------- */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; align-items: start; }
.pos-search { position: relative; }
.pos-search .ic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 20px; height: 20px; }
.pos-search input { padding: 15px 16px 15px 46px; font-size: 15.5px; border-radius: 14px; border-width: 1.5px; }
.pos-search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.pos-results { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); max-height: 420px; overflow-y: auto; }
.pos-item { display: flex; align-items: center; gap: 14px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.pos-item:last-child { border-bottom: 0; }
.pos-item:hover, .pos-item.hl { background: var(--brand-50); }
.pos-item .info { flex: 1; min-width: 0; }
.pos-item .name { font-weight: 650; }
.pos-item .meta { font-size: 12px; color: var(--ink-3); }
.pos-item .price { text-align: right; font-weight: 700; }
.pos-item .price small { display: block; font-weight: 500; color: var(--ink-3); font-size: 11.5px; }
.pos-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cart-line { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto 28px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .t { font-weight: 650; }
.cart-line .m { font-size: 12px; color: var(--ink-3); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; }
.qty button { width: 32px; height: 34px; border: 0; background: var(--bg); font-size: 17px; color: var(--ink-2); }
.qty button:hover { background: var(--brand-50); color: var(--brand-700); }
.qty input { width: 46px; border: 0; border-radius: 0; text-align: center; padding: 7px 0; font-weight: 700; box-shadow: none !important; }
.cart-line .lt { font-weight: 700; min-width: 86px; text-align: right; }
.cart-x { width: 28px; height: 28px; border: 0; background: none; border-radius: 8px; color: var(--ink-3); display: grid; place-items: center; }
.cart-x:hover { background: var(--red-50); color: var(--red); }
.cart-row-new { animation: cartIn .35s ease both; }
.pos-pay { position: sticky; top: calc(var(--topbar-h) + 18px); }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pay-methods label { margin: 0; cursor: pointer; }
.pay-methods input { position: absolute; opacity: 0; pointer-events: none; }
.pay-methods span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 12px; font-weight: 650; color: var(--ink-2); transition: all .15s; }
.pay-methods span .ic { width: 20px; height: 20px; }
.pay-methods input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.pay-methods input:focus-visible + span { outline: 2px solid var(--brand); }
.grand-total { background: linear-gradient(135deg, var(--g-800), var(--g-700)); color: #fff; border-radius: 16px; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; margin: 14px 0; }
.grand-total small { color: #a9d4c2; display: block; font-size: 12px; font-weight: 600; }
.grand-total b { font-size: 27px; letter-spacing: -.02em; }
.change-box { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: var(--green-50); color: #0a7a4c; font-weight: 700; margin-bottom: 4px; }
.change-box.short { background: var(--amber-50); color: #8f5d05; }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick-cash button { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 5px 10px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.quick-cash button:hover { background: var(--brand-50); }
.rx-flag { display: inline-flex; align-items: center; gap: 4px; background: var(--violet-50); color: var(--violet); border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.pos-empty { text-align: center; padding: 56px 20px; color: var(--ink-3); }
.pos-empty .ring { width: 78px; height: 78px; margin: 0 auto 14px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; }
.pos-empty .ring .ic { width: 34px; height: 34px; }

/* Command palette */
.palette { position: fixed; inset: 0; z-index: 300; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; background: rgba(6, 28, 21, .5); backdrop-filter: blur(3px); }
.palette.open { display: flex; animation: fadeIn .12s ease; }
.palette-box { width: min(640px, 92vw); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.palette-input input { border: 0; box-shadow: none !important; padding: 4px 0; font-size: 16px; }
.palette-list { max-height: 54vh; overflow-y: auto; padding: 8px; }
.palette-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; cursor: pointer; }
.palette-item.hl, .palette-item:hover { background: var(--brand-50); }
.palette-item .pi { width: 34px; height: 34px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.palette-item .pi img { width: 100%; height: 100%; object-fit: cover; }
.palette-item.hl .pi { background: #fff; color: var(--brand-700); }
.palette-item b { font-weight: 600; display: block; } .palette-item small { color: var(--ink-3); }
.palette-foot { padding: 10px 18px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); display: flex; gap: 16px; background: #fafcfb; }

/* ---------------------------------------------------------------------
   Auth page
   --------------------------------------------------------------------- */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.auth-hero {
    position: relative; overflow: hidden; color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(70% 50% at 85% 10%, rgba(110, 231, 183, .28), transparent 60%), radial-gradient(60% 50% at 0% 100%, rgba(16, 165, 111, .35), transparent 60%), linear-gradient(160deg, var(--g-800), var(--g-950));
}
.auth-hero .brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; }
.auth-hero .brand img { width: 44px; height: 44px; border-radius: 12px; background: #fff; padding: 4px; }
.auth-hero h2 { font-size: 40px; line-height: 1.12; letter-spacing: -.03em; max-width: 480px; font-weight: 750; }
.auth-hero p { color: #a8d3c1; font-size: 16px; max-width: 440px; margin: 16px 0 0; }
.auth-points { display: grid; gap: 14px; margin-top: 30px; }
.auth-points div { display: flex; align-items: center; gap: 12px; color: #d3ece1; }
.auth-points .ic { color: var(--g-300); }
.auth-hero .float-pill { position: absolute; opacity: .16; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card { background: #fff; border-radius: 22px; padding: 38px 34px; box-shadow: var(--shadow-md); border: 1px solid var(--line); }
.auth-card h1 { font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
.auth-card .sub { color: var(--ink-3); margin: 6px 0 24px; }
.auth-demo-note { margin-top: 22px; padding: 14px 16px; background: var(--bg); border: 1px dashed #cddcd4; border-radius: 14px; font-size: 12.5px; color: var(--ink-2); }
.auth-demo-note table { width: 100%; margin: 8px 0; } .auth-demo-note td { padding: 2px 0; } .auth-demo-note p { margin: 6px 0 0; }

/* ---------------------------------------------------------------------
   Motion
   --------------------------------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes cartIn { from { opacity: 0; transform: translateX(-10px); background: var(--brand-50); } to { opacity: 1; transform: none; } }
@keyframes pulseUrgent { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 59, 65, .35); } 50% { box-shadow: 0 0 0 6px rgba(220, 59, 65, 0); } }
@keyframes checkPop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
/* one orchestrated entrance: the dashboard KPI row */
.kpi-grid.five .kpi { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.kpi-grid.five .kpi:nth-child(2) { animation-delay: .05s; } .kpi-grid.five .kpi:nth-child(3) { animation-delay: .1s; }
.kpi-grid.five .kpi:nth-child(4) { animation-delay: .15s; } .kpi-grid.five .kpi:nth-child(5) { animation-delay: .2s; }
.sale-success-check { animation: checkPop .45s cubic-bezier(.34, 1.56, .64, 1) both; }

a:focus-visible, button:focus-visible, .nav-item:focus-visible, .btn:focus-visible, .chip:focus-visible, .pcard:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    .ch-line { stroke-dashoffset: 0; }
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-height: 960px) { .sidebar-card { display: none; } }
a.kpi { display: block; }
@media (max-width: 1280px) {
    .kpi-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-main, .pos-layout { grid-template-columns: minmax(0, 1fr); }
    .pos-pay { position: static; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .sidebar { position: fixed; left: -290px; width: 270px; transition: left .25s ease; box-shadow: var(--shadow-lg); }
    .sidebar.mobile-open { left: 0; }
    .sidebar.collapsed { width: 270px; }
    .mobile-menu-btn { display: grid; place-items: center; }
    .topbar { padding: 0 14px; gap: 8px; }
    .user-chip .who { display: none; } .user-chip { padding: 4px; }
    .search-trigger kbd { display: none; }
    .content { padding: 18px 14px 40px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: minmax(0, 1fr); }
    .search-trigger { flex: 0 0 42px; max-width: 42px; padding: 0; justify-content: center; }
    .search-trigger .ph { display: none; }
    .nav-label-lg { display: none; }
    .user-chip > .ic { display: none; }
    .topbar-actions { gap: 6px; }
    .topbar-spacer { flex: 1; }
    .page-head h1 { font-size: 21px; }
    .stat-tile b { font-size: 17px; }
    .kpi-grid[style] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .kpi-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth-body { grid-template-columns: 1fr; } .auth-hero { display: none; }
    .notif-menu { width: min(360px, 92vw); position: fixed; right: 10px; left: 10px; width: auto; top: 70px; }
    .cart-line { grid-template-columns: 40px minmax(0, 1fr) auto 28px; } .cart-line .lt { display: none; }
    .date-card svg.pills { display: none; }
    .image-pick { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .kpi-grid.five { grid-template-columns: 1fr; } .stat-split { grid-template-columns: 1fr; } .welcome h1 { font-size: 22px; } }

@media print {
    .sidebar, .topbar, .filters-bar, .btn, .pagination, .no-print, .palette { display: none !important; }
    .content { padding: 0; max-width: none; }
    body { background: #fff; }
    .card, .panel { box-shadow: none; border-color: #ccc; }
}
