/* ============================================================
   Resto OS, Application Component Layer (shared)
   The component kit every Resto OS app imports on top of rg-theme.css.
   rg-theme.css  = brand tokens (color, type, radius, shadow, report bits)
   rg-components.css = app chrome (shell, controls, forms, feedback)

   Usage in any app:
     <link rel="stylesheet" href="/assets/rg-theme.css">
     <link rel="stylesheet" href="/assets/rg-components.css">

   Brand rules inherited: Petrol Blue #0E2A3C navy, Satoshi type,
   no gold, no em dashes. Tune the LIVE KNOBS below to change the
   feel of every app at once.
   ============================================================ */

/* ----------------------------------------------------------------
   LIVE KNOBS  (the surface we iterate on)
   Change these and every control/shell across every app updates.
   ---------------------------------------------------------------- */
:root {
  --ctrl-h: 40px;          /* height of buttons, inputs, selects */
  --ctrl-h-sm: 32px;       /* compact controls */
  --ctrl-radius: 10px;     /* roundness of buttons + inputs (app controls, NOT the report pills) */
  --ctrl-px: 16px;         /* horizontal padding inside controls */
  --ctrl-gap: 8px;         /* gap between icon and label */

  --sidebar-w: 252px;      /* expanded sidebar width */
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;        /* top bar height */
  --content-px: clamp(18px, 2.4vw, 36px);  /* page content padding */

  --field-gap: 7px;        /* label-to-input gap */
  --focus-ring: 0 0 0 3px var(--accent-soft);  /* keyboard focus halo */
}

/* Per-mode control fills + Apple-glass chrome, derived from the brand tokens.
   Glass rule: light mode = light-translucent panel with dark text; dark mode =
   dark-translucent panel with light text. The ambient gradient behind the shell
   is what the frosted panels refract. */
[data-theme="light"] {
  --btn-primary-bg: var(--navy);
  --btn-primary-bg-hover: #163a52;
  --btn-primary-ink: #ffffff;
  /* ambient canvas the glass refracts */
  --ambient-1: rgba(94,120,145,0.22);
  --ambient-2: rgba(127,169,201,0.18);
  /* glass sidebar (light, translucent, dark text) */
  --sidebar-bg: rgba(255,255,255,0.52);
  --sidebar-ink: #20384a;
  --sidebar-ink-strong: #0A1F2D;
  --sidebar-ink-dim: #5a6b7a;
  --sidebar-active-bg: rgba(14,42,60,0.10);
  --sidebar-hover-bg: rgba(14,42,60,0.05);
  --sidebar-hairline: rgba(14,42,60,0.09);
  --topbar-bg: rgba(247,248,250,0.55);
}
[data-theme="dark"] {
  --btn-primary-bg: #ffffff;
  --btn-primary-bg-hover: #e7eef4;
  --btn-primary-ink: var(--navy);
  --ambient-1: rgba(40,82,122,0.36);
  --ambient-2: rgba(127,169,201,0.10);
  /* glass sidebar (dark, translucent, light text) */
  --sidebar-bg: rgba(10,31,45,0.42);
  --sidebar-ink: #d7e2ec;
  --sidebar-ink-strong: #ffffff;
  --sidebar-ink-dim: #8499a9;
  --sidebar-active-bg: rgba(127,169,201,0.18);
  --sidebar-hover-bg: rgba(255,255,255,0.06);
  --sidebar-hairline: rgba(255,255,255,0.10);
  --topbar-bg: rgba(10,31,45,0.50);
}

@media (prefers-reduced-transparency: reduce) {
  [data-theme="light"] { --sidebar-bg: #ffffff; --topbar-bg: #ffffff; }
  [data-theme="dark"]  { --sidebar-bg: #0A1F2D; --topbar-bg: #0A1F2D; }
  .app-sidebar, .app-topbar { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}

/* ================================================================
   1. APP SHELL  (sidebar + topbar + content)
   The chrome that makes all five apps feel like one product.
   ================================================================ */
.app-shell {
  display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh;
  position: relative;
  background:
    radial-gradient(820px 540px at 6% -10%, var(--ambient-1), transparent 60%),
    radial-gradient(900px 620px at 104% -4%, var(--ambient-2), transparent 56%),
    var(--bg);
  background-attachment: fixed;
}
.app-shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
/* Smooth open/close: the rail width animates on an Apple-style ease. Standard
   across every Resto OS app so the sidebar always feels the same. */
.app-shell { transition: grid-template-columns .42s cubic-bezier(.32,.72,0,1); }
@media (prefers-reduced-motion: reduce) { .app-shell { transition: none; } }

/* ---- Glass sidebar (Apple liquid-glass) ---- */
.app-sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-ink);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  backdrop-filter: blur(40px) saturate(200%);
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid var(--sidebar-hairline);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.04), inset 1px 0 0 rgba(255,255,255,0.22);
}
/* Liquid-glass sheen: a faint top-down highlight that catches the light, the
   way frosted glass does. Non-interactive, sits behind the rail content. */
.app-sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 22%);
}
[data-theme="dark"] .app-sidebar::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0) 22%);
}
.app-sidebar > * { position: relative; z-index: 1; }
[data-theme="dark"] .app-sidebar { box-shadow: inset 1px 0 0 rgba(255,255,255,0.05); }
/* Resto OS launcher / app identity at the top of the rail */
.app-brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 14px; }
.app-brand .mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; background: var(--navy);
  color: #fff; font-weight: 900; font-size: 15px; letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
[data-theme="dark"] .app-brand .mark { background: var(--accent); color: var(--navy-deep); }
.app-brand .name { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; white-space: nowrap; }
.app-brand .name b { font-weight: 700; font-size: 15px; color: var(--sidebar-ink-strong); letter-spacing: -0.01em; }
.app-brand .name span { font-size: 11px; color: var(--sidebar-ink-dim); }
/* Labels fade as the rail collapses (the text opacity eases out while the width
   animates), so collapse/expand reads as one smooth motion. Standard for all apps. */
.app-brand .name, .nav-item .txt, .sidebar-user .who {
  transition: opacity .2s var(--ease);
}

.nav-section { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sidebar-ink-dim); padding: 16px 12px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; text-decoration: none;
  color: var(--sidebar-ink); font-size: 14px; font-weight: 500;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-item:hover { background: var(--sidebar-hover-bg); text-decoration: none; color: var(--sidebar-ink-strong); }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-ink-strong); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255,255,255,0.10); }
.nav-item .ico { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--sidebar-active-bg); color: var(--sidebar-ink-strong); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.sidebar-spacer { flex: 1 1 auto; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--sidebar-hairline); margin-top: 6px; }
.sidebar-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
[data-theme="dark"] .sidebar-user .avatar { background: var(--accent); color: var(--navy-deep); }
.sidebar-user .who { line-height: 1.2; min-width: 0; }
.sidebar-user .who b { display: block; font-size: 13px; font-weight: 600; color: var(--sidebar-ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { font-size: 11px; color: var(--sidebar-ink-dim); }

/* ---- Main column ---- */
.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 16px;
  padding: 0 var(--content-px); border-bottom: 1px solid var(--hairline);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  position: sticky; top: 0; z-index: 20;
}
.app-topbar .page-title { font-weight: 700; font-size: 19px; letter-spacing: -0.015em; color: var(--ink-strong); }
.app-topbar .spacer { flex: 1 1 auto; }
.app-content { padding: clamp(20px, 2.6vw, 34px) var(--content-px); flex: 1 1 auto; }
.app-content .wrap { max-width: var(--maxw); margin: 0 auto; }

/* ================================================================
   2. BUTTONS  (app controls: rounded-rect, not the report pill)
   ================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--ctrl-gap);
  height: var(--ctrl-h); padding: 0 var(--ctrl-px);
  font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1;
  border-radius: var(--ctrl-radius); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease), transform .05s var(--ease);
}
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn .ico { width: 17px; height: 17px; flex: none; }

.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-ink); }
.btn-primary:hover { background: var(--btn-primary-bg-hover); text-decoration: none; }

.btn-secondary { background: var(--surface); color: var(--ink-strong); border-color: var(--hairline-2); }
.btn-secondary:hover { border-color: var(--accent-line); color: var(--accent-ink); background: var(--surface); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--ink-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink-strong); text-decoration: none; }

.btn-danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 10%, transparent); text-decoration: none; }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--red) 85%, #000); text-decoration: none; }

.btn-sm { height: var(--ctrl-h-sm); padding: 0 12px; font-size: 13px; border-radius: calc(var(--ctrl-radius) - 2px); }
.btn-icon { width: var(--ctrl-h); padding: 0; }
.btn-icon.btn-sm { width: var(--ctrl-h-sm); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: rg-spin .7s linear infinite; color: var(--btn-primary-ink); }
@keyframes rg-spin { to { transform: rotate(360deg); } }

/* ================================================================
   3. FORM CONTROLS
   ================================================================ */
.field { display: flex; flex-direction: column; gap: var(--field-gap); margin-bottom: 16px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-strong); }
.field .hint { font-size: 12px; color: var(--ink-faint); }
.field .err { font-size: 12px; color: var(--red); font-weight: 500; }
.req { color: var(--red); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--ink-strong);
  background: var(--surface); border: 1px solid var(--hairline-2); border-radius: var(--ctrl-radius);
  height: var(--ctrl-h); padding: 0 13px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.textarea { height: auto; min-height: 90px; padding: 11px 13px; line-height: 1.5; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--accent-line); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-2); color: var(--ink-faint); cursor: not-allowed; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--red); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 14%, transparent); }

.select { -webkit-appearance: none; appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6b7a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }

/* input with a leading icon */
.input-group { position: relative; }
.input-group .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-faint); pointer-events: none; }
.input-group .input { padding-left: 38px; }

/* checkbox + radio */
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-strong); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); cursor: pointer; }
[data-theme="dark"] .check input { accent-color: var(--ice); }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--ink-strong); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 23px; border-radius: 999px; background: var(--hairline-2); transition: background .2s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: var(--focus-ring); }

/* ================================================================
   4. CONTAINERS  (cards extend rg-theme .rg-card; add app headers)
   ================================================================ */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--hairline); }
.card-head h3 { font-size: 15px; font-weight: 700; color: var(--ink-strong); letter-spacing: -0.01em; }
.card-head .spacer { flex: 1 1 auto; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

/* page section header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 900; letter-spacing: -0.025em; color: var(--ink-strong); line-height: 1.1; }
.page-head .sub { font-size: 14px; color: var(--ink-dim); margin-top: 4px; }

/* ================================================================
   5. DATA  (interactive table, pagination, empty, skeleton)
   ================================================================ */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); padding: 11px 16px; border-bottom: 1px solid var(--hairline-2); white-space: nowrap; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--accent-ink); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--hairline); color: var(--ink); }
table.data tbody tr { transition: background .14s var(--ease); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: inline-flex; gap: 4px; opacity: 0; transition: opacity .14s var(--ease); }
table.data tbody tr:hover .row-actions { opacity: 1; }

.pagination { display: flex; align-items: center; gap: 6px; padding: 14px 16px; }
.pagination .pg { min-width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0 9px; border-radius: 8px; border: 1px solid transparent; font-size: 13px; font-weight: 600; color: var(--ink-dim); cursor: pointer; background: transparent; }
.pagination .pg:hover { background: var(--surface-2); color: var(--ink-strong); }
.pagination .pg.active { background: var(--navy); color: #fff; }
[data-theme="dark"] .pagination .pg.active { background: var(--surface-2); color: var(--ink-strong); border-color: var(--hairline-2); }

.empty-state { text-align: center; padding: 54px 24px; }
/* .ico is a span (inline by default), so width/height were ignored and the SVG
   ballooned to fill the card. Force a fixed box and cap the glyph inside it. */
.empty-state .ico { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--ink-faint); margin: 0 auto 14px; }
.empty-state .ico svg { width: 44px; height: 44px; display: block; }
.empty-state h4 { font-size: 16px; font-weight: 700; color: var(--ink-strong); margin-bottom: 5px; }
.empty-state p { font-size: 14px; color: var(--ink-dim); max-width: 360px; margin: 0 auto 18px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-2) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: rg-shimmer 1.4s ease infinite; border-radius: 7px; }
@keyframes rg-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ================================================================
   6. FEEDBACK  (alert banners, modal, toast, tooltip)
   ================================================================ */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius-md); border: 1px solid var(--hairline-2); background: var(--surface); font-size: 14px; }
.alert .ico { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert b { font-weight: 700; }
.alert.info { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink-strong); }
.alert.info .ico { color: var(--accent-ink); }
.alert.success { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: color-mix(in srgb, var(--green) 8%, transparent); }
.alert.success .ico { color: var(--green); }
.alert.warn { border-color: var(--sev-warn-line); background: var(--sev-warn-tint); }
.alert.warn .ico { color: var(--amber); }
.alert.danger { border-color: var(--sev-crit-line); background: var(--sev-crit-tint); }
.alert.danger .ico { color: var(--red); }

/* modal */
.modal-scrim { position: fixed; inset: 0; background: rgba(7,22,31,0.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px; z-index: 100; }
.modal { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow); width: min(520px, 100%); max-height: 90vh; overflow: auto; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { font-size: 18px; font-weight: 700; color: var(--ink-strong); letter-spacing: -0.015em; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 14px 22px; color: var(--ink-dim); font-size: 14px; line-height: 1.55; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 6px 22px 22px; }

/* toast */
.toast-stack { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--hairline-2); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 12px 15px; font-size: 14px; color: var(--ink-strong); min-width: 280px; }
.toast .ico { width: 18px; height: 18px; flex: none; }
.toast.success .ico { color: var(--green); }
.toast.danger .ico { color: var(--red); }
.toast .x { margin-left: auto; }

/* tooltip */
.tip { position: relative; display: inline-flex; }
.tip .tip-body { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--ink-strong); color: var(--surface); font-size: 12px; font-weight: 500; padding: 6px 10px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s var(--ease); }
.tip:hover .tip-body { opacity: 1; }

/* ================================================================
   7. NAVIGATION  (tabs, breadcrumbs)  + segmented tabs reuse rg-tabs
   ================================================================ */
.tabs-underline { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); }
.tabs-underline a { padding: 11px 14px; font-size: 14px; font-weight: 600; color: var(--ink-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; transition: color .15s var(--ease), border-color .15s var(--ease); }
.tabs-underline a:hover { color: var(--ink-strong); text-decoration: none; }
.tabs-underline a.active { color: var(--ink-strong); border-bottom-color: var(--navy); }
[data-theme="dark"] .tabs-underline a.active { border-bottom-color: var(--ice); }

.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-dim); }
.crumbs a { color: var(--ink-dim); }
.crumbs a:hover { color: var(--accent-ink); }
.crumbs .sep { color: var(--ink-faint); }
.crumbs .here { color: var(--ink-strong); font-weight: 600; }

/* ================================================================
   8. SEARCH, FILTERS, DATES & CALENDAR
   ================================================================ */

/* ---- Search ---- */
.search { position: relative; width: 100%; }
.search .lead { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-faint); pointer-events: none; }
.search .input { padding-left: 39px; padding-right: 52px; }
.search .kbd-hint { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.kbd { display: inline-flex; align-items: center; height: 21px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--hairline-2); background: var(--surface-2); color: var(--ink-dim); font-size: 11px; font-weight: 600; }

/* search results popover (shown open in the lab) */
.search-pop { background: var(--surface); border: 1px solid var(--hairline-2); border-radius: var(--radius-md); box-shadow: var(--shadow); overflow: hidden; }
.search-pop .grp { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); padding: 11px 14px 5px; }
.search-result { display: flex; align-items: center; gap: 11px; padding: 9px 14px; cursor: pointer; }
.search-result:hover, .search-result.active { background: var(--surface-2); }
.search-result .ico { width: 17px; height: 17px; color: var(--ink-dim); flex: none; }
.search-result .t { font-size: 14px; color: var(--ink-strong); font-weight: 500; }
.search-result .m { margin-left: auto; font-size: 12px; color: var(--ink-faint); }

/* ---- Filters ---- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 6px 0 12px; border-radius: 999px; border: 1px solid var(--hairline-2); background: var(--surface); color: var(--ink-strong); font-size: 13px; font-weight: 500; }
.chip b { font-weight: 700; }
.chip .x { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--ink-dim); cursor: pointer; font-size: 13px; line-height: 1; transition: background .15s var(--ease), color .15s var(--ease); }
.chip .x:hover { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.filter-add { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px dashed var(--hairline-2); background: transparent; color: var(--ink-dim); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .18s var(--ease), color .18s var(--ease); }
.filter-add:hover { border-color: var(--accent-line); color: var(--accent-ink); border-style: solid; }

/* filter dropdown menu (multi-select, shown open in the lab) */
.menu { background: var(--surface); border: 1px solid var(--hairline-2); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 6px; min-width: 200px; }
.menu .mh { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); padding: 7px 10px 5px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink-strong); }
.menu-item:hover { background: var(--surface-2); }
.menu-item input { width: 16px; height: 16px; accent-color: var(--navy); }
[data-theme="dark"] .menu-item input { accent-color: var(--ice); }
.menu-item .ct { margin-left: auto; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ---- Date fields ---- */
.input-trail { position: relative; }
.input-trail .ico { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-faint); pointer-events: none; }
.input-trail .input { padding-right: 40px; }
.daterange { display: inline-flex; align-items: center; gap: 10px; }
.daterange .sep { color: var(--ink-faint); font-size: 13px; }
.daterange .input-trail { width: 170px; }

/* ---- Calendar ---- */
.calendar { width: 300px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head .m { font-size: 14px; font-weight: 700; color: var(--ink-strong); }
.cal-nav { display: flex; gap: 4px; }
.cal-nav button { width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; color: var(--ink-dim); cursor: pointer; display: grid; place-items: center; font-size: 15px; transition: background .15s var(--ease); }
.cal-nav button:hover { background: var(--surface-2); color: var(--ink-strong); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--ink-faint); padding-bottom: 6px; }
.cal-day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; font-size: 13px; color: var(--ink); cursor: pointer; border: none; background: transparent; font-family: inherit; transition: background .12s var(--ease); }
.cal-day:hover { background: var(--surface-2); }
.cal-day.muted { color: var(--ink-faint); opacity: .55; }
.cal-day.today { font-weight: 700; box-shadow: inset 0 0 0 1px var(--accent-line); }
.cal-day.in-range { background: var(--accent-soft); border-radius: 0; }
.cal-day.range-start, .cal-day.range-end, .cal-day.selected { background: var(--btn-primary-bg); color: var(--btn-primary-ink); font-weight: 600; }
.cal-day.range-start { border-radius: 9px 0 0 9px; }
.cal-day.range-end { border-radius: 0 9px 9px 0; }
.cal-day.disabled { color: var(--ink-faint); opacity: .35; pointer-events: none; }

/* ================================================================
   9. RESPONSIVE
   ================================================================ */
@media (max-width: 860px) {
  .app-shell, .app-shell.collapsed { grid-template-columns: 1fr; }
  .app-sidebar { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform .25s var(--ease); width: var(--sidebar-w); }
  .app-shell.nav-open .app-sidebar { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .nav-item, .input, table.data tbody tr { transition: none; }
  .skeleton, .btn.is-loading::after { animation: none; }
}
