/* Enterprise theme engine — additive only.
 * Classic (data-ui-theme="classic" or unset) receives no theme declarations.
 * The checkbox/radio safeguard below is a global control-size fix, not a theme.
 * Loaded by the public theme bootstrap and moved to the end of <head> so it
 * wins the cascade without changing existing page markup or JS handlers. */

/* ============================ Zero-flash boot ============================== */
/* The legacy static navbar is replaced by the canonical sidebar shell. Hide it
 * before first paint on authenticated workspace pages so the old blue header
 * ("نظام الحضور والموظفين") can never flash while the shell is mounting. */
html[data-workspace="1"] body > nav.nav,
html[data-workspace="1"] body nav.nav,
html[data-workspace="1"] body.wk-shell nav.nav{display:none!important}

/* theme-boot.js marks <html> before paint; auth.js clears it once the sidebar
 * frame and the requested tab are ready. The fallback timer clears it too. */
html.app-booting body{opacity:0!important;transition:none!important}
html:not(.app-booting) body{opacity:1;transition:opacity .12s ease}

/* Global control safeguard: shared full-width input rules must never crush checkboxes/radios. */
input[type="checkbox"],
input[type="radio"]{
  width:18px!important;
  height:18px!important;
  min-width:18px!important;
  min-height:18px!important;
  max-width:18px!important;
  flex:0 0 18px!important;
  padding:0!important;
  margin:2px 0 0 0!important;
  cursor:pointer;
}
/* Custom switch controls stay hidden; their visible .slider supplies the hit area. */
.toggle input[type="checkbox"]{
  width:0!important;
  height:0!important;
  min-width:0!important;
  min-height:0!important;
  max-width:0!important;
  flex:0 0 0!important;
  margin:0!important;
}

/* ============================ Charcoal + Deep Teal ======================== */
html[data-ui-theme="charcoal-teal"]{
  --color-canvas:#f3f5f7;
  --color-surface:#ffffff;
  --color-surface-raised:#ffffff;
  --color-surface-muted:#f8fafb;
  --color-surface-hover:#f5f8fa;
  --color-text-primary:#1f2933;
  --color-text-secondary:#66737f;
  --color-text-muted:#98a4ae;
  --color-text-inverse:#ffffff;
  --color-border:#e5eaee;
  --color-border-strong:#d5dde3;
  --color-divider:#edf1f3;
  --color-sidebar-bg:linear-gradient(180deg,#26343d 0%,#202c34 100%);
  --color-sidebar-text:#c9d3d8;
  --color-sidebar-muted:#8e9ca5;
  --color-sidebar-hover:rgba(255,255,255,.08);
  --color-sidebar-active:rgba(22,155,137,.18);
  --color-sidebar-active-text:#ffffff;
  --color-sidebar-accent:#159b89;
  --color-primary:#087f73;
  --color-primary-hover:#066b61;
  --color-primary-active:#05584f;
  --color-primary-soft:#e5f5f1;
  --color-emerald:#159b78;
  --color-emerald-soft:#e5f6ef;
  --color-success:#159b78;
  --color-success-soft:#e5f6ef;
  --color-warning:#c58a2b;
  --color-warning-soft:#fff4dc;
  --color-danger:#c85b63;
  --color-danger-soft:#fdebed;
  --color-info:#4f7fa6;
  --color-info-soft:#eaf3fa;
  --color-focus-ring:rgba(8,127,115,.24);
  --radius-card:14px;
  --radius-control:10px;
  --radius-modal:18px;
  --radius-pill:999px;
  --shadow-card:0 3px 12px rgba(31,41,51,.06);
  --font-ui:"Cairo","IBM Plex Sans Arabic","Noto Sans Arabic",Tahoma,Arial,sans-serif;

  --wk-bg:var(--color-canvas);
  --wk-surface:var(--color-surface);
  --wk-surface-2:var(--color-surface-muted);
  --wk-tonal:var(--color-surface-hover);
  --wk-tonal-2:var(--color-surface-muted);
  --wk-border:var(--color-border);
  --wk-border-soft:var(--color-divider);
  --wk-text:var(--color-text-primary);
  --wk-muted:var(--color-text-secondary);
  --wk-muted-2:var(--color-text-muted);
  --wk-primary:var(--color-primary);
  --wk-primary-hover:var(--color-primary-hover);
  --wk-primary-soft:var(--color-primary-soft);
  --wk-success:var(--color-success);
  --wk-success-soft:var(--color-success-soft);
  --wk-warn:var(--color-warning);
  --wk-warn-soft:var(--color-warning-soft);
  --wk-danger:var(--color-danger);
  --wk-danger-soft:var(--color-danger-soft);
  --wk-info:var(--color-info);
  --wk-info-soft:var(--color-info-soft);
  --wk-radius:var(--radius-card);
  --wk-radius-sm:var(--radius-control);
  --wk-radius-pill:var(--radius-pill);
  --wk-shadow:var(--shadow-card);
  --wk-shadow-lg:0 12px 32px rgba(31,41,51,.10);

  --bg-canvas:var(--color-canvas);
  --bg-surface:var(--color-surface);
  --bg-surface-2:var(--color-surface-muted);
  --bg-input:var(--color-surface);
  --text-primary:var(--color-text-primary);
  --text-secondary:var(--color-text-secondary);
  --border-color:var(--color-border);
  --bg:var(--color-canvas);
  --card:var(--color-surface);
  --card-solid:var(--color-surface);
  --nav:var(--color-surface);
  --t:var(--color-text-primary);
  --t2:var(--color-text-secondary);
  --b:var(--color-border);
  --p:var(--color-primary);
  --p-600:var(--color-primary-hover);
  --p-glow:var(--color-focus-ring);
  --g:var(--color-success);
  --r:var(--color-danger);
  --w:var(--color-warning);
  --i:var(--color-info);
  --pl:var(--color-primary-soft);
  --gl:var(--color-success-soft);
  --rl:var(--color-danger-soft);
  --wl:var(--color-warning-soft);
  --il:var(--color-info-soft);
  --radius:var(--radius-card);
  --shadow:var(--shadow-card);
  --shadow-soft:var(--shadow-card);
}

html[data-ui-theme="charcoal-teal"][data-theme="dark"],
html[data-ui-theme="charcoal-teal"].dark,
html[data-ui-theme="charcoal-teal"].dark-mode,
html[data-ui-theme="charcoal-teal"] body.dark,
html[data-ui-theme="charcoal-teal"] body.dark-mode{
  --color-canvas:#111a21;
  --color-surface:#1a252d;
  --color-surface-raised:#202d36;
  --color-surface-muted:#162129;
  --color-surface-hover:#26353f;
  --color-text-primary:#f2f6f7;
  --color-text-secondary:#b3c0c6;
  --color-text-muted:#81919a;
  --color-border:#30404a;
  --color-border-strong:#40525d;
  --color-divider:#2b3a43;
  --color-sidebar-bg:linear-gradient(180deg,#0f171d 0%,#0a1116 100%);
  --color-sidebar-active:rgba(21,155,120,.2);
  --color-sidebar-accent:#27b995;
  --color-primary:#20a996;
  --color-primary-hover:#2bbca8;
  --color-primary-active:#188d7f;
  --color-primary-soft:#123d3a;
  --color-emerald:#27b995;
  --color-success:#32c596;
  --color-success-soft:#123e35;
  --color-warning:#e0a83b;
  --color-warning-soft:#493918;
  --color-danger:#eb747d;
  --color-danger-soft:#4c252a;
  --color-info:#73a9d0;
  --color-info-soft:#1d374a;
  --color-focus-ring:rgba(32,169,150,.30);
  --wk-shadow:0 2px 10px rgba(0,0,0,.28);
  --wk-shadow-lg:0 16px 40px rgba(0,0,0,.34);
}

/* ============================ Royal Navy Executive ======================== */
html[data-ui-theme="royal-navy"]{
  --color-canvas:#f4f7fb;
  --color-surface:#ffffff;
  --color-surface-raised:#ffffff;
  --color-surface-muted:#f8fafc;
  --color-surface-hover:#f1f5f9;
  --color-text-primary:#0f172a;
  --color-text-secondary:#64748b;
  --color-text-muted:#94a3b8;
  --color-text-inverse:#ffffff;
  --color-border:#e4eaf2;
  --color-border-strong:#cbd5e1;
  --color-divider:#eef2f6;
  --color-sidebar-bg:linear-gradient(180deg,#0b192c 0%,#071221 100%);
  --color-sidebar-text:#cbd5e1;
  --color-sidebar-muted:#94a3b8;
  --color-sidebar-hover:rgba(255,255,255,.07);
  --color-sidebar-active:#1d6fe8;
  --color-sidebar-active-text:#ffffff;
  --color-sidebar-accent:#1d6fe8;
  --color-primary:#1d6fe8;
  --color-primary-hover:#175cc4;
  --color-primary-active:#12489c;
  --color-primary-soft:#eaf2ff;
  --color-emerald:#16a34a;
  --color-emerald-soft:#e8f8ef;
  --color-success:#16a34a;
  --color-success-soft:#e8f8ef;
  --color-warning:#d97706;
  --color-warning-soft:#fff6e0;
  --color-danger:#e11d48;
  --color-danger-soft:#feecef;
  --color-info:#1d6fe8;
  --color-info-soft:#eaf2ff;
  --color-focus-ring:rgba(29,111,232,.26);
  --radius-card:16px;
  --radius-control:10px;
  --radius-modal:20px;
  --radius-pill:999px;
  --shadow-card:0 4px 16px rgba(15,23,42,.06);
  --font-ui:"IBM Plex Sans Arabic","Inter","Noto Sans Arabic",Tahoma,Arial,sans-serif;

  --wk-bg:var(--color-canvas);
  --wk-surface:var(--color-surface);
  --wk-surface-2:var(--color-surface-muted);
  --wk-tonal:var(--color-surface-hover);
  --wk-tonal-2:var(--color-surface-muted);
  --wk-border:var(--color-border);
  --wk-border-soft:var(--color-divider);
  --wk-text:var(--color-text-primary);
  --wk-muted:var(--color-text-secondary);
  --wk-muted-2:var(--color-text-muted);
  --wk-primary:var(--color-primary);
  --wk-primary-hover:var(--color-primary-hover);
  --wk-primary-soft:var(--color-primary-soft);
  --wk-success:var(--color-success);
  --wk-success-soft:var(--color-success-soft);
  --wk-warn:var(--color-warning);
  --wk-warn-soft:var(--color-warning-soft);
  --wk-danger:var(--color-danger);
  --wk-danger-soft:var(--color-danger-soft);
  --wk-info:var(--color-info);
  --wk-info-soft:var(--color-info-soft);
  --wk-radius:var(--radius-card);
  --wk-radius-sm:var(--radius-control);
  --wk-radius-pill:var(--radius-pill);
  --wk-shadow:var(--shadow-card);
  --wk-shadow-lg:0 14px 38px rgba(15,23,42,.12);

  --bg-canvas:var(--color-canvas);
  --bg-surface:var(--color-surface);
  --bg-surface-2:var(--color-surface-muted);
  --bg-input:var(--color-surface);
  --text-primary:var(--color-text-primary);
  --text-secondary:var(--color-text-secondary);
  --border-color:var(--color-border);
  --bg:var(--color-canvas);
  --card:var(--color-surface);
  --card-solid:var(--color-surface);
  --nav:var(--color-surface);
  --t:var(--color-text-primary);
  --t2:var(--color-text-secondary);
  --b:var(--color-border);
  --p:var(--color-primary);
  --p-600:var(--color-primary-hover);
  --p-glow:var(--color-focus-ring);
  --g:var(--color-success);
  --r:var(--color-danger);
  --w:var(--color-warning);
  --i:var(--color-info);
  --pl:var(--color-primary-soft);
  --gl:var(--color-success-soft);
  --rl:var(--color-danger-soft);
  --wl:var(--color-warning-soft);
  --il:var(--color-info-soft);
  --radius:var(--radius-card);
  --shadow:var(--shadow-card);
  --shadow-soft:var(--shadow-card);
}

html[data-ui-theme="royal-navy"][data-theme="dark"],
html[data-ui-theme="royal-navy"].dark,
html[data-ui-theme="royal-navy"].dark-mode,
html[data-ui-theme="royal-navy"] body.dark,
html[data-ui-theme="royal-navy"] body.dark-mode{
  --color-canvas:#0a101d;
  --color-surface:#111a2c;
  --color-surface-raised:#17233a;
  --color-surface-muted:#101a2b;
  --color-surface-hover:#1b2941;
  --color-text-primary:#f1f5f9;
  --color-text-secondary:#94a3b8;
  --color-text-muted:#64748b;
  --color-border:#233352;
  --color-border-strong:#334765;
  --color-divider:#1b2942;
  --color-sidebar-bg:linear-gradient(180deg,#060c18 0%,#040911 100%);
  --color-sidebar-active:#1d6fe8;
  --color-sidebar-accent:#1d6fe8;
  --color-primary:#1d6fe8;
  --color-primary-hover:#4a8cf0;
  --color-primary-active:#175cc4;
  --color-primary-soft:#172a4b;
  --color-success:#34d399;
  --color-success-soft:#123b32;
  --color-warning:#fbbf24;
  --color-warning-soft:#44330f;
  --color-danger:#fb7185;
  --color-danger-soft:#4a1f2c;
  --color-info:#60a5fa;
  --color-info-soft:#172a4b;
  --color-focus-ring:rgba(96,165,250,.32);
  --wk-shadow:0 2px 12px rgba(0,0,0,.32);
  --wk-shadow-lg:0 18px 46px rgba(0,0,0,.42);
}

/* ============================ Shared component mapping ==================== */
html[data-ui-theme="charcoal-teal"] body,
html[data-ui-theme="royal-navy"] body{
  background:var(--color-canvas)!important;
  color:var(--color-text-primary)!important;
  font-family:var(--font-ui);
}

html[data-ui-theme="charcoal-teal"] .card,
html[data-ui-theme="charcoal-teal"] .panel,
html[data-ui-theme="charcoal-teal"] .box,
html[data-ui-theme="charcoal-teal"] .stat-card,
html[data-ui-theme="charcoal-teal"] .dashboard-card,
html[data-ui-theme="charcoal-teal"] .kpi-card,
html[data-ui-theme="charcoal-teal"] .widget,
html[data-ui-theme="charcoal-teal"] .summary-card,
html[data-ui-theme="charcoal-teal"] .glass-card,
html[data-ui-theme="charcoal-teal"] .content-card,
html[data-ui-theme="charcoal-teal"] .table-card:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .modal-content,
html[data-ui-theme="royal-navy"] .card,
html[data-ui-theme="royal-navy"] .panel,
html[data-ui-theme="royal-navy"] .box,
html[data-ui-theme="royal-navy"] .stat-card,
html[data-ui-theme="royal-navy"] .dashboard-card,
html[data-ui-theme="royal-navy"] .kpi-card,
html[data-ui-theme="royal-navy"] .widget,
html[data-ui-theme="royal-navy"] .summary-card,
html[data-ui-theme="royal-navy"] .glass-card,
html[data-ui-theme="royal-navy"] .content-card,
html[data-ui-theme="royal-navy"] .table-card:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .modal-content{
  background:var(--color-surface)!important;
  color:var(--color-text-primary)!important;
  border-color:var(--color-border)!important;
  border-radius:var(--radius-card)!important;
  box-shadow:var(--shadow-card)!important;
}

html[data-ui-theme="charcoal-teal"] .card-header,
html[data-ui-theme="charcoal-teal"] .panel-header,
html[data-ui-theme="charcoal-teal"] .modal-header,
html[data-ui-theme="charcoal-teal"] .table-header:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .card-header,
html[data-ui-theme="royal-navy"] .panel-header,
html[data-ui-theme="royal-navy"] .modal-header,
html[data-ui-theme="royal-navy"] .table-header:not(.keep-native-grid):not(.keep-native-grid *){border-bottom-color:var(--color-divider)!important}

html[data-ui-theme="charcoal-teal"] .wk-sidebar,
html[data-ui-theme="royal-navy"] .wk-sidebar{
  background:var(--color-sidebar-bg)!important;
  color:var(--color-sidebar-text)!important;
  border-inline-end-color:var(--color-divider)!important;
}

html[data-ui-theme="charcoal-teal"] .wk-sidebar-brand,
html[data-ui-theme="charcoal-teal"] .wk-sidebar-footer,
html[data-ui-theme="royal-navy"] .wk-sidebar-brand,
html[data-ui-theme="royal-navy"] .wk-sidebar-footer{border-color:rgba(255,255,255,.08)!important}

html[data-ui-theme="charcoal-teal"] .wk-sidebar-title,
html[data-ui-theme="royal-navy"] .wk-sidebar-title{color:#ffffff!important}
html[data-ui-theme="charcoal-teal"] .wk-sidebar-sub,
html[data-ui-theme="royal-navy"] .wk-sidebar-sub{color:var(--color-sidebar-muted)!important}

html[data-ui-theme="charcoal-teal"] .wk-nav-item,
html[data-ui-theme="charcoal-teal"] .wk-nav-group-btn,
html[data-ui-theme="royal-navy"] .wk-nav-item,
html[data-ui-theme="royal-navy"] .wk-nav-group-btn{
  color:var(--color-sidebar-text)!important;
  border-radius:var(--radius-pill)!important;
}

html[data-ui-theme="charcoal-teal"] .wk-nav-item:hover,
html[data-ui-theme="charcoal-teal"] .wk-nav-group-btn:hover,
html[data-ui-theme="royal-navy"] .wk-nav-item:hover,
html[data-ui-theme="royal-navy"] .wk-nav-group-btn:hover{
  background:var(--color-sidebar-hover)!important;
  color:#ffffff!important;
}

html[data-ui-theme="charcoal-teal"] .wk-nav-item.active,
html[data-ui-theme="charcoal-teal"] .wk-nav-group-btn.active{
  background:var(--color-sidebar-active)!important;
  color:var(--color-sidebar-active-text)!important;
  box-shadow:inset 3px 0 0 var(--color-sidebar-accent);
}
html[data-ui-theme="charcoal-teal"] .wk-nav-item.active::after,
html[data-ui-theme="charcoal-teal"] .wk-nav-group-btn.active::after{
  content:"";position:absolute;inset-inline-end:0;top:18%;height:64%;width:3px;border-radius:3px;background:var(--color-sidebar-accent);
}

html[data-ui-theme="royal-navy"] .wk-nav-item.active,
html[data-ui-theme="royal-navy"] .wk-nav-group-btn.active{
  background:var(--color-sidebar-active)!important;
  color:var(--color-sidebar-active-text)!important;
  box-shadow:0 4px 14px rgba(29,111,232,.35)!important;
}

html[data-ui-theme="charcoal-teal"] .wk-nav-badge,
html[data-ui-theme="royal-navy"] .wk-nav-badge,
html[data-ui-theme="charcoal-teal"] .wk-bell-badge,
html[data-ui-theme="royal-navy"] .wk-bell-badge{background:#e11d48!important;color:#ffffff!important}

html[data-ui-theme="charcoal-teal"] .wk-topbar,
html[data-ui-theme="charcoal-teal"] .navbar,
html[data-ui-theme="charcoal-teal"] .topbar,
html[data-ui-theme="royal-navy"] .wk-topbar,
html[data-ui-theme="royal-navy"] .navbar,
html[data-ui-theme="royal-navy"] .topbar{
  background:var(--color-surface)!important;
  color:var(--color-text-primary)!important;
  border-bottom-color:var(--color-border)!important;
  box-shadow:0 1px 0 var(--color-divider)!important;
}

html[data-ui-theme="charcoal-teal"] .wk-top-search,
html[data-ui-theme="charcoal-teal"] .wk-top-icon,
html[data-ui-theme="charcoal-teal"] .wk-bell-btn,
html[data-ui-theme="charcoal-teal"] .wk-theme-btn,
html[data-ui-theme="charcoal-teal"] .wk-menu-btn,
html[data-ui-theme="charcoal-teal"] .wk-lang-btn,
html[data-ui-theme="charcoal-teal"] .wk-account-btn,
html[data-ui-theme="royal-navy"] .wk-top-search,
html[data-ui-theme="royal-navy"] .wk-top-icon,
html[data-ui-theme="royal-navy"] .wk-bell-btn,
html[data-ui-theme="royal-navy"] .wk-theme-btn,
html[data-ui-theme="royal-navy"] .wk-menu-btn,
html[data-ui-theme="royal-navy"] .wk-lang-btn,
html[data-ui-theme="royal-navy"] .wk-account-btn{
  background:var(--color-surface-muted)!important;
  color:var(--color-text-primary)!important;
  border-color:var(--color-border)!important;
  border-radius:var(--radius-control)!important;
}

html[data-ui-theme="charcoal-teal"] .wk-top-search input,
html[data-ui-theme="royal-navy"] .wk-top-search input{color:var(--color-text-primary)!important;background:transparent!important}

html[data-ui-theme="charcoal-teal"] .btn,
html[data-ui-theme="charcoal-teal"] .button,
html[data-ui-theme="royal-navy"] .btn,
html[data-ui-theme="royal-navy"] .button{border-radius:var(--radius-control)!important;font-weight:600}

html[data-ui-theme="charcoal-teal"] .btn-primary,
html[data-ui-theme="charcoal-teal"] .btn.primary,
html[data-ui-theme="charcoal-teal"] .btn.btn-p,
html[data-ui-theme="charcoal-teal"] .primary-btn,
html[data-ui-theme="royal-navy"] .btn-primary,
html[data-ui-theme="royal-navy"] .btn.primary,
html[data-ui-theme="royal-navy"] .btn.btn-p,
html[data-ui-theme="royal-navy"] .primary-btn{
  background:var(--color-primary)!important;
  color:var(--color-text-inverse)!important;
  border-color:var(--color-primary)!important;
}
html[data-ui-theme="charcoal-teal"] .btn-primary:hover,
html[data-ui-theme="royal-navy"] .btn-primary:hover{background:var(--color-primary-hover)!important}

html[data-ui-theme="charcoal-teal"] .btn-secondary,
html[data-ui-theme="charcoal-teal"] .btn-o,
html[data-ui-theme="royal-navy"] .btn-secondary,
html[data-ui-theme="royal-navy"] .btn-o{
  background:var(--color-surface)!important;
  color:var(--color-primary)!important;
  border-color:var(--color-border-strong)!important;
}

html[data-ui-theme="charcoal-teal"] input,
html[data-ui-theme="charcoal-teal"] select,
html[data-ui-theme="charcoal-teal"] textarea,
html[data-ui-theme="charcoal-teal"] .form-control,
html[data-ui-theme="charcoal-teal"] .input,
html[data-ui-theme="royal-navy"] input,
html[data-ui-theme="royal-navy"] select,
html[data-ui-theme="royal-navy"] textarea,
html[data-ui-theme="royal-navy"] .form-control,
html[data-ui-theme="royal-navy"] .input{
  background:var(--color-surface)!important;
  color:var(--color-text-primary)!important;
  border-color:var(--color-border-strong)!important;
  border-radius:var(--radius-control)!important;
}

html[data-ui-theme="charcoal-teal"] input:focus,
html[data-ui-theme="charcoal-teal"] select:focus,
html[data-ui-theme="charcoal-teal"] textarea:focus,
html[data-ui-theme="royal-navy"] input:focus,
html[data-ui-theme="royal-navy"] select:focus,
html[data-ui-theme="royal-navy"] textarea:focus{
  border-color:var(--color-primary)!important;
  box-shadow:0 0 0 3px var(--color-focus-ring)!important;
  outline:none!important;
}

/* Native attendance/calculation tables opt out of theme cell overrides. */
html[data-ui-theme="charcoal-teal"] th:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] th:not(.keep-native-grid):not(.keep-native-grid *){border-bottom-color:var(--color-border)!important}
html[data-ui-theme="charcoal-teal"] td:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] td:not(.keep-native-grid):not(.keep-native-grid *){border-bottom-color:var(--color-divider)!important}

html[data-ui-theme="charcoal-teal"] .tab,
html[data-ui-theme="royal-navy"] .tab{border-color:var(--color-border)!important;color:var(--color-text-secondary)!important;border-radius:var(--radius-control)!important}
html[data-ui-theme="charcoal-teal"] .tab.active,
html[data-ui-theme="royal-navy"] .tab.active{background:var(--color-primary)!important;color:#ffffff!important;border-color:var(--color-primary)!important}

html[data-ui-theme="charcoal-teal"] .badge:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .pill:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .status-badge:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .tag:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .chip:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .badge:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .pill:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .status-badge:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .tag:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .chip:not(.keep-native-grid):not(.keep-native-grid *){border-radius:var(--radius-pill)!important;font-weight:700}

html[data-ui-theme="charcoal-teal"] .badge-success:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .status-success:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .badge-success:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .status-success:not(.keep-native-grid):not(.keep-native-grid *){background:var(--color-success-soft)!important;color:var(--color-success)!important}
html[data-ui-theme="charcoal-teal"] .badge-warning:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .status-warning:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .badge-warning:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .status-warning:not(.keep-native-grid):not(.keep-native-grid *){background:var(--color-warning-soft)!important;color:var(--color-warning)!important}
html[data-ui-theme="charcoal-teal"] .badge-danger:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .status-danger:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .badge-danger:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .status-danger:not(.keep-native-grid):not(.keep-native-grid *){background:var(--color-danger-soft)!important;color:var(--color-danger)!important}
html[data-ui-theme="charcoal-teal"] .badge-info:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .status-info:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .badge-info:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .status-info:not(.keep-native-grid):not(.keep-native-grid *){background:var(--color-info-soft)!important;color:var(--color-info)!important}

html[data-ui-theme="royal-navy"] .badge:not(.keep-native-grid):not(.keep-native-grid *)::before,
html[data-ui-theme="royal-navy"] .pill:not(.keep-native-grid):not(.keep-native-grid *)::before,
html[data-ui-theme="royal-navy"] .status-badge:not(.keep-native-grid):not(.keep-native-grid *)::before{
  content:"";width:6px;height:6px;border-radius:50%;background:currentColor;display:inline-block;flex:0 0 6px;
}

html[data-ui-theme="charcoal-teal"] .modal,
html[data-ui-theme="charcoal-teal"] .modal-box,
html[data-ui-theme="charcoal-teal"] .modal-content,
html[data-ui-theme="charcoal-teal"] .dropdown-menu,
html[data-ui-theme="royal-navy"] .modal,
html[data-ui-theme="royal-navy"] .modal-box,
html[data-ui-theme="royal-navy"] .modal-content,
html[data-ui-theme="royal-navy"] .dropdown-menu{
  background:var(--color-surface)!important;
  color:var(--color-text-primary)!important;
  border-color:var(--color-border)!important;
  border-radius:var(--radius-modal)!important;
  box-shadow:var(--wk-shadow-lg)!important;
}

html[data-ui-theme="charcoal-teal"] .muted:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="charcoal-teal"] .text-muted:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .muted:not(.keep-native-grid):not(.keep-native-grid *),
html[data-ui-theme="royal-navy"] .text-muted:not(.keep-native-grid):not(.keep-native-grid *){color:var(--color-text-secondary)!important}

/* ==================== Distinct theme icon systems ========================= */
/* Classic receives no rules here. Charcoal = duotone soft-square, Navy = rings. */

/* Charcoal + Deep Teal — duotone soft-squares. */
html[data-ui-theme="charcoal-teal"] :is(.kpi-icon,.stat-icon,.wk-kpi-icon,.dashboard-card .icon,.card-icon,.module-icon,.wk-ic,.circular-icon,.dept-icon,.shift-icon):not(.keep-native-grid):not(.keep-native-grid *){
  width:42px!important;height:42px!important;border-radius:12px!important;
  display:inline-grid!important;place-items:center!important;flex:0 0 42px;box-sizing:border-box;
  background:#e6f4f1!important;border:1px solid rgba(8,127,115,.16)!important;color:#087f73!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9),inset 0 0 0 3px rgba(21,155,120,.06)!important;
  transition:transform .2s ease,box-shadow .2s ease;
}
html[data-ui-theme="charcoal-teal"] :is(.kpi-icon,.stat-icon,.wk-kpi-icon,.dashboard-card .icon,.card-icon,.module-icon,.wk-ic,.circular-icon,.dept-icon,.shift-icon):not(.keep-native-grid):not(.keep-native-grid *) svg{
  width:22px!important;height:22px!important;stroke:#087f73!important;stroke-width:1.8!important;
  fill:rgba(8,127,115,.10)!important;stroke-linecap:round;stroke-linejoin:round;
}
html[data-ui-theme="charcoal-teal"] :is(.wk-nav-item,.wk-nav-group-btn):not(.keep-native-grid):not(.keep-native-grid *) svg,
html[data-ui-theme="charcoal-teal"] :is(.wk-top-icon,.wk-bell-btn):not(.keep-native-grid):not(.keep-native-grid *) svg{
  width:19px!important;height:19px!important;stroke:#c9e9e2!important;stroke-width:1.7!important;
  fill:none!important;stroke-linecap:round;stroke-linejoin:round;opacity:.92;
}
html[data-ui-theme="charcoal-teal"] :is(.wk-nav-item.active,.wk-nav-group-btn.active):not(.keep-native-grid):not(.keep-native-grid *){
  background:rgba(21,155,120,.20)!important;border-color:rgba(230,244,241,.16)!important;
  color:#e6f4f1!important;box-shadow:inset 3px 0 0 #159b78,0 0 16px rgba(21,155,120,.24)!important;
}
html[data-ui-theme="charcoal-teal"] :is(.wk-nav-item.active,.wk-nav-group-btn.active):not(.keep-native-grid):not(.keep-native-grid *) svg{
  stroke:#e6f4f1!important;filter:drop-shadow(0 0 5px rgba(21,155,120,.55));
}
html[data-ui-theme="charcoal-teal"] td :is(.type-icon,.category-icon,.row-icon):not(.keep-native-grid):not(.keep-native-grid *){
  width:30px!important;height:30px!important;border-radius:9px!important;
  display:inline-grid!important;place-items:center!important;background:#e6f4f1!important;
  border:1px solid rgba(8,127,115,.14)!important;color:#087f73!important;
}
html[data-ui-theme="charcoal-teal"] td :is(.type-icon,.category-icon,.row-icon):not(.keep-native-grid):not(.keep-native-grid *) svg{
  width:16px!important;height:16px!important;stroke:#087f73!important;fill:none!important;stroke-width:1.8!important;
}

/* Royal Navy — executive thin-line circular rings. */
html[data-ui-theme="royal-navy"] :is(.kpi-icon,.stat-icon,.wk-kpi-icon,.dashboard-card .icon,.card-icon,.module-icon,.wk-ic,.circular-icon,.dept-icon,.shift-icon):not(.keep-native-grid):not(.keep-native-grid *){
  width:44px!important;height:44px!important;border-radius:50%!important;
  display:inline-grid!important;place-items:center!important;flex:0 0 44px;box-sizing:border-box;
  background:#eef4ff!important;border:1.5px solid #1d6fe8!important;color:#1d6fe8!important;
  box-shadow:0 4px 12px rgba(29,111,232,.10)!important;
  transition:transform .2s ease,box-shadow .2s ease;
}
html[data-ui-theme="royal-navy"] :is(.kpi-icon,.stat-icon,.wk-kpi-icon,.dashboard-card .icon,.card-icon,.module-icon,.wk-ic,.circular-icon,.dept-icon,.shift-icon):not(.keep-native-grid):not(.keep-native-grid *) svg{
  width:22px!important;height:22px!important;stroke:currentColor!important;stroke-width:1.6!important;
  fill:none!important;stroke-linecap:round;stroke-linejoin:round;
}
html[data-ui-theme="royal-navy"] :is(.theme-ring-amber,.wk-ic.amber):not(.keep-native-grid):not(.keep-native-grid *){background:#fff7e8!important;border-color:#d97706!important;color:#b45309!important}
html[data-ui-theme="royal-navy"] :is(.theme-ring-emerald,.wk-ic.green):not(.keep-native-grid):not(.keep-native-grid *){background:#eaf8f0!important;border-color:#16a34a!important;color:#15803d!important}
html[data-ui-theme="royal-navy"] :is(.theme-ring-rose,.wk-ic.red):not(.keep-native-grid):not(.keep-native-grid *){background:#fff1f2!important;border-color:#e11d48!important;color:#be123c!important}
html[data-ui-theme="royal-navy"] :is(.theme-ring-blue,.wk-ic.blue,.wk-ic.sky):not(.keep-native-grid):not(.keep-native-grid *){background:#eef4ff!important;border-color:#1d6fe8!important;color:#1d6fe8!important}
html[data-ui-theme="royal-navy"] .kpi-grid > *:nth-child(4n+2) :is(.kpi-icon,.stat-icon):not(.keep-native-grid):not(.keep-native-grid *){background:#fff7e8!important;border-color:#d97706!important;color:#b45309!important}
html[data-ui-theme="royal-navy"] .kpi-grid > *:nth-child(4n+3) :is(.kpi-icon,.stat-icon):not(.keep-native-grid):not(.keep-native-grid *){background:#eaf8f0!important;border-color:#16a34a!important;color:#15803d!important}
html[data-ui-theme="royal-navy"] .kpi-grid > *:nth-child(4n+4) :is(.kpi-icon,.stat-icon):not(.keep-native-grid):not(.keep-native-grid *){background:#fff1f2!important;border-color:#e11d48!important;color:#be123c!important}
html[data-ui-theme="royal-navy"] :is(.wk-nav-item,.wk-nav-group-btn):not(.keep-native-grid):not(.keep-native-grid *) svg,
html[data-ui-theme="royal-navy"] :is(.wk-top-icon,.wk-bell-btn):not(.keep-native-grid):not(.keep-native-grid *) svg{
  width:19px!important;height:19px!important;stroke:currentColor!important;stroke-width:1.6!important;
  fill:none!important;stroke-linecap:round;stroke-linejoin:round;opacity:.9;
}
html[data-ui-theme="royal-navy"] :is(.wk-nav-item.active,.wk-nav-group-btn.active):not(.keep-native-grid):not(.keep-native-grid *){
  background:#1d6fe8!important;border-color:#1d6fe8!important;border-radius:12px!important;
  color:#ffffff!important;box-shadow:0 6px 16px rgba(29,111,232,.28)!important;
}
html[data-ui-theme="royal-navy"] :is(.wk-nav-item.active,.wk-nav-group-btn.active):not(.keep-native-grid):not(.keep-native-grid *) svg{stroke:#ffffff!important;opacity:1}
html[data-ui-theme="royal-navy"] td :is(.type-icon,.category-icon,.row-icon):not(.keep-native-grid):not(.keep-native-grid *){
  width:30px!important;height:30px!important;border-radius:50%!important;
  display:inline-grid!important;place-items:center!important;background:var(--color-primary-soft)!important;
  border:1.5px solid var(--color-primary)!important;color:var(--color-primary)!important;
}
html[data-ui-theme="royal-navy"] td :is(.type-icon,.category-icon,.row-icon):not(.keep-native-grid):not(.keep-native-grid *) svg{
  width:16px!important;height:16px!important;stroke:currentColor!important;fill:none!important;stroke-width:1.6!important;
}
html[data-ui-theme="royal-navy"] :is(.ref-code,.transaction-code,[data-ref-code]):not(.keep-native-grid):not(.keep-native-grid *){
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace!important;
  font-weight:700!important;color:var(--color-primary)!important;font-variant-numeric:tabular-nums;
}

/* ============================ Screen shell alignment ===================== */
/* Screen-only, theme-scoped geometry: classic and @media print are untouched. */
@media screen{
  html[data-ui-theme="charcoal-teal"],
  html[data-ui-theme="royal-navy"]{
    --topbar-height:64px;
    --wk-header-h:64px;
    --sidebar-width:var(--wk-sidebar-w,260px);
    --sidebar-rail:var(--wk-sidebar-rail,72px);
  }

  html[data-ui-theme="charcoal-teal"] .wk-topbar,
  html[data-ui-theme="royal-navy"] .wk-topbar{
    height:var(--topbar-height)!important;
    min-height:var(--topbar-height)!important;
    box-sizing:border-box!important;
    padding-block:0!important;
    border-bottom:1px solid var(--color-border)!important;
    box-shadow:none!important;
  }

  html[data-ui-theme="charcoal-teal"] .wk-sidebar-brand,
  html[data-ui-theme="royal-navy"] .wk-sidebar-brand{
    height:var(--topbar-height)!important;
    min-height:var(--topbar-height)!important;
    box-sizing:border-box!important;
    padding-block:0!important;
    border-bottom:1px solid var(--color-border)!important;
    gap:12px;
  }

  html[data-ui-theme="charcoal-teal"] .wk-topbar-start,
  html[data-ui-theme="charcoal-teal"] .wk-topbar-end,
  html[data-ui-theme="royal-navy"] .wk-topbar-start,
  html[data-ui-theme="royal-navy"] .wk-topbar-end{
    display:flex!important;
    align-items:center!important;
    gap:12px!important;
    height:100%;
    min-width:0;
  }
  html[data-ui-theme="charcoal-teal"] .wk-topbar-start > div,
  html[data-ui-theme="royal-navy"] .wk-topbar-start > div{
    display:flex;flex-direction:column;justify-content:center;min-width:0;
  }

  html[data-ui-theme="charcoal-teal"] .wk-menu-btn,
  html[data-ui-theme="royal-navy"] .wk-menu-btn{
    flex:0 0 40px;width:40px!important;height:40px!important;
    background:transparent!important;border-color:transparent!important;box-shadow:none!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-menu-btn:hover,
  html[data-ui-theme="royal-navy"] .wk-menu-btn:hover{
    background:var(--color-surface-muted)!important;border-color:var(--color-border)!important;
  }

  html[data-ui-theme="charcoal-teal"] body.wk-shell :is(.container,.wk-page,.tk-page),
  html[data-ui-theme="royal-navy"] body.wk-shell :is(.container,.wk-page,.tk-page){
    padding-top:24px!important;
  }
}

@media screen and (min-width:993px){
  html[dir="rtl"][data-ui-theme="charcoal-teal"] .wk-topbar,
  html[dir="rtl"][data-ui-theme="royal-navy"] .wk-topbar{
    right:var(--sidebar-width)!important;left:0!important;
  }
  html[dir="rtl"][data-ui-theme="charcoal-teal"] body.sidebar-collapsed .wk-topbar,
  html[dir="rtl"][data-ui-theme="royal-navy"] body.sidebar-collapsed .wk-topbar{
    right:var(--sidebar-rail)!important;
  }
  html[dir="ltr"][data-ui-theme="charcoal-teal"] .wk-topbar,
  html[dir="ltr"][data-ui-theme="royal-navy"] .wk-topbar{
    left:var(--sidebar-width)!important;right:0!important;
  }
  html[dir="ltr"][data-ui-theme="charcoal-teal"] body.sidebar-collapsed .wk-topbar,
  html[dir="ltr"][data-ui-theme="royal-navy"] body.sidebar-collapsed .wk-topbar{
    left:var(--sidebar-rail)!important;
  }
}

/* ==================== Dashboard, sidebar and floating control polish ======= */
/* Screen-only and theme-scoped; classic and @media print remain untouched. */
@media screen{
  /* Dark sidebar: brand, user card, states and scrollbar. */
  html[data-ui-theme="charcoal-teal"] .wk-sidebar-logo,
  html[data-ui-theme="royal-navy"] .wk-sidebar-logo{
    background:rgba(255,255,255,.10)!important;
    color:#ffffff!important;
    border:1px solid rgba(255,255,255,.12)!important;
    border-radius:12px!important;
    box-shadow:none!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-sidebar-sub,
  html[data-ui-theme="royal-navy"] .wk-sidebar-sub{color:rgba(255,255,255,.72)!important}
  html[data-ui-theme="charcoal-teal"] .wk-sidebar-title,
  html[data-ui-theme="royal-navy"] .wk-sidebar-title{color:#ffffff!important}

  html[data-ui-theme="charcoal-teal"] .wk-sidebar-user,
  html[data-ui-theme="royal-navy"] .wk-sidebar-user{
    background:rgba(255,255,255,.06)!important;
    border:1px solid rgba(255,255,255,.10)!important;
    color:#ffffff!important;
    border-radius:12px!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-user-name,
  html[data-ui-theme="royal-navy"] .wk-user-name{color:#ffffff!important}
  html[data-ui-theme="charcoal-teal"] .wk-user-role,
  html[data-ui-theme="royal-navy"] .wk-user-role{color:#b3c2cc!important}
  html[data-ui-theme="charcoal-teal"] .wk-sidebar-user .wk-user-avatar,
  html[data-ui-theme="royal-navy"] .wk-sidebar-user .wk-user-avatar{
    background:rgba(255,255,255,.12)!important;
    color:#ffffff!important;
    border-radius:12px!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-nav-item:hover,
  html[data-ui-theme="charcoal-teal"] .wk-nav-group-btn:hover,
  html[data-ui-theme="royal-navy"] .wk-nav-item:hover,
  html[data-ui-theme="royal-navy"] .wk-nav-group-btn:hover{
    background:rgba(255,255,255,.10)!important;color:#ffffff!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-nav-item.active,
  html[data-ui-theme="charcoal-teal"] .wk-nav-group-btn.active,
  html[data-ui-theme="royal-navy"] .wk-nav-item.active,
  html[data-ui-theme="royal-navy"] .wk-nav-group-btn.active{
    color:#ffffff!important;border-color:rgba(255,255,255,.10)!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-chevron,
  html[data-ui-theme="royal-navy"] .wk-chevron{color:rgba(255,255,255,.78)!important}
  html[data-ui-theme="charcoal-teal"] .wk-sidebar-nav,
  html[data-ui-theme="royal-navy"] .wk-sidebar-nav{
    scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.28) transparent;
  }
  html[data-ui-theme="charcoal-teal"] .wk-sidebar-nav::-webkit-scrollbar,
  html[data-ui-theme="royal-navy"] .wk-sidebar-nav::-webkit-scrollbar{width:6px}
  html[data-ui-theme="charcoal-teal"] .wk-sidebar-nav::-webkit-scrollbar-thumb,
  html[data-ui-theme="royal-navy"] .wk-sidebar-nav::-webkit-scrollbar-thumb{
    background:rgba(255,255,255,.24);border-radius:999px;
  }

  /* Executive header: refined light surfaces, never a heavy bright-blue banner. */
  html[data-ui-theme="charcoal-teal"] .wk-hero{
    background:linear-gradient(135deg,#ffffff 0%,#eef7f4 100%)!important;
    border:1px solid #dbe9e5!important;
    box-shadow:0 10px 30px -22px rgba(31,41,51,.45)!important;
    color:#1f2933!important;
  }
  html[data-ui-theme="royal-navy"] .wk-hero{
    background:linear-gradient(135deg,#ffffff 0%,#f4f7fb 100%)!important;
    border:1px solid #e4eaf2!important;
    box-shadow:0 10px 30px -22px rgba(11,25,44,.42)!important;
    color:#0b192c!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-hero :is(.wk-filter,.wk-btn,.wk-clock,.wk-live),
  html[data-ui-theme="royal-navy"] .wk-hero :is(.wk-filter,.wk-btn,.wk-clock,.wk-live){
    background:var(--color-surface)!important;
    border:1px solid var(--color-border)!important;
    color:var(--color-text-primary)!important;
    box-shadow:0 2px 8px rgba(15,23,42,.04)!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-hero .wk-analog,
  html[data-ui-theme="royal-navy"] .wk-hero .wk-analog{
    background:transparent!important;border:0!important;box-shadow:none!important;
    filter:drop-shadow(0 10px 25px rgba(15,23,42,.18))!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-hero :is(.wk-btn,.wk-filter,.wk-clock,.wk-live):hover,
  html[data-ui-theme="royal-navy"] .wk-hero :is(.wk-btn,.wk-filter,.wk-clock,.wk-live):hover{
    background:var(--color-surface-hover)!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-hero label,
  html[data-ui-theme="royal-navy"] .wk-hero label{color:var(--color-text-secondary)!important}
  html[data-ui-theme="charcoal-teal"] .wk-hero select,
  html[data-ui-theme="royal-navy"] .wk-hero select{color:var(--color-text-primary)!important;background:transparent!important;border-color:transparent!important}
  html[data-ui-theme="charcoal-teal"] .wk-hero select option,
  html[data-ui-theme="royal-navy"] .wk-hero select option{color:#0f172a!important;background:#ffffff!important}
  html[data-ui-theme="charcoal-teal"] .wk-hero svg,
  html[data-ui-theme="royal-navy"] .wk-hero svg{color:var(--color-primary)!important}

  /* Dashboard KPI cards and widgets. */
  html[data-ui-theme="charcoal-teal"] :is(.wk-hkpi,.wk-widget,.wk-kpi,.wk-item),
  html[data-ui-theme="royal-navy"] :is(.wk-hkpi,.wk-widget,.wk-kpi,.wk-item){
    background:var(--color-surface)!important;
    border:1px solid var(--color-border)!important;
    border-radius:14px!important;
    box-shadow:var(--shadow-card)!important;
  }
  html[data-ui-theme="charcoal-teal"] :is(.wk-hkpi,.wk-widget),
  html[data-ui-theme="royal-navy"] :is(.wk-hkpi,.wk-widget){padding:18px!important}
  html[data-ui-theme="charcoal-teal"] :is(.wk-hkpi,.wk-widget) .wk-ic{
    width:42px!important;height:42px!important;border-radius:12px!important;
    border:1px solid rgba(8,127,115,.16)!important;
  }
  html[data-ui-theme="royal-navy"] :is(.wk-hkpi,.wk-widget) .wk-ic{
    width:44px!important;height:44px!important;border-radius:50%!important;
    border:1.5px solid var(--color-primary)!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-wh,
  html[data-ui-theme="royal-navy"] .wk-wh{
    background:var(--color-surface)!important;border-bottom-color:var(--color-border)!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-hkpi-val,
  html[data-ui-theme="royal-navy"] .wk-hkpi-val{color:var(--color-text-primary)!important}
  html[data-ui-theme="charcoal-teal"] .wk-pill,
  html[data-ui-theme="royal-navy"] .wk-pill{border:1px solid var(--color-border)!important}

}

/* ==================== Modern SaaS finish (screen only) =================== */
/* Theme-scoped only; classic, .keep-native-grid and @media print are untouched. */
@media screen{
  html[data-ui-theme="charcoal-teal"]{
    --p:#087f73;--p-600:#159b78;--p-glow:rgba(8,127,115,.20);
    --primary:#087f73;--accent:#087f73;--brand:#26343d;
    --wk-primary:#087f73;--wk-primary-hover:#066b61;--wk-primary-soft:#e6f4f1;
    --cal-primary:#087f73;--c-p:#087f73;--mt-p:#087f73;--mt-p2:#066b61;
    --tk-primary:#087f73;--tk-primary-hover:#066b61;--tk-primary-soft:#e6f4f1;
    --tk-seen:#159b78;--tk-inprogress:#26343d;--tk-review:#087f73;
    --focus-ring:rgba(8,127,115,.28);
    --wk-clock-dial-1:#1e2d36;--wk-clock-dial-2:#0f191f;--wk-clock-accent:#14b8a6;--wk-clock-lume:#f8fafc;
  }
  html[data-ui-theme="royal-navy"]{
    --p:#1d6fe8;--p-600:#175cc4;--p-glow:rgba(29,111,232,.20);
    --primary:#1d6fe8;--accent:#1d6fe8;--brand:#0b192c;
    --wk-primary:#1d6fe8;--wk-primary-hover:#175cc4;--wk-primary-soft:#eaf2ff;
    --cal-primary:#1d6fe8;--c-p:#1d6fe8;--mt-p:#1d6fe8;--mt-p2:#175cc4;
    --tk-primary:#1d6fe8;--tk-primary-hover:#175cc4;--tk-primary-soft:#eaf2ff;
    --focus-ring:rgba(29,111,232,.26);
    --wk-clock-dial-1:#102442;--wk-clock-dial-2:#081326;--wk-clock-accent:#38bdf8;--wk-clock-lume:#f8fafc;
  }

  /* Charcoal: every primary control, tab, link, badge and progress fill follows teal. */
  html[data-ui-theme="charcoal-teal"] :is(.btn-primary,.btn-p,.wk-btn-primary,.fin-primary-btn,.bc-btn.primary,.bc-company-btn.active,.bc-seg button.active,.wk-toggle.on,.tab.active,.wk-tab.active,.dept-tabs button.active,.policy-tabs .tab.active,.wk-ess-pill.active,.wk-badge-blue,.wk-pill.info,.progress>span,.progress-fill,.gantt-bar,.table-zoom-edit.is-editing,.wk-mnav-btn.primary .ic):not(.keep-native-grid):not(.keep-native-grid *){
    background:#087f73!important;background-image:none!important;border-color:#087f73!important;
    color:#ffffff!important;box-shadow:0 6px 18px -12px rgba(8,127,115,.75)!important;
  }
  html[data-ui-theme="charcoal-teal"] :is(.wk-link,.mini-link,.audit-detail-link,.wk-cal-link):not(.keep-native-grid):not(.keep-native-grid *){color:#087f73!important}
  html[data-ui-theme="charcoal-teal"] :is([style*="#2563eb" i],[style*="#3b82f6" i],[style*="#1d6fe8" i],[style*="rgb(37,99,235" i],[style*="rgba(37,99,235" i]):not([style*="color:#fff" i]):not([style*="color: #fff" i]):not([style*="color:#ffffff" i]):not([style*="color: #ffffff" i]):not(.keep-native-grid):not(.keep-native-grid *):not(.wk-sidebar *):not(.wk-nav-item):not(.wk-nav-group-btn){
    color:#087f73!important;border-color:#087f73!important;
  }
  html[data-ui-theme="charcoal-teal"] :is([style*="background:#2563eb" i],[style*="background:#3b82f6" i],[style*="background:#1d6fe8" i],[style*="background: rgb(37,99,235" i]):not(.keep-native-grid):not(.keep-native-grid *):not(.wk-sidebar *){
    background:#087f73!important;background-image:none!important;color:#ffffff!important;
  }
  html[data-ui-theme="charcoal-teal"] .col-resize-handle.is-active:not(.keep-native-grid):not(.keep-native-grid *)::after{
    background:#159b78!important;box-shadow:0 0 0 3px rgba(21,155,120,.18)!important;
  }
  html[data-ui-theme="charcoal-teal"] :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea,button,a,[tabindex]):focus-visible:not(.keep-native-grid):not(.keep-native-grid *){
    outline:3px solid rgba(8,127,115,.24)!important;border-color:#159b78!important;
  }

  /* Royal Navy: clean canvas/cards and no white boxes on the dark sidebar. */
  html[data-ui-theme="royal-navy"] :is(.card,.panel,.box,.wk-widget,.wk-hkpi,.wk-card,.wk-kpi,.wk-item):not(.keep-native-grid):not(.keep-native-grid *){
    background:#ffffff!important;border:1px solid #e4eaf2!important;
    box-shadow:0 8px 24px -20px rgba(11,25,44,.35)!important;
  }
  html[data-ui-theme="royal-navy"] :is(.wk-sidebar,.wk-sidebar-nav,.wk-sidebar-brand,.wk-sidebar-user,.wk-nav,.wk-nav-group):is(div,span,a,button):not(.active):not(.keep-native-grid):not(.keep-native-grid *){
    background-color:transparent!important;box-shadow:none!important;
  }
  html[data-ui-theme="royal-navy"] :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea,button,a,[tabindex]):focus-visible:not(.keep-native-grid):not(.keep-native-grid *){
    outline:3px solid rgba(29,111,232,.24)!important;border-color:#1d6fe8!important;
  }

  /* Shared modern finish for both added themes. */
  html[data-ui-theme="charcoal-teal"] body,
  html[data-ui-theme="royal-navy"] body{
    font-family:var(--font-ui)!important;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;
  }
  html[data-ui-theme="charcoal-teal"] :is(.card,.panel,.box,.wk-widget,.wk-hkpi,.wk-card):not(.keep-native-grid):not(.keep-native-grid *),
  html[data-ui-theme="royal-navy"] :is(.card,.panel,.box,.wk-widget,.wk-hkpi,.wk-card):not(.keep-native-grid):not(.keep-native-grid *){
    border-radius:16px!important;padding:20px!important;
    transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease;
  }
  html[data-ui-theme="charcoal-teal"] :is(.card,.panel,.box,.wk-widget,.wk-hkpi,.wk-card):not(.keep-native-grid):not(.keep-native-grid *):hover,
  html[data-ui-theme="royal-navy"] :is(.card,.panel,.box,.wk-widget,.wk-hkpi,.wk-card):not(.keep-native-grid):not(.keep-native-grid *):hover{
    transform:translateY(-2px);box-shadow:0 14px 34px -24px rgba(15,23,42,.42)!important;
  }
  html[data-ui-theme="charcoal-teal"] :is(h1,h2,h3,h4):not(.keep-native-grid):not(.keep-native-grid *),
  html[data-ui-theme="royal-navy"] :is(h1,h2,h3,h4):not(.keep-native-grid):not(.keep-native-grid *){
    font-weight:700!important;letter-spacing:-.01em;color:var(--color-text-primary)!important;
  }
  html[data-ui-theme="charcoal-teal"] :is(.tab,.wk-tab,.dept-tabs button,.policy-tabs .tab,.wk-pill,.chip):not(.keep-native-grid):not(.keep-native-grid *),
  html[data-ui-theme="royal-navy"] :is(.tab,.wk-tab,.dept-tabs button,.policy-tabs .tab,.wk-pill,.chip):not(.keep-native-grid):not(.keep-native-grid *){
    border-radius:999px!important;
  }
  html[data-ui-theme="charcoal-teal"] table:not(.keep-native-grid):not(.keep-native-grid *),
  html[data-ui-theme="royal-navy"] table:not(.keep-native-grid):not(.keep-native-grid *){
    border-collapse:separate!important;border-spacing:0!important;width:100%;
  }
  html[data-ui-theme="charcoal-teal"] table:not(.keep-native-grid):not(.keep-native-grid *) :is(th,td),
  html[data-ui-theme="royal-navy"] table:not(.keep-native-grid):not(.keep-native-grid *) :is(th,td){
    border-bottom:1px solid var(--color-divider)!important;padding:12px 14px!important;
  }
  html[data-ui-theme="charcoal-teal"] table:not(.keep-native-grid):not(.keep-native-grid *) tbody tr:hover,
  html[data-ui-theme="royal-navy"] table:not(.keep-native-grid):not(.keep-native-grid *) tbody tr:hover{
    background:var(--color-surface-hover)!important;
  }
  html[data-ui-theme="charcoal-teal"] :is(.wk-empty,.empty-state):not(.keep-native-grid):not(.keep-native-grid *),
  html[data-ui-theme="royal-navy"] :is(.wk-empty,.empty-state):not(.keep-native-grid):not(.keep-native-grid *){
    border:1px dashed var(--color-border)!important;border-radius:12px!important;
    padding:22px!important;background:var(--color-surface-muted)!important;
  }

  /* User-selected button shape. Kept last so it wins over theme defaults. */
  html[data-btn-shape="rounded"]{--hr-btn-radius:10px}
  html[data-btn-shape="pill"]{--hr-btn-radius:999px}
  html[data-btn-shape="sharp"]{--hr-btn-radius:4px}
  html[data-btn-shape="soft"]{--hr-btn-radius:10px}
  html[data-btn-shape] :is(button,.btn,.button,.wk-btn,.wk-button,.fin-primary-btn,.bc-btn,.wk-tab,.tab,.wk-ess-pill,.wk-pill,.chip):not(.keep-native-grid):not(.keep-native-grid *):not(.toggle):not(.slider):not(.wk-toggle):not([type="checkbox"]):not([type="radio"]){border-radius:var(--hr-btn-radius,10px)!important}
  html[data-btn-shape="soft"] :is(button,.btn,.button,.wk-btn,.wk-button,.fin-primary-btn,.bc-btn,.wk-tab,.tab,.wk-ess-pill,.wk-pill,.chip):not(.keep-native-grid):not(.keep-native-grid *):not(.toggle):not(.slider):not(.wk-toggle):not([type="checkbox"]):not([type="radio"]){border:1px solid var(--color-border,#CBD5E1)!important;box-shadow:none!important;background-image:none!important}
}

/* ============================ Print integrity ============================= */
@media print{
  html[data-ui-theme="charcoal-teal"],
  html[data-ui-theme="royal-navy"]{
    --color-canvas:#ffffff!important;
    --color-surface:#ffffff!important;
    --color-surface-raised:#ffffff!important;
    --color-surface-muted:#ffffff!important;
    --color-surface-hover:#ffffff!important;
    --color-text-primary:#000000!important;
    --color-text-secondary:#111111!important;
    --color-text-muted:#333333!important;
    --color-text-inverse:#000000!important;
    --color-border:#000000!important;
    --color-border-strong:#000000!important;
    --color-divider:#cccccc!important;
    --color-primary:#000000!important;
    --color-primary-hover:#000000!important;
    --color-primary-soft:#ffffff!important;
    --color-success:#000000!important;
    --color-success-soft:#ffffff!important;
    --color-warning:#000000!important;
    --color-warning-soft:#ffffff!important;
    --color-danger:#000000!important;
    --color-danger-soft:#ffffff!important;
    --color-info:#000000!important;
    --color-info-soft:#ffffff!important;
    --wk-bg:#ffffff!important;
    --wk-surface:#ffffff!important;
    --wk-surface-2:#ffffff!important;
    --wk-text:#000000!important;
    --wk-muted:#111111!important;
    --wk-border:#000000!important;
    --bg:#ffffff!important;
    --card:#ffffff!important;
    --t:#000000!important;
    --t2:#111111!important;
    --b:#000000!important;
    --p:#000000!important;
  }
  html[data-ui-theme="charcoal-teal"] body,
  html[data-ui-theme="royal-navy"] body,
  html[data-ui-theme="charcoal-teal"] .wk-sidebar,
  html[data-ui-theme="royal-navy"] .wk-sidebar,
  html[data-ui-theme="charcoal-teal"] .wk-topbar,
  html[data-ui-theme="royal-navy"] .wk-topbar,
  html[data-ui-theme="charcoal-teal"] .card,
  html[data-ui-theme="royal-navy"] .card,
  html[data-ui-theme="charcoal-teal"] .panel,
  html[data-ui-theme="royal-navy"] .panel,
  html[data-ui-theme="charcoal-teal"] .stat-card,
  html[data-ui-theme="royal-navy"] .stat-card,
  html[data-ui-theme="charcoal-teal"] .badge:not(.keep-native-grid):not(.keep-native-grid *),
  html[data-ui-theme="royal-navy"] .badge:not(.keep-native-grid):not(.keep-native-grid *),
  html[data-ui-theme="charcoal-teal"] .modal,
  html[data-ui-theme="royal-navy"] .modal{
    background:#ffffff!important;
    color:#000000!important;
    background-image:none!important;
    box-shadow:none!important;
    text-shadow:none!important;
    border-color:#000000!important;
  }
  html[data-ui-theme="charcoal-teal"] .wk-nav-item.active::after,
  html[data-ui-theme="royal-navy"] .wk-nav-item.active::after,
  html[data-ui-theme="charcoal-teal"] .wk-nav-group-btn.active::after,
  html[data-ui-theme="royal-navy"] .wk-nav-group-btn.active::after{display:none!important}
}
