/* ==========================================================================
   Design system – "Mạng lưới dữ liệu" (Living Network), mobile-first, light / dark
   Airy tinted background with a slow data network behind it (js/gn-network-bg.js), white frosted cards with soft
   brand-tinted shadows, large radii. Status colours (ok / warn / bad / info) are blue / amber / rose / violet: they
   never derive from the brand, so they read the same for every tenant.

   Per-tenant palette: every brand colour below is mixed (color-mix) from four anchors that js/brand.js sets on <html>
   from the tenant's colours (tenant.json colors.primary / colors.primary_dark):
     --brand-primary       the tenant's primary colour (light theme)
     --brand-primary-dark  the tenant's primary colour for the dark theme
     --brand-deep          a deeper shade of the primary (computed by brand.js)
     --brand-vivid         a brighter, more saturated tint of the dark primary (computed by brand.js)
   The mix ratios were fitted to the original hand-tuned green palette (#1f7a4d / #4fbf86), so that tenant renders as
   before, and every other hue gets the same light / dark relationships. Neutral grey partners keep tints clean for any
   hue. Inside the theme blocks, use var(--token) of the same block only: the dark blocks redefine every brand token.
   ========================================================================== */
:root {
  /* Anchors: neutral product defaults until brand.js applies the tenant (it also computes deep / vivid exactly) */
  --brand-primary: #0b5cad;
  --brand-primary-dark: #5aa0e6;
  --brand-deep: color-mix(in oklab, var(--brand-primary) 80%, #000000);
  --brand-vivid: color-mix(in oklab, var(--brand-primary-dark) 88%, #ffffff);
  /* Shades of the light theme that some rules use in both themes (boot mark, bar and avatar shadows) */
  --shade-primary: color-mix(in oklab, var(--brand-deep) 75%, var(--brand-vivid));
  --shade: color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 20%, var(--brand-deep)) 97%, #000000);
  --shade-2: color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 45%, var(--brand-deep)) 75%, #000000);
  --shade-deep: color-mix(in srgb, var(--brand-deep) 72%, #070707);
  /* Page: off-white with a brand-tinted wash toward the top-right (the canvas paints --bg-image under the network) */
  --bg: color-mix(in srgb, var(--brand-primary-dark) 6%, #fcfcfc);
  --bg-image:
    radial-gradient(85% 70% at 100% 0%, color-mix(in srgb, var(--brand-primary-dark) 21%, #fefefe) 0%, transparent 62%),
    radial-gradient(60% 50% at 0% 100%, color-mix(in srgb, var(--brand-primary-dark) 9%, #fefefe) 0%, transparent 70%),
    linear-gradient(
      170deg,
      color-mix(in srgb, var(--brand-primary-dark) 3%, #fefefe) 0%,
      var(--bg) 55%,
      color-mix(in srgb, var(--brand-primary-dark) 9%, #fafafa) 100%
    );
  --surface: #ffffff;
  --surface-2: color-mix(in srgb, var(--brand-primary) 4%, #ffffff);
  --surface-3: color-mix(in srgb, var(--brand-primary) 9%, #ffffff);
  /* Frosted surfaces over the network */
  --glass: rgba(255, 255, 255, 0.8);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --glass-soft: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.92);
  --glass-blur: blur(14px) saturate(1.3);
  --ink: color-mix(in srgb, var(--brand-primary) 21%, #0c0c0c);
  --text-2: color-mix(in srgb, var(--brand-primary) 22%, #4a4a4a);
  --muted: color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 10%, var(--brand-deep)) 23%, #777777);
  --line: color-mix(in srgb, var(--brand-primary) 12%, #fbfbfb);
  --line-2: color-mix(in srgb, var(--brand-primary-dark) 17%, #e4e4e4);
  --line-soft: color-mix(in srgb, color-mix(in oklab, var(--brand-deep) 96%, #070707) 10%, transparent);
  /* Primary actions: the tenant's primary colour (gradient on buttons) */
  --primary: var(--brand-primary);
  --primary-600: color-mix(in oklab, var(--brand-primary) 45%, var(--brand-deep));
  --primary-soft: color-mix(in srgb, var(--brand-primary-dark) 15%, #fdfdfd);
  --on-primary: #ffffff;
  --accent: var(--brand-primary);
  /* Brand colours exactly as the tenant gave them */
  --brand: var(--brand-primary);
  --brand-soft: color-mix(in srgb, var(--brand-primary) 10%, #ffffff);
  --brand-on-dark: var(--brand-primary-dark);
  --brand-ink: var(--brand-deep);
  --logo-on-light: block;
  --logo-on-dark: none;
  /* Brand scale (named --green-* for history; 1 = tint … 7 = deep) */
  --green-1: color-mix(in srgb, var(--brand-primary-dark) 12%, #ffffff);
  --green-2: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 90%, var(--brand-vivid)) 33%, #ffffff);
  --green-3: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 30%, var(--brand-vivid)) 65%, #ffffff);
  --green-4: color-mix(in oklab, var(--brand-vivid) 94%, #000000);
  --green-5: color-mix(in oklab, var(--brand-primary) 60%, var(--brand-vivid));
  --green-6: var(--shade-primary);
  --green-7: var(--brand-ink);
  --grad-primary: linear-gradient(180deg, color-mix(in oklab, var(--brand-primary) 85%, var(--brand-vivid)), var(--primary-600));
  --grad-primary-hover: linear-gradient(
    180deg,
    color-mix(in oklab, color-mix(in oklab, var(--brand-primary) 75%, var(--brand-vivid)) 90%, #000000),
    color-mix(in oklab, var(--brand-primary) 5%, var(--brand-deep))
  );
  --grad-mark: linear-gradient(145deg, color-mix(in oklab, var(--brand-deep) 10%, var(--brand-vivid)), var(--shade-primary) 70%);
  --grad-bar: linear-gradient(90deg, var(--green-3), var(--green-5) 60%, var(--shade-primary));
  --grad-soft: linear-gradient(
    115deg,
    color-mix(
      in srgb,
      color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 70%, var(--brand-vivid)) 16%, #ffffff) 94%,
      transparent
    ),
    rgba(255, 255, 255, 0.86) 65%
  );
  --grad-avatar: linear-gradient(145deg, color-mix(in oklab, var(--brand-vivid) 15%, #fbfbfb), var(--green-2));
  --track: color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 60%, var(--brand-primary-dark)) 14%, #ffffff);
  --ring-from: var(--green-3);
  --ring-mid: var(--green-5);
  --ring-to: var(--primary-600);
  --ring-dots: color-mix(in oklab, var(--brand-vivid) 33%, #e4e4e4);
  /* Status (StatusTag, alerts, chips): Khớp blue · Lệch amber · Chưa thấy rose · Ngoài sổ violet */
  --ok: #0a6a9e;
  --ok-soft: #e4f2fb;
  --warn: #a14a07;
  --warn-soft: #fdf0e1;
  --bad: #b4233f;
  --bad-soft: #fdebee;
  --info: #6b3fc7;
  --info-soft: #f1ecfd;
  --off: var(--muted);
  --off-soft: color-mix(in oklab, var(--brand-deep) 7%, #ffffff);
  --notify: #c2334f;
  --on-notify: #fff;
  /* Asset class colours = chart palette (validated for colour-vision deficiency) */
  --c-TSCD: #2a78d6;
  --c-CCDC_LON: #eb6834;
  --c-CCDC_TB: #1baf7a;
  --c-CCDC_TH: #eda100;
  --c-NGOAI: #e87ba4;
  /* Chart marks (validated: lightness band, CVD, contrast on --surface) */
  --chart-1: #2a62c9;
  --chart-bad: #c42b2b;
  /* Sidebar: a frosted panel like the cards */
  --sidebar: var(--glass);
  --sidebar-2: color-mix(in srgb, var(--green-1) 85%, transparent);
  --sidebar-ink: var(--text-2);
  --sidebar-muted: var(--muted);
  --sidebar-active: #ffffff;
  --sidebar-accent: var(--green-7);
  --backdrop: color-mix(in srgb, var(--ink) 32%, transparent);
  /* Soft layered shadows tinted with the brand */
  --shadow-sm:
    0 1px 2px color-mix(in srgb, var(--shade-2) 5%, transparent),
    0 4px 12px -8px color-mix(in srgb, var(--shade) 18%, transparent);
  --shadow:
    0 1px 2px color-mix(in srgb, var(--shade-2) 5%, transparent),
    0 10px 28px -14px color-mix(in srgb, var(--shade) 20%, transparent),
    0 30px 60px -36px color-mix(in srgb, var(--shade) 26%, transparent);
  --shadow-lg:
    0 40px 70px -30px color-mix(in srgb, var(--shade-deep) 45%, transparent),
    0 16px 30px -18px color-mix(in srgb, var(--shade-deep) 30%, transparent);
  --shadow-btn: 0 10px 20px -10px color-mix(in srgb, var(--primary-600) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  --shadow-active: 0 6px 16px -10px color-mix(in srgb, var(--shade) 45%, transparent);
  --focus: 0 0 0 3px color-mix(in srgb, var(--green-5) 30%, transparent);
  --focus-ring: color-mix(in srgb, var(--green-5) 55%, transparent);
  /* Network background (gn-network-bg.js): colours + overall strength */
  --net-link: color-mix(in oklab, var(--brand-deep) 75%, var(--brand-vivid));
  --net-node: var(--shade-primary);
  --net-glow: var(--green-4);
  --net-packet: var(--green-5);
  --net-wash: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 35%, var(--brand-vivid)) 74%, #dfdfdf);
  --net-strength: 1;
  /* Camera viewfinder (scan screens): a dark brand-tinted lens in both themes, white corner brackets, bright scan line */
  --vf-from: color-mix(in srgb, var(--brand-deep) 40%, #404040);
  --vf-to: color-mix(in srgb, var(--brand-deep) 25%, #161616);
  --vf-corner: rgba(255, 255, 255, 0.95);
  --vf-glow: color-mix(in srgb, var(--brand-vivid) 63%, #ffffff);
  --vf-ink: #ffffff;
  --vf-chip: color-mix(in srgb, color-mix(in srgb, var(--brand-deep) 19%, #050505) 55%, transparent);
  color-scheme: light;
  /* Type */
  --f-body: 'Be Vietnam Pro', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  /* Big numbers (progress, KPI): Space Grotesk when installed, otherwise the body face with tabular digits */
  --f-num: 'Space Grotesk', var(--f-body);
  --fs-h1: 30px;
  --fs-h2: 16px;
  --fs-body: 14px;
  --fs-sm: 12.5px;
  --fs-xs: 11.5px;
  /* Radii */
  --r-xl: 24px;
  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --r-pill: 999px;
  --topbar-h: 60px;
  --tabbar-h: 62px;
  --actionbar-h: 68px;
  --sidebar-w: 264px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  /* Area hidden by the browser's bottom toolbar (iOS 26 floating tab bar, Chrome Android); set by js/viewport.js */
  --vv-bottom: 0px;
  /* Bottom padding of fixed bars: the home-indicator inset, or a small gap when there is none */
  --bar-pad-b: max(var(--safe-b), 4px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    /* Haze (light lines on dark glass) and the glass tint of the dark theme */
    --haze: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 10%, var(--brand-vivid)) 48%, #f7f7f7);
    --tint-glass: color-mix(in srgb, var(--brand-deep) 20%, #161616);
    /* Dark: deep brand-tinted slate, the network lighter and fainter, cards slightly translucent */
    --bg: color-mix(in srgb, var(--brand-deep) 11%, #0b0b0b);
    --bg-image:
      radial-gradient(
        85% 70% at 100% 0%,
        color-mix(
            in srgb,
            color-mix(in srgb, color-mix(in oklab, var(--brand-deep) 35%, var(--brand-vivid)) 71%, #000000) 30%,
            transparent
          )
          0%,
        transparent 62%
      ),
      radial-gradient(
        60% 50% at 0% 100%,
        color-mix(in srgb, color-mix(in srgb, var(--brand-deep) 60%, #232323) 32%, transparent) 0%,
        transparent 70%
      ),
      linear-gradient(
        170deg,
        color-mix(in srgb, var(--brand-deep) 14%, #0f0f0f) 0%,
        var(--bg) 55%,
        color-mix(in srgb, var(--brand-deep) 11%, #080808) 100%
      );
    --surface: color-mix(in srgb, var(--brand-deep) 17%, #151515);
    --surface-2: color-mix(in srgb, var(--brand-deep) 14%, #101010);
    --surface-3: color-mix(in srgb, var(--brand-deep) 21%, #1f1f1f);
    --glass: color-mix(in srgb, var(--tint-glass) 74%, transparent);
    --glass-strong: color-mix(in srgb, var(--surface) 90%, transparent);
    --glass-soft: color-mix(in srgb, var(--tint-glass) 52%, transparent);
    --glass-border: color-mix(in srgb, var(--haze) 8%, transparent);
    --glass-blur: blur(16px) saturate(1.2);
    --ink: color-mix(in srgb, var(--brand-primary-dark) 11%, #f7f7f7);
    --text-2: color-mix(in srgb, var(--brand-primary) 21%, #dfdfdf);
    --muted: color-mix(in srgb, var(--brand-vivid) 16%, #9b9b9b);
    --line: color-mix(in srgb, var(--brand-deep) 24%, #262626);
    --line-2: color-mix(in srgb, var(--brand-deep) 28%, #3a3a3a);
    --line-soft: color-mix(in srgb, var(--haze) 9%, transparent);
    --primary: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 5%, var(--brand-vivid)) 89%, #c7c7c7);
    --primary-600: color-mix(in srgb, var(--brand-vivid) 75%, #ffffff);
    --primary-soft: color-mix(in srgb, var(--brand-vivid) 23%, #0c0c0c);
    --on-primary: color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 25%, var(--brand-deep)) 23%, #000000);
    --accent: var(--brand-primary-dark);
    --brand: var(--brand-primary-dark);
    --brand-soft: color-mix(in srgb, var(--brand-primary-dark) 16%, var(--surface));
    --brand-on-dark: var(--brand-primary-dark);
    --brand-ink: color-mix(in srgb, var(--brand-vivid) 59%, #fefefe);
    --logo-on-light: none;
    --logo-on-dark: block;
    --green-1: color-mix(in srgb, var(--brand-deep) 35%, #191919);
    --green-2: color-mix(in srgb, var(--brand-vivid) 30%, #0f0f0f);
    --green-3: color-mix(in oklab, var(--brand-vivid) 68%, #060606);
    --green-4: color-mix(in oklab, var(--brand-vivid) 94%, #000000);
    --green-5: var(--primary);
    --green-6: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 20%, var(--brand-vivid)) 68%, #ffffff);
    --green-7: color-mix(in srgb, var(--brand-vivid) 46%, #ffffff);
    --grad-primary: linear-gradient(
      180deg,
      color-mix(in srgb, var(--brand-vivid) 88%, #f5f5f5),
      color-mix(in oklab, var(--brand-primary) 35%, var(--brand-vivid))
    );
    --grad-primary-hover: linear-gradient(
      180deg,
      color-mix(in srgb, var(--brand-vivid) 77%, #ffffff),
      color-mix(in oklab, var(--brand-deep) 20%, var(--brand-vivid))
    );
    --grad-mark: linear-gradient(145deg, var(--brand-vivid), color-mix(in oklab, var(--brand-deep) 80%, var(--brand-vivid)) 75%);
    --grad-bar: linear-gradient(
      90deg,
      color-mix(in srgb, var(--brand-vivid) 50%, #000000),
      color-mix(in oklab, var(--brand-primary) 35%, var(--brand-vivid)) 55%,
      var(--primary-600)
    );
    --grad-soft: linear-gradient(
      115deg,
      color-mix(in srgb, color-mix(in srgb, var(--brand-vivid) 29%, #111111) 72%, transparent),
      color-mix(in srgb, var(--tint-glass) 62%, transparent) 65%
    );
    --grad-avatar: linear-gradient(145deg, var(--green-2), var(--green-1));
    --track: color-mix(in srgb, var(--brand-deep) 23%, #222222);
    --ring-from: color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 10%, var(--brand-vivid)) 56%, #121212);
    --ring-mid: var(--green-4);
    --ring-to: var(--brand-ink);
    --ring-dots: color-mix(in srgb, var(--brand-vivid) 21%, #252525);
    --ok: #6cb8ec;
    --ok-soft: #0f2a3b;
    --warn: #f2b45c;
    --warn-soft: #33250f;
    --bad: #f28ba0;
    --bad-soft: #3a1823;
    --info: #b8a1f7;
    --info-soft: #261d42;
    --off: var(--muted);
    --off-soft: var(--surface-3);
    --notify: #f27a8e;
    --on-notify: #2a0a12;
    --c-TSCD: #3987e5;
    --c-CCDC_LON: #d95926;
    --c-CCDC_TB: #199e70;
    --c-CCDC_TH: #c98500;
    --c-NGOAI: #d55181;
    --chart-1: #4f8de6;
    --chart-bad: #e5524f;
    --sidebar: var(--glass);
    --sidebar-2: color-mix(in srgb, var(--green-2) 45%, transparent);
    --sidebar-ink: var(--text-2);
    --sidebar-muted: var(--muted);
    --sidebar-active: color-mix(in srgb, var(--haze) 10%, transparent);
    --sidebar-accent: var(--green-7);
    --backdrop: color-mix(in srgb, color-mix(in srgb, var(--brand-deep) 8%, #010101) 60%, transparent);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow:
      0 0 0 1px color-mix(in srgb, var(--haze) 5%, transparent), 0 12px 30px -16px rgba(0, 0, 0, 0.6),
      0 30px 60px -36px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 40px 70px -30px rgba(0, 0, 0, 0.8), 0 16px 30px -18px rgba(0, 0, 0, 0.6);
    --shadow-btn:
      0 10px 22px -12px color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 15%, var(--brand-vivid)) 55%, transparent),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
    --shadow-active: 0 6px 16px -10px rgba(0, 0, 0, 0.6), inset 0 0 0 1px color-mix(in srgb, var(--haze) 8%, transparent);
    --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);
    --focus-ring: color-mix(in srgb, var(--primary) 60%, transparent);
    --net-link: color-mix(in srgb, var(--brand-vivid) 60%, #ffffff);
    --net-node: color-mix(in srgb, var(--brand-vivid) 53%, #ffffff);
    --net-glow: var(--primary);
    --net-packet: color-mix(in srgb, var(--brand-vivid) 65%, #ffffff);
    --net-wash: color-mix(in oklab, var(--brand-vivid) 77%, #000000);
    --net-strength: 0.55;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  /* Same tokens as the OS-dark block above (keep both in sync) */
  --haze: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 10%, var(--brand-vivid)) 48%, #f7f7f7);
  --tint-glass: color-mix(in srgb, var(--brand-deep) 20%, #161616);
  /* Dark: deep brand-tinted slate, the network lighter and fainter, cards slightly translucent */
  --bg: color-mix(in srgb, var(--brand-deep) 11%, #0b0b0b);
  --bg-image:
    radial-gradient(
      85% 70% at 100% 0%,
      color-mix(
          in srgb,
          color-mix(in srgb, color-mix(in oklab, var(--brand-deep) 35%, var(--brand-vivid)) 71%, #000000) 30%,
          transparent
        )
        0%,
      transparent 62%
    ),
    radial-gradient(
      60% 50% at 0% 100%,
      color-mix(in srgb, color-mix(in srgb, var(--brand-deep) 60%, #232323) 32%, transparent) 0%,
      transparent 70%
    ),
    linear-gradient(
      170deg,
      color-mix(in srgb, var(--brand-deep) 14%, #0f0f0f) 0%,
      var(--bg) 55%,
      color-mix(in srgb, var(--brand-deep) 11%, #080808) 100%
    );
  --surface: color-mix(in srgb, var(--brand-deep) 17%, #151515);
  --surface-2: color-mix(in srgb, var(--brand-deep) 14%, #101010);
  --surface-3: color-mix(in srgb, var(--brand-deep) 21%, #1f1f1f);
  --glass: color-mix(in srgb, var(--tint-glass) 74%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface) 90%, transparent);
  --glass-soft: color-mix(in srgb, var(--tint-glass) 52%, transparent);
  --glass-border: color-mix(in srgb, var(--haze) 8%, transparent);
  --glass-blur: blur(16px) saturate(1.2);
  --ink: color-mix(in srgb, var(--brand-primary-dark) 11%, #f7f7f7);
  --text-2: color-mix(in srgb, var(--brand-primary) 21%, #dfdfdf);
  --muted: color-mix(in srgb, var(--brand-vivid) 16%, #9b9b9b);
  --line: color-mix(in srgb, var(--brand-deep) 24%, #262626);
  --line-2: color-mix(in srgb, var(--brand-deep) 28%, #3a3a3a);
  --line-soft: color-mix(in srgb, var(--haze) 9%, transparent);
  --primary: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 5%, var(--brand-vivid)) 89%, #c7c7c7);
  --primary-600: color-mix(in srgb, var(--brand-vivid) 75%, #ffffff);
  --primary-soft: color-mix(in srgb, var(--brand-vivid) 23%, #0c0c0c);
  --on-primary: color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 25%, var(--brand-deep)) 23%, #000000);
  --accent: var(--brand-primary-dark);
  --brand: var(--brand-primary-dark);
  --brand-soft: color-mix(in srgb, var(--brand-primary-dark) 16%, var(--surface));
  --brand-on-dark: var(--brand-primary-dark);
  --brand-ink: color-mix(in srgb, var(--brand-vivid) 59%, #fefefe);
  --logo-on-light: none;
  --logo-on-dark: block;
  --green-1: color-mix(in srgb, var(--brand-deep) 35%, #191919);
  --green-2: color-mix(in srgb, var(--brand-vivid) 30%, #0f0f0f);
  --green-3: color-mix(in oklab, var(--brand-vivid) 68%, #060606);
  --green-4: color-mix(in oklab, var(--brand-vivid) 94%, #000000);
  --green-5: var(--primary);
  --green-6: color-mix(in srgb, color-mix(in oklab, var(--brand-primary-dark) 20%, var(--brand-vivid)) 68%, #ffffff);
  --green-7: color-mix(in srgb, var(--brand-vivid) 46%, #ffffff);
  --grad-primary: linear-gradient(
    180deg,
    color-mix(in srgb, var(--brand-vivid) 88%, #f5f5f5),
    color-mix(in oklab, var(--brand-primary) 35%, var(--brand-vivid))
  );
  --grad-primary-hover: linear-gradient(
    180deg,
    color-mix(in srgb, var(--brand-vivid) 77%, #ffffff),
    color-mix(in oklab, var(--brand-deep) 20%, var(--brand-vivid))
  );
  --grad-mark: linear-gradient(145deg, var(--brand-vivid), color-mix(in oklab, var(--brand-deep) 80%, var(--brand-vivid)) 75%);
  --grad-bar: linear-gradient(
    90deg,
    color-mix(in srgb, var(--brand-vivid) 50%, #000000),
    color-mix(in oklab, var(--brand-primary) 35%, var(--brand-vivid)) 55%,
    var(--primary-600)
  );
  --grad-soft: linear-gradient(
    115deg,
    color-mix(in srgb, color-mix(in srgb, var(--brand-vivid) 29%, #111111) 72%, transparent),
    color-mix(in srgb, var(--tint-glass) 62%, transparent) 65%
  );
  --grad-avatar: linear-gradient(145deg, var(--green-2), var(--green-1));
  --track: color-mix(in srgb, var(--brand-deep) 23%, #222222);
  --ring-from: color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 10%, var(--brand-vivid)) 56%, #121212);
  --ring-mid: var(--green-4);
  --ring-to: var(--brand-ink);
  --ring-dots: color-mix(in srgb, var(--brand-vivid) 21%, #252525);
  --ok: #6cb8ec;
  --ok-soft: #0f2a3b;
  --warn: #f2b45c;
  --warn-soft: #33250f;
  --bad: #f28ba0;
  --bad-soft: #3a1823;
  --info: #b8a1f7;
  --info-soft: #261d42;
  --off: var(--muted);
  --off-soft: var(--surface-3);
  --notify: #f27a8e;
  --on-notify: #2a0a12;
  --c-TSCD: #3987e5;
  --c-CCDC_LON: #d95926;
  --c-CCDC_TB: #199e70;
  --c-CCDC_TH: #c98500;
  --c-NGOAI: #d55181;
  --chart-1: #4f8de6;
  --chart-bad: #e5524f;
  --sidebar: var(--glass);
  --sidebar-2: color-mix(in srgb, var(--green-2) 45%, transparent);
  --sidebar-ink: var(--text-2);
  --sidebar-muted: var(--muted);
  --sidebar-active: color-mix(in srgb, var(--haze) 10%, transparent);
  --sidebar-accent: var(--green-7);
  --backdrop: color-mix(in srgb, color-mix(in srgb, var(--brand-deep) 8%, #010101) 60%, transparent);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:
    0 0 0 1px color-mix(in srgb, var(--haze) 5%, transparent), 0 12px 30px -16px rgba(0, 0, 0, 0.6),
    0 30px 60px -36px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 40px 70px -30px rgba(0, 0, 0, 0.8), 0 16px 30px -18px rgba(0, 0, 0, 0.6);
  --shadow-btn:
    0 10px 22px -12px color-mix(in srgb, color-mix(in oklab, var(--brand-primary) 15%, var(--brand-vivid)) 55%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  --shadow-active: 0 6px 16px -10px rgba(0, 0, 0, 0.6), inset 0 0 0 1px color-mix(in srgb, var(--haze) 8%, transparent);
  --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);
  --focus-ring: color-mix(in srgb, var(--primary) 60%, transparent);
  --net-link: color-mix(in srgb, var(--brand-vivid) 60%, #ffffff);
  --net-node: color-mix(in srgb, var(--brand-vivid) 53%, #ffffff);
  --net-glow: var(--primary);
  --net-packet: color-mix(in srgb, var(--brand-vivid) 65%, #ffffff);
  --net-wash: color-mix(in oklab, var(--brand-vivid) 77%, #000000);
  --net-strength: 0.55;
  color-scheme: dark;
}
/* Blue brands (js/brand.js okToneFor): "ok" turns teal so it never reads as the brand tint. After the theme blocks;
   the dark rules carry one more attribute, so they win over the light one in dark mode. */
:root[data-ok-tone='teal'] {
  --ok: #0b7568;
  --ok-soft: #e0f4f0;
}
@media (prefers-color-scheme: dark) {
  :root[data-ok-tone='teal']:not([data-theme='light']) {
    --ok: #5fd3c2;
    --ok-soft: #0d2e2a;
  }
}
:root[data-ok-tone='teal'][data-theme='dark'] {
  --ok: #5fd3c2;
  --ok-soft: #0d2e2a;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--primary);
  text-decoration: none;
}
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
/* Living network behind the whole app (js/gn-network-bg.js). z-index -1 keeps it under every element without
   making #app a stacking context, so dialogs teleported to <body> and the toasts keep their order. */
.net-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: var(--bg-image);
}
@media print {
  .net-bg {
    display: none;
  }
}
/* Big figures: progress, counts, KPI values */
.fig {
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}
p {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
.boot {
  display: grid;
  place-items: center;
  height: 100vh;
  height: 100dvh;
}
.boot-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--grad-mark);
  box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--shade-primary) 70%, transparent);
  animation: pulse 1s infinite alternate;
}
@keyframes pulse {
  to {
    opacity: 0.4;
    transform: scale(0.92);
  }
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.xs {
  font-size: 12px;
}
.mono {
  font-family: var(--f-mono);
  font-size: 0.9em;
  letter-spacing: -0.01em;
}
.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.right {
  text-align: right;
}
.center {
  text-align: center;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Multi-line truncation: unlike .ellipsis the text can wrap, so table columns can still shrink */
.clamp-1,
.clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: break-word;
}
.clamp-1 {
  -webkit-line-clamp: 1;
  line-clamp: 1;
}
.nowrap {
  white-space: nowrap;
}
.eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hidden {
  display: none !important;
}
@media (max-width: 1023px) {
  .only-desktop {
    display: none !important;
  }
}
@media (min-width: 1024px) {
  .only-mobile {
    display: none !important;
  }
}

/* ========== App shell ========== */
.app {
  min-height: 100vh;
  min-height: 100dvh;
}
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--bar-pad-b) + var(--vv-bottom));
}
body.with-actionbar .app-main {
  padding-bottom: calc(var(--tabbar-h) + var(--actionbar-h) + var(--bar-pad-b) + var(--vv-bottom));
}
body.no-tabbar .app-main {
  padding-bottom: calc(var(--bar-pad-b) + var(--vv-bottom));
}
body.no-tabbar.with-actionbar .app-main {
  padding-bottom: calc(var(--actionbar-h) + var(--bar-pad-b) + var(--vv-bottom));
}
/* Virtual keyboard open (js/viewport.js): bottom bars would ride above the keyboard and cover the field */
html.kb-open .tabbar,
html.kb-open .actionbar {
  display: none !important;
}
html.kb-open .app-main,
html.kb-open body.with-actionbar .app-main,
html.kb-open body.no-tabbar .app-main {
  padding-bottom: 0;
}

/* Sidebar (desktop: floating frosted column; mobile: drawer) */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(var(--sidebar-w), 86vw);
  z-index: 70;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  border-radius: 0 var(--r-xl) var(--r-xl) 0;
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  padding-top: var(--safe-t);
}
.sidebar.open {
  transform: none;
  box-shadow: var(--shadow-lg);
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: fade 0.15s;
}
.sb-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 20px 20px 14px;
  text-decoration: none;
}
.sb-logo {
  display: block;
  height: 58px;
  width: auto;
  max-width: 100%;
}
.sb-app {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding-left: 2px;
}
/* Logo variants: original on light surfaces, light lettering on dark ones */
.brand-img {
  display: block;
  height: auto;
  max-width: 100%;
}
.brand-img.on-light {
  display: var(--logo-on-light);
}
.brand-img.on-dark {
  display: var(--logo-on-dark);
}
.sb-site {
  margin: 0 14px 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: var(--sidebar-2);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.sb-site .icon {
  width: 34px;
  height: 34px;
  padding: 8px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--surface);
  color: var(--green-5);
  box-shadow: var(--shadow-sm);
}
.sb-site b {
  color: var(--ink);
  font-weight: 600;
  display: block;
}
.sb-site small {
  color: var(--sidebar-muted);
  font-size: 12px;
}
.sb-nav {
  padding: 6px 14px 16px;
  flex: 1;
}
.sb-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--r);
  color: var(--sidebar-ink);
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  transition:
    background 0.2s,
    color 0.2s;
}
.sb-nav a .icon {
  width: 19px;
  height: 19px;
  color: var(--sidebar-muted);
}
.sb-nav a:hover {
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  color: var(--ink);
}
.sb-nav a.active {
  background: var(--sidebar-active);
  color: var(--brand-ink);
  font-weight: 600;
  box-shadow: var(--shadow-active);
}
.sb-nav a.active .icon {
  color: var(--green-5);
}
.sb-nav a.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 11px;
  bottom: 11px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(var(--green-4), var(--green-6));
}
.sb-nav .badge-n {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--notify);
  color: var(--on-notify);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
/* Collapsible menu groups (menu → submenu) */
.sb-group {
  margin-bottom: 2px;
}
.sb-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r);
  background: none;
  color: var(--sidebar-ink);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}
.sb-group-head .icon {
  width: 19px;
  height: 19px;
  color: var(--sidebar-muted);
}
.sb-group-head:hover {
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  color: var(--ink);
}
.sb-group.current > .sb-group-head {
  color: var(--ink);
  font-weight: 600;
}
.sb-group.current > .sb-group-head .icon {
  color: var(--green-5);
}
.sb-group-head .sb-caret {
  margin-left: auto;
  width: 15px;
  height: 15px;
  transition: transform 0.18s ease;
}
.sb-group.open > .sb-group-head .sb-caret {
  transform: rotate(90deg);
}
.sb-sub {
  margin: 2px 0 6px 21px;
  padding-left: 10px;
  border-left: 1px solid var(--line-soft);
}
.sb-nav .sb-sub a {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13.5px;
  font-weight: 450;
  color: var(--sidebar-muted);
}
.sb-nav .sb-sub a:hover {
  color: var(--ink);
}
.sb-nav .sb-sub a.active {
  color: var(--brand-ink);
  font-weight: 600;
}
.sb-nav .sb-sub a.active::before {
  left: -11px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
}
/* Sidebar: find a screen by name */
.sb-find {
  position: relative;
  margin: 2px 14px 8px;
  display: flex;
  align-items: center;
}
.sb-find > .icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--sidebar-muted);
  pointer-events: none;
}
.sb-find input {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 36px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.sb-find input::placeholder {
  color: var(--sidebar-muted);
}
.sb-find input:focus {
  border-color: var(--green-5);
  box-shadow: var(--focus);
}
.sb-find-x {
  position: absolute;
  right: 4px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--sidebar-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.sb-find-x:hover {
  color: var(--ink);
  background: var(--sidebar-2);
}
.sb-find-x .icon {
  width: 14px;
  height: 14px;
}
.sb-hit {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.sb-hit small {
  color: var(--sidebar-muted);
  font-size: var(--fs-xs);
  font-weight: 400;
}
.sb-empty {
  padding: 10px;
  color: var(--sidebar-muted);
  font-size: 13px;
}
/* Area sub-heading inside a menu group (e.g. Tổ chức / Tài sản / Kế toán) */
.sb-subsec {
  margin: 10px 0 3px;
  padding-left: 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  opacity: 0.85;
}
.sb-foot {
  padding: 10px 14px calc(14px + var(--safe-b));
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: var(--sidebar-2);
  color: var(--sidebar-ink);
  transition: box-shadow 0.2s;
}
.sb-user:hover {
  box-shadow: var(--shadow-active);
}
.sb-user b {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}
.sb-user small {
  color: var(--sidebar-muted);
  font-size: 12px;
}

/* Topbar: frosted strip over the network */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 10px 0;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tb-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition:
    background 0.2s,
    box-shadow 0.2s,
    color 0.2s;
}
.tb-btn:hover {
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.tb-btn .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--notify);
  color: var(--on-notify);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}
.tb-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* Long screen names wrap to a second line instead of being cut */
.tb-title b {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: break-word;
}
.tb-title small {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-crumbs {
  display: none;
}
.tb-search {
  display: none;
}
.tb-user {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-pill);
  position: relative;
}
.tb-user .who {
  display: none;
  text-align: left;
}
.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 248px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 80;
  animation: fade 0.12s;
}
.dropdown .dd-head {
  padding: 10px 10px 10px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}
.dropdown .dd-head b {
  display: block;
}
.dropdown .dd-head small {
  color: var(--muted);
}
.dropdown a,
.dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  color: var(--ink);
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}
.dropdown a:hover,
.dropdown button:hover {
  background: var(--primary-soft);
}
.dropdown .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

/* Page header */
.page-header {
  padding: 16px 16px 4px;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
}
.ph-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.ph-title {
  flex: 1;
  min-width: 0;
  display: none;
}
.ph-title h1 {
  font-size: var(--fs-h1);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.ph-title p {
  color: var(--text-2);
  margin-top: 6px;
}
.ph-sub-m {
  color: var(--muted);
  font-size: 13px;
}
.ph-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.ph-actions:empty {
  display: none;
}
.ph-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ab-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.ab-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.ab-btn .icon {
  width: 18px;
  height: 18px;
}
.ab-btn .dot {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.toolbar {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.body {
  flex: 1;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
}
.body.narrow {
  max-width: 760px;
}

/* Bottom tab bar (mobile): frosted, rounded top, the active item sits on a brand-tinted pill */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--vv-bottom);
  z-index: 45;
  height: calc(var(--tabbar-h) + var(--bar-pad-b));
  padding-bottom: var(--bar-pad-b);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 30px -20px color-mix(in srgb, var(--shade) 35%, transparent);
  display: flex;
}
.tabbar a,
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  position: relative;
  border: 0;
  background: none;
  cursor: pointer;
  min-width: 0;
}
.tabbar .icon {
  width: 22px;
  height: 22px;
}
.tabbar .active {
  color: var(--brand-ink);
  font-weight: 600;
}
.tabbar .active .ic {
  background: var(--primary-soft);
  color: var(--green-6);
}
.tabbar .ic {
  padding: 4px 16px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  transition:
    background 0.2s,
    color 0.2s;
}
.tabbar .badge-n {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--notify);
  color: var(--on-notify);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--surface);
}

/* Sticky action bar (mobile) / page-header actions (desktop) */
.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--bar-pad-b) + var(--vv-bottom));
  z-index: 44;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--line-soft);
  min-height: var(--actionbar-h);
}
body.no-tabbar .actionbar {
  bottom: var(--vv-bottom);
  padding-bottom: max(var(--safe-b), 10px);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 30px -20px color-mix(in srgb, var(--shade) 35%, transparent);
}
.actionbar .btn {
  flex: 1;
  height: 46px;
}
.page-actions-inner {
  display: flex;
  gap: 8px;
}

/* ========== Cards ==========
   White frosted cards with large radii and soft layered brand-tinted shadows. The blur is only applied where the
   network shows through (desktop); on phones the card is near-opaque so long lists stay cheap to scroll. */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.card-h h3 {
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
}
.card-h .sub {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 400;
  display: block;
  margin-top: 1px;
}
.card-b {
  padding: 18px;
}
.card-b.flush {
  padding: 0;
}
.card-f {
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  gap: 8px;
  align-items: center;
}
/* Highlighted card (smart suggestion, next step): brand wash */
.card.soft {
  background: var(--grad-soft);
}
.sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px 0;
}
.sec-title h2 {
  font-size: var(--fs-h2);
  flex: 1;
}
/* Eyebrow pill with a live dot ("Đang kiểm kê"): <span class="live-pill"><i class="live"></i>…</span> */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--green-6);
  background: var(--glass);
  box-shadow: 0 0 0 1px var(--line-soft);
}
.live {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-5);
  flex-shrink: 0;
}
.live::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green-5);
  animation: live-pulse 2.4s ease-out infinite;
}
@keyframes live-pulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* KPI */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.tile,
.kpi {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: inherit;
  position: relative;
  transition:
    transform 0.15s,
    box-shadow 0.2s;
}
a.tile:hover,
a.kpi:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.tile .lbl,
.kpi .lbl {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}
.tile .val,
.kpi .val {
  font-family: var(--f-num);
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.tile .val.sm {
  font-size: 20px;
}
/* Money values never wrap the currency sign (non-breaking space), so their size follows the tile width */
.tile:has(> .val.money),
.kpi:has(> .val.money) {
  container-type: inline-size;
}
.tile .val.money,
.kpi .val.money {
  font-size: min(26px, 13cqi);
  white-space: nowrap;
}
.tile .val.sm.money {
  font-size: min(20px, 12cqi);
}
.tile .sub,
.kpi .sub {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.kpi .kpi-ic {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.kpi .kpi-ic .icon {
  width: 20px;
  height: 20px;
}
.ic-primary {
  background: var(--primary-soft);
  color: var(--green-6);
}
.ic-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.ic-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.ic-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.ic-info {
  background: var(--info-soft);
  color: var(--info);
}
/* Solid brand mark tile (suggestion icon, logo square) */
.ic-mark {
  background: var(--grad-mark);
  color: #fff;
  box-shadow: 0 10px 20px -10px color-mix(in srgb, var(--shade-primary) 70%, transparent);
}
.kpi .trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.tile.t-ok,
.tile.t-warn,
.tile.t-bad {
  border-left-width: 1px;
}

/* Progress ring (components.js <ProgressRing>): track, dotted inner guide, gradient arc, figure in the middle */
.ring {
  position: relative;
  flex: none;
  width: var(--ring-size, 150px);
  height: var(--ring-size, 150px);
}
.ring svg {
  display: block;
  width: 100%;
  height: 100%;
}
.ring-track {
  stroke: var(--track);
}
.ring-stop-a {
  stop-color: var(--ring-from);
}
.ring-stop-b {
  stop-color: var(--ring-mid);
}
.ring-stop-c {
  stop-color: var(--ring-to);
}
.ring-dots {
  stroke: var(--ring-dots);
}
.ring-arc {
  transition: stroke-dashoffset 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ring-txt {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.ring-txt b {
  font: 700 calc(var(--ring-size, 150px) * 0.25) / 1 var(--f-num);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.ring-txt span {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.ring.sm .ring-txt b {
  font-size: calc(var(--ring-size, 150px) * 0.28);
}
.ring.sm .ring-txt span {
  display: none;
}

/* Status count chips (Khớp / Lệch / Chưa thấy / Ngoài sổ): icon + label + figure on the status tint */
.stat-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  min-width: 0;
  padding: 0 12px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--off-soft);
  color: var(--off);
}
.stat-chip .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}
.stat-chip b {
  margin-left: auto;
  font: 700 15px/1 var(--f-num);
  font-variant-numeric: tabular-nums;
}
.stat-chip.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.stat-chip.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.stat-chip.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.stat-chip.info {
  background: var(--info-soft);
  color: var(--info);
}
/* Neutral figure in the brand tint (a total, not a status) */
.stat-chip.primary {
  background: var(--green-1);
  color: var(--green-7);
}
a.stat-chip {
  transition:
    transform 0.15s,
    box-shadow 0.2s;
}
a.stat-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Dashboard grid */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.chart-box {
  position: relative;
  height: 240px;
}
.chart-box.sm {
  height: 200px;
}
.donut-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: center;
}
.donut-box {
  position: relative;
  height: 190px;
  min-width: 0;
}
/* Donut above its legend in a narrow card: minmax(0, …) so the chart canvas cannot widen the column */
.donut-wrap.stacked,
.legend.one-col {
  grid-template-columns: minmax(0, 1fr);
}
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  text-align: center;
}
.donut-center b {
  font-size: 24px;
  display: block;
  line-height: 1.1;
}
.donut-center small {
  color: var(--muted);
  font-size: 12px;
}

/* ========== Lists (mobile) ========== */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  align-items: stretch;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  color: inherit;
  text-align: left;
  width: 100%;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  box-shadow: var(--shadow-sm);
}
.item {
  transition:
    box-shadow 0.2s,
    transform 0.15s;
}
.item:hover {
  box-shadow: var(--shadow);
}
.item:active {
  background: var(--surface-2);
}
.item .band {
  background: var(--line);
}
.item > .main {
  padding: 12px 14px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.item .trail {
  padding: 12px 14px 12px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  text-align: right;
}
.item .code {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.item .name {
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.item .sub {
  font-size: 13px;
  color: var(--muted);
}
.item .meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
  align-items: center;
}
.item.plain {
  grid-template-columns: 1fr auto;
}
.item.plain .band {
  display: none;
}
.chev {
  color: var(--muted);
  width: 18px;
  height: 18px;
}
.band-TSCD {
  background: var(--c-TSCD) !important;
}
.band-CCDC_LON {
  background: var(--c-CCDC_LON) !important;
}
.band-CCDC_TB {
  background: var(--c-CCDC_TB) !important;
}
.band-CCDC_TH {
  background: var(--c-CCDC_TH) !important;
}
.band-NGOAI {
  background: var(--c-NGOAI) !important;
}

/* Data tables (desktop) */
.tbl {
  overflow-x: auto;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
table.t {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 14px;
}
.t th {
  position: sticky;
  top: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.t td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.t tbody tr:last-child td {
  border-bottom: 0;
}
.t tbody tr {
  transition: background 0.1s;
}
.t tbody tr.clickable {
  cursor: pointer;
}
.t tbody tr:hover td {
  background: color-mix(in srgb, var(--primary-soft) 55%, transparent);
}
.t td.num,
.t th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.t .cell-main {
  font-weight: 600;
  color: var(--ink);
}
.t .cell-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.t .neg {
  color: var(--bad);
  font-weight: 600;
}
.t .pos {
  color: var(--warn);
  font-weight: 600;
}
.t tr.grp td {
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-block: 7px;
}
.tbl-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}

/* Tags */
.st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  border-radius: var(--r-pill);
  padding: 3px 10px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
  background: var(--off-soft);
  color: var(--off);
}
.st > .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.4;
}
.st:has(> .icon)::before {
  display: none;
}
.st::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.st.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.st.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.st.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.st.off {
  background: var(--off-soft);
  color: var(--off);
}
.st.info {
  background: var(--info-soft);
  color: var(--info);
}
.cls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.cls::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--line-2);
}
.cls.c-TSCD::before {
  background: var(--c-TSCD);
}
.cls.c-CCDC_LON::before {
  background: var(--c-CCDC_LON);
}
.cls.c-CCDC_TB::before {
  background: var(--c-CCDC_TB);
}
.cls.c-CCDC_TH::before {
  background: var(--c-CCDC_TH);
}
.cls.c-NGOAI::before {
  background: var(--c-NGOAI);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  padding: 1px 9px;
  color: var(--text-2);
  white-space: nowrap;
  line-height: 1.6;
}
/* Long labels (permission names) wrap inside their card instead of overflowing it */
.pill.wrap {
  white-space: normal;
  max-width: 100%;
  overflow-wrap: break-word;
}
.code-tag {
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

/* Filter chips */
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  padding: 6px 13px;
  background: var(--glass-strong);
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-2);
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.chip:hover {
  border-color: var(--line-2);
  color: var(--ink);
}
.chip.on {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--green-5) 45%, transparent);
  color: var(--brand-ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green-5) 30%, transparent);
}
.chip .n {
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
  font-weight: 600;
}

/* Unit of measure picker (UnitSelect): combobox with a list under the input */
.unit-select {
  position: relative;
  min-width: 0;
}
.unit-select .input {
  padding-right: 30px;
  text-overflow: ellipsis;
}
.unit-select .input[aria-invalid='true'] {
  border-color: var(--warn);
}
.unit-caret {
  position: absolute;
  right: 9px;
  top: calc(var(--field-h) / 2 - 8px);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.unit-pop {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-width: min(320px, calc(100vw - 32px));
  max-height: 248px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.unit-select.inline .unit-pop {
  position: static;
  margin-top: 6px;
  max-width: none;
  max-height: 208px;
  box-shadow: none;
}
.unit-opt {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.unit-opt small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unit-opt:hover,
.unit-opt.hi {
  background: var(--surface-2);
}
.unit-opt.on {
  font-weight: 600;
}
.unit-opt.on::after {
  content: '✓';
  margin-left: auto;
  color: var(--ink);
}
@media (pointer: coarse) {
  .unit-opt {
    min-height: 44px;
    font-size: 15px;
  }
}
.unit-none {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  color: var(--warn);
  font-size: 12.5px;
}
.unit-none .btn {
  max-width: 100%;
  height: auto;
  min-height: 32px;
  white-space: normal;
  text-align: left;
}
.unit-opt + .unit-none {
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

/* Search box */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  border-radius: 16px;
  padding: 0 14px;
  height: 44px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.search:focus-within {
  border-color: color-mix(in srgb, var(--green-5) 50%, transparent);
  box-shadow: var(--focus), var(--shadow-sm);
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  min-width: 0;
  height: 100%;
  font-size: 15px;
}
.search .icon {
  color: var(--muted);
  width: 18px;
  height: 18px;
}
.search button {
  border: 0;
  background: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  display: grid;
}
/* Search inside a dialog matches the form field height */
.sheet-b .search {
  height: var(--field-h);
  border-color: var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: none;
}
.search kbd {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
}

/* Progress bar */
.bar {
  height: 10px;
  background: var(--track);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.bar.thin {
  height: 6px;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--grad-bar);
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bar.ok i {
  background: var(--ok);
}
.bar.warn i {
  background: var(--warn);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: var(--glass-strong);
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition:
    background 0.15s,
    box-shadow 0.2s,
    color 0.15s,
    transform 0.15s ease-out;
}
.btn:hover {
  background: var(--surface);
  color: var(--ink);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn .icon {
  width: 18px;
  height: 18px;
}
.btn.main {
  background: var(--grad-primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-btn);
}
.btn.main:hover {
  background: var(--grad-primary-hover);
  color: var(--on-primary);
}
.btn.main:not(:disabled):hover {
  transform: translateY(-1px);
}
.btn.danger {
  color: var(--bad);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 35%, transparent);
}
.btn.danger:hover {
  background: var(--bad-soft);
  color: var(--bad);
}
.btn.danger.main {
  background: var(--bad);
  color: var(--surface);
  box-shadow: 0 10px 20px -12px color-mix(in srgb, var(--bad) 80%, transparent);
}
.btn.ok.main {
  background: var(--ok);
  color: var(--surface);
  box-shadow: 0 10px 20px -12px color-mix(in srgb, var(--ok) 80%, transparent);
}
.btn.ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
}
.btn.ghost:hover {
  background: var(--primary-soft);
  color: var(--brand-ink);
}
/* Text action in the brand colour ("Xem tất cả") */
.btn.link {
  height: auto;
  padding: 2px 4px;
  background: none;
  box-shadow: none;
  color: var(--green-6);
  font-size: 13px;
  border-radius: 8px;
}
.btn.quiet {
  background: var(--glass-strong);
}
.btn.sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--r-sm);
}
.btn.lg {
  height: 48px;
  padding: 0 22px;
  font-size: 15px;
  border-radius: 16px;
}
.btn.block {
  width: 100%;
}
.btn.icon-only {
  width: 40px;
  padding: 0;
}
.btn.sm.icon-only {
  width: 32px;
}
.seg {
  display: flex;
  background: var(--surface-3);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  min-height: calc(var(--field-h) - 6px);
  padding: 4px 8px;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
  border-radius: 9px;
  color: var(--muted);
}
.seg button.on {
  background: var(--surface);
  color: var(--brand-ink);
  font-weight: 600;
  box-shadow: var(--shadow-active);
}
.seg button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* ========== Forms ==========
   Compact density: 40 px fields on phones (16 px text so iOS does not zoom on focus),
   38 px from 640 px. Touch screens keep 16 px text at every width. */
:root {
  --field-h: 40px;
  --field-fs: 16px;
  --field-px: 11px;
  --btn-h: 40px;
}
@media (min-width: 640px) {
  :root {
    --field-h: 38px;
    --field-fs: 14px;
  }
}
@media (min-width: 640px) and (pointer: coarse) {
  :root {
    --field-fs: 16px;
  }
}
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Field grid: 2 columns (1 below 380 px). Inside dialogs and `.cq` containers the column count follows
   the container width: `.c3` → 3 columns from 720 px, `.c4` → 3 / 4 columns from 720 / 920 px.
   Spans: `.span-2` (2 columns, full row in a 2-column grid), `.full` / `.span-all` (whole row),
   `.full-m` (whole row only in narrow containers, e.g. long selects on phones). */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid > .full,
.form-grid > .span-all,
.form-grid > .span-2 {
  grid-column: 1 / -1;
}
.cq {
  container-type: inline-size;
}
@container (max-width: 519px) {
  .form-grid > .full-m {
    grid-column: 1 / -1;
  }
  .form-grid.stack-m {
    grid-template-columns: minmax(0, 1fr);
  }
}
@container (min-width: 720px) {
  .form-grid.c3,
  .form-grid.c4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .form-grid.c3 > .span-2,
  .form-grid.c4 > .span-2 {
    grid-column: span 2;
  }
}
@container (min-width: 920px) {
  .form-grid.c4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* Notes and checkboxes placed in a grid line up with the inputs, not the labels */
.form-grid > .alert,
.form-grid > .check {
  align-self: end;
}
.form-grid > .alert {
  min-height: var(--field-h);
  padding-block: 8px;
  align-items: center;
}
/* Two controls for one field (e.g. filter box + select): side by side when there is room */
.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}
@container (min-width: 520px) {
  .field-pair {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.field > label {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-2);
}
.field .req {
  color: var(--bad);
}
.field .hint,
.form > .hint,
.form-grid > .hint,
fieldset > .hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.input,
select.input,
textarea.input {
  width: 100%;
  height: var(--field-h);
  padding: 0 var(--field-px);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  font-size: var(--field-fs);
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}
textarea.input {
  height: auto !important;
  min-height: 62px;
  padding: 8px var(--field-px);
  resize: vertical;
  line-height: 1.45;
}
.input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.input:focus {
  border-color: var(--green-5);
  box-shadow: var(--focus);
}
.input:disabled {
  background: var(--surface-3);
  color: var(--muted);
}
.input.mono {
  font-family: var(--f-mono);
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-height: 28px;
  line-height: 1.4;
}
.check input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--green-6);
  flex-shrink: 0;
}
@media (pointer: coarse) {
  .check {
    min-height: 36px;
  }
  .chip {
    min-height: 32px;
  }
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
fieldset legend {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  width: 100%;
  border-bottom: 1px solid var(--line);
  padding: 0 0 6px;
  margin-bottom: 2px;
}
/* Optional / rarely used fields: <details class="form-more"><summary>Thông tin thêm <small>…</small></summary>
   <div class="form-more-b">…fields…</div></details> */
.form-more {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  min-width: 0;
}
.form-more > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  border-radius: var(--r);
  user-select: none;
}
.form-more > summary::-webkit-details-marker {
  display: none;
}
.form-more > summary > .icon {
  width: 17px;
  height: 17px;
  color: var(--muted);
}
.form-more > summary small {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-more > summary::after {
  content: '';
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin: -4px 4px 0 auto;
  border-right: 1.8px solid var(--muted);
  border-bottom: 1.8px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}
.form-more[open] > summary::after {
  transform: rotate(225deg);
  margin-top: 4px;
}
.form-more > summary:hover {
  background: var(--surface-3);
}
.form-more > summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.form-more[open] > summary {
  border-bottom: 1px solid var(--line);
  border-radius: var(--r) var(--r) 0 0;
}
.form-more-b {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 0 0 var(--r) var(--r);
}
/* Two-pane dialog form (picker on the left, details on the right) from 760 px of dialog width */
.split-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.split-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.pick-list {
  max-height: 260px;
  overflow: auto;
  gap: 6px;
  padding: 2px;
}
.pick-list > * {
  flex-shrink: 0;
}
.pick-list .item > .main,
.pick-list .item .trail {
  padding-block: 8px;
}
.pick-list .item.on {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: var(--primary-soft);
}
.pick-list input[type='radio'] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
@container (min-width: 760px) {
  .split-form {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 24px;
  }
  .split-form > .split-pane + .split-pane {
    position: sticky;
    top: 0;
  }
  .pick-list {
    max-height: calc(88vh - 250px);
    max-height: calc(88dvh - 250px);
  }
}
/* Invoice lines: stacked card on phones, one table-like row per line in wide dialogs */
.inv-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inv-line {
  display: grid;
  /* Phone card: money fields get a wide row each so 9-digit amounts stay readable, every field is labelled */
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) 32px;
  grid-template-areas:
    'no type type del'
    'name name name name'
    'qty unit unit unit'
    'price price price price'
    'amount amount amount amount';
  gap: 6px 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
}
.inv-line-h {
  display: none;
}
.il-f {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.il-l {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.il-del {
  margin-bottom: 4px;
}
.il-no {
  grid-area: no;
}
.il-type {
  grid-area: type;
}
.il-name {
  grid-area: name;
}
.il-qty {
  grid-area: qty;
}
.il-unit {
  grid-area: unit;
}
.il-price {
  grid-area: price;
}
.il-amount {
  grid-area: amount;
}
.il-del {
  grid-area: del;
}
@container (min-width: 760px) {
  .inv-lines {
    gap: 4px;
  }
  .inv-line {
    grid-template-columns: 60px 150px minmax(0, 1fr) 72px 96px 130px 140px 32px;
    grid-template-areas: 'no type name qty unit price amount del';
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
  }
  /* The header row labels the columns */
  .il-l {
    display: none;
  }
  .il-del {
    margin-bottom: 0;
  }
  .inv-line-h {
    display: grid;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
  }
}
/* Permission groups in the role dialog */
.perm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.perm-card .card-h {
  padding: 8px 14px;
  min-height: 0;
}
.perm-card .card-b {
  padding: 8px 14px 10px;
}
@container (min-width: 600px) {
  .perm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container (min-width: 920px) {
  .perm-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
/* Radio / checkbox options as compact tiles: <div class="choice-grid"><label class="check choice" :class="{ on }"> */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  gap: 6px;
}
.choice-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.check.choice {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  min-height: var(--field-h);
}
.check.choice:hover {
  border-color: var(--line-2);
}
.check.choice.on {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.check.choice:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ========== Sheets / dialogs ==========
   Phone: compact bottom sheet. From 640 px: centred dialog; width by size class
   (sm 440 · default 600 · lg 860 · full 1100 px with a fixed tall height). Header and footer stay put,
   only the body scrolls. */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overscroll-behavior: contain;
  /* Phone bottom sheet sits above the browser toolbar */
  padding-bottom: var(--vv-bottom);
  animation: fade 0.18s ease-out;
}
.sheet {
  --sheet-px: 16px;
  position: relative;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  width: 100%;
  max-height: 94vh;
  max-height: calc(100dvh - var(--safe-t) - 8px - var(--vv-bottom));
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  box-shadow: var(--shadow-lg);
  outline: none;
  animation: sheet-up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.full {
  height: 94vh;
  height: calc(100dvh - var(--safe-t) - 8px - var(--vv-bottom));
}
.sheet-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 10px 10px var(--sheet-px);
  border-bottom: 1px solid var(--line-soft);
  min-height: 56px;
  position: relative;
  flex-shrink: 0;
}
.sheet-h::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 38px;
  height: 4px;
  margin-left: -19px;
  border-radius: var(--r-pill);
  background: var(--line-2);
}
.sheet-h .sh-ic {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--green-6);
}
.sheet-h .sh-ic .icon {
  width: 17px;
  height: 17px;
}
.sheet-h .sh-t {
  flex: 1;
  min-width: 0;
}
.sheet-h h3 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.sheet-h .sh-sub {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-h > .btn.icon-only {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.sheet-b {
  padding: 14px var(--sheet-px) 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
  container-type: inline-size;
  /* Fields scrolled into view keep a gap from the footer */
  scroll-padding-block: 12px 24px;
}
/* A notice at the top of a dialog (e.g. read-only role) keeps a gap before the form below it */
.sheet-b > .alert:not(:last-child) {
  margin-bottom: 12px;
}
.sheet-f {
  display: flex;
  gap: 8px;
  padding: 12px 14px max(var(--safe-b), 12px);
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  flex-shrink: 0;
}
.sheet-f .btn {
  flex: 1;
  height: var(--btn-h);
}
/* Icon-only actions (delete) keep a square size; callers may still pass an inline flex basis */
.sheet-f .btn.icon-only {
  flex: 0 0 var(--btn-h) !important;
  width: var(--btn-h);
}
@media (min-width: 640px) {
  .sheet-backdrop {
    align-items: center;
    padding: 24px 24px calc(24px + var(--vv-bottom));
  }
  .sheet {
    --sheet-px: 20px;
    width: min(600px, 100%);
    max-height: 88vh;
    max-height: min(88dvh, calc(100dvh - var(--safe-t) - 48px - var(--vv-bottom)));
    border-radius: var(--r-xl);
    border-bottom: 1px solid var(--glass-border);
    animation: sheet-pop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .sheet.sm {
    width: min(440px, 100%);
  }
  .sheet.lg {
    width: min(860px, 100%);
  }
  .sheet.full {
    width: min(1100px, 100%);
    height: min(88vh, 980px);
    height: min(88dvh, 980px, calc(100dvh - var(--safe-t) - 48px - var(--vv-bottom)));
  }
  .sheet-h {
    padding: 12px 12px 12px var(--sheet-px);
    min-height: 58px;
  }
  .sheet-h::before {
    display: none;
  }
  .sheet-h h3 {
    font-size: 16.5px;
  }
  .sheet-b {
    padding: 16px var(--sheet-px) 20px;
  }
  .sheet-f {
    justify-content: flex-end;
    padding: 12px var(--sheet-px) max(var(--safe-b), 12px);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
  }
  .sheet-f .btn {
    flex: 0 0 auto;
    min-width: 96px;
    height: 38px;
  }
  .sheet-f .btn.icon-only {
    flex: 0 0 38px !important;
    width: 38px;
    min-width: 0;
  }
  /* Destructive icon action sits apart on the left */
  .sheet-f > .btn.danger.icon-only:first-child {
    margin-right: auto;
  }
}
/* Keyboard open: the dialog fits the visible part of the screen so its footer stays above the keyboard */
html.kb-open .sheet-backdrop {
  top: var(--vv-top, 0px);
  bottom: auto;
  height: var(--vv-height, 100%);
  padding: 8px 8px 0;
}
html.kb-open .sheet {
  max-height: calc(var(--vv-height, 100dvh) - 8px);
}
html.kb-open .sheet.full {
  height: calc(var(--vv-height, 100dvh) - 8px);
}
html.kb-open .sheet-f {
  padding-bottom: 10px;
}
@media (max-width: 639px) {
  html.kb-open .sheet-backdrop {
    padding: 0;
  }
}
@media (min-width: 640px) {
  html.kb-open .sheet {
    border-radius: var(--r-lg);
  }
}
@keyframes sheet-up {
  from {
    transform: translateY(32px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes sheet-pop {
  from {
    transform: translateY(8px) scale(0.975);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes up {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.menu-list {
  display: flex;
  flex-direction: column;
  margin: -6px calc(-1 * var(--sheet-px, 18px)) -8px;
}
.menu-list button,
.menu-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border: 0;
  background: none;
  text-align: left;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  width: 100%;
}
.menu-list button:hover,
.menu-list a:hover {
  background: var(--surface-2);
}
.menu-list button:last-child,
.menu-list a:last-child {
  border-bottom: 0;
}
.menu-list .icon {
  color: var(--primary);
}
.menu-list .danger,
.menu-list .danger .icon {
  color: var(--bad);
}
.menu-list small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}

/* ========== Notifications ========== */
.toasts {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(12px + var(--safe-t));
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  align-items: center;
}
.toast {
  pointer-events: auto;
  width: 100%;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  color: var(--ink);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  animation: toast-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast .icon {
  width: 22px;
  height: 22px;
  padding: 3px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--green-6);
}
.toast.error .icon {
  background: var(--bad-soft);
  color: var(--bad);
}
.toast.info .icon {
  background: var(--info-soft);
  color: var(--info);
}
.toast.error {
  box-shadow:
    inset 3px 0 0 var(--bad),
    var(--shadow-lg);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.alert {
  padding: 12px 14px;
  border-radius: var(--r);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert .icon {
  margin-top: 1px;
  width: 18px;
  height: 18px;
}
.alert.info {
  background: var(--primary-soft);
  color: var(--brand-ink);
}
.alert.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.alert.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.alert.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty > .icon {
  width: 26px;
  height: 26px;
  padding: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--surface), var(--primary-soft) 70%);
  color: var(--green-6);
  box-shadow:
    0 0 0 8px color-mix(in srgb, var(--primary-soft) 45%, transparent),
    var(--shadow-sm);
  box-sizing: content-box;
  margin-bottom: 4px;
}

/* ========== Detail views ========== */
.dl {
  display: grid;
  /* minmax(0, …): a long code or name wraps instead of widening a narrow side card */
  grid-template-columns: minmax(110px, 36%) minmax(0, 1fr);
  margin: 0;
}
.dl dt,
.dl dd {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.dl dt {
  color: var(--muted);
  font-size: 13.5px;
  padding-right: 12px;
}
.dl dd {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.dl > :nth-last-child(-n + 2) {
  border-bottom: 0;
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  position: relative;
  padding: 0 0 16px 24px;
}
.timeline li::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--primary);
}
.timeline li::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}
.timeline li:last-child {
  padding-bottom: 0;
}
.timeline li:last-child::after {
  display: none;
}
.timeline .t-note {
  color: var(--muted);
  font-size: 13.5px;
}

/* Asset label preview */
.tem {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.tem .band {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--c-TSCD);
}
.tem .qr {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  color: var(--muted);
  flex-shrink: 0;
}
.tem .txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tem .tp {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.tem .code {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  word-break: break-all;
}
.tem .code span {
  color: var(--muted);
}
.tem .nm {
  font-size: 13.5px;
  color: var(--text-2);
}

/* Thanh ngang */
.hbars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  color: inherit;
}
.hbar .lbl {
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}
.hbar .v {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13.5px;
}
.hbar .bar {
  grid-column: 1 / -1;
}
.stackbar {
  display: flex;
  height: 10px;
  gap: 2px;
  overflow: hidden;
  border-radius: 99px;
}
.stackbar span {
  height: 100%;
  min-width: 3px;
}
.legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 16px;
}
.legend .li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-2);
}
.legend .sw {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 3px;
}
.legend .li b {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.legend .li .lbl {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend .li .pct {
  color: var(--muted);
  font-size: 12px;
  min-width: 38px;
  text-align: right;
}

/* Link groups */
.nav-group {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.nav-group a,
.nav-group button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  color: var(--ink);
  border: 0;
  background: none;
  width: 100%;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  cursor: pointer;
  font-size: 14.5px;
}
.nav-group a:hover,
.nav-group button:hover {
  background: var(--glass-strong);
}
.nav-group > :last-child {
  border-bottom: 0;
}
.nav-group .nic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
/* Leading icon on a soft brand-tinted tile, like the sidebar of the network theme */
.nav-group > a > .icon:first-child,
.nav-group > button > .icon:first-child {
  box-sizing: content-box;
  width: 18px;
  height: 18px;
  padding: 8px;
  border-radius: 12px;
  background: var(--green-1);
  color: var(--green-6);
}
.nav-group > .danger,
.nav-group > .danger > .icon:first-child {
  color: var(--bad);
}
.nav-group > .danger > .icon:first-child {
  background: var(--bad-soft);
}
.nav-group .t {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}
.nav-group .t small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
}
.nav-group .cnt {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--grad-avatar);
  color: var(--brand-ink);
  box-shadow:
    0 0 0 3px var(--glass-strong),
    0 6px 14px -8px color-mix(in srgb, var(--shade) 50%, transparent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.loadmore {
  display: flex;
  justify-content: center;
  padding: 6px 0;
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* Permission matrix */
.matrix th,
.matrix td {
  padding: 8px 12px;
}
.matrix td.c {
  text-align: center;
}
.matrix th.rc {
  text-align: center;
  min-width: 110px;
  font-size: 12px;
}
.matrix th.rc small {
  display: block;
  font-weight: 400;
  color: var(--muted);
}
.matrix .dirty {
  background: var(--warn-soft) !important;
}
.matrix input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.matrix .first {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  min-width: 200px;
}
.matrix tr.grp .first {
  background: var(--surface-3);
}
.matrix th.first {
  background: var(--surface-2);
  z-index: 2;
}

/* ========== Sign-in ========== */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b));
}
.login-hero {
  display: none;
}
.login-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 22px 24px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  gap: 22px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
}
.login-lead {
  margin-top: 4px;
}
.login-body .input {
  height: 44px;
}
.login-body .search.login-pw {
  height: 44px;
  padding-right: 4px;
  border-color: var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}
.login-body .search.login-pw:focus-within {
  border-color: var(--green-5);
  box-shadow: var(--focus);
}
.login-foot {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-brand b {
  font-size: 17px;
  display: block;
}
.login-brand span {
  font-size: 13px;
  color: var(--muted);
}
.login-body h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-body .btn.main {
  height: 48px;
  border-radius: 16px;
  font-size: 15px;
}
.demo {
  font-size: 13px;
}
.demo table {
  width: 100%;
  border-collapse: collapse;
}
.demo td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
}
.demo tr:last-child td {
  border-bottom: 0;
}
.demo button {
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: var(--f-mono);
  font-size: 13px;
}

.forbidden {
  text-align: center;
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.forbidden .big {
  font: 800 72px/1 var(--f-num);
  letter-spacing: -0.04em;
  background: var(--grad-mark);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.forbidden h2 {
  font-size: 20px;
}
.forbidden p {
  max-width: 440px;
  text-wrap: pretty;
}
/* "Tất cả chức năng": the profile card on top, section titles between the groups */
.more-me {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}
.more-me .avatar {
  width: 46px;
  height: 46px;
}
.more-me.lg .avatar {
  width: 56px;
  height: 56px;
  font-size: 18px;
}
.more-me.lg b {
  font-size: 17px;
}
/* Profile: the screens the role may open */
.my-screen {
  cursor: default;
}
.my-screen .row .icon {
  box-sizing: content-box;
  width: 16px;
  height: 16px;
  padding: 6px;
  border-radius: 10px;
  background: var(--green-1);
  color: var(--green-6);
}
.eyebrow.sec {
  padding: 4px 2px 0;
}

/* ========== Tablet ========== */
@media (min-width: 640px) {
  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .donut-wrap {
    grid-template-columns: 190px 1fr;
  }
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chips {
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
  }
}

/* ========== Desktop ========== */
@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .sidebar {
    position: sticky;
    top: 14px;
    width: auto;
    height: calc(100vh - 28px);
    height: calc(100dvh - 28px);
    margin: 14px 0 14px 14px;
    transform: none;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow);
  }
  .drawer-backdrop,
  .tabbar,
  .tb-menu {
    display: none !important;
  }
  .app-main,
  body.with-actionbar .app-main {
    padding-bottom: 0;
  }
  :root {
    --topbar-h: 72px;
  }
  /* Desktop top bar: no strip, the search and buttons float as frosted pills over the network */
  .topbar {
    padding: 0 28px;
    gap: 10px;
    height: var(--topbar-h);
    background: linear-gradient(
      to bottom,
      color-mix(in srgb, var(--bg) 82%, transparent),
      color-mix(in srgb, var(--bg) 55%, transparent)
    );
    border-bottom: 0;
  }
  .topbar .tb-btn {
    width: 44px;
    height: 44px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
  }
  .topbar .tb-btn:hover {
    background: var(--glass-strong);
    box-shadow: var(--shadow);
  }
  .tb-title {
    display: none;
  }
  /* The crumbs take the free width of the top bar; the search box narrows with the viewport so the trail fits.
     When space still runs out only the parent crumbs shrink (ellipsis); the current page name keeps its width
     (up to 65 % of the trail). */
  .tb-crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13.5px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .tb-crumbs a {
    color: var(--muted);
  }
  .tb-crumbs > a,
  .tb-crumbs > span {
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 2.5em;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tb-crumbs a:hover {
    color: var(--ink);
  }
  .tb-crumbs b {
    color: var(--ink);
    font-weight: 600;
    flex: 0 0 auto;
    max-width: 65%;
  }
  .tb-crumbs .icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
  .tb-search {
    display: flex;
    flex: 0 0 auto;
    width: clamp(200px, 100vw - 1100px, 420px);
  }
  .tb-search input {
    text-overflow: ellipsis;
  }
  .tb-search .search {
    width: 100%;
    height: 44px;
    background: var(--glass);
    box-shadow: var(--shadow-sm);
  }
  .tb-user {
    flex-shrink: 0;
    padding: 4px 14px 4px 4px;
    border-radius: var(--r-pill);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
  }
  .tb-user:hover {
    background: var(--glass-strong);
    box-shadow: var(--shadow);
  }
  .tb-user .who {
    display: block;
    line-height: 1.25;
  }
  .tb-user .who b {
    font-size: 13.5px;
    display: block;
  }
  .tb-user .who small {
    font-size: 12px;
    color: var(--muted);
  }
  .page-header {
    padding: 22px 28px 6px;
  }
  .ph-title {
    display: block;
  }
  .ph-sub-m {
    display: none;
  }
  .body {
    padding: 18px 28px 36px;
    gap: 18px;
  }
  /* The network shows through the cards on wide screens */
  .card,
  .tile,
  .kpi {
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
  .actionbar {
    display: none;
  }
  .dash {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
  }
  .col-4 {
    grid-column: span 4;
  }
  .col-5 {
    grid-column: span 5;
  }
  .col-6 {
    grid-column: span 6;
  }
  .col-7 {
    grid-column: span 7;
  }
  .col-8 {
    grid-column: span 8;
  }
  .col-12 {
    grid-column: span 12;
  }
  .chart-box {
    height: 280px;
  }
  .login {
    grid-template-columns: minmax(0, 1.1fr) minmax(380px, 460px);
    gap: clamp(48px, 6vw, 120px);
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 48px clamp(32px, 6vw, 96px);
  }
  .login-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    min-height: min(640px, calc(100dvh - 96px));
  }
  .login-hero h2 {
    font-size: 40px;
    line-height: 1.15;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.03em;
    margin: 14px 0 12px;
    max-width: 560px;
  }
  .login-hero p {
    color: var(--text-2);
    max-width: 500px;
    font-size: 15.5px;
  }
  .hero-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 560px;
  }
  .hero-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: 16px;
  }
  .hero-card .icon {
    width: 36px;
    height: 36px;
    padding: 8px;
    box-sizing: border-box;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--green-6);
  }
  .hero-card b {
    display: block;
    font-size: 15px;
    color: var(--ink);
  }
  .hero-card span {
    font-size: 12.5px;
    color: var(--muted);
  }
  .login-body {
    max-width: 460px;
    padding: 36px 34px 30px;
  }
}
/* ========== Desktop layout refinements ========== */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.detail-main,
.detail-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.hub-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.hub-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  color: inherit;
}
.hub-card:hover {
  border-color: var(--line-2);
  box-shadow:
    var(--shadow),
    0 4px 14px -6px rgba(15, 23, 42, 0.12);
}
.hub-card .nic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.hub-card .t {
  flex: 1;
  min-width: 0;
}
.hub-card .nic .icon {
  width: 18px;
  height: 18px;
}
.hub-card .t b {
  display: block;
  font-size: 14px;
}
.hub-card .t small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 1px;
  line-height: 1.35;
}
.hub-card .t small.hub-warn {
  color: var(--warn);
}
.md-area .sec-title h2 {
  white-space: nowrap;
}
@media (max-width: 639px) {
  .md-area .sec-title > span {
    display: none;
  }
}
@media (min-width: 1280px) {
  .md-area .hub-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* Proposed asset change on a request: label · before → after */
.change-list {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  max-height: 280px;
  overflow: auto;
}
.change-row {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
}
.change-row:last-child {
  border-bottom: 0;
}
.change-row .lbl {
  flex: 0 0 34%;
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.change-row .vals {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.change-row .from {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent);
}
.change-row .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
/* Asset waiting for an approved movement */
a.pending-req {
  color: inherit;
}
a.pending-req .chev {
  margin-left: auto;
  flex-shrink: 0;
}
.menu-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0 0 10px;
}
.menu-note .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}
/* Catalog hub: global search + area sections */
.md-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.search.lg {
  height: 44px;
}
.md-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.md-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
@media (min-width: 1024px) {
  .md-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}
.hub-card .cnt {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.steps-ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.steps-ol li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-2);
}
.steps-ol .n {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  transition:
    border-color 0.12s,
    background 0.12s;
}
.dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone .icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
}
.dropzone b {
  font-size: 14.5px;
}
.dropzone small {
  color: var(--muted);
}
.mini-bar {
  width: 120px;
}
@media (min-width: 640px) {
  .hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .app-main .list {
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .app-main .list > .item {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid var(--line);
  }
  .app-main .list > .item:last-child {
    border-bottom: 0;
  }
  .app-main .list > .item:hover {
    background: var(--surface-2);
  }
  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .toolbar > .search {
    flex: 0 1 400px;
  }
  .toolbar > .chips {
    flex: 1 1 auto;
  }
  .toolbar > .input,
  .toolbar > select {
    width: auto;
    min-width: 200px;
  }
  .dl {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .detail-grid {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
  }
  .detail-grid > .detail-side {
    order: 2;
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
  }
  .detail-side .dl {
    grid-template-columns: 130px minmax(0, 1fr);
  }
  .detail-grid.wide-side {
    grid-template-columns: 400px minmax(0, 1fr);
  }
  .detail-grid.wide-side > .detail-side {
    order: 0;
  }
  .hub-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}
@media (max-width: 380px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .tile .val,
  .kpi .val {
    font-size: 22px;
  }
}
@media print {
  .sidebar,
  .topbar,
  .tabbar,
  .actionbar,
  .page-header,
  .no-print,
  .toasts {
    display: none !important;
  }
  /* Landscape sheets can be laid out at desktop width: the hidden sidebar must not keep its grid column */
  .app {
    display: block !important;
  }
  .app-main {
    padding: 0 !important;
    margin: 0 !important;
  }
  body,
  .body {
    background: #fff !important;
    padding: 0 !important;
  }
  .paper {
    box-shadow: none !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    break-after: page;
  }
  /* The on-screen fit-to-width scale never applies to the printed sheet */
  .paper-fit-in {
    zoom: 1 !important;
    width: auto !important;
  }
}
@page {
  size: A4 portrait;
  margin: 10mm;
}
@page paper-landscape {
  size: A4 landscape;
  margin: 8mm;
}

/* ===== Audit log: field-level changes ===== */
.chg {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 13px;
}
.chg li {
  display: grid;
  grid-template-columns: minmax(84px, 120px) 1fr;
  gap: 10px;
  align-items: baseline;
}
.chg li:last-child:has(.link-btn) {
  grid-template-columns: 1fr;
}
.chg-f {
  color: var(--muted);
  font-size: 12.5px;
}
.chg-v {
  min-width: 0;
  overflow-wrap: anywhere;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 0;
}
.chg-from {
  color: var(--bad);
  background: var(--bad-soft);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--bad) 55%, transparent);
  padding: 0 5px;
  border-radius: 4px;
}
.chg-to {
  color: var(--ok);
  background: var(--ok-soft);
  font-weight: 600;
  padding: 0 5px;
  border-radius: 4px;
}
.chg-from.empty,
.chg-to.empty {
  color: var(--muted);
  background: var(--surface-3);
  font-style: italic;
  font-weight: 400;
  text-decoration: none;
}
.chg-create .chg-to {
  color: var(--ink);
  background: none;
  padding: 0;
  font-weight: 500;
}
.chg-delete .chg-from {
  color: var(--muted);
  background: none;
  padding: 0;
}
.chg-arrow {
  color: var(--muted);
  margin: 0 6px;
}
.chg-tag {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}
.chg-tag.add {
  color: var(--ok);
  background: var(--ok-soft);
}
.chg-tag.del {
  color: var(--bad);
  background: var(--bad-soft);
}
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.audit-t td {
  vertical-align: top;
}
.audit-card > .main {
  gap: 6px;
}
.audit-card .chg {
  margin: 4px 0 2px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.audit-card .chg li {
  grid-template-columns: 1fr;
  gap: 1px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-row > select {
  flex: 1 1 180px;
  max-width: 240px;
}
.date-range {
  flex: 1 1 320px;
  max-width: 420px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}
.date-range .input {
  min-width: 0;
}
@media (max-width: 719px) {
  .filter-row > select,
  .date-range {
    max-width: none;
  }
}

/* ===== Inventory evidence ===== */
.ev-card {
  display: grid;
  gap: 12px;
}
.h-card {
  margin: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.h-card .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.ev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.ev-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-3);
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-2);
  font: inherit;
}
.ev-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ev-tile:hover {
  border-color: var(--line-2);
}
.ev-tile:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.ev-add {
  border: 1.5px dashed var(--line-2);
  background: var(--surface-2);
  align-content: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
}
.ev-add .icon {
  width: 22px;
  height: 22px;
}
.ev-add.busy {
  opacity: 0.6;
  cursor: progress;
}
.ev-doc {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px;
  max-width: 100%;
  font-size: 12px;
}
.ev-doc .icon {
  width: 24px;
  height: 24px;
  color: var(--bad);
}
.ev-doc small {
  max-width: 76px;
  color: var(--muted);
}
.ev-doc.big {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
}
.ev-full {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  max-height: 62dvh;
  margin: 0 auto;
  border-radius: var(--r);
  background: var(--surface-3);
}
.inv-item {
  align-items: flex-start;
  padding-right: 12px;
}
.ev-btn {
  align-self: center;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.ev-btn .icon {
  width: 19px;
  height: 19px;
}
.ev-btn.has {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
  background: var(--ok-soft);
}
.ev-btn.need {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
  background: var(--warn-soft);
}
.proof-tag {
  margin-top: 6px;
  align-self: flex-start;
}
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.checklist li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-weight: 500;
}
.checklist li .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.checklist li.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.checklist li.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

/* ===== Excel import dialog ===== */
.dropzone.over {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.imp-rows {
  display: grid;
  gap: 8px;
  max-height: 46vh;
  max-height: 46dvh;
  overflow: auto;
  padding-right: 2px;
}
.imp-row {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  background: var(--surface);
  display: grid;
  gap: 6px;
}
.imp-row.imp-error {
  border-color: color-mix(in srgb, var(--bad) 35%, var(--line));
  background: color-mix(in srgb, var(--bad-soft) 45%, var(--surface));
}
.imp-h {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.imp-h b {
  min-width: 0;
}
.imp-err {
  color: var(--bad);
}
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.spec-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  display: grid;
  gap: 8px;
  align-content: start;
  background: var(--surface-2);
}
.spec-card p {
  margin: 0;
}
.spec-card .pill {
  margin: 0 4px 4px 0;
}
.spec-card .pill.req {
  font-weight: 600;
  color: var(--ink);
}
.spec-card .btn {
  justify-self: start;
}
.spec-ic {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
}
.spec-ic .icon {
  width: 18px;
  height: 18px;
}
/* QR on the tag: always black on white so it scans in dark mode too */
.tem .qr svg {
  width: 100%;
  height: 100%;
  display: block;
}
.tem .qr:has(svg) {
  background: #fff;
  padding: 4px;
}
/* Tag scanner */
.scan-view {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: linear-gradient(165deg, var(--vf-from), var(--vf-to));
  aspect-ratio: 4 / 3;
}
.scan-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Viewfinder of the network theme: rounded corner brackets (a border masked to its four corners) and a soft scan
   line sweeping inside them. Used by the camera sheet (TagScanner) and the Quét tem screen. */
.vf-frame {
  position: absolute;
  inset: 0;
  border: 3.5px solid var(--vf-corner);
  border-radius: 18px;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--vf-glow) 55%, transparent));
  -webkit-mask:
    linear-gradient(#000 0 0) 0 0 / 32px 32px no-repeat,
    linear-gradient(#000 0 0) 100% 0 / 32px 32px no-repeat,
    linear-gradient(#000 0 0) 0 100% / 32px 32px no-repeat,
    linear-gradient(#000 0 0) 100% 100% / 32px 32px no-repeat;
  mask:
    linear-gradient(#000 0 0) 0 0 / 32px 32px no-repeat,
    linear-gradient(#000 0 0) 100% 0 / 32px 32px no-repeat,
    linear-gradient(#000 0 0) 0 100% / 32px 32px no-repeat,
    linear-gradient(#000 0 0) 100% 100% / 32px 32px no-repeat;
}
.vf-line {
  position: absolute;
  inset: 8px;
  overflow: hidden;
  border-radius: 12px;
  pointer-events: none;
}
.vf-line::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 36%,
    color-mix(in srgb, var(--vf-glow) 28%, transparent) 48%,
    color-mix(in srgb, var(--vf-glow) 95%, transparent) 50%,
    transparent 51%
  );
  animation: vf-sweep 2.6s ease-in-out infinite alternate;
}
.scan-view .vf-frame {
  inset: 18% 22%;
}
.scan-view .vf-line {
  inset: calc(18% + 8px) calc(22% + 8px);
}
@keyframes vf-sweep {
  from {
    transform: translateY(-50%);
  }
  to {
    transform: translateY(49%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .vf-line::before {
    animation: none;
  }
}
/* Asset photos in lists and the form */
.thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--line);
}
.thumb.lg {
  width: 52px;
  height: 52px;
  border-radius: 10px;
}
.thumb.ph {
  display: grid;
  place-items: center;
  color: var(--muted);
}
.thumb.ph .icon {
  width: 16px;
  height: 16px;
}
.input-row {
  display: flex;
  gap: 8px;
}
.input-row .input {
  flex: 1;
  min-width: 0;
}
.input-row > .btn {
  height: var(--field-h);
  flex-shrink: 0;
}
.sm-gap {
  margin-bottom: 6px;
}
/* ===== Paper forms (offline): always black on white, also in dark mode ===== */
.paper {
  background: #fff;
  color: #111;
  border-radius: var(--r);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 22px 24px;
  margin-top: 12px;
  overflow-x: auto;
  font-size: 12px;
  color-scheme: light;
}
.paper.landscape {
  page: paper-landscape;
}
.paper-fit {
  min-width: 0;
}
.paper-fit-in {
  margin-inline: auto;
}
.paper-fit-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.paper-fit-hint .icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.paper-h {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 2px solid #111;
  padding-bottom: 10px;
  margin-bottom: 8px;
}
.paper-h > div span {
  display: block;
  color: #555;
  font-size: 11px;
  margin-top: 2px;
}
.paper-title {
  font-size: 16px;
  letter-spacing: 0.02em;
}
.paper-h dl {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr);
  gap: 4px 10px;
  margin: 0;
  min-width: 300px;
}
.paper-h dt {
  color: #555;
}
.paper-h dd {
  margin: 0;
  border-bottom: 1px dotted #888;
  min-height: 16px;
  font-weight: 600;
}
.paper-note {
  margin: 6px 0 10px;
  color: #333;
  font-size: 11px;
}
.paper-t {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}
.paper-t th,
.paper-t td {
  border: 1px solid #333;
  padding: 4px 6px;
  height: 26px;
  vertical-align: middle;
  color: #111;
}
.paper-t th {
  background: #f1eee8;
  font-size: 11px;
  text-align: left;
  line-height: 1.25;
}
.paper-t th small {
  display: block;
  font-family: var(--f-mono);
  font-size: 9.5px;
  color: #666;
  font-weight: 500;
}
.paper-t .c {
  text-align: center;
}
.paper-t .mono {
  font-family: var(--f-mono);
  font-size: 11px;
}
.paper-zone td {
  background: #f7f5f0;
  font-weight: 700;
}
.paper-t tr {
  break-inside: avoid;
}
.paper-sign {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: center;
  margin-top: 16px;
  min-height: 90px;
  font-weight: 600;
  break-inside: avoid;
}
.paper-sign small {
  font-weight: 400;
  color: #666;
}
.paper-names {
  columns: 3 240px;
  column-gap: 22px;
}
.paper-group {
  break-inside: avoid;
  margin-bottom: 10px;
}
.paper-group ul {
  margin: 4px 0 0;
  padding-left: 16px;
}
.paper-group li {
  margin: 1px 0;
}

/* =====================================================================
   Motion & loading: progress bar, skeletons, soft enter transitions
   ===================================================================== */
/* Thin progress bar for API calls; the delay keeps fast requests from flickering */
.topline {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: 2.5px;
  z-index: 300;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.topline.on {
  opacity: 1;
  transition-delay: 0.15s;
}
.topline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 38%;
  border-radius: 2px;
  background: var(--grad-bar);
  animation: topline 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes topline {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(280%);
  }
}

/* Skeleton placeholders (same footprint as the real content → no layout jump) */
.sk {
  display: grid;
  gap: 14px;
}
.sk-detail {
  grid-template-columns: minmax(0, 1fr);
}
.sk-col,
.sk-list {
  display: grid;
  gap: 10px;
}
.sk-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 14px;
}
.sk-tiles.two {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.sk-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
}
.sk-line,
.sk-block {
  display: block;
  border-radius: var(--r-pill);
  background: linear-gradient(
    90deg,
    var(--surface-3) 0%,
    color-mix(in srgb, var(--surface) 70%, var(--primary-soft)) 45%,
    var(--surface-3) 90%
  );
  background-size: 300% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
.sk-line {
  height: 12px;
}
.sk-line.short {
  margin-left: auto;
}
.sk-block {
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  opacity: 0.85;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -50% 0;
  }
}
@media (min-width: 1024px) {
  .sk-detail {
    grid-template-columns: minmax(0, 1fr) 380px;
  }
  .sk-list {
    gap: 0;
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .sk-list .sk-row {
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--line-soft);
  }
}

/* New screen content eases in instead of popping (runs once, when the element is created) */
.body > *,
.page-header {
  animation: rise 0.24s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.body > .list > .item,
.body > .tbl tbody tr {
  animation: fade 0.22s ease-out both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* =====================================================================
   Touch devices (phones, iPad): instant taps, press feedback, no sticky hover
   ===================================================================== */
a,
button,
label,
summary,
select,
input,
.item,
.chip {
  touch-action: manipulation;
}
@media (hover: none) {
  .btn:active,
  .chip:active,
  .ev-tile:active,
  .ev-btn:active,
  .tabbar a:active,
  .tabbar button:active,
  .sb-nav a:active {
    transform: scale(0.97);
  }
  .item:active {
    background: var(--surface-2);
  }
  .app-main .list > .item:hover,
  .t tr.clickable:hover {
    background: inherit;
  }
}
.sheet-b,
.sidebar,
.imp-rows {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* =====================================================================
   Tablet / iPad portrait (640–1023 px): centred dialogs, two-column cards
   ===================================================================== */
@media (min-width: 640px) and (max-width: 1023px) {
  .body {
    padding: 18px 24px 28px;
  }
  .body > .list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
  }
  .dash {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash > .col-8,
  .dash > .col-12 {
    grid-column: 1 / -1;
  }
  .detail-grid {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  }
  .detail-grid > .detail-side {
    order: 2;
  }
  .actionbar {
    justify-content: flex-end;
    padding-inline: 24px;
  }
  .actionbar .btn {
    flex: 0 1 260px;
  }
  .tabbar {
    padding-inline: max(10%, env(safe-area-inset-left, 0px));
  }
  .ev-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
  .toolbar > .chips {
    flex-wrap: wrap;
  }
}

/* Laptops up to 1399 px: the floating sidebar leaves too little room for the optional table columns either */
@media (min-width: 1280px) and (max-width: 1399px) {
  .t .opt {
    display: none;
  }
}
/* iPad landscape / small laptops (1024–1279 px): give the content more room */
@media (min-width: 1024px) and (max-width: 1279px) {
  :root {
    --sidebar-w: 244px;
  }
  .t .opt {
    display: none;
  }
  .body {
    padding-inline: 20px;
  }
  /* The user's name is already in the sidebar footer: the avatar alone frees room for the breadcrumbs */
  .tb-user {
    padding: 3px;
  }
  .tb-user .who {
    display: none;
  }
  .detail-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .t th,
  .t td {
    padding-inline: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* Touch screens keep 16 px search text so iOS does not zoom on focus (form fields: --field-fs) */
@media (pointer: coarse) {
  .search input {
    font-size: 16px;
  }
}

/* Date field: dd/mm/yyyy text + native picker behind the calendar button */
.date-input {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}
.date-input > .input {
  padding-right: 40px;
  font-variant-numeric: tabular-nums;
}
.date-input.invalid > .input {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}
.di-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 38px;
  height: var(--field-h);
  display: grid;
  place-items: center;
  color: var(--muted);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.di-btn .icon {
  width: 18px;
  height: 18px;
}
.di-btn:hover {
  color: var(--ink);
}
.di-btn.off {
  opacity: 0.5;
}
.di-btn input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}
.di-btn input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.di-err {
  color: var(--bad);
  font-size: 12px;
  margin-top: 4px;
}
/* Money field: grouped digits + ₫ unit inside the field */
.money-input {
  position: relative;
  min-width: 0;
}
.money-input > .input {
  padding-right: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mi-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
/* Login: logo sizes */
.login-logo {
  width: 260px;
  max-width: 70%;
}
.login-body .login-logo {
  width: 220px;
}
/* Paper forms carry the logo in their header */
.paper-logo {
  height: 38px;
  width: auto;
  display: block;
  margin-bottom: 6px;
}

/* ===== Approval workflows ===== */
/* Timeline step states (request detail) */
.timeline li.done::before {
  border-color: var(--ok);
  background: var(--ok);
}
.timeline li.rejected::before {
  border-color: var(--bad);
  background: var(--bad);
}
.timeline li.current::before {
  border-color: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-soft);
}
.timeline li.skip {
  opacity: 0.55;
}
.timeline li.skip::before {
  border-style: dashed;
  border-color: var(--line-2);
}
/* Request type picker */
.type-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.type-grid .hub-card {
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: var(--surface);
}
@media (min-width: 640px) {
  .type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Approval route preview: step chips joined by arrows */
.route-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.route-line .rs {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.route-line .rs.off {
  color: var(--muted);
  text-decoration: line-through;
}
.route-line .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
/* Editable rows of the approval configuration (steps, fields) */
.builder-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
}
.builder-row .no {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  font-weight: 700;
  font-size: 13px;
}
.builder-row .tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* Remove button on an attachment tile */
.ev-tile .ev-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--bad);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.ev-tile .ev-del .icon {
  width: 14px;
  height: 14px;
}
.amount-big {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
/* ===== CCDC norms & accounting import ===== */
.norm-input {
  width: 110px;
  height: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.row-dirty td,
.norm-card.row-dirty {
  background: var(--brand-soft);
}
.norm-card .trail {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.norm-sites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.acc-file {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  background: var(--surface-2);
}
.acc-sheets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.acc-sheet {
  font-size: 12.5px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
/* ===== Value-based classification ===== */
.tier-list {
  display: grid;
  gap: 8px;
}
.tier {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 14px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  flex-wrap: wrap;
}
.tier .band {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
}
.tier-input {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
}
.tier-input .money-input {
  flex: 1;
}
.chg-preview {
  display: grid;
  gap: 4px;
  max-height: 320px;
  overflow: auto;
}
.chg-preview > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
}

/* Feature switches (Quản trị hệ thống → Bật / tắt tính năng) */
.feature-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
}
.feature-row .nic {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.feature-row.off b {
  color: var(--muted);
}
.switch {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  margin-top: 4px;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.switch i {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--line-2);
  transition: background 0.15s;
  pointer-events: none;
}
.switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}
.switch input:checked + i {
  background: var(--ok, #157f3c);
}
.switch input:checked + i::after {
  transform: translateX(20px);
}
.switch input:focus-visible + i {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Active / inactive field in forms (components.js → ActiveSwitch) */
.active-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.active-switch .switch {
  margin-top: 0;
}
.active-switch.is-on {
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
  background: var(--ok-soft);
}
.active-switch.is-off {
  background: var(--off-soft);
}
.active-switch:has(input:disabled) {
  cursor: default;
  opacity: 0.75;
}
.active-switch:has(input:disabled) input {
  cursor: default;
}
.active-switch:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.as-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.as-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}
.as-state .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
}
.active-switch.is-on .as-state {
  color: var(--ok);
}
.active-switch.is-on .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}
.active-switch.is-off .as-state {
  color: var(--muted);
}
.as-hint {
  font-size: 0.8125rem;
  color: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
  .active-switch,
  .switch i,
  .switch i::after {
    transition: none;
  }
}

/* =====================================================================
   List toolkit (js/list-kit.js): filter bar, filter panel, summary strips, data table, list cards
   ===================================================================== */
.lk-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.lk-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.lk-search {
  flex: 1 1 auto;
  min-width: 0;
}
/* Our own clear button replaces the browser's */
.lk-search input::-webkit-search-cancel-button,
.lk-fsearch input::-webkit-search-cancel-button {
  display: none;
}
.lk-fbtn {
  flex-shrink: 0;
  height: 42px;
  padding: 0 14px;
}
.lk-fbtn.on {
  color: var(--brand-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green-5) 55%, transparent);
}
.lk-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--grad-primary);
  color: var(--on-primary);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.lk-sort {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.lk-sort .input {
  height: 42px;
  width: auto;
  max-width: 220px;
}
.lk-sort .btn.icon-only {
  height: 42px;
  width: 42px;
}
.chips.lk-views .chip .icon {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  vertical-align: -2px;
}
.lk-chip-saved {
  border-style: dashed;
}
.lk-views .chip.zero:not(.on) {
  color: var(--muted);
  border-style: dashed;
}
/* Phones: the summary is one compact scrolling row of chips, so the first records stay above the fold */
@media (max-width: 639px) {
  :root .lk-summary {
    display: flex;
    gap: 6px;
    padding: 0;
    margin: 0;
    background: none;
    border: 0;
    box-shadow: none;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    padding-right: 24px;
  }
  :root .lk-summary::-webkit-scrollbar {
    display: none;
  }
  :root .lk-summary .lk-strip,
  :root .lk-summary .lk-strip-items {
    display: contents;
  }
  :root .lk-summary .lk-strip-t,
  :root .lk-summary .lk-bar-track,
  :root .lk-summary .lk-strip-sk {
    display: none;
  }
  :root .lk-summary .lk-si {
    padding: 4px 9px;
    font-size: 12.5px;
    gap: 5px;
    white-space: nowrap;
  }
  :root .lk-summary .lk-si-n {
    font-size: 13px;
  }
}
.lk-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-height: 26px;
  font-size: 13px;
}
.lk-count {
  color: var(--muted);
  margin-right: 4px;
}
.lk-count b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.lk-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 99px;
  padding: 3px 6px 3px 10px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  min-width: 0;
}
.lk-tag:hover {
  border-color: var(--ink);
}
.lk-tag:focus-visible,
.lk-link:focus-visible,
.lk-si:focus-visible,
.dt-sort:focus-visible,
.dt-grp-b:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.lk-tag-k {
  color: var(--muted);
  white-space: nowrap;
}
.lk-tag-v {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lk-tag-n {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lk-tag .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.lk-link {
  border: 0;
  background: none;
  padding: 3px 4px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lk-link .icon {
  width: 14px;
  height: 14px;
}
.lk-link:hover {
  color: var(--ink);
}

/* Filter panel: bottom sheet (phone), dialog (tablet), right side panel (desktop) */
@media (min-width: 1024px) {
  .sheet-backdrop:has(> .sheet.side) {
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
    background: color-mix(in srgb, var(--backdrop) 35%, transparent);
  }
  .sheet.side {
    width: 400px;
    max-height: none;
    height: 100%;
    border-radius: 0;
    animation: lk-side 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .sheet.side .sheet-f {
    border-radius: 0;
  }
}
@keyframes lk-side {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.lk-panel {
  display: flex;
  flex-direction: column;
}
.lk-sec {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lk-sec:first-child {
  padding-top: 0;
}
.lk-sec:last-child {
  border-bottom: 0;
}
.lk-sec h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.lk-sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sheet-b .lk-fsearch,
.lk-fsearch {
  height: 36px;
  box-shadow: none;
}
.lk-opts {
  display: flex;
  flex-direction: column;
  max-height: 264px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -6px;
}
.lk-opts.plain {
  max-height: none;
}
.lk-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  min-height: 38px;
}
.lk-opt:hover {
  background: var(--surface-2);
}
.lk-opt input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.lk-opt.on .lk-ol {
  font-weight: 600;
}
.lk-opt.zero {
  color: var(--muted);
}
.lk-ol {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lk-n {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}
.lk-ogrp {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 8px 6px 2px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}
.lk-none {
  padding: 6px;
  margin: 0;
}
.lk-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--line-2);
}
.lk-dot.sq {
  border-radius: 3px;
}
.lk-dot.ok {
  background: var(--ok);
}
.lk-dot.warn {
  background: var(--warn);
}
.lk-dot.bad {
  background: var(--bad);
}
.lk-dot.info {
  background: var(--info);
}
.lk-dot.off {
  background: var(--off);
}
.lk-seg-wrap {
  flex-wrap: wrap;
}
.lk-seg-wrap button {
  flex: 1 1 auto;
}
.lk-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.lk-sortrow {
  display: grid;
  gap: 8px;
}
.lk-saved-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lk-saved {
  display: inline-flex;
  align-items: center;
  border: 1px dashed var(--line-2);
  border-radius: 99px;
  background: var(--surface);
}
.lk-saved.on {
  border-style: solid;
  border-color: var(--ink);
}
.lk-saved button {
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 4px 5px 10px;
}
.lk-saved button.lk-x {
  padding: 5px 8px 5px 2px;
  color: var(--muted);
}
.lk-saved .icon {
  width: 14px;
  height: 14px;
}
.lk-tags-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Summary strips (counts by status / class; click = filter) */
.lk-summary {
  padding: 12px 14px;
  display: grid;
  gap: 12px;
}
.lk-strip {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.lk-strip-t {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.lk-strip-items {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.lk-strip-items::-webkit-scrollbar {
  display: none;
}
.lk-strip-sk {
  height: 34px;
  width: 60%;
  border-radius: var(--r-sm);
  background: var(--surface-3);
}
.lk-si {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-radius: 12px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition:
    border-color 0.12s,
    opacity 0.12s;
}
.lk-si:hover {
  border-color: var(--line-2);
}
.lk-si.on {
  border-color: color-mix(in srgb, var(--green-5) 55%, transparent);
  background: var(--primary-soft);
  color: var(--brand-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green-5) 35%, transparent);
}
.lk-si.dim {
  opacity: 0.6;
}
.lk-si-n {
  font-family: var(--f-num);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
}
.lk-si-p {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lk-strip.v-tiles .lk-si.tone-warn .lk-si-n {
  color: var(--warn);
}
.lk-strip.v-tiles .lk-si.tone-bad .lk-si-n {
  color: var(--bad);
}
.lk-bar-track {
  display: flex;
  height: 8px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--track);
  gap: 2px;
}
.lk-bar-track span {
  display: block;
  min-width: 3px;
  transition:
    width 0.3s ease,
    opacity 0.12s;
}
.lk-bar-track span.dim {
  opacity: 0.3;
}
@media (min-width: 1024px) {
  .lk-summary {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
  .lk-strip-items {
    flex-wrap: wrap;
    overflow: visible;
  }
}

/* Data table */
.tbl.dt {
  /* clip (not a scroll container) keeps the header sticky against the page scroll */
  overflow: clip;
}
.dt .t th {
  top: var(--topbar-h);
  z-index: 2;
  box-shadow: 0 1px 0 var(--line-soft);
}
.dt-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.dt-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.dt-group .input {
  height: 32px;
  width: auto;
  font-size: 13px;
  padding-block: 0;
}
.dt-cols {
  position: relative;
}
.dt-density {
  padding: 2px;
}
.dt-density button {
  min-height: 26px;
  padding: 2px 10px;
  font-size: 12.5px;
}
.lk-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.lk-pop .lk-opt {
  min-height: 34px;
  font-size: 13.5px;
}
.lk-pop .lk-link {
  align-self: flex-end;
  margin: 4px;
}
.dt-sort {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dt-sort .icon {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.12s;
}
.dt-sort:hover .icon {
  opacity: 0.5;
}
.dt-sort.on {
  color: var(--ink);
}
.dt-sort.on .icon {
  opacity: 1;
}
.t th.num .dt-sort {
  flex-direction: row-reverse;
}
.dt .t tbody tr[data-row]:nth-child(even of [data-row]) td {
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
}
@media (hover: hover) {
  .dt .t tbody tr[data-row]:hover td {
    background: var(--surface-3);
  }
}
.dt .t tbody tr[data-row]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.dt .t tbody tr.sel td {
  background: var(--primary-soft);
}
.dt .t tbody tr:last-child td {
  border-bottom: 1px solid var(--line);
}
.dt .t tbody:last-of-type tr:last-child td {
  border-bottom: 0;
}
.dt.compact .t td {
  padding-block: 5px;
}
.dt.compact .thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.dt.compact .dt-prime .cell-sub {
  display: none;
}
.dt-sel {
  width: 40px;
}
.dt-sel input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}
.dt .t tr.dt-grp td {
  background: var(--surface-3);
  padding: 0;
}
.dt-grp-b {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  text-align: left;
}
.dt-grp-b .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.15s;
}
.dt-grp-b .icon.open {
  transform: rotate(90deg);
}
.dt-grp-n {
  margin-left: auto;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* The primary column takes the width the other (single-line) columns leave, so nothing is clipped */
.dt .t td.dt-primary {
  width: 100%;
  max-width: 0;
  min-width: 220px;
}
.dt .t td:not(.dt-primary) {
  white-space: nowrap;
}
/* Single-line columns: a little tighter than plain tables so wide registers still fit beside the sidebar
   (1024–1279 px has its own 10 px) */
@media (min-width: 1280px) {
  .dt .t th,
  .dt .t td {
    padding-inline: 14px;
  }
}
.dt-prime {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.dt-prime-t {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dt-prime .cell-main {
  color: var(--ink);
  display: block;
}
.dt-prime .cell-main:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dt-prime .cell-sub .mono {
  font-size: 12px;
  color: var(--text-2);
}
.dt-loc {
  white-space: nowrap;
  font-size: 13.5px;
}
.dt-loc .st {
  margin-left: 6px;
}
.t td.nowrap {
  white-space: nowrap;
}

/* Phone / tablet cards */
.lk-card .lk-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.lk-card .lk-card-top .st {
  flex-shrink: 0;
}
.lk-card .name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lk-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-2);
  min-width: 0;
}
.lk-fact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.lk-fact .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.lk-fact.warn,
.lk-fact.warn .icon {
  color: var(--warn);
}
.lk-ghead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 2px 2px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  grid-column: 1 / -1;
}

/* Empty result: name the filters that exclude everything */
.lk-empty {
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  color: var(--text-2);
}
.lk-empty > .icon {
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--muted);
  box-sizing: content-box;
}
.lk-empty p {
  max-width: 560px;
  color: var(--muted);
  font-size: 13.5px;
}
.lk-empty-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 720px;
}

/* List toolkit: the filter bar takes the full toolbar width (search box never collapses) */
.toolbar > .lk-bar {
  flex: 1 1 100%;
}

/* List pager: "Hiển thị 51–100 / 166" · page size · numbered pages */
.lk-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  width: 100%;
  font-size: 13px;
  color: var(--text-2);
}
.lk-pager.only-mobile {
  padding: 12px 2px 4px;
}
.lk-pg-info b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lk-pg-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.lk-pg-size .input {
  width: auto;
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 13px;
}
.lk-pg-nums {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
.lk-pg-nums .btn {
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.lk-pg-n.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  font-weight: 700;
}
.lk-pg-gap {
  min-width: 18px;
  text-align: center;
  color: var(--muted);
}
@media (max-width: 639px) {
  .lk-pg-nums {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
  .lk-pg-nums .btn {
    min-width: 38px;
    height: 38px;
  }
}

/* Asset form: the picked item of the master catalog (assets.js → AssetForm) */
.catalog-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.catalog-pick > span:not(.cls) {
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2, var(--muted));
  font-size: 12.5px;
}
.add-catalog {
  justify-self: start;
  align-self: flex-start;
  margin-top: 6px;
}

/* Work mode switch in the sidebar (main.js, core.js hasModes): Kiểm kê | Nhập dữ liệu */
.mode-switch {
  margin: 0 14px 8px;
  background: var(--sidebar-2);
}
.mode-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 6px;
  color: var(--sidebar-muted);
  min-height: 34px;
  font-size: 12.5px;
  white-space: nowrap;
}
.mode-switch button .icon {
  width: 15px;
  height: 15px;
}
.mode-switch button:hover {
  color: var(--ink);
}
.mode-switch button.on {
  background: var(--sidebar-active);
  color: var(--brand-ink);
  box-shadow: var(--shadow-active);
}
.mode-switch button.on .icon {
  color: var(--green-5);
}

/* Compact screens (user request 2026-10-11): field hints and switch descriptions are not shown. A hint that carries
   live information (a warning, a preview, an empty result) is marked `keep`. */
.hint:not(.keep),
.as-hint {
  display: none !important;
}

/* Block title inside a form (SimpleCrud field type "heading") */
.form-heading {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.form-heading h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2, var(--ink));
}

/* A photo still waiting on the phone (upload-queue.js) in a tile grid */
.ev-tile.pending {
  border-style: dashed;
  border-color: var(--warn);
}
.ev-tile.pending img {
  opacity: 0.7;
}
.ev-tile.failed {
  border-color: var(--bad);
}
.ev-q {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1px 4px;
  font-size: 11px;
  text-align: center;
  background: var(--warn);
  color: var(--surface);
  pointer-events: none;
}
.ev-tile.failed .ev-q {
  background: var(--bad);
}

/* "Bản dùng thử" badge (components.js TrialBadge): bottom-right corner, above the phone bars, below sheets */
.trial {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 43;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.trial-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow);
  cursor: help;
}
.trial-pill .icon {
  width: 14px;
  height: 14px;
}
/* Room under the last row of every screen so the badge never sits on top of content (badge height + its offset) */
.trial ~ .app .app-main::after {
  content: '';
  display: block;
  flex-shrink: 0;
  height: 50px;
}
@media (max-width: 1023px) {
  .trial ~ .app .app-main::after {
    height: 40px;
  }
}
.trial-pill:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.trial-tip {
  display: none;
  max-width: min(300px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: var(--shadow-lg, var(--shadow));
}
.trial-tip b {
  display: block;
  margin-bottom: 2px;
}
.trial.open .trial-tip {
  display: block;
}
@media (hover: hover) {
  .trial:hover .trial-tip {
    display: block;
  }
}
/* Phones / tablets (store.isMobile, ≤ 1023 px): above the bottom tab bar (and the action bar when a screen has one) */
@media (max-width: 1023px) {
  .trial:not(.solo) {
    right: 10px;
    bottom: calc(var(--tabbar-h) + var(--bar-pad-b) + var(--vv-bottom) + 10px);
  }
  body.with-actionbar .trial:not(.solo) {
    bottom: calc(var(--tabbar-h) + var(--actionbar-h) + var(--bar-pad-b) + var(--vv-bottom) + 10px);
  }
  .trial-pill {
    min-height: 26px;
    padding: 0 10px;
    font-size: 10.5px;
    opacity: 0.92;
  }
}
@media print {
  .trial {
    display: none;
  }
}
