/* ==========================================================================
   NIFANA Absensi - design system (final presentation layer, r222)

   Cascade order (index.html):
     style.css       base markup + legacy page layouts
     web.css         browser-only page layouts (no colour tokens)
     web-desktop.css desktop-only layouts
     web-mobile.css  mobile-web layouts
     android.css     Android/PWA presentation (keeps its own geometry)
     employee.css    employee page layouts
     redesign.css    THIS FILE: the single source of colour, type, spacing,
                     shell chrome and shared components.

   Rules of the road:
   - Every colour comes from a --ds-* token below. Older token families
     (--bg/--card/--primary, --ui-*, --emp-*, --role-*, --web-*) are aliases
     of --ds-* so legacy page rules follow the same palette and theme.
   - Presentation only. No route, RBAC, API or business-state behaviour
     lives here.
   ========================================================================== */

/* 1. Tokens ------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* surfaces */
  --ds-bg: #f4f6f8;
  --ds-surface: #ffffff;
  --ds-surface-2: #f7f9fa;
  --ds-surface-3: #eef2f5;
  --ds-surface-elevated: #ffffff;
  --ds-overlay: rgba(15, 23, 32, .48);

  /* lines */
  --ds-border: #e1e6eb;
  --ds-border-strong: #c8d1da;

  /* text */
  --ds-text: #17222e;
  --ds-text-2: #4f5d6b;
  --ds-text-3: #606c79;
  --ds-text-inverse: #ffffff;

  /* brand / intent */
  --ds-primary: #0f766e;
  --ds-primary-hover: #0b5f58;
  --ds-primary-active: #094d48;
  --ds-primary-fg: #ffffff;
  --ds-primary-text: #0f766e;
  --ds-primary-soft: #e7f4f2;
  --ds-primary-soft-2: #d3ebe7;

  --ds-success: #177245;
  --ds-success-soft: #e8f5ee;
  /* r260: filled success button (white text, AA contrast). */
  --ds-success-fill: #177245;
  --ds-success-fill-hover: #125c38;
  --ds-success-fg: #ffffff;
  --ds-warning: #9a5b07;
  --ds-warning-soft: #fdf3e1;
  --ds-danger: #b8332f;
  --ds-danger-soft: #fdeceb;
  --ds-danger-hover: #9c2a27;
  --ds-danger-fill: #b8332f;
  --ds-danger-fill-hover: #9c2a27;
  --ds-info: #2459c4;
  --ds-info-soft: #eaf0fd;
  --ds-neutral: #5e6b78;
  --ds-neutral-soft: #edf0f3;
  --ds-indigo: #4338ca;
  --ds-indigo-soft: #eef2ff;
  --ds-purple: #7e22ce;
  --ds-purple-soft: #faf5ff;

  /* chart series (status) */
  --ds-chart-present: #1f9d63;
  --ds-chart-late: #e0a12b;
  --ds-chart-absent: #d9534f;
  --ds-chart-incomplete: #8a97a5;
  --ds-chart-grid: #e8ecf0;

  /* brand ink: login, boot splash (dark in both themes) */
  --ds-brand-ink: #0f1b29;
  --ds-brand-ink-text: #f3f7fa;
  --ds-brand-ink-muted: #75889a;

  /* sidebar (light) */
  --ds-sidebar-bg: #f4f7fa;
  --ds-sidebar-border: #d9e2ec;
  --ds-sidebar-text: #243447;
  --ds-sidebar-text-strong: #172b4d;
  --ds-sidebar-muted: #5b6b7e;
  --ds-sidebar-group-text: #5b6b7e;
  --ds-sidebar-group-hover: #172b4d;
  --ds-sidebar-group-hover-bg: #e8f3f5;
  --ds-sidebar-icon: #64748b;
  --ds-sidebar-icon-opacity: 1;
  --ds-sidebar-hover: #e8f3f5;
  --ds-sidebar-active: #d8f3f0;
  --ds-sidebar-active-text: #07746f;
  --ds-sidebar-indicator: #087f7a;
  --ds-sidebar-icon-active: #07746f;
  --ds-sidebar-focus: #087f7a;
  --ds-sidebar-scrollbar: #c3cfdb;

  /* topbar (light) */
  --ds-topbar-bg: #ffffff;
  --ds-topbar-border: #e2e8f0;
  --ds-topbar-title: #172b4d;
  --ds-topbar-subtitle: #64748b;
  --ds-topbar-icon-bg: #f1f5f9;
  --ds-topbar-icon-fg: #475569;
  --ds-topbar-icon-hover-bg: #e2e8f0;
  --ds-topbar-icon-hover-fg: #172b4d;

  /* table header */
  --ds-table-head: #f1f5f9;

  /* category accents (Sistem cards) */
  --ds-cat-indigo: #4338ca;
  --ds-cat-violet: #6d28d9;
  --ds-cat-teal: #0f766e;
  --ds-cat-blue: #1d4ed8;
  --ds-cat-green: #15803d;
  --ds-cat-amber: #b45309;
  --ds-cat-cyan: #0e7490;
  --ds-cat-orange: #c2410c;
  --ds-cat-red: #b91c1c;
  --ds-cat-purple: #7e22ce;
  --ds-cat-emerald: #047857;
  --ds-cat-tint: 5%;
  --ds-cat-border: 28%;
  --ds-cat-icon-bg: 13%;

  /* tooltip (inverse surface) */
  --ds-tooltip-bg: #172b4d;
  --ds-tooltip-fg: #ffffff;

  /* KPI / status cards (light: soft tinted surfaces) */
  --ds-kpi-success-bg: #ecfdf5;
  --ds-kpi-success-border: #a7f3d0;
  --ds-kpi-success-icon-bg: #d1fae5;
  --ds-kpi-success-label: var(--ds-kpi-success-accent);
  --ds-kpi-success-strip: var(--ds-kpi-success-accent);
  --ds-kpi-success-accent: #047857;
  --ds-kpi-warning-bg: #fffbeb;
  --ds-kpi-warning-border: #fde68a;
  --ds-kpi-warning-icon-bg: #fef3c7;
  --ds-kpi-warning-label: var(--ds-kpi-warning-accent);
  --ds-kpi-warning-strip: var(--ds-kpi-warning-accent);
  --ds-kpi-warning-accent: #b45309;
  --ds-kpi-danger-bg: #fff1f2;
  --ds-kpi-danger-border: #fecdd3;
  --ds-kpi-danger-icon-bg: #ffe4e6;
  --ds-kpi-danger-label: var(--ds-kpi-danger-accent);
  --ds-kpi-danger-strip: var(--ds-kpi-danger-accent);
  --ds-kpi-danger-accent: #be123c;
  --ds-kpi-info-bg: #eff6ff;
  --ds-kpi-info-border: #bfdbfe;
  --ds-kpi-info-icon-bg: #dbeafe;
  --ds-kpi-info-label: var(--ds-kpi-info-accent);
  --ds-kpi-info-strip: var(--ds-kpi-info-accent);
  --ds-kpi-info-accent: #1d4ed8;
  --ds-kpi-indigo-bg: #eef2ff;
  --ds-kpi-indigo-border: #c7d2fe;
  --ds-kpi-indigo-icon-bg: #e0e7ff;
  --ds-kpi-indigo-accent: #4338ca;
  --ds-kpi-indigo-label: #4338ca;
  --ds-kpi-purple-bg: #faf5ff;
  --ds-kpi-purple-border: #e9d5ff;
  --ds-kpi-purple-icon-bg: #f3e8ff;
  --ds-kpi-purple-accent: #7e22ce;
  --ds-kpi-purple-label: #7e22ce;
  --ds-kpi-value: #17222e;
  --ds-kpi-value-warning: #17222e;
  --ds-kpi-value-danger: #17222e;
  --ds-kpi-hover-shadow: 0 4px 12px rgba(16, 24, 40, .08);
  --ds-kpi-hover-mix: 45%;
  --ds-strip-width: 3px;
  --ds-btn-secondary-bg: var(--ds-surface);
  --ds-btn-secondary-hover: var(--ds-surface-2);
  --ds-btn-secondary-active: var(--ds-surface-3);
  --ds-btn-disabled-bg: var(--ds-surface-2);
  --ds-btn-disabled-border: var(--ds-border-strong);
  /* KTA sheet replica keeps its printed palette in both themes */
  --ds-kta-link: #2457a6;

  /* focus */
  --ds-focus: #0f766e;
  --ds-focus-ring: 0 0 0 3px rgba(15, 118, 110, .22);

  /* shape */
  --ds-radius-xs: 4px;
  --ds-radius-sm: 6px;
  --ds-radius-md: 8px;
  --ds-radius-lg: 12px;
  --ds-radius-pill: 999px;

  /* elevation */
  --ds-shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --ds-shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --ds-shadow-md: 0 6px 16px rgba(16, 24, 40, .08);
  --ds-shadow-lg: 0 18px 44px rgba(16, 24, 40, .18);

  /* spacing (4px grid) */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-8: 32px;

  /* type */
  --ds-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ds-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ds-text-xs: 11px;
  --ds-text-sm: 12px;
  --ds-text-base: 13.5px;
  --ds-text-md: 15px;
  --ds-text-lg: 18px;
  --ds-text-xl: 22px;
  --ds-text-kpi: 28px;

  /* sizes */
  --ds-icon-sm: 16px;
  --ds-icon-md: 18px;
  --ds-icon-lg: 20px;
  --ds-control-h: 38px;
  --ds-control-h-sm: 32px;
  --ds-control-h-touch: 44px;
  --ds-topbar-h: 64px;
  --sidebar-w: 248px;

  /* motion */
  --ds-ease: cubic-bezier(.2, .75, .25, 1);
  --ds-fast: 120ms;
  --ds-base: 180ms;
  --ds-slow: 240ms;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --ds-bg: #0d141c;
  --ds-surface: #141d27;
  --ds-surface-2: #18222e;
  --ds-surface-3: #1e2a37;
  --ds-surface-elevated: #1a2430;
  --ds-overlay: rgba(2, 6, 12, .66);

  --ds-border: #263341;
  --ds-border-strong: #384858;

  --ds-text: #e5ecf2;
  --ds-text-2: #aab6c2;
  --ds-text-3: #8794a2;
  --ds-text-inverse: #0d141c;

  --ds-primary: #15847b;
  --ds-primary-hover: #117a71;
  --ds-primary-active: #12726a;
  --ds-primary-fg: #ffffff;
  --ds-primary-text: #5fd0c3;
  --ds-primary-soft: #14302f;
  --ds-primary-soft-2: #1a3e3c;

  --ds-success: #5fcf98;
  --ds-success-soft: #15302a;
  /* r260: filled success button on dark surfaces (dark text, AA contrast). */
  --ds-success-fill: #3fae7a;
  --ds-success-fill-hover: #52bf8b;
  --ds-success-fg: #04160d;
  --ds-warning: #efb85a;
  --ds-warning-soft: #362a15;
  --ds-danger: #f28b85;
  --ds-danger-soft: #3a1d1f;
  --ds-danger-hover: #f6a39e;
  --ds-danger-fill: #c23b35;
  --ds-danger-fill-hover: #ad302b;
  --ds-info: #8fb3ff;
  --ds-info-soft: #1a2741;
  --ds-neutral: #a3afbb;
  --ds-neutral-soft: #222d39;
  --ds-indigo: #a5b4fc;
  --ds-indigo-soft: #1e2147;
  --ds-purple: #d8b4fe;
  --ds-purple-soft: #2a1d3d;

  --ds-chart-present: #3dbf82;
  --ds-chart-late: #e9b04a;
  --ds-chart-absent: #ec6e69;
  --ds-chart-incomplete: #7d8a98;
  --ds-chart-grid: #222e3a;

  --ds-brand-ink: #0a121b;

  --ds-sidebar-bg: #0a121b;
  --ds-sidebar-border: rgba(255, 255, 255, .05);
  --ds-sidebar-text: #b4c1cd;
  --ds-sidebar-text-strong: #f3f7fa;
  --ds-sidebar-muted: #75889a;
  --ds-sidebar-group-text: #c8d6e7;
  --ds-sidebar-group-hover: #ffffff;
  --ds-sidebar-group-hover-bg: rgba(255, 255, 255, .06);
  --ds-sidebar-icon: currentColor;
  --ds-sidebar-icon-opacity: .85;
  --ds-sidebar-hover: rgba(255, 255, 255, .06);
  --ds-sidebar-active: rgba(45, 212, 191, .13);
  --ds-sidebar-active-text: #f3f7fa;
  --ds-sidebar-indicator: #2dd4bf;
  --ds-sidebar-icon-active: #5eead4;
  --ds-sidebar-focus: #5eead4;
  --ds-sidebar-scrollbar: rgba(255, 255, 255, .16);

  --ds-topbar-bg: var(--ds-surface);
  --ds-topbar-border: var(--ds-border);
  --ds-topbar-title: var(--ds-text);
  --ds-topbar-subtitle: var(--ds-text-3);
  --ds-topbar-icon-bg: transparent;
  --ds-topbar-icon-fg: var(--ds-text-2);
  --ds-topbar-icon-hover-bg: var(--ds-surface-3);
  --ds-topbar-icon-hover-fg: var(--ds-text);

  --ds-table-head: var(--ds-surface-2);

  --ds-cat-indigo: #a5b4fc;
  --ds-cat-violet: #c4b5fd;
  --ds-cat-teal: #5eead4;
  --ds-cat-blue: #93c5fd;
  --ds-cat-green: #86efac;
  --ds-cat-amber: #fcd34d;
  --ds-cat-cyan: #67e8f9;
  --ds-cat-orange: #fdba74;
  --ds-cat-red: #fca5a5;
  --ds-cat-purple: #d8b4fe;
  --ds-cat-emerald: #6ee7b7;
  --ds-cat-tint: 7%;
  --ds-cat-border: 32%;
  --ds-cat-icon-bg: 16%;

  --ds-tooltip-bg: #e5ecf2;
  --ds-tooltip-fg: #0d141c;

  /* KPI / status cards (dark: same tone system as light, on a dark surface) */
  --ds-kpi-success-accent: var(--ds-success);
  --ds-kpi-success-bg: color-mix(in srgb, var(--ds-kpi-success-accent) var(--ds-tone-tint), var(--ds-surface));
  --ds-kpi-success-border: color-mix(in srgb, var(--ds-kpi-success-accent) var(--ds-tone-border), var(--ds-border));
  --ds-kpi-success-icon-bg: color-mix(in srgb, var(--ds-kpi-success-accent) var(--ds-tone-icon-bg), var(--ds-surface));
  --ds-kpi-success-label: color-mix(in srgb, var(--ds-kpi-success-accent) 62%, var(--ds-text-2));
  --ds-kpi-success-strip: var(--ds-kpi-success-accent);
  --ds-kpi-warning-accent: var(--ds-warning);
  --ds-kpi-warning-bg: color-mix(in srgb, var(--ds-kpi-warning-accent) var(--ds-tone-tint), var(--ds-surface));
  --ds-kpi-warning-border: color-mix(in srgb, var(--ds-kpi-warning-accent) var(--ds-tone-border), var(--ds-border));
  --ds-kpi-warning-icon-bg: color-mix(in srgb, var(--ds-kpi-warning-accent) var(--ds-tone-icon-bg), var(--ds-surface));
  --ds-kpi-warning-label: color-mix(in srgb, var(--ds-kpi-warning-accent) 62%, var(--ds-text-2));
  --ds-kpi-warning-strip: var(--ds-kpi-warning-accent);
  --ds-kpi-danger-accent: var(--ds-danger);
  --ds-kpi-danger-bg: color-mix(in srgb, var(--ds-kpi-danger-accent) var(--ds-tone-tint), var(--ds-surface));
  --ds-kpi-danger-border: color-mix(in srgb, var(--ds-kpi-danger-accent) var(--ds-tone-border), var(--ds-border));
  --ds-kpi-danger-icon-bg: color-mix(in srgb, var(--ds-kpi-danger-accent) var(--ds-tone-icon-bg), var(--ds-surface));
  --ds-kpi-danger-label: color-mix(in srgb, var(--ds-kpi-danger-accent) 62%, var(--ds-text-2));
  --ds-kpi-danger-strip: var(--ds-kpi-danger-accent);
  --ds-kpi-info-accent: var(--ds-info);
  --ds-kpi-info-bg: color-mix(in srgb, var(--ds-kpi-info-accent) var(--ds-tone-tint), var(--ds-surface));
  --ds-kpi-info-border: color-mix(in srgb, var(--ds-kpi-info-accent) var(--ds-tone-border), var(--ds-border));
  --ds-kpi-info-icon-bg: color-mix(in srgb, var(--ds-kpi-info-accent) var(--ds-tone-icon-bg), var(--ds-surface));
  --ds-kpi-info-label: color-mix(in srgb, var(--ds-kpi-info-accent) 62%, var(--ds-text-2));
  --ds-kpi-info-strip: var(--ds-kpi-info-accent);
  --ds-kpi-indigo-accent: var(--ds-indigo);
  --ds-kpi-indigo-bg: color-mix(in srgb, var(--ds-kpi-indigo-accent) var(--ds-tone-tint), var(--ds-surface));
  --ds-kpi-indigo-border: color-mix(in srgb, var(--ds-kpi-indigo-accent) var(--ds-tone-border), var(--ds-border));
  --ds-kpi-indigo-icon-bg: color-mix(in srgb, var(--ds-kpi-indigo-accent) var(--ds-tone-icon-bg), var(--ds-surface));
  --ds-kpi-indigo-label: color-mix(in srgb, var(--ds-kpi-indigo-accent) 62%, var(--ds-text-2));
  --ds-kpi-indigo-strip: var(--ds-kpi-indigo-accent);
  --ds-kpi-purple-accent: var(--ds-purple);
  --ds-kpi-purple-bg: color-mix(in srgb, var(--ds-kpi-purple-accent) var(--ds-tone-tint), var(--ds-surface));
  --ds-kpi-purple-border: color-mix(in srgb, var(--ds-kpi-purple-accent) var(--ds-tone-border), var(--ds-border));
  --ds-kpi-purple-icon-bg: color-mix(in srgb, var(--ds-kpi-purple-accent) var(--ds-tone-icon-bg), var(--ds-surface));
  --ds-kpi-purple-label: color-mix(in srgb, var(--ds-kpi-purple-accent) 62%, var(--ds-text-2));
  --ds-kpi-purple-strip: var(--ds-kpi-purple-accent);
  --ds-tone-tint: 8%;
  --ds-tone-border: 34%;
  --ds-tone-icon-bg: 20%;
  --ds-kpi-value: var(--ds-text);
  --ds-kpi-value-warning: var(--ds-warning);
  --ds-kpi-value-danger: var(--ds-danger);
  --ds-kpi-hover-shadow: 0 4px 14px rgba(0, 0, 0, .32);
  --ds-kpi-hover-mix: 55%;
  --ds-strip-width: 3px;
  --ds-btn-secondary-bg: var(--ds-surface-3);
  --ds-btn-secondary-hover: #263445;
  --ds-btn-secondary-active: #2c3b4d;
  --ds-btn-disabled-bg: var(--ds-surface-3);
  --ds-btn-disabled-border: var(--ds-border-strong);

  --ds-focus: #5fd0c3;
  --ds-focus-ring: 0 0 0 3px rgba(95, 208, 195, .28);

  --ds-shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --ds-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .2);
  --ds-shadow-md: 0 8px 20px rgba(0, 0, 0, .35);
  --ds-shadow-lg: 0 22px 50px rgba(0, 0, 0, .5);
}

/* 2. Legacy token aliases ------------------------------------------------
   Declared on <html> (light + dark) and re-declared on the role shells so a
   body-level legacy declaration can never re-introduce a second palette. */
:root,
html[data-theme="dark"],
:root body.admin-shell,
:root body.finance-shell,
:root body.employee-shell,
:root body.inventory-shell {
  /* style.css family */
  --navy: var(--ds-brand-ink);
  --navy2: var(--ds-brand-ink);
  --blue: var(--ds-primary);
  --bg: var(--ds-bg);
  --card: var(--ds-surface);
  --text: var(--ds-text);
  --muted: var(--ds-text-3);
  --line: var(--ds-border);
  --card-alt: var(--ds-surface-2);
  --ok: var(--ds-success);
  --warn: var(--ds-warning);
  --danger: var(--ds-danger);
  --radius: var(--ds-radius-lg);
  --shadow: var(--ds-shadow-md);
  --surface: var(--ds-surface);
  --surface-muted: var(--ds-surface-2);
  --text-muted: var(--ds-text-3);
  --border: var(--ds-border);
  --border-strong: var(--ds-border-strong);
  --primary: var(--ds-primary);
  --accent: var(--ds-primary);
  --accent-strong: var(--ds-primary);
  --action-secondary: var(--ds-surface-2);
  --action-hover: var(--ds-primary-hover);
  --action-hover-surface: var(--ds-primary-soft);
  --focus-ring: var(--ds-focus);
  --sidebar: var(--ds-sidebar-bg);
  --topbar-bg: var(--ds-surface);
  --modal-bg: var(--ds-surface-elevated);
  --dropdown-bg: var(--ds-surface-elevated);
  --input-bg: var(--ds-surface);
  --notice-bg: var(--ds-info-soft);
  --notice-border: color-mix(in srgb, var(--ds-info) 22%, transparent);
  --notice-text: var(--ds-text-2);

  /* earlier redesign family */
  --ui-ink: var(--ds-text);
  --ui-ink-soft: var(--ds-text-2);
  --ui-blue: var(--ds-primary-text);
  --ui-blue-dark: var(--ds-primary-hover);
  --ui-blue-soft: var(--ds-primary-soft);
  --ui-cyan: var(--ds-primary-text);
  --ui-border: var(--ds-border);
  --ui-surface: var(--ds-surface);
  --ui-surface-subtle: var(--ds-surface-2);
  --ui-muted-surface: var(--ds-surface-2);
  --ui-bg: var(--ds-bg);
  --ui-sidebar: var(--ds-sidebar-bg);
  --ui-success: var(--ds-success);
  --ui-warning: var(--ds-warning);
  --ui-danger: var(--ds-danger);
  --ui-accent: var(--ds-primary-text);
  --ui-accent-strong: var(--ds-primary-text);
  --ui-radius-sm: var(--ds-radius-sm);
  --ui-radius-md: var(--ds-radius-md);
  --ui-radius-lg: var(--ds-radius-lg);
  --ui-shadow-sm: var(--ds-shadow-sm);
  --ui-shadow-md: var(--ds-shadow-md);
  --ui-focus: color-mix(in srgb, var(--ds-focus) 40%, transparent);
  --ui-motion-fast: var(--ds-fast);
  --ui-motion-standard: var(--ds-base);
  --ui-motion-slow: var(--ds-slow);
  --ui-ease: var(--ds-ease);

  /* employee family */
  --emp-font-display: var(--ds-font);
  --emp-bg: var(--ds-bg);
  --emp-surface: var(--ds-surface);
  --emp-surface-subtle: var(--ds-surface-2);
  --emp-text: var(--ds-text);
  --emp-text-soft: var(--ds-text-2);
  --emp-text-muted: var(--ds-text-3);
  --emp-border: var(--ds-border);
  --emp-border-strong: var(--ds-border-strong);
  --emp-primary: var(--ds-primary);
  --emp-primary-strong: var(--ds-primary);
  --emp-primary-soft: var(--ds-primary-soft);
  --emp-success: var(--ds-success);
  --emp-success-soft: var(--ds-success-soft);
  --emp-warning: var(--ds-warning);
  --emp-warning-soft: var(--ds-warning-soft);
  --emp-danger: var(--ds-danger);
  --emp-danger-soft: var(--ds-danger-soft);
  --emp-radius-sm: var(--ds-radius-md);
  --emp-radius-md: var(--ds-radius-lg);
  --emp-radius-lg: 14px;
  --emp-shadow-sm: var(--ds-shadow-sm);
  --emp-shadow-md: var(--ds-shadow-md);
  --emp-space-1: var(--ds-space-1);
  --emp-space-2: var(--ds-space-2);
  --emp-space-3: var(--ds-space-3);
  --emp-space-4: var(--ds-space-4);
  --emp-space-5: var(--ds-space-5);
  --emp-space-6: var(--ds-space-6);

  /* admin/finance family */
  --role-bg: var(--ds-bg);
  --role-surface: var(--ds-surface);
  --role-subtle: var(--ds-surface-2);
  --role-text: var(--ds-text);
  --role-soft: var(--ds-text-2);
  --role-muted: var(--ds-text-3);
  --role-border: var(--ds-border);
  --role-border-strong: var(--ds-border-strong);
  --role-primary: var(--ds-primary);
  --role-primary-strong: var(--ds-primary-hover);
  --role-radius: var(--ds-radius-lg);
  --role-shadow: var(--ds-shadow-sm);

  /* browser action family (web.css / web-desktop.css / web-mobile.css) */
  --web-action-primary-bg: var(--ds-primary);
  --web-action-primary-fg: var(--ds-primary-fg);
  --web-action-primary-hover: var(--ds-primary-hover);
  --web-action-secondary-bg: var(--ds-surface);
  --web-action-secondary-fg: var(--ds-text);
  --web-action-secondary-border: var(--ds-border-strong);
  --web-action-secondary-hover: var(--ds-surface-2);
  --web-action-icon-bg: var(--ds-btn-secondary-bg);
  --web-action-icon-fg: var(--ds-text-2);
  --web-action-icon-border: var(--ds-border-strong);
  --web-action-icon-hover: var(--ds-surface-2);
  --web-action-disabled-bg: var(--ds-surface-2);
  --web-action-disabled-fg: var(--ds-text-3);
  --web-action-disabled-border: var(--ds-border);
  --web-action-danger-bg: var(--ds-danger-soft);
  --web-action-danger-fg: var(--ds-danger);
  --web-focus-ring: var(--ds-focus);
}
:root body.sidebar-collapsed { --sidebar-w: 72px; }

/* 3. Base --------------------------------------------------------------- */
html, body { background: var(--ds-bg); color: var(--ds-text); }
body {
  font-family: var(--ds-font);
  font-size: var(--ds-text-base);
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.employee-shell { background: var(--ds-bg); color: var(--ds-text); font-family: var(--ds-font); letter-spacing: 0; }
h1, h2, h3, h4 { color: var(--ds-text); letter-spacing: -.01em; }
.kta-sheet :is(h1, h2, h3, h4) { color: inherit; }
a { color: var(--ds-primary-text); }
::selection { background: color-mix(in srgb, var(--ds-primary) 22%, transparent); }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.muted, .section-title p { color: var(--ds-text-3); }
code { background: var(--ds-surface-3); color: var(--ds-text); font-family: var(--ds-font-mono); border-radius: var(--ds-radius-xs); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
* { scrollbar-width: thin; scrollbar-color: var(--ds-border-strong) transparent; }

/* 4. Login and boot ----------------------------------------------------- */
.boot-splash { background: var(--ds-brand-ink); color: var(--ds-brand-ink-text); }
/* R241: longhands only - the old `background:` shorthand reset size/position/
   repeat from style.css, tiling the uploaded image at its natural size. One
   image now covers the screen proportionally (desktop, mobile, Android app). */
.login-screen { position: relative; background-color: var(--ds-brand-ink); background-size: cover; background-position: center; background-repeat: no-repeat; min-height: 100dvh; overflow-x: hidden; align-content: center; row-gap: var(--ds-space-4); }
@media (max-width: 480px) { .login-screen { padding: var(--ds-space-4); } .login-card { padding: 24px 20px; } }
.login-screen:not(.has-custom-bg)::before { content: ""; position: absolute; inset: 0; background: radial-gradient(1200px 600px at 85% -10%, rgba(45, 212, 191, .16), transparent 60%); pointer-events: none; }
.login-card { position: relative; z-index: 1; width: min(420px, 100%); padding: 32px; background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: 14px; box-shadow: var(--ds-shadow-lg); color: var(--ds-text); }
.login-card h1, .login-card h2 { color: var(--ds-text); font-size: var(--ds-text-xl); font-weight: 650; letter-spacing: -.02em; }
.login-card > p { color: var(--ds-text-2); }
.login-card .btn.primary { min-height: var(--ds-control-h-touch); width: 100%; }
.login-footer { color: var(--ds-brand-ink-muted); }
.brand-mark { background: var(--ds-primary); color: var(--ds-primary-fg); box-shadow: none; font-weight: 700; }
.brand-logo { background: transparent; object-fit: contain; }
.link-btn { color: var(--ds-primary-text); }
.kta-sheet .link-btn { color: var(--ds-kta-link); }

/* 5. App frame ---------------------------------------------------------- */
.app-shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); background: var(--ds-bg); }
.main { min-width: 0; background: var(--ds-bg); }
.content { width: 100%; max-width: 1600px; margin: 0 auto; padding: var(--ds-space-6) clamp(16px, 2.4vw, 32px) var(--ds-space-8); box-sizing: border-box; }
.app-footer { padding: 0 clamp(16px, 2.4vw, 32px) var(--ds-space-5); color: var(--ds-text-3); font-size: var(--ds-text-xs); border-top: 0; }

/* 5a. Sidebar */
.sidebar {
  width: var(--sidebar-w);
  padding: 16px 12px 12px;
  background: var(--ds-sidebar-bg);
  color: var(--ds-sidebar-text);
  border-right: 1px solid var(--ds-sidebar-border);
  overflow: hidden;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 40px; padding: 0 6px 16px; margin-bottom: 4px; border-bottom: 1px solid var(--ds-sidebar-border); }
.sidebar .brand-mark.small, .sidebar .brand-logo.small { flex: 0 0 36px; width: 36px; height: 36px; border-radius: var(--ds-radius-md); font-size: 12px; }
.sidebar .brand-logo.small { background: transparent; object-fit: contain; }
.sidebar .brand-text { min-width: 0; transition: opacity var(--ds-fast) var(--ds-ease); }
.sidebar .brand-text strong { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--ds-sidebar-text-strong); font-size: 13.5px; font-weight: 650; line-height: 1.25; }
.sidebar .brand-text small { display: block; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; color: var(--ds-sidebar-muted); font-size: var(--ds-text-xs); }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; min-height: 0; flex: 1 1 auto; max-height: none; overflow-x: hidden; overflow-y: auto; padding: 4px 0 8px; scrollbar-color: var(--ds-sidebar-scrollbar) transparent; }
.sidebar nav::before { content: none; display: none; }

.nav-section-label,
.nav-section-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 28px; margin: 14px 0 2px; padding: 0 12px;
  border: 0; border-radius: var(--ds-radius-sm); background: transparent;
  color: var(--ds-sidebar-muted); font: inherit; font-size: 10.5px; font-weight: 650; letter-spacing: .08em; line-height: 1;
  text-align: left; text-transform: uppercase; white-space: nowrap;
}
.nav-section-label:first-child { margin-top: 6px; }
.nav-section-toggle { cursor: pointer; }
/* Group toggles are <button>s: outrank the legacy `.sidebar nav button` colour. */
.sidebar nav > .nav-section-toggle { color: var(--ds-sidebar-group-text); }
.sidebar nav > .nav-section-toggle:hover { color: var(--ds-sidebar-group-hover); background: var(--ds-sidebar-group-hover-bg); }
.nav-section-toggle:focus-visible { outline: 2px solid var(--ds-sidebar-focus); outline-offset: -2px; }
.nav-section-toggle svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .8; transition: transform var(--ds-base) var(--ds-ease); }
.nav-section-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }

.sidebar nav > button[data-view],
.sidebar nav > button[data-domain] {
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 38px; padding: 0 12px;
  border: 0; border-radius: var(--ds-radius-md); background: transparent;
  color: var(--ds-sidebar-text); font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.2;
  text-align: left; white-space: nowrap; cursor: pointer; box-shadow: none; transform: none;
  transition: background-color var(--ds-fast) var(--ds-ease), color var(--ds-fast) var(--ds-ease);
}
.sidebar nav > button .nav-icon { width: var(--ds-icon-lg); height: var(--ds-icon-lg); flex: 0 0 var(--ds-icon-lg); color: var(--ds-sidebar-icon); opacity: var(--ds-sidebar-icon-opacity); }
.sidebar nav > button .nav-icon path { fill: currentColor; }
.sidebar nav > button .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar nav > button:hover { background: var(--ds-sidebar-hover); color: var(--ds-sidebar-text-strong); }
.sidebar nav > button:hover .nav-icon, .sidebar nav > button:focus-visible .nav-icon { color: var(--ds-sidebar-text-strong); opacity: 1; }
.sidebar nav > button:focus-visible { outline: 2px solid var(--ds-sidebar-focus); outline-offset: -2px; background: var(--ds-sidebar-hover); color: var(--ds-sidebar-text-strong); }
.sidebar nav > button.active { background: var(--ds-sidebar-active); color: var(--ds-sidebar-active-text); font-weight: 600; box-shadow: none; }
.sidebar nav > button.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ds-sidebar-indicator); }
.sidebar nav > button.active .nav-icon { color: var(--ds-sidebar-icon-active); opacity: 1; }
.sidebar nav > button:disabled, .sidebar nav > button[aria-disabled="true"] { opacity: .45; cursor: not-allowed; background: transparent; }

#nav.nav-section-operasional-collapsed [data-nav-section="OPERASIONAL"],
#nav.nav-section-manajemen-collapsed [data-nav-section="MANAJEMEN"],
#nav.nav-section-sistem-collapsed [data-nav-section="SISTEM"],
#nav.nav-section-keuangan-collapsed [data-nav-section="KEUANGAN"] { display: none; }

/* Collapsed rail: fixed 72px, icons always visible, sections become dividers. */
body.sidebar-collapsed .sidebar { padding-inline: 12px; }
body.sidebar-collapsed .sidebar .brand { justify-content: center; padding-inline: 0; gap: 0; }
body.sidebar-collapsed .sidebar .brand-text { width: 0; opacity: 0; overflow: hidden; margin: 0; }
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-section-toggle { justify-content: center; min-height: 0; height: 1px; margin: 10px 8px; padding: 0; background: var(--ds-sidebar-border); font-size: 0; pointer-events: none; overflow: hidden; }
body.sidebar-collapsed .nav-section-label:first-child { height: 0; margin: 4px 0; background: transparent; }
body.sidebar-collapsed .nav-section-toggle > *, body.sidebar-collapsed .nav-section-label > * { display: none; }
body.sidebar-collapsed .sidebar nav > button[data-view],
body.sidebar-collapsed .sidebar nav > button[data-domain] { justify-content: center; width: 48px; min-height: 40px; padding: 0; margin-inline: auto; gap: 0; }
body.sidebar-collapsed .sidebar nav > button .nav-label { width: 0; opacity: 0; }
body.sidebar-collapsed #nav[class*="-collapsed"] > button[data-nav-section] { display: flex; }

/* Design-system tooltip (collapsed sidebar rail). */
.ui-tooltip {
  position: fixed; z-index: 400; max-width: min(260px, calc(100vw - 16px)); padding: 6px 10px;
  border-radius: var(--ds-radius-sm); background: var(--ds-tooltip-bg); color: var(--ds-tooltip-fg); box-shadow: var(--ds-shadow-md);
  font-size: var(--ds-text-sm); font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; opacity: 0; transform: translateX(-4px); transition: opacity var(--ds-fast) var(--ds-ease), transform var(--ds-fast) var(--ds-ease);
}
.ui-tooltip.is-visible { opacity: 1; transform: none; }
.ui-tooltip[hidden] { display: none; }

/* Sidebar logo: wide logo when expanded, compact mark when collapsed. */
.sidebar .brand-logo.small.horizontal { flex: 0 1 auto; width: auto; height: 40px; max-width: 196px; border-radius: 0; object-fit: contain; object-position: left center; }
.sidebar .brand-logo.small:not(.horizontal) { flex: 0 0 44px; width: 44px; height: 44px; }
.brand-logo-compact { display: none; width: 40px; height: 40px; flex: 0 0 40px; object-fit: contain; border-radius: var(--ds-radius-md); }
.brand-logo-compact.from-wide { object-fit: cover; object-position: left center; }
.sidebar .brand { min-height: 48px; transition: padding var(--ds-base) var(--ds-ease); }
body.sidebar-collapsed .sidebar .brand.has-compact-logo #sidebarLogo,
body.sidebar-collapsed .sidebar .brand.has-compact-logo #sidebarBrandMark { display: none; }
body.sidebar-collapsed .sidebar .brand.has-compact-logo .brand-logo-compact:not([hidden]) { display: block; }
.app-shell { transition: grid-template-columns var(--ds-base) var(--ds-ease); }
.sidebar { transition: width var(--ds-base) var(--ds-ease); }

/* Tab bar overflow menu ("Lainnya") */
.domain-tab-more { display: flex; align-items: stretch; }
.domain-tab-more-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--ds-text-2); font: inherit; font-size: var(--ds-text-base); cursor: pointer; position: relative; }
.domain-tab-more-btn svg path { fill: currentColor; }
.domain-tab-more-btn:hover, .domain-tab-more-btn[aria-expanded="true"] { color: var(--ds-text); }
.domain-tab-more-btn.active { color: var(--ds-primary-text); font-weight: 600; }
.domain-tab-more-btn.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--ds-primary-text); }
.domain-tab-more-btn:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -4px; border-radius: var(--ds-radius-sm); }

/* Language toggle: flag + code, behaves like the theme toggle. */
#langBtn.lang-toggle { width: auto; min-width: 38px; padding: 0 8px; }
.lang-current { gap: 6px; }
.lang-code { font-size: var(--ds-text-xs); font-weight: 650; letter-spacing: .04em; color: currentColor; }

/* 5b. Hamburger: three bars, morphs to X while the mobile drawer is open and
   shortens its middle bar while the desktop rail is collapsed. */
#sidebarToggle .hb-bar { transform-box: fill-box; transform-origin: center; transition: transform var(--ds-base) var(--ds-ease), opacity var(--ds-fast) var(--ds-ease); }
body.sidebar-collapsed #sidebarToggle .hb-mid { transform: scaleX(.6); transform-origin: left center; }
body.sidebar-drawer-open #sidebarToggle .hb-top { transform: translateY(5px) rotate(45deg); }
body.sidebar-drawer-open #sidebarToggle .hb-mid { opacity: 0; transform: scaleX(0); }
body.sidebar-drawer-open #sidebarToggle .hb-bot { transform: translateY(-5px) rotate(-45deg); }

/* 5c. Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; flex: 0 0 auto;
  height: var(--ds-topbar-h); padding: 0 clamp(16px, 2.4vw, 32px);
  background: var(--ds-topbar-bg); border-bottom: 1px solid var(--ds-topbar-border); backdrop-filter: none; box-shadow: none;
}
body.employee-shell .topbar { background: var(--ds-topbar-bg); border-bottom-color: var(--ds-topbar-border); backdrop-filter: none; }
.topbar-left { flex: 1 1 auto; min-width: 0; gap: 12px; }
.topbar-right, .utility-cluster { gap: 6px; }
.topbar-right { flex: 0 0 auto; }
.page-heading { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.topbar h2, body.employee-shell #pageTitle {
  margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ds-topbar-title); font-size: var(--ds-text-lg); font-weight: 650; letter-spacing: -.015em; line-height: 1.25;
}
.topbar p { margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ds-topbar-subtitle); font-size: var(--ds-text-sm); line-height: 1.3; }
.topbar p:empty { display: none; }

/* Topbar icon buttons: one size, one stroke weight, one state model. */
.topbar-icon-btn,
.topbar .icon-btn.topbar-icon-btn,
html[data-ui-profile] .topbar .topbar-icon-btn,
body.employee-shell .topbar-icon-btn,
.user-menu-btn,
body.employee-shell #userMenuBtn {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; min-width: 38px; min-height: 38px; padding: 0;
  border: 1px solid transparent; border-radius: var(--ds-radius-md);
  background: var(--ds-topbar-icon-bg); color: var(--ds-topbar-icon-fg); box-shadow: none; filter: none; cursor: pointer;
}
.user-menu-btn, body.employee-shell #userMenuBtn { background: transparent; }
.topbar-icon-btn svg { width: var(--ds-icon-lg); height: var(--ds-icon-lg); }
.topbar-icon-btn svg path:not([fill^="#"]), .topbar-icon-btn svg rect.hb-bar { fill: currentColor; }
.topbar-icon-btn:hover, .user-menu-btn:hover, html[data-ui-profile] .topbar .topbar-icon-btn:hover:not(:disabled) { background: var(--ds-topbar-icon-hover-bg); color: var(--ds-topbar-icon-hover-fg); border-color: transparent; }
.topbar-icon-btn:active, .user-menu-btn:active { background: var(--ds-primary-soft); color: var(--ds-primary-text); }
.topbar-icon-btn[aria-expanded="true"] { background: var(--ds-primary-soft); color: var(--ds-primary-text); }
.topbar-icon-btn:focus-visible, .user-menu-btn:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 1px; }
.topbar-icon-btn:disabled { opacity: .45; cursor: not-allowed; background: transparent; }
.lang-toggle { width: 38px; height: 38px; }
.lang-flag { box-shadow: 0 0 0 1px var(--ds-border); border-radius: 2px; }
.avatar, body.employee-shell .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ds-primary); color: var(--ds-primary-fg); font-size: 12px; font-weight: 650; box-shadow: none; }
.notif-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border: 2px solid var(--ds-surface); border-radius: var(--ds-radius-pill); background: var(--ds-danger-fill); color: #fff; font-size: 10px; font-weight: 700; line-height: 12px; text-align: center; box-sizing: content-box; }

/* 5d. Domain sub-navigation (tabs inside one domain) */
.domain-tabs {
  display: flex; flex: 0 0 auto; align-items: stretch; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  padding: 0 clamp(16px, 2.4vw, 32px); background: var(--ds-surface); border-bottom: 1px solid var(--ds-border);
}
.domain-tabs::-webkit-scrollbar { display: none; }
.domain-tabs button {
  position: relative; flex: 0 0 auto; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  color: var(--ds-text-2); font: inherit; font-size: var(--ds-text-base); font-weight: 500; white-space: nowrap; cursor: pointer;
}
.domain-tabs button:hover { color: var(--ds-text); background: transparent; }
.domain-tabs button::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background-color var(--ds-fast) var(--ds-ease); }
.domain-tabs button:hover::after { background: var(--ds-border-strong); }
.domain-tabs button.active { background: transparent; color: var(--ds-primary-text); font-weight: 600; }
.domain-tabs button.active::after { background: var(--ds-primary-text); }
.domain-tabs button:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -4px; border-radius: var(--ds-radius-sm); }

/* 6. Cards and sections --------------------------------------------------- */
.card,
.section-card, .panel, .dashboard-card, .chart-card, .analytics-card, .trend-card, .metric-card {
  background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-xs); color: var(--ds-text);
}
.card { padding: var(--ds-space-5); }
.card:hover, .dashboard-card:hover { box-shadow: var(--ds-shadow-xs); }
.section-title { gap: var(--ds-space-3); margin-bottom: var(--ds-space-4); }
.section-title h2, .section-title h3, .card h3 { margin: 0; color: var(--ds-text); font-size: var(--ds-text-md); font-weight: 650; letter-spacing: -.01em; }
.section-title p { margin-top: 2px; font-size: var(--ds-text-sm); }
.grid.cards { gap: var(--ds-space-3); }
.metric { position: relative; padding: var(--ds-space-4); }
.metric::after, .stat-card::after, .metric-card::after { content: none; display: none; }
.metric .label { color: var(--ds-text-2); font-size: var(--ds-text-sm); font-weight: 500; }
.metric .value { color: var(--ds-text); font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric .hint { color: var(--ds-text-3); font-size: var(--ds-text-xs); }

/* 7. Buttons ------------------------------------------------------------
   primary  - one main action per surface
   secondary- neutral bordered action
   ghost    - low-emphasis inline action
   danger   - destructive action (always confirmed in a modal)
   icon-btn - icon-only action, always with aria-label + title         */
.btn,
html[data-ui-profile="desktop"] .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--ds-control-h); padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--ds-radius-md);
  background: var(--ds-surface); color: var(--ds-text);
  font: inherit; font-size: var(--ds-text-base); font-weight: 600; line-height: 1.2; letter-spacing: 0;
  white-space: nowrap; cursor: pointer; box-shadow: none; transform: none; filter: none;
  transition: background-color var(--ds-fast) var(--ds-ease), border-color var(--ds-fast) var(--ds-ease), color var(--ds-fast) var(--ds-ease), box-shadow var(--ds-fast) var(--ds-ease);
}
.btn svg { width: var(--ds-icon-md); height: var(--ds-icon-md); flex: 0 0 auto; }
.btn svg path { fill: currentColor; }

.btn.primary,
html[data-ui-profile="desktop"] .btn.primary,
.login-card .btn.primary { background: var(--ds-primary); border-color: var(--ds-primary); color: var(--ds-primary-fg); box-shadow: var(--ds-shadow-xs); }
.btn.primary:hover:not(:disabled),
html[data-ui-profile="desktop"] .btn.primary:hover:not(:disabled) { background: var(--ds-primary-hover); border-color: var(--ds-primary-hover); color: var(--ds-primary-fg); box-shadow: var(--ds-shadow-xs); transform: none; }
.btn.primary:active:not(:disabled) { background: var(--ds-primary-active); border-color: var(--ds-primary-active); }

.btn.secondary,
html[data-ui-profile="desktop"] .btn.secondary { background: var(--ds-btn-secondary-bg); border-color: var(--ds-border-strong); color: var(--ds-text); }
.btn.secondary:hover:not(:disabled),
html[data-ui-profile="desktop"] .btn.secondary:hover:not(:disabled) { background: var(--ds-btn-secondary-hover); border-color: var(--ds-border-strong); color: var(--ds-text); transform: none; box-shadow: none; }
.btn.secondary:active:not(:disabled) { background: var(--ds-btn-secondary-active); }

.btn.ghost,
html[data-ui-profile="desktop"] .btn.ghost { background: transparent; border-color: transparent; color: var(--ds-primary-text); }
.btn.ghost:hover:not(:disabled),
html[data-ui-profile="desktop"] .btn.ghost:hover:not(:disabled) { background: var(--ds-primary-soft); color: var(--ds-primary-text); }

.btn.danger,
html[data-ui-profile="desktop"] .btn.danger { background: var(--ds-surface); border-color: color-mix(in srgb, var(--ds-danger) 38%, var(--ds-border)); color: var(--ds-danger); }
.btn.danger:hover:not(:disabled),
html[data-ui-profile="desktop"] .btn.danger:hover:not(:disabled) { background: var(--ds-danger-soft); border-color: var(--ds-danger); color: var(--ds-danger); }
.btn.primary.danger, .btn.danger.solid, .modal-actions .btn.danger:not(.secondary) { background: var(--ds-danger-fill); border-color: var(--ds-danger-fill); color: #fff; }
.btn.primary.danger:hover:not(:disabled), .btn.danger.solid:hover:not(:disabled), .modal-actions .btn.danger:not(.secondary):hover:not(:disabled) { background: var(--ds-danger-fill-hover); border-color: var(--ds-danger-fill-hover); color: #fff; }

.btn.sm { min-height: var(--ds-control-h-sm); padding: 0 10px; font-size: var(--ds-text-sm); }
.btn:focus-visible,
html[data-ui-profile="desktop"] .btn:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; box-shadow: none; }
.btn:active:not(:disabled) { transform: none; }

/* (0,3,2): above shell button colours such as body.employee-shell .btn.secondary (0,3,1)
   and [data-theme="dark"] .btn.secondary (0,3,0) in style.css. */
html body .btn:is(.btn):is(:disabled, [aria-disabled="true"]),
html:is([data-ui-profile], [data-ui-preview]) body.employee-shell .profile-photo-form .row-actions .btn:is(.primary, .secondary):is(:disabled, [aria-disabled="true"]),
.btn:disabled,
.btn[aria-disabled="true"],
html[data-ui-profile="desktop"] .btn:disabled,
html[data-ui-profile="desktop"] button.btn:disabled,
html[data-ui-profile="desktop"] button[disabled].btn { opacity: 1; background: var(--ds-btn-disabled-bg); border-color: var(--ds-btn-disabled-border); color: var(--ds-text-3); box-shadow: none; cursor: not-allowed; filter: none; }

/* Loading: keeps width, swaps label emphasis for a spinner. */
.btn.is-busy { position: relative; pointer-events: none; padding-inline-start: 36px; opacity: .85; }
.btn.is-busy::before { content: ""; position: absolute; left: 13px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ds-spin .65s linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* Icon button */
.icon-btn,
html[data-ui-profile="desktop"] .icon-btn,
.toolbar-button, .search-button,
html[data-ui-profile="desktop"] .toolbar-button,
html[data-ui-profile="desktop"] .search-button {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 34px; height: 34px; min-width: 34px; min-height: 34px; padding: 0;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md);
  background: var(--ds-surface); color: var(--ds-text-2); box-shadow: none; filter: none; cursor: pointer; font-size: 15px; line-height: 1;
  transition: background-color var(--ds-fast) var(--ds-ease), border-color var(--ds-fast) var(--ds-ease), color var(--ds-fast) var(--ds-ease);
}
.icon-btn svg { width: var(--ds-icon-md); height: var(--ds-icon-md); }
.icon-btn svg path { fill: currentColor; }
.icon-btn:hover:not(:disabled),
html[data-ui-profile="desktop"] .icon-btn:hover:not(:disabled),
.toolbar-button:hover, .search-button:hover { background: var(--ds-surface-2); border-color: var(--ds-border-strong); color: var(--ds-primary-text); filter: none; }
.icon-btn:active:not(:disabled) { background: var(--ds-surface-3); transform: none; }
.icon-btn:focus-visible,
html[data-ui-profile="desktop"] .icon-btn:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.icon-btn.danger,
html[data-ui-profile="desktop"] .icon-btn.danger { background: var(--ds-surface); border-color: var(--ds-border); color: var(--ds-danger); }
.icon-btn.danger:hover:not(:disabled),
html[data-ui-profile="desktop"] .icon-btn.danger:hover:not(:disabled) { background: var(--ds-danger-soft); border-color: color-mix(in srgb, var(--ds-danger) 40%, var(--ds-border)); color: var(--ds-danger); }
.icon-btn:disabled,
html[data-ui-profile="desktop"] .icon-btn:disabled,
html[data-ui-profile="desktop"] button.icon-btn:disabled { opacity: .45; background: var(--ds-surface); border-color: var(--ds-border); color: var(--ds-text-3); cursor: not-allowed; }
.icon-btn.primary, html[data-ui-profile="desktop"] .icon-btn.primary { background: var(--ds-primary); border-color: var(--ds-primary); color: var(--ds-primary-fg); }
.icon-btn.primary:hover:not(:disabled), html[data-ui-profile="desktop"] .icon-btn.primary:hover:not(:disabled) { background: var(--ds-primary-hover); border-color: var(--ds-primary-hover); color: var(--ds-primary-fg); }
.section-title .icon-btn, .section-title + .toolbar-row .icon-btn { width: var(--ds-control-h); height: var(--ds-control-h); min-width: var(--ds-control-h); min-height: var(--ds-control-h); }
.section-title > div:last-child:not(:first-child) { display: flex; align-items: center; gap: var(--ds-space-2); flex-wrap: wrap; justify-content: flex-end; }
.toolbar-icon-btn { width: 38px; height: 38px; min-width: 38px; min-height: 38px; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
table .row-actions { flex-wrap: nowrap; justify-content: flex-end; }
.row-actions > button:not(.btn):not(.icon-btn) { min-height: var(--ds-control-h-sm); padding: 0 10px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-text-2); }

.dashboard-text-link, .btn-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--ds-primary-text); font: inherit; font-size: var(--ds-text-sm); font-weight: 600; text-decoration: none; cursor: pointer; }
.dashboard-text-link:hover, .btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* 8. Form controls ------------------------------------------------------ */
label, .form-field { color: var(--ds-text-2); }
.form-field__label { color: var(--ds-text-2); font-size: var(--ds-text-sm); font-weight: 600; }
.form-field:focus-within .form-field__label { color: var(--ds-primary-text); }
input, select, textarea {
  min-height: var(--ds-control-h); border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius-md);
  background: var(--ds-surface); color: var(--ds-text); font-size: var(--ds-text-base); box-shadow: none; box-sizing: border-box;
  transition: border-color var(--ds-fast) var(--ds-ease), box-shadow var(--ds-fast) var(--ds-ease);
}
textarea { min-height: 96px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--ds-text-3); opacity: 1; }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: color-mix(in srgb, var(--ds-text-3) 55%, var(--ds-border-strong)); }
input:focus, select:focus, textarea:focus,
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--ds-focus); box-shadow: var(--ds-focus-ring); outline: none; }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--ds-surface-2); color: var(--ds-text-3); cursor: not-allowed; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--ds-danger); }
select { cursor: pointer; color-scheme: light; }
html[data-theme="dark"] select, html[data-theme="dark"] input[type="date"], html[data-theme="dark"] input[type="datetime-local"], html[data-theme="dark"] input[type="month"], html[data-theme="dark"] input[type="time"] { color-scheme: dark; }
input[type="checkbox"], input[type="radio"] { width: 16px; min-width: 16px; height: 16px; min-height: 16px; padding: 0; accent-color: var(--ds-primary); box-shadow: none; cursor: pointer; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; box-shadow: none; }
input[type="file"] { min-height: 0; padding: 6px; }
input[type="color"] { padding: 2px; }
input[type="search"], .search-input { background: var(--ds-surface); }
.form-grid { gap: var(--ds-space-4); }
.field-hint { color: var(--ds-text-3); }

/* Switch: boolean values only. */
.switch-row { gap: var(--ds-space-4); padding: 10px 0; color: var(--ds-text); font-weight: 500; }
.switch { width: 36px; height: 20px; flex: 0 0 36px; border-radius: var(--ds-radius-pill); background: var(--ds-border-strong); transition: background-color var(--ds-base) var(--ds-ease); }
.switch::after { width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform var(--ds-base) var(--ds-ease); }
.switch-input:checked + .switch { background: var(--ds-primary); }
.switch-input:checked + .switch::after { transform: translateX(16px); }
.switch-input:focus-visible + .switch { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.switch-input:disabled + .switch { opacity: .5; cursor: not-allowed; }

/* 9. Badges ------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 2px 8px;
  border: 1px solid transparent; border-radius: var(--ds-radius-pill);
  background: var(--ds-neutral-soft); color: var(--ds-neutral);
  font-size: var(--ds-text-xs); font-weight: 600; line-height: 1.2; letter-spacing: 0; white-space: nowrap;
}
.badge.ok, .badge.success { background: var(--ds-success-soft); color: var(--ds-success); border-color: color-mix(in srgb, var(--ds-success) 20%, transparent); }
.badge.warn, .badge.warning { background: var(--ds-warning-soft); color: var(--ds-warning); border-color: color-mix(in srgb, var(--ds-warning) 22%, transparent); }
.badge.bad, .badge.danger, .badge.error { background: var(--ds-danger-soft); color: var(--ds-danger); border-color: color-mix(in srgb, var(--ds-danger) 20%, transparent); }
.badge.info { background: var(--ds-info-soft); color: var(--ds-info); border-color: color-mix(in srgb, var(--ds-info) 20%, transparent); }
.badge.neutral { background: var(--ds-neutral-soft); color: var(--ds-neutral); border-color: var(--ds-border); }
.badge.indigo { background: var(--ds-indigo-soft); color: var(--ds-indigo); border-color: color-mix(in srgb, var(--ds-indigo) 22%, transparent); }
.badge.purple { background: var(--ds-purple-soft); color: var(--ds-purple); border-color: color-mix(in srgb, var(--ds-purple) 22%, transparent); }

/* 10. Tables ------------------------------------------------------------ */
.table-wrap {
  max-width: 100%; overflow: auto; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface); box-shadow: none;
}
table { width: 100%; border-collapse: collapse; background: var(--ds-surface); color: var(--ds-text); font-size: 13px; }
th {
  position: sticky; top: 0; z-index: 1; padding: 10px 12px;
  background: var(--ds-table-head); color: var(--ds-text-3); border-bottom: 1px solid var(--ds-border);
  font-size: var(--ds-text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; text-align: left; vertical-align: middle;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--ds-border); color: var(--ds-text); vertical-align: middle; }
html[data-ui-profile="desktop"] :is(th, td) { padding: 10px 12px; }
th:last-child, td:last-child { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transform: none; transition: background-color var(--ds-fast) var(--ds-ease); }
tbody tr:hover,
html[data-ui-profile="desktop"] .table-wrap tbody tr:hover { background: var(--ds-surface-2); transform: none; }
td .muted, td small { color: var(--ds-text-3); }
table input[type="checkbox"] { accent-color: var(--ds-primary); }

/* Stacked cells and a sticky action column for wide registries. */
.cell-stack { display: grid; gap: 2px; min-width: 0; }
.cell-main { color: var(--ds-text); font-weight: 500; }
.cell-sub { color: var(--ds-text-3); font-size: var(--ds-text-sm); }
.pa-people-table td { white-space: normal; }
.pa-people-table td .cell-stack span { overflow-wrap: anywhere; }
.pa-people-table :is(th, td):last-child { position: sticky; right: 0; z-index: 1; background: var(--ds-surface); box-shadow: -1px 0 0 var(--ds-border); }
.pa-people-table th:last-child { z-index: 2; background: var(--ds-table-head); }
.pa-people-table tbody tr:hover td:last-child { background: var(--ds-surface-2); }
/* The sticky action cell is its own stacking context: lift the one whose row menu is open. */
.pa-people-table td:last-child:has(.row-menu-trigger[aria-expanded="true"]) { z-index: 5; }

/* One empty state for every table (table() helper). */
.table-empty-state { min-height: 96px; padding: var(--ds-space-5) var(--ds-space-4); color: var(--ds-text-3); }

/* Interactive rows: the whole row opens its detail; inner controls keep their own action. */
tr.is-clickable-row { cursor: pointer; }
tr.is-clickable-row:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -2px; background: var(--ds-surface-2); }
tr.is-clickable-row:hover td { background: var(--ds-surface-2); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-top: var(--ds-space-3); color: var(--ds-text-3); font-size: var(--ds-text-sm); }
.pagination button, .page-size { min-width: 32px; min-height: var(--ds-control-h-sm); padding: 0 10px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-text-2); cursor: pointer; }
.pagination button:hover:not(:disabled) { background: var(--ds-surface-2); color: var(--ds-text); }
.pagination button.active, .pagination button[aria-current="page"] { background: var(--ds-primary-soft); border-color: color-mix(in srgb, var(--ds-primary) 35%, var(--ds-border)); color: var(--ds-primary-text); font-weight: 600; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }

/* Toolbars and filters */
.toolbar, .table-toolbar, .filters, .page-actions, .section-actions, .toolbar-row, .toolbar-actions { gap: var(--ds-space-2); }
.toolbar, .table-toolbar { padding: var(--ds-space-3); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); }
.toolbar-row .btn, .toolbar-actions .btn { min-height: var(--ds-control-h); padding: 0 12px; font-size: var(--ds-text-base); }
.toolbar-row input[type="search"], .toolbar-row select { min-height: var(--ds-control-h); }
.finance-filters { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); padding: var(--ds-space-3); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); align-items: end; }
.finance-filters input, .finance-filters select { width: 100%; min-width: 0; }
.finance-filters input[type="search"] { grid-column: 1 / -1; }

/* Empty, loading, notice */
.empty { display: grid; place-items: center; min-height: 96px; padding: var(--ds-space-6) var(--ds-space-4); color: var(--ds-text-3); font-size: var(--ds-text-base); text-align: center; }
.empty-state, .loading-state { display: grid; place-items: center; align-content: center; gap: 6px; min-height: 120px; padding: var(--ds-space-6) var(--ds-space-4); border: 1px dashed var(--ds-border-strong); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); color: var(--ds-text-2); text-align: center; }
.route-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 120px; color: var(--ds-text-3); font-size: var(--ds-text-base); }
.route-loading::before { content: ""; width: 16px; height: 16px; border: 2px solid var(--ds-border-strong); border-top-color: var(--ds-primary-text); border-radius: 50%; animation: ds-spin .7s linear infinite; }
.skeleton, .loading-skeleton, .skeleton-line { position: relative; overflow: hidden; min-height: 12px; border-radius: var(--ds-radius-sm); background: linear-gradient(90deg, var(--ds-surface-2) 25%, var(--ds-surface-3) 37%, var(--ds-surface-2) 63%); background-size: 400% 100%; animation: ds-skeleton 1.35s ease infinite; }
.skeleton-line { width: 70%; height: 12px; }
@keyframes ds-skeleton { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.notice { padding: 12px 14px; border: 1px solid var(--notice-border); border-radius: var(--ds-radius-md); background: var(--ds-info-soft); color: var(--ds-text-2); font-size: var(--ds-text-base); }
.notice.warn, .notice.warning { color: var(--ds-text); background: var(--ds-warning-soft); border-color: color-mix(in srgb, var(--ds-warning) 25%, transparent); }
.notice.bad, .notice.danger, .notice.error { color: var(--ds-text); background: var(--ds-danger-soft); border-color: color-mix(in srgb, var(--ds-danger) 25%, transparent); }
.notice.ok, .notice.success { color: var(--ds-text); background: var(--ds-success-soft); border-color: color-mix(in srgb, var(--ds-success) 25%, transparent); }

/* 11. In-page tabs (modal sections) and segmented controls --------------- */
.modal-tabs, .tabs, .tab-list { display: flex; align-items: stretch; gap: 4px; flex-wrap: wrap; margin-bottom: var(--ds-space-4); border-bottom: 1px solid var(--ds-border); }
.modal-tabs button, .tabs button, .tab-list button, [role="tab"] {
  position: relative; min-height: 38px; padding: 0 12px; border: 0; border-radius: 0; background: transparent; color: var(--ds-text-2); font: inherit; font-size: var(--ds-text-base); font-weight: 500; white-space: nowrap; cursor: pointer;
}
.modal-tabs button:hover, .tabs button:hover, .tab-list button:hover, [role="tab"]:hover { background: transparent; color: var(--ds-text); }
.modal-tabs button.active, .tabs button.active, .tab-list button.active, [role="tab"][aria-selected="true"] { background: transparent; color: var(--ds-primary-text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ds-primary-text); }
.modal-tabs button:focus-visible, .tabs button:focus-visible, .tab-list button:focus-visible, [role="tab"]:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -3px; border-radius: var(--ds-radius-sm); }

.segmented { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface-2); }
.segmented button { min-height: 28px; padding: 0 10px; border: 0; border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-text-2); font: inherit; font-size: var(--ds-text-sm); font-weight: 500; cursor: pointer; white-space: nowrap; }
.segmented button:hover { color: var(--ds-text); }
.segmented button[aria-pressed="true"] { background: var(--ds-surface); color: var(--ds-text); font-weight: 600; box-shadow: var(--ds-shadow-sm); }
html[data-theme="dark"] .segmented button[aria-pressed="true"] { background: var(--ds-surface-3); }
.segmented button:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 0; }

/* 12. Dropdown menus (small menus and secondary actions) ----------------- */
.dropdown-menu {
  min-width: 200px; padding: 6px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg);
  background: var(--ds-surface-elevated); color: var(--ds-text); box-shadow: var(--ds-shadow-lg);
  transform-origin: top right; animation: ds-menu-in var(--ds-fast) var(--ds-ease) both;
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 8px 10px;
  border: 0; border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-text); font: inherit; font-size: var(--ds-text-base); text-align: left; cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--ds-surface-3); color: var(--ds-text); outline: none; }
.dropdown-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ds-focus); }
.dropdown-item.active { color: var(--ds-primary-text); font-weight: 600; }
.dropdown-item.danger { color: var(--ds-danger); }
.dropdown-item.danger:hover, .dropdown-item.danger:focus-visible { background: var(--ds-danger-soft); color: var(--ds-danger); }
.dropdown-item svg { width: var(--ds-icon-sm); height: var(--ds-icon-sm); flex: 0 0 auto; color: var(--ds-text-3); }
.dropdown-user-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--ds-border); color: var(--ds-text); }
.dropdown-user-name { color: var(--ds-text); font-size: var(--ds-text-base); font-weight: 600; }
.dropdown-user-role { color: var(--ds-text-3); font-size: var(--ds-text-sm); }
.lang-option-check { display: inline-grid; place-items: center; color: var(--ds-primary-text); }
.lang-option-check svg path, .row-chevron svg path, .attendance-history-chevron svg path { fill: currentColor; }
.row-chevron { display: inline-grid; place-items: center; color: var(--ds-text-3); font-weight: 400; }
.attendance-history-chevron { display: inline-grid; place-items: center; }
.notif-dropdown { width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 520px); overflow-y: auto; }
.notif-section-label { padding: 8px 10px 4px; color: var(--ds-text-3); font-size: var(--ds-text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.notif-item { align-items: flex-start; }
.notif-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border-radius: var(--ds-radius-md); background: var(--ds-primary-soft); color: var(--ds-primary-text); }
.notif-icon svg { width: 16px; height: 16px; color: currentColor; }
.notif-body { display: grid; gap: 2px; min-width: 0; }
.notif-title { color: var(--ds-text); font-weight: 600; }
.notif-summary, .notif-date, .notif-status { color: var(--ds-text-3); font-size: var(--ds-text-sm); }
.notif-dot { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 6px; border-radius: 50%; background: var(--ds-primary-text); }
.notif-empty { padding: 24px 12px; color: var(--ds-text-3); text-align: center; }
/* Row action menu: secondary actions of a table row or card. */
.personnel-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: nowrap; }
.row-menu { position: relative; display: inline-flex; }
.row-menu .dropdown-menu { z-index: var(--z-dropdown, 60); min-width: 210px; text-align: left; }
.row-menu .dropdown-item { white-space: nowrap; }
.row-menu-trigger[aria-expanded="true"] { background: var(--ds-surface-3); border-color: var(--ds-border-strong); color: var(--ds-text); }
@keyframes ds-menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* 13. Modal (confirmations, short detail) and drawer (long forms) -------- */
.modal-overlay, .drawer-overlay { background: var(--ds-overlay); backdrop-filter: none; overscroll-behavior: contain; }
.modal-overlay { animation: ds-fade-in var(--ds-base) var(--ds-ease) both; }
.modal-card {
  width: min(560px, 100%); max-height: min(92vh, 900px);
  background: var(--ds-surface-elevated); color: var(--ds-text);
  border: 1px solid var(--ds-border); border-radius: 14px; box-shadow: var(--ds-shadow-lg);
  animation: ds-modal-in var(--ds-slow) var(--ds-ease) both;
}
.modal-card.modal-small { max-width: 420px; }
.modal-card.modal-medium { max-width: 560px; }
.modal-card.modal-large { width: min(760px, 100%); max-width: 760px; }
.modal-overlay { padding: 16px; }
.modal-card { max-height: calc(100dvh - 32px); overflow: hidden; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal-head,
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-4);
  padding: 16px 20px; background: transparent; border-bottom: 1px solid var(--ds-border);
}
.modal-head h3, .drawer-head h3 { margin: 0; color: var(--ds-text); font-size: var(--ds-text-md); font-weight: 650; letter-spacing: -.01em; }
.modal-subtitle { margin: 2px 0 0; color: var(--ds-text-3); font-size: var(--ds-text-sm); }
.modal-body { padding: 20px; color: var(--ds-text); }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--ds-space-2); margin-top: var(--ds-space-5); padding: 0; border-top: 0; }
.modal-body > .modal-actions, .modal-body form > .modal-actions, .modal-body > .stack > .modal-actions, .modal-body form > .stack > .modal-actions { position: sticky; bottom: -20px; z-index: 2; margin-bottom: -20px; padding-bottom: 16px; background: var(--ds-surface-elevated); }
.modal-body > .modal-actions, .modal-body form > .modal-actions, .modal-body > .stack > .modal-actions, .modal-body form > .stack > .modal-actions { margin-inline: -20px; padding: 16px 20px; border-top: 1px solid var(--ds-border); }
.modal-close {
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 0;
  border: 0; border-radius: var(--ds-radius-md); background: transparent; color: var(--ds-text-3); cursor: pointer;
}
.modal-close svg path { fill: currentColor; }
.modal-close:hover { background: var(--ds-surface-3); color: var(--ds-text); }
.modal-close:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 1px; }
.android-modal-icon { background: var(--ds-primary-soft); color: var(--ds-primary-text); }

.drawer-overlay { position: fixed; inset: 0; z-index: var(--z-modal-overlay, 300); display: flex; justify-content: flex-end; opacity: 0; transition: opacity var(--ds-base) var(--ds-ease); }
.drawer-overlay.is-open { opacity: 1; }
.drawer-panel { display: flex; flex-direction: column; width: min(600px, 100vw); height: 100%; overflow: hidden; background: var(--ds-surface-elevated); color: var(--ds-text); border-left: 1px solid var(--ds-border); box-shadow: var(--ds-shadow-lg); transform: translateX(100%); transition: transform var(--ds-slow) var(--ds-ease); }
.drawer-panel.drawer-small { width: min(420px, 100vw); }
.drawer-panel.drawer-large { width: min(760px, 100vw); }
.drawer-overlay.is-open .drawer-panel { transform: none; }
.drawer-head { position: sticky; top: 0; z-index: 1; background: var(--ds-surface-elevated); }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px; }
.drawer-body .modal-actions { position: sticky; bottom: -20px; margin: 20px -20px -20px; padding: 14px 20px; background: var(--ds-surface-elevated); }
@keyframes ds-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ds-modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* 14. Toast (short feedback) -------------------------------------------- */
#toast { z-index: 1000; white-space: pre-wrap; overflow-wrap: anywhere; }
.toast {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--ds-border); border-left: 3px solid var(--ds-success); border-radius: var(--ds-radius-md);
  background: var(--ds-surface-elevated); color: var(--ds-text); box-shadow: var(--ds-shadow-lg);
  font-size: var(--ds-text-base); font-weight: 500; line-height: 1.45; text-align: left;
}
.toast.error { background: var(--ds-surface-elevated); color: var(--ds-text); border-color: var(--ds-border); border-left-color: var(--ds-danger); }
.toast:not(.show) { visibility: hidden; transition: opacity var(--ds-base) var(--ds-ease), transform var(--ds-base) var(--ds-ease), visibility 0s linear var(--ds-base); }
.toast.show { visibility: visible; pointer-events: auto; }
.toast-icon { display: inline-grid; place-items: center; flex: 0 0 auto; color: var(--ds-success); }
.toast.error .toast-icon { color: var(--ds-danger); }
.toast-icon svg path, .toast-close svg path { fill: currentColor; }
.toast-msg { flex: 1 1 auto; min-width: 0; }
.toast-close { display: inline-grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; margin: -4px -6px -4px 4px; padding: 0; border: 0; border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-text-3); cursor: pointer; }
.toast-close:hover { background: var(--ds-surface-3); color: var(--ds-text); }
.toast-close:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 1px; }
.auth-toast { background: var(--ds-surface-elevated); color: var(--ds-text); border-color: color-mix(in srgb, var(--ds-danger) 45%, var(--ds-border)); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-lg); }

/* 15. Dashboard --------------------------------------------------------- */
#content.content:has(> .dashboard-layout) { container-type: inline-size; container-name: dash; }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ds-space-4); align-items: stretch; }
@container dash (min-width: 880px) {
  .dashboard-layout { grid-template-columns: minmax(340px, 5fr) minmax(0, 7fr); }
}
.dashboard-summary, .dashboard-trend {
  display: flex; flex-direction: column; min-width: 0; padding: var(--ds-space-5);
  background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-xs);
}
.dashboard-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ds-space-3); margin-bottom: var(--ds-space-4); }
.dashboard-section-head h3 { margin: 0; color: var(--ds-text); font-size: var(--ds-text-md); font-weight: 650; line-height: 1.35; letter-spacing: -.01em; }
.dashboard-section-sub { display: block; margin: 2px 0 0; color: var(--ds-text-3); font-size: var(--ds-text-sm); }

.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-3); }
.kpi {
  --kpi-bg: var(--ds-surface); --kpi-border: var(--ds-border); --kpi-icon-bg: var(--ds-neutral-soft); --kpi-accent: var(--ds-neutral); --kpi-value: var(--ds-kpi-value);
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label icon" "value icon" "hint hint";
  align-items: start; column-gap: var(--ds-space-2); row-gap: 2px; min-width: 0; padding: 14px;
  border: 1px solid var(--kpi-border); border-radius: var(--ds-radius-md); background: var(--kpi-bg);
  color: var(--ds-text); text-align: left; text-decoration: none; cursor: pointer;
  transition: border-color var(--ds-fast) var(--ds-ease), background-color var(--ds-fast) var(--ds-ease), box-shadow var(--ds-fast) var(--ds-ease);
}
.kpi--success { --kpi-bg: var(--ds-kpi-success-bg); --kpi-border: var(--ds-kpi-success-border); --kpi-icon-bg: var(--ds-kpi-success-icon-bg); --kpi-accent: var(--ds-kpi-success-accent); }
.kpi--warning { --kpi-bg: var(--ds-kpi-warning-bg); --kpi-border: var(--ds-kpi-warning-border); --kpi-icon-bg: var(--ds-kpi-warning-icon-bg); --kpi-accent: var(--ds-kpi-warning-accent); }
.kpi--danger { --kpi-bg: var(--ds-kpi-danger-bg); --kpi-border: var(--ds-kpi-danger-border); --kpi-icon-bg: var(--ds-kpi-danger-icon-bg); --kpi-accent: var(--ds-kpi-danger-accent); }
.kpi--info { --kpi-bg: var(--ds-kpi-info-bg); --kpi-border: var(--ds-kpi-info-border); --kpi-icon-bg: var(--ds-kpi-info-icon-bg); --kpi-accent: var(--ds-kpi-info-accent); }
.kpi--indigo { --kpi-bg: var(--ds-kpi-indigo-bg); --kpi-border: var(--ds-kpi-indigo-border); --kpi-icon-bg: var(--ds-kpi-indigo-icon-bg); --kpi-accent: var(--ds-kpi-indigo-accent); }
.kpi--purple { --kpi-bg: var(--ds-kpi-purple-bg); --kpi-border: var(--ds-kpi-purple-border); --kpi-icon-bg: var(--ds-kpi-purple-icon-bg); --kpi-accent: var(--ds-kpi-purple-accent); }
.kpi.is-static { cursor: default; }
.kpi.is-static:hover { box-shadow: none; border-color: var(--kpi-border); }
.kpi-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: var(--ds-space-4); }
.kpi--warning.has-value { --kpi-value: var(--ds-kpi-value-warning); }
.kpi--danger.has-value { --kpi-value: var(--ds-kpi-value-danger); }
/* Light: a small lift and a stronger tone border. Dark: the previous
   neutral hover (mix 0% keeps the border-strong colour, shadow none). */
.kpi:hover { border-color: color-mix(in srgb, var(--kpi-accent) var(--ds-kpi-hover-mix), var(--ds-border-strong)); box-shadow: var(--ds-kpi-hover-shadow); }
html[data-theme="dark"] .kpi:not(.is-static):hover { background: color-mix(in srgb, var(--kpi-accent) 13%, var(--ds-surface)); }
.kpi:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.kpi-label { grid-area: label; color: var(--ds-text-2); font-size: var(--ds-text-sm); font-weight: 600; }
.kpi-value { grid-area: value; color: var(--kpi-value); font-size: var(--ds-text-kpi); font-weight: 650; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-hint { grid-area: hint; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ds-text-3); font-size: var(--ds-text-xs); }
.kpi-icon { grid-area: icon; display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--ds-radius-md); background: var(--kpi-icon-bg); color: var(--kpi-accent); }
.kpi-icon svg { width: 17px; height: 17px; }
.kpi-icon svg path { fill: currentColor; }

.dashboard-secondary { margin-top: var(--ds-space-4); padding-top: var(--ds-space-3); border-top: 1px solid var(--ds-border); }
.dashboard-secondary-title { display: block; margin-bottom: var(--ds-space-2); color: var(--ds-text-3); font-size: var(--ds-text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.dashboard-secondary-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.status-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; min-height: 32px; padding: 0 10px;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface-2);
  color: var(--ds-text-2); font-size: var(--ds-text-sm); text-decoration: none; cursor: pointer;
}
.status-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-chip strong { color: var(--ds-text); font-weight: 650; font-variant-numeric: tabular-nums; }
.status-chip:hover { border-color: var(--ds-border-strong); color: var(--ds-text); }
.status-chip:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 1px; }

/* Trend chart: stacked status bars, sized to its container. */
.dashboard-trend .dashboard-section-head { align-items: center; flex-wrap: wrap; }
.dashboard-trend .dashboard-section-head > div:first-child { min-width: 0; flex: 1 1 180px; }
.segmented { flex: 0 0 auto; flex-wrap: nowrap; }
.trend-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 var(--ds-space-3); padding: 0; color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-item strong { color: var(--ds-text); font-weight: 650; font-variant-numeric: tabular-nums; }
.legend-dot { display: inline-block; width: 10px; height: 10px; flex: 0 0 10px; margin: 0; border-radius: 3px; }
.trend-body { position: relative; display: flex; flex: 1 1 auto; min-height: var(--trend-min-h, 200px); }
.trend-chart-wrap { position: relative; flex: 1 1 auto; min-width: 0; min-height: var(--trend-min-h, 200px); border-radius: var(--ds-radius-md); outline: none; }
.trend-chart-wrap:focus-visible { box-shadow: 0 0 0 2px var(--ds-focus); }
.trend-chart-wrap svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.trend-axis text { fill: var(--ds-text-3); font-family: var(--ds-font); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend-grid line { stroke: var(--ds-chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.trend-grid line.baseline { stroke: var(--ds-border-strong); }
.trend-band { fill: var(--ds-surface-3); opacity: 0; transition: opacity var(--ds-fast) var(--ds-ease); }
.trend-col.is-active .trend-band { opacity: 1; }
.trend-seg { stroke: var(--ds-surface); stroke-width: 1; }
.trend-dense .trend-seg { stroke-width: 0; }
.trend-seg-present { fill: var(--ds-chart-present); }
.trend-seg-late { fill: var(--ds-chart-late); }
.trend-seg-absent { fill: var(--ds-chart-absent); }
.trend-seg-incomplete { fill: var(--ds-chart-incomplete); }
.legend-dot.trend-seg-present { background: var(--ds-chart-present); }
.legend-dot.trend-seg-late { background: var(--ds-chart-late); }
.legend-dot.trend-seg-absent { background: var(--ds-chart-absent); }
.legend-dot.trend-seg-incomplete { background: var(--ds-chart-incomplete); }
.trend-tooltip {
  position: absolute; z-index: 4; min-width: 168px; padding: 10px 12px; pointer-events: none;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface-elevated); color: var(--ds-text); box-shadow: var(--ds-shadow-md);
  font-size: var(--ds-text-sm); white-space: nowrap; transform: none;
}
.trend-tooltip[hidden] { display: none; }
.trend-tooltip-date { margin-bottom: 6px; color: var(--ds-text); font-weight: 650; }
.trend-tooltip-row { display: flex; align-items: center; gap: 8px; line-height: 1.6; color: var(--ds-text-2); }
.trend-tooltip-row strong { margin-left: auto; color: var(--ds-text); font-variant-numeric: tabular-nums; }
.trend-empty { display: grid; place-items: center; align-content: center; gap: 6px; flex: 1 1 auto; min-height: 160px; padding: var(--ds-space-4); border: 1px dashed var(--ds-border-strong); border-radius: var(--ds-radius-md); color: var(--ds-text-3); font-size: var(--ds-text-base); text-align: center; }
.trend-empty svg { width: 22px; height: 22px; color: var(--ds-text-3); }
.trend-empty svg path { fill: currentColor; }

/* Security page: three summary cards, a highlighted MFA section, and
   structured empty rows. Tones reuse the status tokens above. */
.security-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.security-metric, .security-callout { --tone-strip: var(--ds-border); --tone-bg: var(--ds-surface); --tone-border: var(--ds-border); border-color: var(--tone-border); border-left: var(--ds-strip-width) solid var(--tone-strip); }
.security-callout { background: var(--tone-bg); }
.security-metric.tone-success, .security-callout.tone-success { --tone-strip: var(--ds-kpi-success-strip); --tone-bg: var(--ds-kpi-success-bg); --tone-border: var(--ds-kpi-success-border); }
.security-metric.tone-warning, .security-callout.tone-warning { --tone-strip: var(--ds-kpi-warning-strip); --tone-bg: var(--ds-kpi-warning-bg); --tone-border: var(--ds-kpi-warning-border); }
.security-metric.tone-info, .security-callout.tone-info { --tone-strip: var(--ds-kpi-info-strip); --tone-bg: var(--ds-kpi-info-bg); --tone-border: var(--ds-kpi-info-border); }
.security-metric { --tone-border: var(--ds-border); }
.security-metric strong { color: var(--ds-text); font-size: 22px; font-weight: 650; }
.monitor-page > .card + .card, .monitor-page > .monitor-grid + .card { margin-top: var(--ds-space-4); }
.monitor-page .card > h3 { margin: 0 0 var(--ds-space-3); }
.table-empty { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; color: var(--ds-text-3); font-size: var(--ds-text-base); text-align: center; white-space: normal; }
.table-empty svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ds-success); }
.table-empty svg path { fill: currentColor; }
td.table-empty-cell { text-align: center; }
@media (max-width: 720px) { .security-metrics { grid-template-columns: minmax(0, 1fr); } }

/* Sistem: one card per feature, each with its category accent (strip, tint,
   border, icon). Status colour stays on the badge. Max 5 columns. */
.system-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(240px, calc((100% - 4 * var(--ds-space-4)) / 5)), 1fr)); grid-auto-rows: 1fr; gap: var(--ds-space-4); }
.system-card {
  --card-accent: var(--ds-primary-text);
  display: flex; flex-direction: column; gap: var(--ds-space-2); min-width: 0; min-height: 188px; padding: var(--ds-space-4) var(--ds-space-4) var(--ds-space-4) calc(var(--ds-space-4) + 1px);
  border: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border)); border-left: 4px solid var(--card-accent); border-radius: var(--ds-radius-lg);
  background: color-mix(in srgb, var(--card-accent) var(--ds-cat-tint), var(--ds-surface)); color: var(--ds-text); cursor: pointer;
  transition: border-color var(--ds-fast) var(--ds-ease), box-shadow var(--ds-fast) var(--ds-ease), transform var(--ds-fast) var(--ds-ease);
}
.system-card[data-system-card="branding"] { --card-accent: var(--ds-cat-indigo); }
.system-card[data-system-card="kta"] { --card-accent: var(--ds-cat-violet); }
.system-card[data-system-card="attendance"] { --card-accent: var(--ds-cat-teal); }
.system-card[data-system-card="email"] { --card-accent: var(--ds-cat-blue); }
.system-card[data-system-card="whatsapp"] { --card-accent: var(--ds-cat-green); }
.system-card[data-system-card="notifications"] { --card-accent: var(--ds-cat-amber); }
.system-card[data-system-card="backup"] { --card-accent: var(--ds-cat-cyan); }
.system-card[data-system-card="apiintegration"] { --card-accent: var(--ds-cat-orange); }
.system-card[data-system-card="update"] { --card-accent: var(--ds-cat-red); }
.system-card[data-system-card="android"] { --card-accent: var(--ds-cat-purple); }
.system-card[data-system-card="systemMonitoring"] { --card-accent: var(--ds-cat-blue); }
.system-card[data-system-card="security"] { --card-accent: var(--ds-cat-emerald); }
.system-card:hover { box-shadow: var(--ds-shadow-md); transform: translateY(-1px); }
.system-card:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.system-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-2); }
.system-card-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: var(--ds-radius-md); background: color-mix(in srgb, var(--card-accent) var(--ds-cat-icon-bg), var(--ds-surface)); color: var(--card-accent); }
.system-card-icon svg path { fill: currentColor; }
.system-card h4 { margin: 4px 0 0; color: var(--ds-text); font-size: var(--ds-text-md); font-weight: 650; }
.system-card p { margin: 0; color: var(--ds-text-2); font-size: var(--ds-text-sm); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.system-card-foot { display: flex; justify-content: flex-end; margin-top: auto; padding-top: var(--ds-space-2); }
.system-card .badge { max-width: 72%; white-space: normal; text-align: center; line-height: 1.25; }

/* Monitoring: collector not available. */
.monitor-empty { gap: 8px; min-height: 180px; }
.monitor-empty strong { color: var(--ds-text); font-size: var(--ds-text-md); font-weight: 650; }
.monitor-empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--ds-radius-lg); background: color-mix(in srgb, var(--ds-cat-blue) var(--ds-cat-icon-bg), var(--ds-surface)); color: var(--ds-cat-blue); }
.monitor-empty-icon svg path { fill: currentColor; }

/* Monitoring / Keamanan inside a modal: the modal title replaces the page heading. */
.system-page-modal .monitor-page > .section-title h3 { display: none; }
.system-page-modal .monitor-page { max-width: none; }
.system-page-modal .monitor-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* Kehadiran: Kebijakan Lembur action card in the summary header. */
.kh-summary-head { align-items: center; flex-wrap: wrap; }
.kh-policy-slot:empty { display: none; }
.policy-card { --card-accent: var(--ds-cat-purple); display: flex; align-items: center; gap: var(--ds-space-3); max-width: 520px; padding: 8px 10px 8px 12px; border: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border)); border-left: 3px solid var(--card-accent); border-radius: var(--ds-radius-md); background: color-mix(in srgb, var(--card-accent) var(--ds-cat-tint), var(--ds-surface)); }
.policy-card-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--ds-radius-md); background: color-mix(in srgb, var(--card-accent) var(--ds-cat-icon-bg), var(--ds-surface)); color: var(--card-accent); }
.policy-card-icon svg path { fill: currentColor; }
.policy-card-copy { display: grid; gap: 2px; min-width: 0; }
.policy-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.policy-card-title strong { color: var(--ds-text); font-size: var(--ds-text-base); font-weight: 650; }
.policy-card-summary { color: var(--ds-text-2); font-size: var(--ds-text-sm); }

/* Gudang: filters in one row on desktop, one column on mobile. */
.inventory-section-head { flex-wrap: wrap; }
.inventory-filters { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 240px); gap: var(--ds-space-2); align-items: center; }
.inventory-filters > select, .inventory-filters > input { width: 100%; min-width: 0; }
.inventory-section .table-wrap, .inventory-section .table-empty-state { margin-top: 0; }

/* Kunjungan: status tabs above the filters. */
.visit-status-tabs { margin: 0 0 var(--ds-space-4); }

/* KTA front: logo header, large photo, name, fields, status + QR footer. */
.kta-sheet.kta-front { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; padding: 14px 14px 12px; text-align: center; }
.kta-front-head { display: grid; justify-items: center; gap: 4px; }
.kta-front .kta-preview-logo { max-width: 128px; max-height: 40px; margin: 0 auto; }
.kta-regulation .kta-preview-logo { max-width: 112px; max-height: 36px; margin: 2px auto 6px; }
.kta-front .kta-identity-company, .kta-front .kta-issuer { font-size: 8.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; max-height: none; }
.kta-front .kta-photo-frame, .kta-front .kta-profile-photo-frame { width: 104px; height: 126px; margin: 6px auto 2px; border-radius: 8px; box-shadow: 0 0 0 2px rgba(23, 32, 51, .08); }
.kta-front .kta-preview-photo, .kta-front .kta-avatar-placeholder { width: 104px; height: 126px; margin: 0; border-radius: 8px; }
.kta-front .kta-photo-missing .kta-avatar-placeholder { width: 52px; height: 62px; }
.kta-front-name { margin-top: 4px; font-size: 15px; font-weight: 750; line-height: 1.2; overflow-wrap: anywhere; }
.kta-front-fields { display: grid; gap: 2px; margin: 0; }
.kta-front-fields > div { display: flex; justify-content: center; gap: 5px; font-size: 9.5px; line-height: 1.35; }
.kta-front-fields dt { opacity: .7; }
.kta-front-fields dd { margin: 0; font-weight: 650; }
.kta-unset { font-style: italic; font-weight: 500; opacity: .75; }
.kta-front-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid rgba(23, 32, 51, .12); text-align: left; }
.kta-front-foot > div { display: grid; gap: 2px; min-width: 0; }
.kta-front-foot b { font-size: 9px; letter-spacing: .04em; }
.kta-front-foot small { font-size: 7.5px; line-height: 1.3; opacity: .8; }
.kta-front .kta-verify-note { margin: 0; font-size: 7px; }
.kta-front .kta-qr { width: 60px; height: 60px; flex: 0 0 60px; }
.kta-qr-placeholder { width: 52px; height: 52px; flex: 0 0 52px; border: 1px dashed rgba(23, 32, 51, .3); border-radius: 6px; }

/* 16. Kehadiran (attendance hub) ---------------------------------------- */
.summary-strip { gap: var(--ds-space-2); }
.summary-strip .stat-card,
.stat-card {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-width: 0;
  padding: 12px 14px; overflow: visible; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md);
  background: var(--ds-surface); color: var(--ds-text); text-align: left; box-shadow: none; filter: none; cursor: pointer;
}
.stat-card:hover { border-color: var(--ds-border-strong); background: var(--ds-surface-2); filter: none; }
.stat-card[data-status="PRESENT"] { background: var(--ds-kpi-success-bg); border-color: var(--ds-kpi-success-border); }
.stat-card[data-status="LATE"] { background: var(--ds-kpi-warning-bg); border-color: var(--ds-kpi-warning-border); }
.stat-card[data-status="ABSENT"] { background: var(--ds-kpi-danger-bg); border-color: var(--ds-kpi-danger-border); }
.stat-card[data-status="INCOMPLETE"] { background: var(--ds-kpi-indigo-bg); border-color: var(--ds-kpi-indigo-border); }
.stat-card[data-kpi="OVERTIME_ACTIVE"] { background: var(--ds-kpi-purple-bg); border-color: var(--ds-kpi-purple-border); }
.stat-card[data-status="PRESENT"] .l { color: var(--ds-kpi-success-label); }
.stat-card[data-status="LATE"] .l { color: var(--ds-kpi-warning-label); }
.stat-card[data-status="ABSENT"] .l { color: var(--ds-kpi-danger-label); }
.stat-card[data-status="INCOMPLETE"] .l { color: var(--ds-kpi-indigo-label); }
.stat-card[data-kpi="OVERTIME_ACTIVE"] .l { color: var(--ds-kpi-purple-label); }
.stat-card[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ds-primary-text); }
.kh-filter-note { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-3); flex-wrap: wrap; margin: 0 0 var(--ds-space-3); padding: 8px 12px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface-2); color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.kh-filter-note strong { color: var(--ds-text); }
.attendance-flag.purple { color: var(--ds-purple); background: var(--ds-purple-soft); }
.stat-card[data-status]:not([data-status=""]):hover { box-shadow: var(--ds-kpi-hover-shadow); }
html[data-theme="dark"] .stat-card:not([data-status]):not([data-kpi]):hover { background: var(--ds-surface-2); border-color: var(--ds-border-strong); }
html[data-theme="dark"] .stat-card:is([data-status], [data-kpi]):hover { border-color: var(--ds-border-strong); }
.stat-card:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.stat-card.active, .stat-card[aria-pressed="true"] { border-color: var(--ds-primary-text); }
.stat-card .n { order: 2; color: var(--ds-text); font-size: 22px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-card .l { order: 1; margin: 0; color: var(--ds-text-2); font-size: var(--ds-text-sm); font-weight: 500; letter-spacing: 0; text-transform: none; }
.attendance-status-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.attendance-flag { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--ds-radius-sm); color: var(--ds-text-3); }
.attendance-flag svg { width: 15px; height: 15px; }
.attendance-flag svg path { fill: currentColor; }
.attendance-flag.warn { color: var(--ds-warning); background: var(--ds-warning-soft); }
.attendance-flag.info { color: var(--ds-info); background: var(--ds-info-soft); }
.attendance-cell-stack { display: grid; gap: 2px; min-width: 0; }
.attendance-cell-stack strong { color: var(--ds-text); font-weight: 600; }
.attendance-muted, .attendance-subline { color: var(--ds-text-3); font-size: var(--ds-text-sm); }
.attendance-subline.is-warn { color: var(--ds-warning); }
.attendance-time { color: var(--ds-text); font-variant-numeric: tabular-nums; }
.attendance-time.is-empty { color: var(--ds-text-3); }
.attendance-icon { color: var(--ds-text-3); }
.attendance-icon svg path { fill: currentColor; }
.attendance-disabled-action { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 148px; }
.attendance-disabled-reason { max-width: 230px; color: var(--ds-text-3); font-size: var(--ds-text-xs); line-height: 1.35; }
.attendance-history-format { margin: 3px 0 0; color: var(--ds-text-3); font-size: var(--ds-text-xs); }
.attendance-history-details { min-width: 0; }
.attendance-history-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; list-style: none; cursor: pointer; }
.attendance-history-details > summary::-webkit-details-marker { display: none; }
.attendance-history-chevron { color: var(--ds-text-3); font-size: 18px; line-height: 1; transition: transform var(--ds-fast) var(--ds-ease); }
.attendance-history-details:not([open]) .attendance-history-chevron { transform: rotate(-90deg); }

/* 17. Mobile bottom navigation + "Lainnya" drawer ----------------------- */
#androidBottomNav { gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--ds-surface); border-top: 1px solid var(--ds-border); box-shadow: 0 -1px 0 var(--ds-border); }
#androidBottomNav .android-nav-item {
  display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; min-height: 52px; padding: 6px 2px; border: 0; border-radius: var(--ds-radius-md); background: transparent;
  color: var(--ds-text-3); font: inherit; box-shadow: none; cursor: pointer;
}
#androidBottomNav .android-nav-item svg { width: 22px; height: 22px; flex: 0 0 22px; }
#androidBottomNav .android-nav-item svg path { fill: currentColor; }
#androidBottomNav .android-nav-item > span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 500; line-height: 1.15; }
#androidBottomNav .android-nav-item:hover { color: var(--ds-text); background: var(--ds-surface-2); }
#androidBottomNav .android-nav-item.active { color: var(--ds-primary-text); background: var(--ds-primary-soft); box-shadow: none; }
#androidBottomNav .android-nav-item.active > span { font-weight: 650; }
#androidBottomNav .android-nav-item:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -2px; }
#androidBottomNav .android-nav-item[aria-expanded="true"] { color: var(--ds-text); background: var(--ds-surface-3); }

.android-more-drawer .drawer-body { overflow-y: auto; }
.android-more-drawer .android-more-menu { display: grid; gap: var(--ds-space-5); }
.android-more-group h4 { margin: 0 0 var(--ds-space-2); color: var(--ds-text-3); font-size: var(--ds-text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.android-more-drawer .android-more-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-2); }
.android-more-drawer .android-more-item {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-text);
  font: inherit; font-size: var(--ds-text-base); text-align: left; cursor: pointer;
}
.android-more-drawer .android-more-item:hover, .android-more-drawer .android-more-item:focus-visible { border-color: var(--ds-border-strong); background: var(--ds-surface-2); }
.android-more-drawer .android-more-item:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 1px; }
.android-more-drawer .android-more-item.active { border-color: color-mix(in srgb, var(--ds-primary) 40%, var(--ds-border)); background: var(--ds-primary-soft); color: var(--ds-primary-text); }
.android-more-drawer .android-more-item svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--ds-primary-text); }
.android-more-drawer .android-more-item svg path { fill: currentColor; }
.android-more-drawer .android-more-item span { min-width: 0; overflow-wrap: anywhere; }

/* 18. Shared page fragments carried from earlier passes ------------------ */
.inventory-onboarding { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; padding: 16px; margin-bottom: 16px; border: 1px dashed var(--ds-border-strong); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); }
.inventory-onboarding > svg { margin-top: 2px; color: var(--ds-primary-text); }
.inventory-onboarding h3 { margin: 0 0 4px; font-size: var(--ds-text-md); }
.inventory-onboarding p { margin: 0 0 10px; color: var(--ds-text-2); font-size: var(--ds-text-base); }
.inventory-onboarding ol { margin: 0; padding-left: 19px; color: var(--ds-text-2); font-size: var(--ds-text-sm); line-height: 1.7; }
.inventory-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.admin-attendance-summary-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ds-text-3); font-size: 10px; line-height: 1.1; }
.admin-system-mobile-icon { display: grid; place-items: center; min-height: 21px; color: var(--ds-primary-text); }
.admin-visit-empty-state, html[data-ui-profile="desktop"] body.admin-shell .admin-visit-empty-state { display: grid; place-items: center; gap: 8px; min-height: 140px; padding: 24px 16px; border: 1px dashed var(--ds-border-strong); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); color: var(--ds-text-3); text-align: center; }
.admin-visit-empty-state strong { color: var(--ds-text); font-size: var(--ds-text-md); }
.admin-visit-empty-icon { display: grid; place-items: center; color: var(--ds-primary-text); }
.finance-page { max-width: none; }
.finance-metrics { gap: var(--ds-space-3); }
.finance-metric { border-radius: var(--ds-radius-lg); border-color: var(--ds-border); }
body.route-transitioning #content { opacity: .6; }
#content { transition: opacity var(--ds-base) var(--ds-ease); }
body.employee-shell .attendance-history-row:hover { border-color: var(--ds-border-strong); box-shadow: var(--ds-shadow-sm); }
body.employee-shell .attendance-history-details > summary { color: var(--ds-text); }

/* 19. Responsive -------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile drawer (<=768px): the sidebar becomes a full-label off-canvas panel. */
@media (max-width: 768px) {
  :root body.sidebar-collapsed { --sidebar-w: 248px; }
  .sidebar { width: min(288px, 86vw); padding: 16px 12px; box-shadow: var(--ds-shadow-lg); }
  body.sidebar-collapsed .sidebar .brand { justify-content: flex-start; padding-inline: 6px; gap: 10px; }
  body.sidebar-collapsed .sidebar .brand-text { width: auto; opacity: 1; }
  body.sidebar-collapsed .nav-section-label, body.sidebar-collapsed .nav-section-toggle { justify-content: space-between; height: auto; min-height: 28px; margin: 14px 0 2px; padding: 0 12px; background: transparent; font-size: 10.5px; pointer-events: auto; }
  body.sidebar-collapsed .nav-section-toggle > *, body.sidebar-collapsed .nav-section-label > * { display: inline; }
  body.sidebar-collapsed .sidebar nav > button[data-view], body.sidebar-collapsed .sidebar nav > button[data-domain] { justify-content: flex-start; width: 100%; padding: 0 12px; gap: 12px; }
  body.sidebar-collapsed .sidebar nav > button .nav-label { width: auto; opacity: 1; }
  body.sidebar-collapsed #sidebarToggle .hb-mid { transform: none; }
  .topbar { padding: 0 12px; }
  .topbar h2 { font-size: 17px; }
  .content { padding: var(--ds-space-4) 12px var(--ds-space-6); }
  .card { padding: var(--ds-space-4); }
  .app-footer { padding-inline: 12px; }
  input, select, textarea { min-height: var(--ds-control-h-touch); font-size: 16px; }
  input[type="checkbox"], input[type="radio"] { min-height: 18px; width: 18px; height: 18px; }
  .btn { min-height: 42px; }
  .icon-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
  th { position: static; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-card { width: 100%; max-width: 100% !important; max-height: calc(100dvh - 24px); border-radius: 14px 14px 0 0; border-bottom: 0; }
  .modal-head, .drawer-head { padding: 14px 16px; }
  .modal-body, .drawer-body { padding: 16px; }
  .modal-body > .modal-actions, .modal-body form > .modal-actions, .modal-body > .stack > .modal-actions, .modal-body form > .stack > .modal-actions { bottom: -16px; margin-bottom: -16px; }
  .modal-body > .modal-actions, .modal-body form > .modal-actions, .modal-body > .stack > .modal-actions { margin-inline: -16px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .modal-actions .btn { flex: 1 1 140px; }
  .drawer-panel, .drawer-panel.drawer-small, .drawer-panel.drawer-large { width: 100%; }
  .drawer-body .modal-actions { margin: 16px -16px -16px; padding-inline: 16px; }
  .toast { left: 12px; right: 12px; max-width: none; transform: translateY(-10px); }
  .toast.show { transform: none; }
  .domain-tabs { padding: 0 8px; }
  .domain-tabs button { min-height: 42px; padding: 0 10px; }
  .dashboard-summary, .dashboard-trend { padding: var(--ds-space-4); }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 24px; }
  .dashboard-secondary-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .kpi-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .kpi-grid, .kpi-grid--4 { grid-template-columns: minmax(0, 1fr); }
  .inventory-filters { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .system-card-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .system-card { min-height: 0; }
  .policy-card { max-width: none; width: 100%; }
  .kh-policy-slot { width: 100%; }
  .modal-overlay { padding: 0; }
  .modal-card { max-height: calc(100dvh - 12px); }
}

@media (max-width: 420px) {
  .kpi-grid { gap: var(--ds-space-2); }
  .kpi-icon { width: 26px; height: 26px; }
  .trend-legend { gap: 4px 12px; font-size: var(--ds-text-xs); }
  .android-more-drawer .android-more-items { gap: 6px; }
  .android-more-drawer .android-more-item { min-height: 46px; padding: 9px 10px; font-size: var(--ds-text-sm); }
  .attendance-disabled-action { min-width: 0; }
  .attendance-disabled-reason { max-width: 190px; }
}

/* ---------------------------------------------------------------------------
   R230 Retensi Foto: storage status, warning banners, dry-run review.
   Tone comes from one variable so light/dark follow the --ds-* palette. */
.storage-alert, .storage-status-card, .system-card[data-storage-level] { --storage-tone: var(--ds-success); }
.storage-alert--warning, .storage-status--warning, .system-card[data-storage-level="warning"] { --storage-tone: var(--ds-warning); }
.storage-alert--critical, .storage-status--critical, .system-card[data-storage-level="critical"] { --storage-tone: var(--ds-danger); }
.storage-alert--unknown, .storage-status--unknown, .system-card[data-storage-level="unknown"] { --storage-tone: var(--ds-text-3); }
.system-card[data-system-card="storageManagement"] { --card-accent: var(--storage-tone); }

.storage-alert {
  display: flex; align-items: center; gap: var(--ds-space-3); margin: 0 0 var(--ds-space-4); padding: var(--ds-space-3) var(--ds-space-4);
  border: 1px solid color-mix(in srgb, var(--storage-tone) var(--ds-cat-border), var(--ds-border)); border-left: 4px solid var(--storage-tone);
  border-radius: var(--ds-radius-lg); background: color-mix(in srgb, var(--storage-tone) 9%, var(--ds-surface)); color: var(--ds-text);
}
.storage-alert > svg { flex: 0 0 auto; color: var(--storage-tone); }
.storage-alert-copy { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.storage-alert-copy strong { color: var(--ds-text); font-size: var(--ds-text-md); font-weight: 650; }
.storage-alert-copy span { color: var(--ds-text-2); font-size: var(--ds-text-sm); line-height: 1.45; overflow-wrap: anywhere; }
.storage-alert .btn { flex: 0 0 auto; }
.dashboard-layout > .storage-alert { margin: 0; }

.storage-head-actions, .storage-actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); align-items: center; }
.storage-status-card {
  display: grid; gap: var(--ds-space-3); margin-bottom: var(--ds-space-4); padding: var(--ds-space-4) var(--ds-space-5);
  border: 1px solid color-mix(in srgb, var(--storage-tone) var(--ds-cat-border), var(--ds-border)); border-left: 4px solid var(--storage-tone);
  border-radius: var(--ds-radius-lg); background: color-mix(in srgb, var(--storage-tone) var(--ds-cat-tint), var(--ds-surface)); color: var(--ds-text);
}
.storage-status-main { display: flex; align-items: center; gap: var(--ds-space-3); }
.storage-status-main > div { flex: 1 1 auto; min-width: 0; display: grid; }
.storage-status-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: var(--ds-radius-md); background: color-mix(in srgb, var(--storage-tone) var(--ds-cat-icon-bg), var(--ds-surface)); color: var(--storage-tone); }
.storage-status-label { color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.storage-status-value { color: var(--ds-text); font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.storage-meter { height: 10px; border-radius: var(--ds-radius-pill); background: var(--ds-surface-3); overflow: hidden; }
.storage-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--storage-tone); }
.storage-status-facts, .storage-policy-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: var(--ds-space-2) var(--ds-space-4); margin: 0; }
.storage-status-facts dt, .storage-policy-facts dt { color: var(--ds-text-3); font-size: var(--ds-text-xs); text-transform: uppercase; letter-spacing: .04em; }
.storage-status-facts dd, .storage-policy-facts dd { margin: 2px 0 0; color: var(--ds-text); font-weight: 600; overflow-wrap: anywhere; }

.storage-metric-grid, .storage-dry-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--ds-space-3); margin-bottom: var(--ds-space-4); }
.storage-metric { display: grid; gap: 4px; min-width: 0; padding: var(--ds-space-3) var(--ds-space-4); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface); color: var(--ds-text); }
.storage-metric span { color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.storage-metric strong { color: var(--ds-text); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.storage-metric small { color: var(--ds-text-3); font-size: var(--ds-text-xs); line-height: 1.4; overflow-wrap: anywhere; }
.storage-run-card .storage-metric { background: var(--ds-surface-2); }

.storage-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: var(--ds-space-4); margin-bottom: var(--ds-space-4); }
.storage-columns > .card { margin: 0; min-width: 0; }
.storage-page .section-title { flex-wrap: wrap; gap: var(--ds-space-3); }
.storage-page .section-title > div:first-child { min-width: 0; flex: 1 1 280px; }
.storage-subhead { margin: var(--ds-space-4) 0 var(--ds-space-2); color: var(--ds-text); font-size: var(--ds-text-md); font-weight: 650; }
.storage-table td.num, .storage-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.storage-path { max-width: 320px; color: var(--ds-text-2); font-family: var(--ds-font-mono, ui-monospace, monospace); font-size: var(--ds-text-xs); overflow-wrap: anywhere; word-break: break-all; }
.storage-details { margin-top: var(--ds-space-3); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.storage-details > summary { padding: var(--ds-space-2) var(--ds-space-3); color: var(--ds-text); font-weight: 600; cursor: pointer; }
.storage-details > summary:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.storage-details > .table-wrap, .storage-details > p { margin: 0 var(--ds-space-3) var(--ds-space-3); }
.storage-empty { min-height: 120px; gap: 6px; }
.storage-empty strong { color: var(--ds-text); }

.storage-fieldset { display: grid; gap: var(--ds-space-2); margin: 0; padding: var(--ds-space-3); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); }
.storage-fieldset legend { padding: 0 4px; color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.storage-check { display: flex; align-items: center; gap: var(--ds-space-2); color: var(--ds-text); }
.storage-check input { width: auto; margin: 0; }
.storage-switch small { display: block; color: var(--ds-text-3); font-size: var(--ds-text-xs); font-weight: 400; }
.storage-switch input { width: auto; }
.storage-delete-modal .storage-alert { margin: 0; }
/* R231 backup gate card. */
.storage-backup-card { --storage-tone: var(--ds-success); margin-bottom: var(--ds-space-4); border-left: 4px solid var(--storage-tone); }
.storage-backup--warning { --storage-tone: var(--ds-warning); }
.storage-backup--critical { --storage-tone: var(--ds-danger); }
.storage-backup-card .storage-alert { margin: 0 0 var(--ds-space-3); }
.storage-backup-card .storage-alert code, .storage-alert-copy code { font-size: var(--ds-text-xs); color: var(--ds-text-2); }
.storage-fact-sub { display: block; margin-top: 2px; color: var(--ds-text-3); font-size: var(--ds-text-xs); font-weight: 400; overflow-wrap: anywhere; }
.storage-gate-reason { margin: var(--ds-space-2) 0 0; padding: var(--ds-space-2) var(--ds-space-3); border-radius: var(--ds-radius-md); border: 1px solid color-mix(in srgb, var(--ds-danger) var(--ds-cat-border), var(--ds-border)); background: color-mix(in srgb, var(--ds-danger) 7%, var(--ds-surface)); color: var(--ds-text); font-size: var(--ds-text-sm); overflow-wrap: anywhere; }
/* Form labels set display, which would otherwise override [hidden]. */
.storage-policy-modal .storage-confirm[hidden] { display: none; }

@media (max-width: 640px) {
  .storage-alert { flex-wrap: wrap; }
  .storage-alert .btn { width: 100%; }
  .storage-status-card { padding: var(--ds-space-4); }
  .storage-status-value { font-size: 24px; }
  .storage-head-actions, .storage-actions { width: 100%; }
  .storage-head-actions .btn, .storage-actions .btn { flex: 1 1 140px; }
  .storage-path { max-width: 180px; }
}

/* R232 Retensi Foto modal on Sistem: same system-page modal as Monitoring /
   Keamanan, wider for the cleanup tables.  Body scrolls, footer stays put. */
.modal-card.modal-large.storage-retention-modal,
html[data-ui-profile="desktop"] .modal-card.modal-large.storage-retention-modal { width: min(1080px, 100%); max-width: 1080px; }
.storage-retention-modal .system-page-host { min-width: 0; }
.storage-retention-modal .storage-page > .section-title { margin-bottom: var(--ds-space-3); }
.storage-retention-modal .storage-page > .section-title > div:first-child p { margin: 0; }
.storage-retention-modal .storage-page .card:last-child { margin-bottom: 0; }
.storage-retention-modal .table-wrap { max-width: 100%; overflow-x: auto; }
.storage-retention-modal .btn[aria-busy="true"] { cursor: progress; opacity: .7; }

/* ======================================================================
   R233 UI audit
   ====================================================================== */
/* Tone cards: one pattern (tint, accent border, icon container) for the
   Kunjungan KPI, Ringkasan Pengajuan and Personalia master cards.  The
   doubled class only lifts specificity above the per-profile card rules
   in web-desktop/web-mobile/android.css (no !important). */
.ds-tone-card { --card-accent: var(--ds-primary-text); }
.ds-tone-card[data-tone="indigo"] { --card-accent: var(--ds-cat-indigo); }
.ds-tone-card[data-tone="blue"] { --card-accent: var(--ds-cat-blue); }
.ds-tone-card[data-tone="amber"] { --card-accent: var(--ds-cat-amber); }
.ds-tone-card[data-tone="green"] { --card-accent: var(--ds-cat-green); }
.ds-tone-card[data-tone="red"] { --card-accent: var(--ds-cat-red); }
.ds-tone-card[data-tone="violet"] { --card-accent: var(--ds-cat-violet); }
.ds-tone-card[data-tone="teal"] { --card-accent: var(--ds-cat-teal); }
html:root body .ds-tone-card.ds-tone-card[data-tone] {
  border: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border));
  border-left: 4px solid var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) var(--ds-cat-tint), var(--ds-surface));
  color: var(--ds-text);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
html:root body .ds-tone-card.ds-tone-card[data-tone]:hover {
  border-color: color-mix(in srgb, var(--card-accent) 55%, var(--ds-border));
  border-left-color: var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) calc(var(--ds-cat-tint) * 2), var(--ds-surface));
}
html:root body .ds-tone-card.ds-tone-card[data-tone]:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
html:root body .ds-tone-card.ds-tone-card[data-tone][aria-pressed="true"] { box-shadow: 0 0 0 2px var(--card-accent); border-color: var(--card-accent); }
.ds-tone-icon {
  display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: var(--ds-radius-md);
  background: color-mix(in srgb, var(--card-accent) var(--ds-cat-icon-bg), var(--ds-surface)); color: var(--card-accent);
}
.ds-tone-icon svg path { fill: currentColor; }
.ds-tone-card .l, .ds-tone-card .admin-visit-metric-label { color: var(--ds-text-2); }
.ds-tone-card .n, .ds-tone-card .admin-visit-metric-value { color: var(--ds-text); }

/* Kunjungan / Pengajuan cards: icon column sized for the container. */
html:root body .admin-visit-summary-metric.ds-tone-card,
html:root body .admin-reimbursement-summary-metric.ds-tone-card { grid-template-columns: auto minmax(0, 1fr); }
html:root body .admin-visit-summary-metric.ds-tone-card .ds-tone-icon,
html:root body .admin-reimbursement-summary-metric.ds-tone-card .ds-tone-icon { grid-row: 1 / span 2; color: var(--card-accent); }
@media (max-width: 760px) {
  .admin-visit-summary-metric .ds-tone-icon, .admin-reimbursement-summary-metric .ds-tone-icon { width: 26px; height: 26px; }
}
html:root body .stat-card.pj-summary-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon label" "icon value";
  align-items: center; column-gap: var(--ds-space-3); row-gap: 0;
}
.pj-summary-card .ds-tone-icon { grid-area: icon; }
.pj-summary-card .l { grid-area: label; }
.pj-summary-card .n { grid-area: value; }

/* Kehadiran "Ada masalah" toggle. */
.kh-issue-toggle[aria-pressed="true"], .kh-issue-toggle-btn[aria-pressed="true"] {
  --card-accent: var(--ds-cat-amber);
  border-color: var(--card-accent); color: var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) var(--ds-cat-icon-bg), var(--ds-surface));
}
.kh-issue-toggle[aria-pressed="true"]:hover:not(:disabled), .kh-issue-toggle-btn[aria-pressed="true"]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--card-accent) calc(var(--ds-cat-icon-bg) * 1.6), var(--ds-surface)); color: var(--card-accent);
}
.kh-issue-toggle svg path, .kh-issue-toggle-btn svg path { fill: currentColor; }
.kh-issue-toggle-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-2); min-height: 44px; }

/* Tugas/Tiket: visual-only truncation + Preview Bukti. */
.task-name-clip { display: inline-block; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.admin-task-card .task-name-clip { max-width: 100%; }
.task-evidence-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.admin-task-table .task-evidence-btn small { display: none; } /* count stays in title/aria-label */
.task-evidence-btn small { color: var(--ds-text-3); font-size: var(--ds-text-xs); font-variant-numeric: tabular-nums; }
.task-evidence-none { font-size: var(--ds-text-sm); white-space: nowrap; }
.admin-task-card-detail-row { display: flex; align-items: center; justify-content: flex-end; gap: var(--ds-space-2); }
.task-evidence-summary { margin-top: var(--ds-space-2); }
/* The task table is wider than the page (pre-existing); keep the Aksi
   column (Preview) reachable without horizontal scrolling. */
.admin-task-table :is(th, td):last-child { position: sticky; right: 0; z-index: 1; background: var(--ds-surface); box-shadow: inset 1px 0 0 var(--ds-border); }
.admin-task-table thead th:last-child { background: var(--ds-surface-2); }
.admin-task-table tr.is-clickable-row:hover td:last-child { background: var(--ds-surface-2); }
/* Personalia master cards: action buttons never clipped. */
.pa-master-card.master-col table :is(th, td):last-child { width: 1%; min-width: 0; white-space: nowrap; }
.pa-master-card .row-actions { flex-wrap: nowrap; justify-content: flex-end; }

/* Evidence gallery (thumbnails, active photo, prev/next, swipe). */
.modal-card.modal-large.evidence-viewer-modal { width: min(880px, 100%); }
.evidence-viewer { gap: var(--ds-space-3); }
.evidence-stage { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--ds-space-2); min-height: 260px; touch-action: pan-y; user-select: none; }
.evidence-figure { display: grid; place-items: center; gap: var(--ds-space-2); min-width: 0; min-height: 260px; margin: 0; padding: var(--ds-space-2); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); }
.evidence-image { display: block; max-width: 100%; max-height: min(56dvh, 520px); object-fit: contain; border-radius: var(--ds-radius-md); }
.evidence-figure figcaption { color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.evidence-fallback { display: grid; justify-items: center; gap: 6px; padding: var(--ds-space-4); color: var(--ds-text-2); text-align: center; }
.evidence-fallback strong { color: var(--ds-text); }
.evidence-fallback svg path { fill: currentColor; }
.evidence-fallback--error { color: var(--ds-danger); }
.evidence-nav[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.evidence-counter { margin: 0; color: var(--ds-text-2); font-size: var(--ds-text-sm); text-align: center; }
.evidence-thumbs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); gap: var(--ds-space-2); }
.evidence-thumb { display: grid; gap: 4px; min-width: 0; padding: 6px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-text); text-align: left; cursor: pointer; font: inherit; }
.evidence-thumb:hover { border-color: var(--ds-border-strong); background: var(--ds-surface-2); }
.evidence-thumb:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.evidence-thumb.active { border-color: var(--ds-primary-text); box-shadow: 0 0 0 1px var(--ds-primary-text); }
.evidence-thumb-media { display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--ds-radius-md); background: var(--ds-surface-3); color: var(--ds-text-3); }
.evidence-thumb-media img { width: 100%; height: 100%; object-fit: cover; }
.evidence-thumb-media svg path { fill: currentColor; }
.evidence-thumb-label { overflow: hidden; color: var(--ds-text-2); font-size: var(--ds-text-xs); text-overflow: ellipsis; white-space: nowrap; }
.evidence-thumb.is-missing .evidence-thumb-label { color: var(--ds-text-3); }
@media (max-width: 640px) {
  .evidence-stage { grid-template-columns: minmax(0, 1fr); min-height: 200px; }
  .evidence-stage .evidence-nav { position: absolute; top: 50%; z-index: 1; transform: translateY(-50%); background: var(--ds-surface-elevated); }
  .evidence-stage .evidence-nav--prev { left: 6px; }
  .evidence-stage .evidence-nav--next { right: 6px; }
  .evidence-figure { min-height: 200px; }
  .evidence-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Gudang forms in the centred modal: footer spans the two-column grid. */
.inventory-form > .modal-actions { grid-column: 1 / -1; }

/* Checkbox + label in one row (Lintas tengah malam, Serial tracked). */
label.check-row { display: inline-flex; flex-direction: row; align-items: center; gap: var(--ds-space-2); width: fit-content; max-width: 100%; min-height: 40px; margin: 0; padding: 4px 8px; margin-inline: -8px; border-radius: var(--ds-radius-md); color: var(--ds-text); font-weight: 500; cursor: pointer; white-space: normal; }
label.check-row > input[type="checkbox"] { flex: 0 0 auto; margin: 0; }
label.check-row > span { min-width: 0; line-height: 1.3; }
label.check-row:hover { background: var(--ds-surface-2); }
label.check-row:has(input:focus-visible) { outline: 2px solid var(--ds-focus); outline-offset: 1px; }
label.check-row > input[type="checkbox"]:focus-visible { outline-offset: 1px; }

/* Personalia master data: three separate cards. */
.pa-master-section { margin-top: 18px; }
.pa-master-section > .section-title { margin-bottom: var(--ds-space-3); }
.pa-master-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--ds-space-4); align-items: start; }
.pa-master-grid > .pa-master-card { min-width: 0; margin: 0; }
.pa-master-head { display: flex; align-items: center; gap: var(--ds-space-2); margin-bottom: var(--ds-space-3); }
.pa-master-head h4 { flex: 1 1 auto; min-width: 0; margin: 0; color: var(--ds-text); }
.pa-master-card .table-wrap { overflow-x: auto; }
.pa-master-card table :is(th, td) { padding-inline: 10px; }
.pa-master-card table :is(th, td):not(:last-child) { white-space: normal; overflow-wrap: anywhere; }
.pa-master-card .row-actions { gap: 4px; }
/* Lokasi Absensi has four columns, so it gets a little more width. */
@media (min-width: 1200px) { .pa-master-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr); } }

/* Integrasi Billing per karyawan. */
.billing-map-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--ds-space-2) var(--ds-space-4); margin: 0; }
.billing-map-facts dt { color: var(--ds-text-3); font-size: var(--ds-text-xs); text-transform: uppercase; letter-spacing: .04em; }
.billing-map-facts dd { margin: 2px 0 0; color: var(--ds-text); font-weight: 600; overflow-wrap: anywhere; }
.field-error { margin: 0; color: var(--ds-danger); font-size: var(--ds-text-sm); }
.field-error[hidden] { display: none; }
/* R234 HMAC Billing modal: modal body is the only scroll container; the
   header stays on top and the footer (.modal-actions) is sticky. */
.modal-card.modal-large.hmac-modal,
html[data-ui-profile="desktop"] .modal-card.modal-large.hmac-modal { width: min(1080px, 100%); max-width: 1080px; }
@media (min-width: 769px) { .modal-card.modal-large.hmac-modal { max-height: 90vh; } }
.hmac-modal .modal-head h3 { font-size: 19px; font-weight: 650; }
.hmac-form { display: grid; gap: var(--ds-space-3); min-width: 0; font-size: var(--ds-text-base); }
.hmac-form > .modal-actions { margin-top: var(--ds-space-1); }
.hmac-intro { max-width: 760px; color: var(--ds-text-2); line-height: 1.5; }
.hmac-intro p { margin: 0; }
.hmac-intro p + p { margin-top: 2px; font-size: var(--ds-text-sm); }
.hmac-intro strong { color: var(--ds-text); font-weight: 600; }
.hmac-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ds-space-3); align-items: stretch; }
.hmac-panel { display: flex; flex-direction: column; }
.hmac-panel > .hmac-test { margin-top: auto; }
.hmac-panel > .hmac-scopes { margin-bottom: var(--ds-space-3); }
@media (min-width: 900px) { .hmac-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.hmac-card { --card-accent: var(--ds-primary-text); min-width: 0; margin: 0; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border)); border-left: 3px solid var(--card-accent); border-radius: var(--ds-radius-lg); background: color-mix(in srgb, var(--card-accent) var(--ds-cat-tint), var(--ds-surface)); box-shadow: var(--ds-shadow-sm); color: var(--ds-text); }
.hmac-card[data-tone="blue"] { --card-accent: var(--ds-cat-blue); }
.hmac-card[data-tone="teal"] { --card-accent: var(--ds-cat-teal); }
.hmac-card[data-tone="amber"] { --card-accent: var(--ds-cat-amber); }
.hmac-card[data-tone="violet"] { --card-accent: var(--ds-cat-violet); }
.hmac-card-head { display: flex; align-items: flex-start; gap: var(--ds-space-3); }
.hmac-card-copy { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.hmac-card-copy h4 { margin: 0; color: var(--ds-text); font-size: 15px; font-weight: 650; line-height: 1.3; }
.hmac-card-copy p { margin: 0; color: var(--ds-text-2); font-size: var(--ds-text-sm); line-height: 1.45; }
.hmac-card-status { display: grid; flex: 0 0 auto; justify-items: end; gap: 2px; }
.hmac-card-status small { color: var(--ds-text-3); font-size: var(--ds-text-xs); }
.hmac-fields { display: grid; gap: 10px; margin-top: var(--ds-space-3); }
label.hmac-field { display: grid; gap: 4px; margin: 0; min-width: 0; font-weight: 400; }
.hmac-label { color: var(--ds-text-2); font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.hmac-field input { width: 100%; min-width: 0; }
/* 14px on desktop/tablet; touch screens keep the system 16px (no iOS zoom). */
@media (min-width: 769px) { .hmac-modal .hmac-field input { font-size: 14px; } }
.hmac-hint { color: var(--ds-text-3); font-size: var(--ds-text-xs); line-height: 1.35; }
.hmac-scopes { display: flex; flex-wrap: wrap; gap: 0 var(--ds-space-4); min-width: 0; margin: 10px 0 0; padding: 0; border: 0; }
.hmac-scopes > legend { width: 100%; margin-bottom: 2px; padding: 0; }
label.check-row.hmac-scope { min-height: 32px; font-weight: 400; }
.hmac-scope code { font-size: 12.5px; overflow-wrap: anywhere; }
.hmac-test { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2) var(--ds-space-3); margin-top: var(--ds-space-3); padding-top: var(--ds-space-3); border-top: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border)); }
.hmac-test .hmac-test-result { flex: 1 1 200px; min-width: 0; min-height: 0; margin: 0; font-size: var(--ds-text-sm); line-height: 1.4; overflow-wrap: anywhere; }
.hmac-test-result.ok { color: var(--ds-success); }
.hmac-test-result.bad { color: var(--ds-danger); }
.hmac-test-btn[aria-busy="true"] { cursor: progress; opacity: .7; }

label.hmac-switch { position: relative; display: flex; align-items: center; gap: var(--ds-space-3); margin: 0; color: var(--ds-text); font-weight: 400; cursor: pointer; }
label.hmac-switch:has(.switch-input:disabled) { cursor: not-allowed; }
.hmac-switch .switch { flex: 0 0 36px; }
.hmac-switch-title { color: var(--ds-text); font-size: 15px; font-weight: 650; line-height: 1.3; }
.hmac-switch-text { color: var(--ds-text-2); font-size: var(--ds-text-sm); line-height: 1.45; }

.hmac-mapping-details { margin-top: var(--ds-space-2); }
.hmac-mapping-details > summary { width: fit-content; color: var(--ds-primary-text); font-size: var(--ds-text-sm); font-weight: 600; cursor: pointer; border-radius: var(--ds-radius-md); }
.hmac-mapping-details > summary:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.hmac-mapping-list { display: grid; gap: 4px; margin: var(--ds-space-2) 0 0; padding: 0; list-style: none; }
.hmac-mapping-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.hmac-mapping-empty { margin: var(--ds-space-2) 0 0; font-size: var(--ds-text-sm); }

@media (max-width: 600px) {
  .hmac-modal .modal-head h3 { font-size: 18px; }
  .hmac-card { padding: 12px; }
  .hmac-card-head { flex-wrap: wrap; }
  .hmac-card-head > .hmac-card-copy { flex: 1 1 0; }
  .hmac-card-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; padding-left: calc(32px + var(--ds-space-3)); justify-items: start; }
  .hmac-test .hmac-test-btn { width: 100%; }
}

/* ======================================================================
   R235: Personalia row menu sheet, Ubah Password, Branding, Update, ANDROID
   ====================================================================== */
/* Row menu on phones: full-width bottom sheet above the bottom navigation.
   The overlay is the sheet's own shadow, so it never ends up beneath a
   parent stacking context; outside taps are swallowed in app.js. */
.row-menu .dropdown-menu.row-menu-sheet {
  position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: calc(var(--z-modal-overlay, 300) + 1);
  width: auto; min-width: 0; max-width: 520px; max-height: min(70dvh, 480px); margin-inline: auto; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--ds-space-2); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg);
  background: var(--ds-surface-elevated); box-shadow: 0 0 0 100vmax var(--ds-overlay), var(--ds-shadow-sm);
}
.row-menu .dropdown-menu.row-menu-sheet .dropdown-item { min-height: 48px; padding-inline: 12px; white-space: normal; font-size: var(--ds-text-base); }
.row-menu .dropdown-menu:not(.row-menu-sheet) { overflow-y: auto; }

/* Ubah Password */
.password-change-modal .pw-note { margin: 0; font-size: var(--ds-text-sm); line-height: 1.45; }
label.pw-field { display: grid; gap: 4px; margin: 0; font-weight: 400; }
.pw-label { color: var(--ds-text-2); font-size: 12.5px; font-weight: 500; }
.pw-input { position: relative; display: flex; align-items: center; min-width: 0; }
.pw-input input { width: 100%; min-width: 0; padding-right: 48px; }
.pw-input .pw-toggle { position: absolute; right: 4px; width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
.pw-toggle[aria-pressed="true"] { color: var(--ds-primary-text); }
.pw-strength { display: grid; gap: 4px; margin-top: -4px; }
.pw-meter { display: block; height: 6px; overflow: hidden; border-radius: var(--ds-radius-pill); background: var(--ds-surface-3); }
.pw-meter > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--ds-text-3); transition: width .15s ease; }
.pw-strength[data-tone="bad"] .pw-meter > span { background: var(--ds-danger); }
.pw-strength[data-tone="warn"] .pw-meter > span { background: var(--ds-warning); }
.pw-strength[data-tone="ok"] .pw-meter > span { background: var(--ds-success); }
.pw-strength small { color: var(--ds-text-3); font-size: var(--ds-text-xs); }

/* Branding: one identity */
.branding-identity { display: grid; gap: var(--ds-space-2); min-width: 0; }
.branding-hint, .branding-copyright { margin: 0; font-size: var(--ds-text-sm); }
.branding-copyright span { color: var(--ds-text); font-weight: 500; }
.branding-preview { display: flex; align-items: center; gap: var(--ds-space-3); min-width: 0; padding: 10px 12px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); }
.branding-preview-logo { display: grid; flex: 0 0 auto; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-text-2); }
.branding-preview-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.branding-preview-logo svg path { fill: currentColor; }
.branding-preview-copy { display: grid; gap: 2px; min-width: 0; }
.branding-preview-copy strong { color: var(--ds-text); font-size: var(--ds-text-md); font-weight: 650; overflow-wrap: anywhere; }
.branding-preview-copy small { color: var(--ds-text-3); font-size: var(--ds-text-xs); }
.branding-modal .brand-asset-grid, .branding-modal .brand-asset-row, .branding-modal .brand-card { min-width: 0; }

/* Update Aplikasi */
.update-facts, .android-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: var(--ds-space-2) var(--ds-space-4); margin: 0; }
.update-fact dt, .android-fact dt { color: var(--ds-text-3); font-size: var(--ds-text-xs); text-transform: uppercase; letter-spacing: .04em; }
.update-fact dd, .android-fact dd { margin: 2px 0 0; color: var(--ds-text); font-size: var(--ds-text-base); overflow-wrap: anywhere; }
.android-fact--wide { grid-column: 1 / -1; }
.update-release, .update-progress, .android-card { display: grid; gap: var(--ds-space-2); min-width: 0; padding: 14px 16px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); }
.update-release h4, .android-card h4 { margin: 0; color: var(--ds-text); font-size: 15px; font-weight: 650; }
.update-progress-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ds-space-2); }
.update-progress-bar { height: 8px; overflow: hidden; border-radius: var(--ds-radius-pill); background: var(--ds-surface-3); }
.update-progress-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ds-primary); transition: width .3s ease; }
.update-progress p, .update-release p { margin: 0; font-size: var(--ds-text-sm); }
.update-notes > summary { cursor: pointer; color: var(--ds-primary-text); font-size: var(--ds-text-sm); font-weight: 600; }
.update-notes pre { max-height: 240px; margin: var(--ds-space-2) 0 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--ds-text-xs); }
.update-confirm-list { display: grid; gap: 6px; margin: 0; padding-left: 18px; color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.update-modal .btn[aria-busy="true"], .update-confirm-modal .btn[aria-busy="true"], #androidGenerate[aria-busy="true"] { cursor: progress; opacity: .7; }

/* ANDROID */
.android-modal .modal-head h3 { font-size: 18px; letter-spacing: .02em; }
.android-modal-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--ds-radius-md); background: color-mix(in srgb, var(--ds-cat-green) var(--ds-cat-icon-bg), var(--ds-surface)); color: var(--ds-cat-green); }
.android-modal-icon svg path { fill: currentColor; }
.android-release-modal { gap: var(--ds-space-3); }
.android-break { overflow-wrap: anywhere; }
.android-hash { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px var(--ds-space-2); min-width: 0; }
.android-hash-label { grid-column: 1 / -1; color: var(--ds-text-3); font-size: var(--ds-text-xs); text-transform: uppercase; letter-spacing: .04em; }
.android-hash-value { min-width: 0; padding: 6px 8px; border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-text); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; word-break: break-all; }
.android-note { margin: 0; font-size: var(--ds-text-sm); }
.android-card .android-package-input { width: 100%; min-width: 0; }
.android-modal .android-modal-actions { flex-wrap: wrap; }
@media (max-width: 600px) {
  .update-modal .modal-actions .btn { flex: 1 1 140px; }
  /* style.css turns this footer into a column on phones: full width, normal height. */
  .android-modal .android-modal-actions .btn { flex: 0 0 auto; width: 100%; }
  .android-hash { grid-template-columns: minmax(0, 1fr); }
  .android-hash .android-copy { justify-self: start; }
}

/* ======================================================================
   R239: three distinct header surfaces.
   - #notifMenu.notif-popover : notification popover anchored under the bell
     (<= 768px; JS sets fixed top/left/width/max-height from the bell rect).
     Desktop (> 768px) keeps the normal dropdown under the bell.
   - #userMenu                : account dropdown under the avatar (unchanged).
   - .logout-confirm-modal    : logout confirmation, centred modal at every
     width (overrides the mobile bottom-sheet modal rule).
   ====================================================================== */
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-2); }
.notif-head strong { min-width: 0; overflow-wrap: anywhere; }
#notifMenu .notif-close { display: none; }
.notif-item .notif-title, .notif-item .notif-summary, .notif-item .notif-status { white-space: normal; overflow-wrap: anywhere; }

html body #notifDropdown #notifMenu.notif-popover {
  position: fixed; bottom: auto;
  z-index: calc(var(--z-modal-overlay, 300) + 1);
  display: flex; flex-direction: column;
  min-width: 0; max-width: calc(100vw - 24px);
  margin: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface-elevated); color: var(--ds-text);
  box-shadow: 0 0 0 100vmax var(--ds-overlay), var(--ds-shadow-lg);
  transform: none; transform-origin: top right; animation: none;
}
html body #notifDropdown #notifMenu.notif-popover.hidden { display: none; }
#notifMenu.notif-popover .notif-head { flex: 0 0 auto; margin: 0; padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--ds-border); }
#notifMenu.notif-popover .notif-head strong { font-size: var(--ds-text-md); font-weight: 650; }
#notifMenu.notif-popover .notif-close { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
#notifMenu.notif-popover .notif-list { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 8px; }
#notifMenu.notif-popover .notif-item { min-height: 52px; padding: 10px 8px; }
#notifMenu.notif-popover .notif-empty { padding: 24px 16px; }
/* The popover lives in the topbar's stacking context: lift the topbar above
   the bottom navigation while it is open. */
body.notif-popover-open .topbar { z-index: calc(var(--z-modal-overlay, 300) + 1); }

html body .modal-overlay.logout-confirm-overlay { display: block; padding: 0; z-index: calc(var(--z-modal-overlay, 300) + 10); }
html body .modal-overlay.logout-confirm-overlay .modal-card.logout-confirm-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); overflow: auto;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); margin: 0; animation: none;
}
.logout-confirm-modal .modal-body > .logout-confirm-actions { position: static; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 16px 0 0; padding: 0; border: 0; background: none; bottom: auto; }
.logout-confirm-modal .logout-confirm-actions .btn { flex: 1 1 120px; min-height: 44px; }

/* R240: MFA login step - centred modal at every width, like the logout
   confirmation (never the mobile bottom-sheet modal). */
html body .modal-overlay.mfa-login-overlay { display: block; padding: 0; z-index: calc(var(--z-modal-overlay, 300) + 10); }
html body .modal-overlay.mfa-login-overlay .modal-card.mfa-login-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); overflow: auto;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); margin: 0; animation: none;
}
.mfa-login-modal #mfaCode { letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.mfa-login-modal .mfa-mode-toggle { align-self: flex-start; min-height: 44px; padding-inline: 0; color: var(--ds-primary-text); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.mfa-login-modal .modal-body .mfa-login-actions { position: static; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 4px 0 0; padding: 0; border: 0; background: none; bottom: auto; }
.mfa-login-modal .mfa-login-actions .btn { flex: 1 1 120px; min-height: 44px; }

/* R240: overtime items in the attendance approval queue. */
.approval-overtime-detail { display: grid; gap: var(--ds-space-2); margin: var(--ds-space-2) 0; }
.approval-overtime-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--ds-space-2); margin: 0; }
.approval-overtime-grid dt { font-size: var(--ds-text-xs); color: var(--ds-text-2); }
.approval-overtime-grid dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.approval-overtime-reason { margin: 0; overflow-wrap: anywhere; }
.approval-card .appr-reason { width: 100%; min-height: 64px; }

/* ======================================================================
   R241: Personalia detail (section cards) + compact Jabatan permissions.
   ====================================================================== */
/* Centred at every width (never the mobile bottom sheet); header stays put
   and .modal-body is the single scroll area. */
html body .modal-overlay.center-overlay { display: block; padding: 0; }
html body .modal-overlay.center-overlay .modal-card.center-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(880px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column; overflow: hidden; margin: 0; animation: none;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg);
}
html body .modal-overlay.center-overlay .modal-card.center-modal.modal-small { width: min(480px, calc(100vw - 24px)); }
.center-modal .modal-head { flex: 0 0 auto; }
.center-modal .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.pa-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-3); }
.pa-detail-card { --card-accent: var(--ds-cat-blue); display: grid; align-content: start; gap: var(--ds-space-3); min-width: 0; padding: var(--ds-space-4);
  border: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border)); border-left: 4px solid var(--card-accent);
  border-radius: var(--ds-radius-lg); background: color-mix(in srgb, var(--card-accent) var(--ds-cat-tint), var(--ds-surface)); color: var(--ds-text); }
.pa-detail-card[data-span="wide"] { grid-column: 1 / -1; }
.pa-detail-head { display: flex; align-items: center; gap: var(--ds-space-2); min-width: 0; }
.pa-detail-head h4 { margin: 0; font-size: var(--ds-text-md); font-weight: 650; overflow-wrap: anywhere; }
.pa-detail-icon, .capability-icon { display: grid; place-items: center; flex: 0 0 auto; border-radius: var(--ds-radius-md); color: var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) var(--ds-cat-icon-bg), var(--ds-surface)); }
.pa-detail-icon { width: 34px; height: 34px; }
.pa-detail-list { display: grid; gap: var(--ds-space-2); margin: 0; }
.pa-detail-row { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: var(--ds-space-2); align-items: baseline; }
.pa-detail-row dt { color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.pa-detail-row dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.pa-detail-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2); margin: 0; }
.pa-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px; border-radius: 999px; font-size: var(--ds-text-sm); font-weight: 600; border: 1px solid transparent; }
.pa-badge.is-ok { color: var(--ds-success); background: var(--ds-success-soft); border-color: color-mix(in srgb, var(--ds-success) 30%, transparent); }
.pa-badge.is-warn { color: var(--ds-warning); background: var(--ds-warning-soft); border-color: color-mix(in srgb, var(--ds-warning) 30%, transparent); }
.pa-badge.is-off { color: var(--ds-text-2); background: var(--ds-surface-2, var(--ds-surface)); border-color: var(--ds-border); }
.pa-loc-list { display: grid; gap: var(--ds-space-2); }
.pa-loc-item { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-2); min-width: 0; padding: 8px 8px 8px 12px;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.pa-loc-name { min-width: 0; overflow-wrap: anywhere; }
.pa-loc-form { gap: var(--ds-space-2); }
.check-row { display: inline-flex; align-items: center; gap: var(--ds-space-2); min-height: 44px; cursor: pointer; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; margin: 0; flex: 0 0 18px; }
.pa-detail-actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); }
.pa-detail-actions .btn { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 160px; min-height: 44px; justify-content: center; }
@media (max-width: 640px) { .pa-detail-grid { grid-template-columns: minmax(0, 1fr); } .pa-detail-row { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.capability-list { display: grid; gap: var(--ds-space-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.capability-item { --card-accent: var(--ds-cat-blue); display: flex; align-items: center; gap: var(--ds-space-3); min-width: 0; padding: 4px 12px;
  border: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border)); border-radius: var(--ds-radius-md);
  background: color-mix(in srgb, var(--card-accent) var(--ds-cat-tint), var(--ds-surface)); }
.capability-icon { width: 30px; height: 30px; }
.capability-item .switch-row { flex: 1 1 auto; min-width: 0; padding: 8px 0; }
.capability-item .switch-row > span:first-child { overflow-wrap: anywhere; }
.emp-password-hint { margin: 0; }

/* ======================================================================
   R242: shared tinted cards (--ds-cat-*), icon buttons, and the Sistem /
   Kehadiran surfaces built on them: WhatsApp, Notifikasi, Monitoring,
   Evidence Lembur, Menunggu Persetujuan.
   ====================================================================== */
/* Lucide icons are stroke-only; some .btn rules set fill on any svg. */
svg.ui-icon, .btn svg.ui-icon, .icon-btn svg.ui-icon { fill: none; stroke: currentColor; }
.btn svg.ui-icon :is(path, circle, rect, line, polyline, polygon),
.icon-btn svg.ui-icon :is(path, circle, rect, line, polyline, polygon),
.ui-cat-card svg.ui-icon :is(path, circle, rect, line, polyline, polygon) { fill: none; }
.ui-cat-card { --card-accent: var(--ds-cat-blue); display: grid; align-content: start; gap: var(--ds-space-3); min-width: 0; padding: var(--ds-space-4); margin: 0;
  border: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border)); border-left: 4px solid var(--card-accent);
  border-radius: var(--ds-radius-lg); background: color-mix(in srgb, var(--card-accent) var(--ds-cat-tint), var(--ds-surface)); color: var(--ds-text); box-shadow: none; }
.ui-cat-head { display: flex; align-items: center; gap: var(--ds-space-3); min-width: 0; }
.ui-cat-icon { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: var(--ds-radius-md); color: var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) var(--ds-cat-icon-bg), var(--ds-surface)); }
.ui-cat-icon .ui-icon { width: 18px; height: 18px; }
.ui-cat-title { flex: 1 1 auto; min-width: 0; }
.ui-cat-title h3 { margin: 0; font-size: var(--ds-text-md); font-weight: 650; overflow-wrap: anywhere; }
.ui-cat-title p { margin: 2px 0 0; color: var(--ds-text-2); font-size: var(--ds-text-sm); overflow-wrap: anywhere; }
.ui-cat-body { display: grid; gap: var(--ds-space-3); min-width: 0; }
.ui-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--ds-space-2) var(--ds-space-4); margin: 0; }
.ui-kv dt { color: var(--ds-text-2); font-size: var(--ds-text-xs); }
.ui-kv dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.ui-card-actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); }
.ui-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; }
.ui-btn .ui-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.ui-icon-btn .ui-icon { width: 18px; height: 18px; }
.ui-icon-btn.primary { color: var(--ds-primary-fg); background: var(--ds-primary); border-color: var(--ds-primary); }
.ui-icon-btn.danger { color: var(--ds-danger, var(--ds-cat-red)); border-color: color-mix(in srgb, var(--ds-cat-red) 40%, var(--ds-border)); }
@media (max-width: 480px) { .ui-card-actions .ui-btn { flex: 1 1 140px; } }

/* WhatsApp */
.wa-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-3); }
.wa-layout > #waStatusCard, .wa-layout > #waDeliveryCard { grid-column: 1 / -1; }
.wa-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2); }
.wa-status-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding-inline: 10px; font-weight: 650; letter-spacing: .02em; }
.wa-status-badge .ui-icon { width: 16px; height: 16px; }
.wa-status-detail { margin: 0; }
.wa-qr-box { display: grid; gap: var(--ds-space-2); justify-items: start; }
.wa-qr-img { max-width: 220px; width: 100%; border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.wa-disabled-note { margin-top: var(--ds-space-3); }
@media (max-width: 768px) { .wa-layout { grid-template-columns: minmax(0, 1fr); } }

/* Notifikasi */
.notif-jump { position: sticky; top: calc(-1 * var(--ds-space-4)); z-index: 1; display: flex; flex-wrap: wrap; gap: var(--ds-space-2); padding: var(--ds-space-2) 0; background: var(--ds-surface-elevated, var(--ds-surface)); }
.notif-jump-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border: 1px solid var(--ds-border); border-radius: 999px; background: var(--ds-surface); color: var(--ds-text); font-weight: 600; cursor: pointer; }
.notif-jump-chip .ui-icon { width: 16px; height: 16px; }
.notif-jump-chip.active, .notif-jump-chip:hover { border-color: var(--ds-primary); color: var(--ds-primary-text); }
.notif-section { scroll-margin-top: 56px; }
.notif-settings .table-wrap { max-width: 100%; }
.notif-modal-footer { margin-top: 0; }

/* Monitoring */
.ui-cat-metric { --card-accent: var(--ds-cat-blue); border: 1px solid color-mix(in srgb, var(--card-accent) var(--ds-cat-border), var(--ds-border)); border-left: 4px solid var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) var(--ds-cat-tint), var(--ds-surface)); }
.monitor-metric-label { display: inline-flex; align-items: center; gap: var(--ds-space-2); }
.ui-cat-metric .ui-cat-icon { width: 30px; height: 30px; }
.monitor-card { min-width: 0; }
.monitor-status-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; }
.monitor-status-icon .ui-icon { width: 18px; height: 18px; }
.monitor-status-icon.is-ok { color: var(--ds-success); }
.monitor-status-icon.is-neutral { color: var(--ds-text-2); }
.monitor-status-icon.is-bad { color: var(--ds-cat-red); }
.monitor-status-fail { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
@media (max-width: 640px) {
  .monitor-svc-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .monitor-svc-table, .monitor-svc-table tbody, .monitor-svc-table tr, .monitor-svc-table td { display: block; width: 100%; }
  .monitor-svc-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px var(--ds-space-3); padding: var(--ds-space-2) 0; border-bottom: 1px solid var(--ds-border); }
  .monitor-svc-table td { display: grid; gap: 2px; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .monitor-svc-table td::before { content: attr(data-label); color: var(--ds-text-2); font-size: var(--ds-text-xs); }
  .monitor-svc-table td.monitor-svc-name { grid-column: 1 / -1; font-weight: 650; }
  .monitor-svc-table td[colspan] { grid-column: 1 / -1; }
  .monitor-svc-table td[colspan]::before { content: none; }
}

/* Kebijakan Evidence Lembur */
.policy-role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--ds-space-3); }
.policy-check-grid { display: flex; flex-wrap: wrap; gap: 0 var(--ds-space-4); }
.policy-photo-grid { margin: 0; }
.policy-dest { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: var(--ds-text-sm); }
.policy-dest .ui-icon { width: 14px; height: 14px; flex: 0 0 14px; }

/* Menunggu Persetujuan */
.approval-card.ui-cat-card { padding: var(--ds-space-4); }
.approval-head .approval-event { flex: 0 0 auto; white-space: nowrap; }
.approval-geo { display: flex; align-items: flex-start; gap: var(--ds-space-2); margin: 0; }
.approval-geo .ui-icon { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; }
.approval-evidence { display: flex; }
.approval-actions { display: flex; justify-content: flex-end; gap: var(--ds-space-2); }
.approval-actions .ui-icon-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
@media (max-width: 420px) { .approval-head { flex-wrap: wrap; } }

/* ======================================================================
   R243: sidebar group dividers, Branding "Preview Tampilan" (local only,
   scoped --pv-* custom properties set on each preview panel), and stacked
   Lokasi Absensi rows on small screens.  Tokens only.
   ====================================================================== */
.sidebar nav > .nav-section-divider { flex: 0 0 auto; height: 1px; margin: 10px 12px; background: var(--ds-sidebar-border); }
body.sidebar-collapsed .sidebar nav > .nav-section-divider { margin: 10px 8px; }

.brand-pv { display: grid; gap: var(--ds-space-3); min-width: 0; padding: var(--ds-space-4); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface-2); }
.brand-pv-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ds-space-2); }
.brand-pv-head h4 { margin: 0; color: var(--ds-text); }
.brand-pv-note { margin: 0; }
.brand-pv-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-3); }
.brand-pv-inputs { display: flex; flex-wrap: wrap; gap: var(--ds-space-2) var(--ds-space-4); min-width: 0; }
.brand-pv-color { display: inline-flex; align-items: center; gap: var(--ds-space-2); margin: 0; color: var(--ds-text-2); font-size: var(--ds-text-sm); }
.brand-pv-color input[type="color"] { width: 36px; height: 32px; min-height: 32px; padding: 2px; border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius-sm); background: var(--ds-surface); cursor: pointer; }
.brand-pv-color input[type="color"]:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.brand-pv-color code { color: var(--ds-text-3); font-family: var(--ds-font-mono); font-size: var(--ds-text-xs); }
.brand-pv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--ds-space-3); }

.brand-pv-panel { position: relative; display: grid; gap: var(--ds-space-2); min-width: 0; padding: var(--ds-space-3); border: 1px solid var(--pv-border, var(--ds-border)); border-radius: var(--ds-radius-md); background: var(--pv-bg, var(--ds-bg)); color: var(--pv-text, var(--ds-text)); }
.brand-pv-theme-tag { justify-self: start; padding: 2px 8px; border-radius: var(--ds-radius-pill); background: var(--pv-surface, var(--ds-surface)); color: var(--pv-text-2, var(--ds-text-2)); font-size: var(--ds-text-xs); font-weight: 600; }
.brand-pv-shell { overflow: hidden; border: 1px solid var(--pv-border, var(--ds-border)); border-radius: var(--ds-radius-md); background: var(--pv-surface, var(--ds-surface)); }
.brand-pv-topbar { display: flex; align-items: center; gap: var(--ds-space-2); min-width: 0; padding: 8px 10px; border-bottom: 1px solid var(--pv-border, var(--ds-border)); background: var(--pv-surface, var(--ds-surface)); }
.brand-pv-topbar strong { min-width: 0; overflow: hidden; color: var(--pv-text, var(--ds-text)); font-size: var(--ds-text-sm); text-overflow: ellipsis; white-space: nowrap; }
.brand-pv-logo { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; border-radius: var(--ds-radius-sm); background: var(--pv-primary, var(--ds-primary)); color: var(--pv-primary-fg, var(--ds-primary-fg)); }
.brand-pv-body { display: grid; grid-template-columns: auto minmax(0, 1fr); min-width: 0; }
.brand-pv-sidebar { display: grid; align-content: start; gap: 2px; padding: 8px 6px; border-right: 1px solid var(--pv-border, var(--ds-border)); background: var(--pv-sidebar, var(--ds-sidebar-bg)); }
.brand-pv-nav { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: var(--ds-radius-sm); color: var(--pv-text-2, var(--ds-text-2)); font-size: var(--ds-text-xs); }
.brand-pv-nav em { font-style: normal; white-space: nowrap; }
.brand-pv-nav.is-active { background: color-mix(in srgb, var(--pv-primary, var(--ds-primary)) 16%, var(--pv-surface, var(--ds-surface))); color: var(--pv-text, var(--ds-text)); font-weight: 600; box-shadow: inset 3px 0 0 var(--pv-primary, var(--ds-primary)); }
.brand-pv-card { display: grid; gap: var(--ds-space-2); min-width: 0; margin: var(--ds-space-2); padding: var(--ds-space-3); border: 1px solid var(--pv-border, var(--ds-border)); border-radius: var(--ds-radius-md); background: var(--pv-surface, var(--ds-surface)); }
.brand-pv-card-head { display: flex; align-items: center; gap: var(--ds-space-2); min-width: 0; }
.brand-pv-card-head > div { min-width: 0; }
.brand-pv-card-head strong { display: block; color: var(--pv-text, var(--ds-text)); font-size: var(--ds-text-sm); }
.brand-pv-card-head small { display: block; color: var(--pv-text-2, var(--ds-text-2)); font-size: var(--ds-text-xs); overflow-wrap: break-word; }
.brand-pv-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: var(--ds-radius-md); background: color-mix(in srgb, var(--pv-accent, var(--ds-info)) 16%, var(--pv-surface, var(--ds-surface))); color: var(--pv-accent, var(--ds-info)); }
.brand-pv-badges, .brand-pv-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.brand-pv-badge { padding: 2px 8px; border: 1px solid transparent; border-radius: var(--ds-radius-pill); font-size: var(--ds-text-xs); font-weight: 600; }
.brand-pv-badge.is-accent { border-color: color-mix(in srgb, var(--pv-accent, var(--ds-info)) 35%, transparent); background: color-mix(in srgb, var(--pv-accent, var(--ds-info)) 14%, var(--pv-surface, var(--ds-surface))); color: color-mix(in srgb, var(--pv-accent, var(--ds-info)) 70%, var(--pv-text, var(--ds-text))); }
.brand-pv-badge.is-success { border-color: color-mix(in srgb, var(--pv-success, var(--ds-success)) 35%, transparent); background: color-mix(in srgb, var(--pv-success, var(--ds-success)) 14%, var(--pv-surface, var(--ds-surface))); color: color-mix(in srgb, var(--pv-success, var(--ds-success)) 70%, var(--pv-text, var(--ds-text))); }
.brand-pv-btn { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--ds-radius-sm); font-size: var(--ds-text-sm); font-weight: 600; }
.brand-pv-btn.is-primary { background: var(--pv-primary, var(--ds-primary)); color: var(--pv-primary-fg, var(--ds-primary-fg)); }
.brand-pv-btn.is-secondary { border-color: var(--pv-border, var(--ds-border)); background: var(--pv-surface-2, var(--ds-surface-2)); color: var(--pv-text, var(--ds-text)); }
.brand-pv-contrast { margin: 0; color: var(--pv-text-2, var(--ds-text-2)); font-size: var(--ds-text-xs); }
/* Uses the theme's own secondary text (never the user-picked text colour),
   so the warning stays readable exactly when the picked colour is not. */
.brand-pv-contrast.is-low { color: var(--pv-text-2, var(--ds-text-2)); font-weight: 600; }
.brand-pv-contrast.is-low::before { content: "⚠ "; }
@media (max-width: 420px) { .brand-pv-nav em { display: none; } }
/* Asset-card Reset buttons use [hidden]; `.btn` display must not reveal them. */
.branding-modal .brand-card .btn[hidden] { display: none; }

/* Stack by the card's own width (it is narrow inside the 3-column master grid
   on desktop too), so names never squeeze to one letter per line. */
#paLocCol { container: pa-loc / inline-size; }
@container pa-loc (max-width: 560px) {
  .pa-master-card .pa-loc-table, .pa-master-card .pa-loc-table tbody { display: block; width: 100%; }
  .pa-master-card .pa-loc-table thead { display: none; }
  .pa-master-card .pa-loc-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--ds-space-3); padding: 10px 0; border-bottom: 1px solid var(--ds-border); }
  .pa-master-card .pa-loc-table tr:last-child { border-bottom: 0; }
  .pa-master-card .pa-loc-table td { display: block; width: auto; min-width: 0; padding: 0; border: 0; white-space: normal; overflow-wrap: break-word; word-break: normal; }
  .pa-master-card .pa-loc-table td[data-label="Nama"] { grid-column: 1 / -1; color: var(--ds-text); font-weight: 600; }
  .pa-master-card .pa-loc-table td[data-label="Radius"], .pa-master-card .pa-loc-table td[data-label="Status"] { grid-column: 1; display: flex; align-items: center; gap: 6px; color: var(--ds-text-2); font-size: var(--ds-text-sm); }
  .pa-master-card .pa-loc-table td[data-label="Radius"]::before, .pa-master-card .pa-loc-table td[data-label="Status"]::before { content: attr(data-label); min-width: 52px; color: var(--ds-text-3); font-size: var(--ds-text-xs); }
  /* Outranks `.pa-master-card.master-col table td:last-child { width: 1% }`. */
  .pa-master-card.master-col .pa-loc-table td[data-label="Aksi"] { grid-column: 2; grid-row: 2 / span 2; align-self: center; width: auto; }
}

/* ======================================================================
   R244: "Lainnya" drawer groups are separated by a divider (no visible
   group label, like the sidebar); Arsip Mantan rows stack on narrow cards.
   Tokens only.
   ====================================================================== */
.android-more-group + .android-more-group { padding-top: var(--ds-space-4); border-top: 1px solid var(--ds-border); }
.former-note { margin: 0 0 var(--ds-space-3); }
.modal-body:has(.former-table) { container: former / inline-size; }
@container former (max-width: 560px) {
  .former-table, .former-table tbody { display: block; width: 100%; }
  .former-table thead { display: none; }
  .former-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--ds-space-3); padding: 10px 0; border-bottom: 1px solid var(--ds-border); }
  .former-table tr:last-child { border-bottom: 0; }
  .former-table td { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; overflow-wrap: break-word; }
  .former-table td[data-label="Nama"] { grid-column: 1 / -1; color: var(--ds-text); font-weight: 600; }
  .former-table td[data-label="EMP ID"], .former-table td[data-label="Status"] { grid-column: 1; color: var(--ds-text-2); font-size: var(--ds-text-sm); }
  .former-table td[data-label="Aksi"] { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
}

/* ======================================================================
   R247: Personalia -> KTA panel (status, PDF, revoke), reissue / revoke
   warnings.  Tokens only.
   ====================================================================== */
.kta-card-list { display: grid; gap: var(--ds-space-3); margin: 0; padding: 0; list-style: none; }
.kta-card-row { display: grid; gap: var(--ds-space-2); min-width: 0; padding: var(--ds-space-3); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.kta-card-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ds-space-2); }
.kta-card-main strong { color: var(--ds-text); font-family: var(--ds-font-mono); overflow-wrap: anywhere; }
.kta-card-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--ds-space-2); margin: 0; }
.kta-card-meta dt { color: var(--ds-text-2); font-size: var(--ds-text-xs); }
.kta-card-meta dd { margin: 0; color: var(--ds-text); font-size: var(--ds-text-sm); overflow-wrap: anywhere; }
.kta-card-reason { grid-column: 1 / -1; }
.kta-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--ds-space-2); }
.kta-card-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.kta-reissue-warning, .kta-revoke-modal .notice.warn { display: flex; align-items: flex-start; gap: var(--ds-space-2); }
.kta-reissue-warning > svg, .kta-revoke-modal .notice.warn > svg { flex: 0 0 18px; margin-top: 1px; }
.kta-revoke-modal textarea[aria-invalid="true"] { border-color: var(--ds-danger); }
@media (max-width: 420px) { .kta-card-actions .btn { flex: 1 1 100%; justify-content: center; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* r258: native Android permission onboarding / refusal modals. */
.permission-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.permission-item { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.permission-item > span:last-child { display: grid; gap: 2px; min-width: 0; }
.permission-item-icon { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; font-size: 18px; border-radius: 8px; background: var(--ds-surface-2, var(--surface)); }
.permission-onboarding-modal .modal-actions, .permission-denied-modal .modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.permission-onboarding-modal .modal-actions .btn, .permission-denied-modal .modal-actions .btn { flex: 1 1 auto; min-width: 0; }
.permission-item strong .muted { margin-left: 4px; font-weight: 500; }

/* r260: Profil photo actions - one token-based rule for every profile/theme.
   Before a photo is chosen "Ganti Foto" is the accent (primary) action and
   "Simpan" is disabled; once a photo is chosen "Simpan" becomes the green
   primary action and "Ganti Foto" drops to an accent outline. */
html body .profile-photo-form #profilePhotoChoose {
  background: var(--ds-primary); color: var(--ds-primary-fg); border: 1px solid var(--ds-primary);
  opacity: 1; cursor: pointer; pointer-events: auto; box-shadow: none; filter: none;
}
html body .profile-photo-form #profilePhotoChoose:hover { background: var(--ds-primary-hover); border-color: var(--ds-primary-hover); }
html body .profile-photo-form #profilePhotoChoose:active { background: var(--ds-primary-active); border-color: var(--ds-primary-active); }
html body .profile-photo-form:has(#profilePhotoSave:not(:disabled)) #profilePhotoChoose {
  background: var(--ds-surface); color: var(--ds-primary-text); border-color: var(--ds-primary);
}
html body .profile-photo-form:has(#profilePhotoSave:not(:disabled)) #profilePhotoChoose:hover { background: var(--ds-primary-soft); }
html body .profile-photo-form #profilePhotoSave:not(:disabled) {
  background: var(--ds-success-fill); color: var(--ds-success-fg); border: 1px solid var(--ds-success-fill);
  opacity: 1; cursor: pointer; pointer-events: auto; box-shadow: none; filter: none;
}
html body .profile-photo-form #profilePhotoSave:not(:disabled):hover { background: var(--ds-success-fill-hover); border-color: var(--ds-success-fill-hover); }
html body .profile-photo-form #profilePhotoSave:disabled {
  background: var(--ds-btn-disabled-bg); color: var(--ds-text-3); border: 1px solid var(--ds-btn-disabled-border);
  opacity: 1; cursor: not-allowed; box-shadow: none; filter: none;
}
html body .profile-photo-form #profilePhotoSave.is-busy { background: var(--ds-success-fill); color: var(--ds-success-fg); border-color: var(--ds-success-fill); }
html body .profile-photo-form :is(#profilePhotoChoose, #profilePhotoSave):focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; box-shadow: var(--ds-focus-ring); }

