/* ════════════════════════════════════════════════════════════════
   PharmaCore — Theme: Dark + Neon Green · Windows 11 Fluent · Gamer Luxury
   ════════════════════════════════════════════════════════════════ */

:root {
  /* ── Backgrounds (deep dark) ── */
  --bg-base:   #060a09;
  --bg-900:    #080d0c;
  --bg-800:    #0b1311;
  --bg-700:    #0f1a17;
  --bg-600:    #14211d;

  /* ── Surfaces (Mica/acrylic) ── */
  --surface:        rgba(18, 28, 25, 0.72);
  --surface-solid:  #101a17;
  --surface-hover:  rgba(26, 40, 35, 0.85);
  --surface-2:      rgba(12, 20, 18, 0.6);

  /* ── Neon green brand ── */
  --brand-300: #6ee7b7;
  --brand-400: #34d399;
  --brand-500: #10d97e;
  --brand-600: #059669;
  --brand-700: #047857;
  --neon:      #00ffa3;
  --neon-glow: rgba(0, 255, 163, 0.45);

  /* ── Accent palette ── */
  --cyan:   #22d3ee;
  --violet: #a78bfa;
  --amber:  #fbbf24;
  --rose:   #fb7185;
  --sky:    #38bdf8;
  --pink:   #f472b6;

  /* ── Status ── */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #38bdf8;

  /* ── Text ── */
  --ink:         #e7f3ee;
  --ink-soft:    #b9ccc4;
  --ink-muted:   #7b938a;
  --ink-faint:   #51635c;

  /* ── Lines ── */
  --line:        rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --line-neon:   rgba(0, 255, 163, 0.22);

  /* ── Shadows (Fluent depth) ── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 8px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.55);
  --shadow-neon: 0 0 0 1px var(--line-neon), 0 8px 30px rgba(0,255,163,.12);

  /* ── Radius (Win11) ── */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* ── Motion ── */
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);

  --sidebar-w: 264px;
  --navbar-h: 68px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Sarabun', 'Kanit', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient neon glow background */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(0,255,163,.10), transparent 60%),
    radial-gradient(900px 600px at 8% 105%, rgba(34,211,238,.07), transparent 55%),
    radial-gradient(700px 500px at 50% 50%, rgba(16,217,126,.04), transparent 70%);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}

h1,h2,h3,h4,h5 { font-family: 'Kanit', sans-serif; font-weight: 600; letter-spacing: -.01em; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--neon-glow); color: #042b1d; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,255,163,.18); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,255,163,.34); background-clip: padding-box; }

/* ════════════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════════════ */
.app-shell { display: flex; min-height: 100dvh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-900), var(--bg-800) 60%, var(--bg-900));
  border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  z-index: 40;
}
.sidebar-head {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #042b1d; font-size: 22px;
  box-shadow: 0 6px 18px rgba(0,255,163,.32), inset 0 1px 0 rgba(255,255,255,.4);
  position: relative;
}
.brand-logo::after {
  content: ""; position: absolute; inset: -3px; border-radius: 16px;
  background: radial-gradient(circle, var(--neon-glow), transparent 70%);
  z-index: -1; opacity: .6;
}
.brand-name { font-family: 'Kanit'; font-weight: 700; font-size: 17px; color: #fff; line-height: 1.1; }
.brand-name b { color: var(--neon); }
.brand-sub { font-size: 11px; color: var(--ink-muted); letter-spacing: .02em; }

.side-clock {
  margin-top: 14px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); text-align: center;
  backdrop-filter: blur(10px);
}
.side-clock-time {
  font-family: 'Kanit'; font-weight: 700; font-size: 26px;
  color: var(--neon); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px var(--neon-glow); letter-spacing: .04em;
}
.side-clock-date { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-group { margin-bottom: 16px; }
.nav-group-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--ink-faint);
  padding: 0 12px 8px; display: flex; align-items: center; gap: 7px;
}
.nav-group-title::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand-400); box-shadow: 0 0 8px var(--brand-400);
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border-radius: var(--r-sm);
  color: var(--ink-soft); font-size: 14px; font-weight: 500;
  position: relative; transition: all .18s var(--ease); margin-bottom: 2px;
}
.nav-link i { font-size: 18px; width: 22px; text-align: center; color: var(--ink-muted); transition: color .18s; }
.nav-link:hover { background: var(--surface-hover); color: #fff; }
.nav-link:hover i { color: var(--brand-400); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(0,255,163,.16), rgba(0,255,163,.03));
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--line-neon);
}
.nav-link.active i { color: var(--neon); }
.nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 4px 4px 0;
  background: var(--neon); box-shadow: 0 0 12px var(--neon);
}
.nav-link .nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--danger); color: #fff; padding: 1px 7px; border-radius: 10px;
  box-shadow: 0 0 10px rgba(239,68,68,.5);
}

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

/* ── Navbar ── */
.navbar {
  height: var(--navbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: var(--surface); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.nav-toggle { display: none; background: none; border: none; color: var(--ink); font-size: 22px; cursor: pointer; }
.page-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(0,255,163,.18), rgba(0,255,163,.04));
  border: 1px solid var(--line-neon); color: var(--neon); font-size: 20px;
}
.page-title { line-height: 1.15; }
.page-title h1 { font-size: 18px; color: #fff; }
.page-title p { font-size: 12px; color: var(--ink-muted); }

.nav-search {
  margin-left: 8px; flex: 1; max-width: 420px; position: relative;
}
.nav-search input {
  width: 100%; height: 42px; padding: 0 16px 0 42px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink); font-size: 14px; font-family: inherit;
  transition: all .2s;
}
.nav-search input:focus { outline: none; border-color: var(--line-neon); box-shadow: 0 0 0 3px rgba(0,255,163,.1); }
.nav-search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-pill {
  display: flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-soft);
}
.nav-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.nav-icon-btn {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 18px; cursor: pointer; position: relative;
  display: grid; place-items: center; transition: all .18s;
}
.nav-icon-btn:hover { background: var(--surface-hover); color: var(--neon); border-color: var(--line-neon); }
.nav-icon-btn .badge-dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%; border: 2px solid var(--bg-800);
}
.nav-profile {
  display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  cursor: pointer; transition: all .18s;
}
.nav-profile:hover { border-color: var(--line-neon); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  display: grid; place-items: center; color: #042b1d; font-weight: 700; font-size: 14px;
  font-family: 'Kanit';
}
.nav-profile-info { line-height: 1.1; }
.nav-profile-info b { font-size: 13px; color: #fff; display: block; }
.nav-profile-info span { font-size: 11px; color: var(--ink-muted); }

/* Profile dropdown */
.profile-menu {
  position: absolute; top: calc(var(--navbar-h) - 6px); right: 24px;
  width: 260px; background: var(--surface-solid); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); backdrop-filter: blur(20px);
  padding: 8px; z-index: 60; opacity: 0; transform: translateY(-8px) scale(.97);
  pointer-events: none; transition: all .2s var(--ease-out);
}
.profile-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.profile-menu-head { padding: 14px; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.profile-menu-head .avatar { width: 46px; height: 46px; font-size: 18px; }
.profile-menu-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: var(--r-sm); color: var(--ink-soft); font-size: 14px; transition: all .15s;
}
.profile-menu-item:hover { background: var(--surface-hover); color: #fff; }
.profile-menu-item i { font-size: 17px; width: 20px; }
.profile-menu-item.danger:hover { background: rgba(239,68,68,.12); color: var(--rose); }

/* ── Content ── */
.content { padding: 24px; flex: 1; }
@media (min-width: 1400px) { .content { padding: 28px 32px; } }

/* ── Role chip ── */
.role-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.role-chip i { font-size: 12px; }
.role-chip-admin      { background: linear-gradient(135deg,#fde68a,#fbbf24); color:#78350f; }
.role-chip-pharmacist { background: linear-gradient(135deg,#a7f3d0,#34d399); color:#065f46; }
.role-chip-cashier    { background: linear-gradient(135deg,#bfdbfe,#60a5fa); color:#1e3a8a; }

/* ════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════ */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: 28px 30px;
  background: linear-gradient(120deg, #06251a 0%, #073d2a 45%, #042b1f 100%);
  border: 1px solid var(--line-neon);
  margin-bottom: 22px; box-shadow: var(--shadow-neon);
}
.hero::before {
  content: ""; position: absolute; top: -60%; left: -10%; width: 60%; height: 220%;
  background: linear-gradient(90deg, transparent, rgba(0,255,163,.12), transparent);
  transform: rotate(18deg); animation: beam 7s ease-in-out infinite;
}
@keyframes beam { 0%,100%{ transform: translateX(-30%) rotate(18deg) } 50%{ transform: translateX(160%) rotate(18deg) } }
.hero-deco {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  font-size: 130px; color: rgba(0,255,163,.10); pointer-events: none;
}
.hero-content { position: relative; z-index: 2; }
.hero-greet { font-size: 13px; color: var(--brand-300); font-weight: 600; margin-bottom: 4px; }
.hero h1 { font-size: 26px; color: #fff; margin-bottom: 6px; }
.hero h1 b { color: var(--neon); text-shadow: 0 0 24px var(--neon-glow); }
.hero p { font-size: 14px; color: var(--ink-soft); max-width: 560px; }
.hero-kpis { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.hero-kpi {
  background: rgba(0,0,0,.28); border: 1px solid var(--line-neon);
  border-radius: var(--r); padding: 12px 16px; min-width: 130px;
  backdrop-filter: blur(8px);
}
.hero-kpi .label { font-size: 11.5px; color: var(--brand-300); display: flex; align-items: center; gap: 6px; }
.hero-kpi .value { font-family: 'Kanit'; font-size: 21px; font-weight: 700; color: #fff; margin-top: 2px; }

/* ════════════════════════════════════════════════
   CARDS / GRID
   ════════════════════════════════════════════════ */
.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm); transition: all .25s var(--ease);
}
.card:hover { border-color: var(--line-strong); }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; color: #fff; }
.card-head .sub { font-size: 12px; color: var(--ink-muted); }
.card-head .head-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(0,255,163,.12); color: var(--neon); font-size: 17px; flex-shrink: 0;
}
.card-head .head-action { margin-left: auto; }
.card-body { padding: 18px; }

/* KPI stat card */
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; backdrop-filter: blur(14px);
  transition: all .25s var(--ease); animation: rise .5s var(--ease-out) both;
}
.stat:hover { transform: translateY(-3px); border-color: var(--line-neon); box-shadow: var(--shadow); }
.stat::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, var(--brand-400)); opacity: .85;
}
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  font-size: 22px; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent, var(--brand-400)) 16%, transparent);
  color: var(--accent, var(--brand-400));
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent, var(--brand-400)) 28%, transparent);
}
.stat-label { font-size: 12.5px; color: var(--ink-muted); font-weight: 500; }
.stat-value { font-family: 'Kanit'; font-size: 27px; font-weight: 700; color: #fff; margin-top: 8px; line-height: 1.1; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 8px; padding: 2px 8px; border-radius: 999px; }
.stat-delta.up   { color: var(--success); background: rgba(34,197,94,.12); }
.stat-delta.down { color: var(--rose);    background: rgba(251,113,133,.12); }
.stat-delta.flat { color: var(--ink-muted); background: var(--surface-2); }
.stat-spark { margin-top: 12px; height: 34px; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.stat:nth-child(1){animation-delay:0s}.stat:nth-child(2){animation-delay:.06s}.stat:nth-child(3){animation-delay:.12s}
.stat:nth-child(4){animation-delay:.18s}.stat:nth-child(5){animation-delay:.24s}.stat:nth-child(6){animation-delay:.3s}

/* accent helpers */
.acc-green  { --accent: #10d97e; } .acc-cyan { --accent: #22d3ee; }
.acc-violet { --accent: #a78bfa; } .acc-amber{ --accent: #fbbf24; }
.acc-rose   { --accent: #fb7185; } .acc-sky  { --accent: #38bdf8; }
.acc-pink   { --accent: #f472b6; }

/* ════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.badge i { font-size: 12px; }
.badge-green  { background: rgba(34,197,94,.14); color: #4ade80; border-color: rgba(34,197,94,.25); }
.badge-amber  { background: rgba(245,158,11,.14); color: #fbbf24; border-color: rgba(245,158,11,.25); }
.badge-red    { background: rgba(239,68,68,.14); color: #f87171; border-color: rgba(239,68,68,.25); }
.badge-cyan   { background: rgba(34,211,238,.14); color: #67e8f9; border-color: rgba(34,211,238,.25); }
.badge-violet { background: rgba(167,139,250,.14); color: #c4b5fd; border-color: rgba(167,139,250,.25); }
.badge-gray   { background: var(--surface-2); color: var(--ink-muted); border-color: var(--line); }

/* ════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: var(--r-sm);
  font-family: 'Kanit'; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .18s var(--ease); white-space: nowrap;
  position: relative; overflow: hidden; user-select: none;
}
.btn i { font-size: 17px; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #042b1d; box-shadow: 0 6px 18px rgba(0,255,163,.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(0,255,163,.38); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--line-neon); color: #fff; }
.btn-danger { background: linear-gradient(135deg,#f87171,#ef4444); color: #fff; }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(239,68,68,.35); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 38px; padding: 0; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ════════════════════════════════════════════════
   TOOLBAR / FILTER
   ════════════════════════════════════════════════ */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar .grow { flex: 1; min-width: 200px; }
.field {
  display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
}
.field i { color: var(--ink-muted); }
.field input, .field select {
  background: none; border: none; outline: none; color: var(--ink);
  font-family: inherit; font-size: 14px; width: 100%;
}
.field select option { background: var(--surface-solid); color: var(--ink); }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  font-family: inherit; font-size: 14px; transition: all .18s;
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; }
.input:focus { outline: none; border-color: var(--line-neon); box-shadow: 0 0 0 3px rgba(0,255,163,.1); }
.input::placeholder { color: var(--ink-faint); }
select.input option { background: var(--surface-solid); }
.label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 7px; font-weight: 500; }
.form-row { margin-bottom: 16px; }
.chip-group { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.chip {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; color: var(--ink-muted);
  cursor: pointer; transition: all .15s; border: none; background: none; font-family: inherit;
}
.chip.active { background: linear-gradient(135deg, var(--brand-400), var(--brand-600)); color: #042b1d; font-weight: 600; }

/* ════════════════════════════════════════════════
   TABLE → CARD on mobile
   ════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
  text-align: left; padding: 12px 14px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.t-strong { color: #fff; font-weight: 600; }

@media (max-width: 768px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    margin-bottom: 10px; padding: 8px 14px;
  }
  .data-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); text-align: right; }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before { content: attr(data-label); font-weight: 600; color: var(--ink-muted); font-size: 12px; text-align: left; }
  .data-table .num { text-align: right; }
}

/* ════════════════════════════════════════════════
   PRODUCT / ENTITY CARD GRID
   ════════════════════════════════════════════════ */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.prod-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; backdrop-filter: blur(14px); transition: all .22s var(--ease);
  position: relative; overflow: hidden; cursor: pointer;
}
.prod-card:hover { transform: translateY(-3px); border-color: var(--line-neon); box-shadow: var(--shadow); }
.prod-card-top { display: flex; gap: 12px; align-items: flex-start; }
.prod-thumb {
  width: 52px; height: 52px; border-radius: 13px; flex-shrink: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent,#10d97e) 15%, transparent);
  color: var(--accent,#10d97e); font-size: 24px;
}
.prod-name { font-family: 'Kanit'; font-weight: 600; font-size: 15px; color: #fff; line-height: 1.25; }
.prod-generic { font-size: 12px; color: var(--ink-muted); }
.prod-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.prod-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.prod-price { font-family: 'Kanit'; font-weight: 700; font-size: 18px; color: var(--neon); }
.prod-stock-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.prod-stock-bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-600), var(--brand-400)); }

/* ════════════════════════════════════════════════
   CHARTS (pure SVG)
   ════════════════════════════════════════════════ */
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* progress */
.prog { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.prog > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-600), var(--neon)); position: relative; }
.prog > i::after { content:""; position:absolute; inset:0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent); animation: shimmer 2.4s infinite; }
@keyframes shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }

/* medal */
.medal { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.medal-1 { background: linear-gradient(135deg,#fde68a,#f59e0b); color:#78350f; box-shadow: 0 0 14px rgba(245,158,11,.5); }
.medal-2 { background: linear-gradient(135deg,#e5e7eb,#9ca3af); color:#374151; }
.medal-3 { background: linear-gradient(135deg,#fdba74,#c2410c); color:#fff; }
.medal-n { background: var(--surface-2); color: var(--ink-muted); }

/* ════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════ */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3,7,6,.7); backdrop-filter: blur(6px); animation: fade .25s; }
@keyframes fade { from{opacity:0} to{opacity:1} }
.modal-card {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto;
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); animation: pop .3s var(--ease-out);
}
.modal-card.wide { width: min(820px, calc(100vw - 32px)); }
@keyframes pop { from{ opacity:0; transform: translate(-50%,-46%) scale(.96) } to{ opacity:1; transform: translate(-50%,-50%) scale(1) } }
.modal-header {
  padding: 20px 22px; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #06251a, #073d2a);
  border-bottom: 1px solid var(--line-neon); border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-header h3 { font-size: 18px; color: #fff; display: flex; align-items: center; gap: 10px; }
.modal-header p { font-size: 12.5px; color: var(--brand-300); margin-top: 2px; }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(0,0,0,.3); border: 1px solid var(--line); color: var(--ink-soft);
  cursor: pointer; display: grid; place-items: center; font-size: 18px; transition: all .15s;
}
.modal-close:hover { background: rgba(239,68,68,.2); color: var(--rose); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.modal-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 20px; }
.modal-stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; text-align: center; }
.modal-stat .v { font-family: 'Kanit'; font-size: 19px; font-weight: 700; color: var(--neon); }
.modal-stat .l { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.modal-section { margin-bottom: 18px; }
.modal-section-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.modal-section-title i { color: var(--neon); }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-muted); }
.kv .v { color: var(--ink); font-weight: 500; text-align: right; }

/* ════════════════════════════════════════════════
   EMPTY / SKELETON
   ════════════════════════════════════════════════ */
.empty { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 56px; color: var(--ink-faint); margin-bottom: 14px; }
.empty h3 { color: var(--ink-soft); font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--ink-muted); font-size: 13.5px; margin-bottom: 18px; }
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: 8px; }
@keyframes skel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ════════════════════════════════════════════════
   QUANTUM SPINNER
   ════════════════════════════════════════════════ */
.spinner-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(3,7,6,.78); backdrop-filter: blur(8px); animation: fade .2s; }
.spinner-box { text-align: center; }
.spinner-quantum { width: 70px; height: 70px; margin: 0 auto 18px; position: relative; }
.spinner-quantum span { position: absolute; inset: 0; border: 3px solid transparent; border-radius: 50%; }
.spinner-quantum span:nth-child(1) { border-top-color: var(--neon); animation: spin 1s linear infinite; }
.spinner-quantum span:nth-child(2) { border-right-color: var(--brand-400); inset: 9px; animation: spin 1.4s linear infinite reverse; }
.spinner-quantum span:nth-child(3) { border-bottom-color: var(--cyan); inset: 18px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-title { font-family: 'Kanit'; font-weight: 600; color: #fff; font-size: 16px; }
.spinner-stage { font-size: 13px; color: var(--brand-300); margin-top: 5px; min-height: 18px; }

/* ════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════ */
.footer {
  margin-top: auto; padding: 18px 24px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--surface-2); font-size: 12.5px; color: var(--ink-muted);
}
.footer-dev { display: flex; align-items: center; gap: 11px; }
.footer-dev img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line-neon); box-shadow: 0 0 14px var(--neon-glow); object-fit: cover; }
.footer-dev b { color: var(--ink-soft); }
.footer .ver { display: inline-flex; padding: 2px 9px; border-radius: 999px; background: rgba(0,255,163,.1); color: var(--brand-300); font-size: 11px; margin-left: 8px; }

.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 14px; }
.section-title h2 { font-size: 17px; color: #fff; }
.section-title .bar { width: 4px; height: 20px; border-radius: 4px; background: var(--neon); box-shadow: 0 0 10px var(--neon); }
.section-title .head-action { margin-left: auto; }

/* utility */
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.mt-2{margin-top:8px}.mt-4{margin-top:16px}.mb-4{margin-bottom:16px}
.text-muted{color:var(--ink-muted)} .text-neon{color:var(--neon)} .text-sm{font-size:12.5px}
.text-danger{color:var(--rose)} .text-success{color:var(--success)} .text-amber{color:var(--amber)}
.hidden{display:none!important}
.text-right{text-align:right} .text-center{text-align:center}
.mono { font-variant-numeric: tabular-nums; font-family: 'Kanit'; }

/* ════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .nav-toggle { display: grid; place-items: center; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(3,7,6,.6); z-index: 39; display: none; }
  .sidebar-overlay.open { display: block; }
}
@media (max-width: 720px) {
  .navbar { padding: 0 14px; gap: 10px; }
  .nav-search { display: none; }
  .page-title p { display: none; }
  .nav-pill { display: none; }
  .nav-profile-info { display: none; }
  .content { padding: 16px; }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 21px; }
  .hero-deco { font-size: 90px; opacity: .5; }
  .modal-stats { grid-template-columns: 1fr; }
}
