/* Jomkumpul Campus — professional layout layer.
   Loaded after the original stylesheet. Every colour goes through the theme tokens,
   so Light/Dark and the user's Highlight color keep working. Spacing on a 4px base. */

/* ───────────── 1. Tokens ───────────── */
:root {
  --font: "Inter Variable", "Noto Sans Tamil Variable", system-ui, sans-serif;
  --display-font: var(--font);
  --canvas: #f4f6f8;
  --paper: #fff;
  --surface: #f8fafc;
  --ink: #111827;
  --muted: #5f6b7a;
  --line: #e4e7ec;
  --control-line: #d0d5dd;
  --blue: color-mix(in srgb, var(--highlight) 88%, #0b1530);
  --tint: color-mix(in srgb, var(--highlight) 9%, var(--paper));
  --action: var(--blue);
  --action-shadow: none;
  --card-shadow: 0 1px 2px #1018280d;
  --feature-shadow: 0 1px 3px #1018281a;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--highlight) 28%, transparent);
}
:root[data-bs-theme="dark"] {
  --canvas: #0e1116;
  --paper: #151a21;
  --surface: #1b212a;
  --ink: #eef1f5;
  --muted: #9aa5b4;
  --line: #29313c;
  --control-line: #3a4452;
  --blue: color-mix(in srgb, var(--highlight) 60%, #fff);
  --tint: color-mix(in srgb, var(--highlight) 18%, var(--paper));
  --card-shadow: none;
  --feature-shadow: none;
}

/* ───────────── 2. Base type ───────────── */
body { font-size: 14px; line-height: 1.5; background: var(--canvas); }
h1, h2, h3, h4 { font-family: var(--font); letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(22px, 2vw, 26px); font-weight: 650; line-height: 1.25; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 620; line-height: 1.4; }
h3 { font-size: 15px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }
.eyebrow {
  color: var(--muted); font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
:focus-visible { outline: 2px solid var(--highlight); outline-offset: 2px; }

/* ───────────── 3. App shell ───────────── */
.workspace.app-shell { padding-block-end: 0; min-height: 100dvh; }
.app-sidebar { display: none; }
.app-body { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }

/* Top bar */
.page-chrome {
  position: sticky; top: 0; z-index: 6;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.page-chrome .chrome-inner { min-height: var(--topbar-h); max-width: none; gap: 16px; }
.chrome-inner .brand { width: 128px; }
.chrome-trail {
  display: none; align-items: center; gap: 6px; margin: 0;
  color: var(--muted); font-size: 14px; min-width: 0;
}
.chrome-trail svg { width: 16px; height: 16px; opacity: 0.6; }
.chrome-trail strong { color: var(--ink); font-weight: 600; }
.chrome-actions { gap: 8px; align-items: center; margin-inline-start: auto; }
.chrome-actions .language-control { display: none; }
.utility-tile, .chrome-actions .icon-button {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--paper); border: 1px solid var(--line); box-shadow: none; color: var(--muted);
}
.utility-tile:hover { background: var(--surface); color: var(--ink); }
.utility-tile svg { width: 18px; height: 18px; }

/* Content */
.portal-main.content-width {
  width: 100%; max-width: 1280px; margin-inline: 0;
  padding: 24px 16px 32px; flex: 1;
}
.portal-main > section, .portal-main > .panel + .panel,
.portal-main > .panel + section, .portal-main > section + .panel { margin-top: 24px; }

/* Footer */
.campus-footer.content-width { max-width: none; margin: 0; padding: 0 16px; }
.footer-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 16px 0; border-top: 1px solid var(--line);
  background: none; box-shadow: none; border-radius: 0; color: var(--muted);
}
.footer-card strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.footer-card p { display: inline; margin: 0 0 0 8px; font-size: 13px; }
.footer-card > div:first-child { display: flex; align-items: baseline; }
.footer-actions { gap: 8px; margin-inline-start: auto; }
.footer-actions .utility-tile { width: 32px; height: 32px; }
.footer-card time { font-size: 12px; }

/* Mobile tab bar (below 992px) */
.portal-nav {
  width: 100%; inset: auto 0 0 0; translate: none;
  border: 0; border-top: 1px solid var(--line); border-radius: 0;
  background: var(--paper); box-shadow: 0 -1px 2px #1018280a;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.portal-nav .nav-button {
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 550;
  gap: 2px; min-height: 52px; justify-content: center; color: var(--muted);
}
.portal-nav .nav-icon, .portal-nav .dock-home .nav-icon {
  width: 24px; height: 24px; margin: 0; border-radius: 6px; background: none;
  color: inherit;
}
.portal-nav .nav-icon svg { width: 20px; height: 20px; }
.portal-nav .nav-button.active { background: none; color: var(--blue); font-weight: 650; }
.portal-nav .dock-home.active:after { display: none; }
.workspace.app-shell .app-body { padding-block-end: calc(var(--dock-height) + env(safe-area-inset-bottom)); }

/* Desktop: sidebar layout */
@media (width >= 992px) {
  .workspace.app-shell {
    display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    background: linear-gradient(90deg, var(--paper) calc(var(--sidebar-w) - 1px), var(--line) 0 var(--sidebar-w), transparent 0);
  }
  .workspace.app-shell .app-body { padding-block-end: 0; }
  .portal-nav { display: none; }
  body:has(.portal-nav) #toast { bottom: 24px; }
  .app-sidebar {
    position: sticky; top: 0; height: 100dvh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 4px;
    padding: 20px 12px 16px; background: var(--paper); border-right: 1px solid var(--line);
  }
  .sidebar-brand { display: block; width: 148px; margin: 0 8px 20px; }
  .sidebar-brand .official-wordmark { mix-blend-mode: multiply; }
  [data-bs-theme="dark"] .sidebar-brand .official-wordmark { mix-blend-mode: normal; }
  .sidebar-role {
    margin: 0 12px 8px; color: var(--muted); font-size: 11px; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase;
  }
  .sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar-nav .nav-button {
    min-height: 40px; padding: 8px 12px; gap: 12px; border: 0; border-radius: var(--radius-sm);
    color: var(--muted); font-size: 14px; font-weight: 520; position: relative;
  }
  .sidebar-nav .nav-icon { width: 20px; height: 20px; background: none; color: inherit; border-radius: 0; }
  .sidebar-nav .nav-icon svg { width: 20px; height: 20px; }
  .sidebar-nav .nav-button:hover { background: var(--surface); color: var(--ink); }
  .sidebar-nav .nav-button.active { background: var(--tint); color: var(--blue); font-weight: 620; box-shadow: none; }
  .sidebar-nav .nav-button.active:before {
    content: ""; position: absolute; inset: 8px auto 8px -12px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--highlight);
  }
  .sidebar-nav .message-badge { position: static; margin-inline-start: auto; }
  .sidebar-foot {
    margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line);
    display: grid; gap: 12px;
  }
  .sidebar-user { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-width: 0; }
  .sidebar-user div { min-width: 0; display: grid; }
  .sidebar-user strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-user small { color: var(--muted); font-size: 12px; }
  .sidebar-avatar {
    flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
    background: var(--tint); color: var(--blue); font-weight: 650; font-size: 13px; text-transform: uppercase;
  }
  .sidebar-foot .button { width: 100%; }
  .page-chrome .brand { display: none; }
  .chrome-trail { display: flex; }
  .chrome-actions .language-control { display: flex; }
  .page-chrome .chrome-inner, .campus-footer.content-width { padding-inline: 32px; }
  .portal-main.content-width { padding: 32px; }
}

/* ───────────── 4. Page heading ───────────── */
.page-heading { margin-bottom: 24px; gap: 16px; align-items: flex-end; }
.page-heading-copy { flex: 1 1 320px; }
.page-heading h1 { margin: 4px 0 4px; }
.page-heading p { color: var(--muted); font-size: 14px; margin: 0; max-width: 72ch; }
[data-bs-theme="dark"] .page-heading h1 { color: var(--ink); }

/* ───────────── 5. Surfaces ───────────── */
.panel, .guide, .child-card, .empty, .table-wrap, .card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); box-shadow: var(--card-shadow);
}
.panel, .guide, .child-card, .empty { padding: 20px; }
@media (width >= 768px) { .panel, .guide { padding: 24px; } }
.panel > h2, .section-title h2 { font-size: 16px; font-weight: 620; }
.section-title { margin-bottom: 12px; align-items: flex-end; }
.section-title p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.empty { color: var(--muted); text-align: center; padding: 32px 20px; border-style: dashed; box-shadow: none; }
.panel .empty { border: 1px dashed var(--line); }

/* KPI tiles */
.stat { display: grid; gap: 4px; align-content: start; }
.stat .activity-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm); margin-bottom: 8px;
  background: color-mix(in srgb, var(--tone) 12%, var(--paper)); color: var(--tone); box-shadow: none;
}
[data-bs-theme="dark"] .stat .activity-icon { color: var(--tone); }
.stat p { color: var(--muted); font-size: 13px; font-weight: 500; margin: 0; }
.stat strong { color: var(--ink); font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }

/* Wallet */
.wallet-card {
  border-radius: var(--radius); box-shadow: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--highlight) 78%, #07101f), color-mix(in srgb, var(--highlight) 52%, #07101f));
}
.wallet-card:before, .wallet-card:after, .wallet-decoration { display: none; }
.wallet-card .wallet-content { padding: 24px; }
.wallet-label { font-size: 14px; font-weight: 550; }
.wallet-icon { background: #ffffff1f; border-radius: var(--radius-sm); }
.balance-caption { opacity: 0.8; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; }
.balance { font-size: 40px; font-weight: 650; letter-spacing: -0.02em; }
.balance span { font-size: 16px; font-weight: 500; opacity: 0.85; }
.wallet-bottom > span { background: #ffffff1a; border-color: #ffffff33; }

/* Guide */
.guide-icon { display: none; }
.guide h2 { margin-top: 0; }
.guide li span { border-radius: var(--radius-sm); }

/* Activity list: one bordered list, rows divided */
.activity-list {
  gap: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); overflow: hidden; box-shadow: var(--card-shadow);
}
.panel .activity-list { box-shadow: none; }
.activity-item {
  border: 0; border-radius: 0; border-top: 1px solid var(--line);
  padding: 12px 16px; gap: 4px 12px; font-size: 14px;
}
.activity-item:first-child { border-top: 0; }
.activity-item:hover { background: var(--surface); }
.activity-item strong { font-weight: 600; }
.activity-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); box-shadow: none; }
.activity-icon svg { width: 16px; height: 16px; }
.activity-date { color: var(--muted); font-size: 13px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Children */
.child-grid { gap: 16px; }
.child-card { display: grid; gap: 16px; }
.child-balance { background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* Alert */
#low-wallet-alert {
  border-radius: var(--radius); box-shadow: none; padding: 12px 16px; margin-bottom: 24px;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--paper));
}
#low-wallet-alert .button, #low-wallet-alert .button:hover {
  min-height: 36px; background: var(--paper); color: var(--ink); border: 1px solid var(--control-line); box-shadow: none;
}

/* ───────────── 6. Controls ───────────── */
.button, .btn.button {
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  font: 600 14px/1.25 var(--font); gap: 8px; box-shadow: none; transition: background-color .15s, border-color .15s, color .15s;
}
.button svg { width: 16px; height: 16px; }
.button.primary, .btn.button.primary {
  background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: none;
}
.button.primary:not(:disabled):hover {
  color: #fff; background: color-mix(in srgb, var(--blue) 86%, #000); border-color: transparent;
}
[data-bs-theme="dark"] .button.primary { color: #0b1220; }
.button.primary:disabled { opacity: 0.45; background: var(--blue); }
.button.outline { background: var(--paper); border-color: var(--control-line); color: var(--ink); }
.button.outline:not(:disabled):hover { background: var(--surface); color: var(--ink); }
.button.soft { background: var(--tint); color: var(--blue); border-color: transparent; }
.button.text { background: none; color: var(--blue); padding-inline: 8px; min-height: 32px; }
.button.text:not(:disabled):hover { background: var(--tint); }
.button.white { background: #fff; color: #111827; border-color: #fff; }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .form-control, .form-select, select, textarea {
  border-radius: var(--radius-sm); border-color: var(--control-line); font-size: 14px; box-shadow: none;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .form-control, .form-select, select { min-height: 40px; }
input:focus, .form-control:focus, .form-select:focus, select:focus, textarea:focus {
  border-color: var(--highlight); box-shadow: var(--focus); outline: none;
}
label { font-size: 13px; font-weight: 550; color: var(--ink); }
.error { font-size: 13px; }
.language-control { border-radius: var(--radius-sm); }
.language-control .form-select { min-height: 38px; font-size: 13px; }
.message-badge { border-radius: 999px; font-size: 11px; font-weight: 650; }

/* ───────────── 7. Tables ───────────── */
.table-wrap { overflow: auto; }
th {
  font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--muted); background: var(--surface); padding: 10px 16px;
}
td { padding: 12px 16px; font-size: 14px; vertical-align: top; }
tbody tr:hover td { background: var(--surface); }
td small { color: var(--muted); }

/* Filters / report controls */
.sales-report-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin-bottom: 16px; }

/* ───────────── 8. Merchant checkout ───────────── */
.merchant-grid { gap: 24px; }
.pos-category { aspect-ratio: auto; }
.pos-category .button { min-height: 76px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; gap: 6px; }
.pos-category .button svg { width: 24px; height: 24px; }
.pos-category:hover .button, .pos-category input:checked + .button { background: var(--blue); border-color: var(--blue); color: #fff; }
.pos-category input:checked + .button { box-shadow: var(--focus); }
.pos-amount input { font-size: 20px; font-weight: 650; }
.pos-keys .button { min-height: 48px; font-size: 16px; }
.order-total { border-top: 1px solid var(--line); padding-top: 12px; }

/* ───────────── 9. Messages ───────────── */
.messages-layout { gap: 24px; }
.message-peer { border-radius: var(--radius-sm); }
.message-peer[aria-pressed="true"] { background: var(--tint); color: var(--blue); }
.peer-icon { border-radius: var(--radius-sm); }
.mail-item { border-radius: var(--radius-sm); }

/* ───────────── 10. Dialogs, drawer, toast ───────────── */
dialog { border-radius: var(--radius); box-shadow: 0 20px 48px #10182833; padding: 24px; }
dialog::backdrop { background: #0f172a66; }
.dialog-head h2 { font-size: 18px; font-weight: 650; }
.dialog-head .icon-button { width: 36px; height: 36px; border-radius: var(--radius-sm); background: none; color: var(--muted); }
dialog[data-presentation="drawer"] { border-radius: 0; }
.drawer-art { display: none; }
.drawer-banner { padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; background: none; }
.highlight-choice { border-radius: var(--radius-sm); }
#toast { border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); font-weight: 500; box-shadow: 0 8px 24px #10182833; }

/* Drawer: banner without art, links styled like the sidebar */
.drawer-banner { min-height: 0; padding: 0 0 16px; color: var(--ink); }
.drawer-brand { position: static; color: var(--ink); text-shadow: none; }
.drawer-brand strong { color: var(--ink); font-size: 14px; font-weight: 600; }
.drawer-brand p { color: var(--muted); font-size: 13px; margin: 0; }
.drawer-brand .official-wordmark { mix-blend-mode: multiply; width: 140px; }
[data-bs-theme="dark"] .drawer-brand .official-wordmark { mix-blend-mode: normal; }
.drawer-links .nav-button {
  min-height: 40px; padding: 8px 12px; gap: 12px; border: 0; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 520; box-shadow: none;
}
.drawer-links .nav-icon { width: 20px; height: 20px; background: none; color: inherit; }
.drawer-links .nav-button:hover { background: var(--surface); color: var(--ink); }
.drawer-links .nav-button.active { background: var(--tint); color: var(--blue); font-weight: 620; }
