:root[data-theme="dark"]{
  --ink:#e7ebf4;
  --muted:#929db2;
  --line:#303a4d;
  --bg:#111722;
  --panel:#1a2230;
  --blue:#7894ff;
  --blue-dark:#6684f5;
  --blue-soft:#263556;
  --nav:#151d29;
  --amber:#e3ad54;
  --amber-bg:#3b3021;
  --red:#f07b86;
  --red-bg:#40272d;
  --green:#58c98f;
  --green-2:#203b30;
  --shadow:0 8px 24px rgba(0,0,0,.2);
}
:root[data-theme="dark"] body{
  background:linear-gradient(135deg,#0d131d 0,#151d29 52%,#101620 100%);
}
:root[data-theme="dark"] .app-shell,
:root[data-theme="dark"] .main,
:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .kpi,
:root[data-theme="dark"] .device-card,
:root[data-theme="dark"] .shift-card,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .setup-shell,
:root[data-theme="dark"] .message-dock,
:root[data-theme="dark"] .messenger-compose,
:root[data-theme="dark"] .notification-item,
:root[data-theme="dark"] .notification-popup-preview{
  background:#1a2230;
  border-color:var(--line);
}
:root[data-theme="dark"] .topbar{background:rgba(26,34,48,.95)}
:root[data-theme="dark"] .brand{color:var(--ink)}
:root[data-theme="dark"] .sidebar nav a{color:#a8b2c3}
:root[data-theme="dark"] .sidebar nav a:hover{background:#202a3a;color:#dce3ef}
:root[data-theme="dark"] .sidebar nav a.active{background:#263556;box-shadow:inset 0 0 0 1px #384b72}
:root[data-theme="dark"] .nav-icon,
:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] .badge.gray,
:root[data-theme="dark"] .role-badge.role-user,
:root[data-theme="dark"] .role-badge.role-viewer{background:#26303f;color:#aab5c7}
:root[data-theme="dark"] .secondary,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .messenger-peer-list a,
:root[data-theme="dark"] .privacy-matrix .check{
  background:#151d29;
  color:var(--ink);
  border-color:#394458;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder{color:#768297}
:root[data-theme="dark"] .ghost:hover,
:root[data-theme="dark"] .message-dock-back:hover,
:root[data-theme="dark"] .message-dock-close:hover{background:#26303f;color:var(--ink)}
:root[data-theme="dark"] th,
:root[data-theme="dark"] .device-address,
:root[data-theme="dark"] .device-mini dl,
:root[data-theme="dark"] .calendar-upcoming,
:root[data-theme="dark"] .privacy-matrix,
:root[data-theme="dark"] .discover-row,
:root[data-theme="dark"] .messenger-start,
:root[data-theme="dark"] .notification-facts span{background:#151d29}
:root[data-theme="dark"] .employee-photo-form{background:#151d29;border-color:#2b3547}
:root[data-theme="dark"] .employee-photo-preview{background:#1a2230;border-color:#394458}
:root[data-theme="dark"] td,
:root[data-theme="dark"] .employee-status-row,
:root[data-theme="dark"] .alert-row,
:root[data-theme="dark"] .quick-card>a,
:root[data-theme="dark"] .device-summary-row,
:root[data-theme="dark"] .profile-details dt,
:root[data-theme="dark"] .profile-details dd,
:root[data-theme="dark"] .notification-item,
:root[data-theme="dark"] .messenger-peer{border-color:#2b3547}
:root[data-theme="dark"] td,
:root[data-theme="dark"] .notification-copy p,
:root[data-theme="dark"] .field-label,
:root[data-theme="dark"] label{color:#adb7c8}
:root[data-theme="dark"] .messenger-peer:hover,
:root[data-theme="dark"] .messenger-peer.is-active,
:root[data-theme="dark"] .messenger-peer-list a:hover,
:root[data-theme="dark"] .messenger-peer-list a.is-active{background:#222d40;border-color:#405477}
:root[data-theme="dark"] .messenger-messages{background:linear-gradient(180deg,#151d29,#1a2230 42%)}
:root[data-theme="dark"] .messenger-bubble.is-mine{background:#2c4171;border-color:#49629a}
:root[data-theme="dark"] .messenger-bubble.is-theirs.sender-color-0{background:#3d3025;border-color:#66503a}
:root[data-theme="dark"] .messenger-bubble.is-theirs.sender-color-1{background:#213747;border-color:#36596f}
:root[data-theme="dark"] .messenger-bubble.is-theirs.sender-color-2{background:#30294a;border-color:#504675}
:root[data-theme="dark"] .messenger-bubble.is-theirs.sender-color-3{background:#203b32;border-color:#35604f}
:root[data-theme="dark"] .messenger-bubble.is-theirs.sender-color-4{background:#402a32;border-color:#68424d}
:root[data-theme="dark"] .messenger-bubble.is-theirs.sender-color-5{background:#393927;border-color:#5c5d3d}
:root[data-theme="dark"] .message-toast{background:#1a2230;border-color:#394458;color:var(--ink)}
:root[data-theme="dark"] .pdks-assistant-dock{background:#1a2230;border-color:#2b3547}
:root[data-theme="dark"] .pdks-assistant-head{background:linear-gradient(180deg,#171f2d,#1a2230)}
:root[data-theme="dark"] .pdks-assistant-close:hover{background:#26303f;color:var(--ink)}
:root[data-theme="dark"] .pdks-assistant-message.is-assistant{background:#151d29;border-color:#2b3547}
:root[data-theme="dark"] .pdks-assistant-message.is-user{background:#253047}
:root[data-theme="dark"] .pdks-assistant-suggestions button{background:#151d29;border-color:#2b3547;color:var(--ink)}
:root[data-theme="dark"] .sidebar-toggle{background:#151d29;border-color:#2b3547;color:#adb7c8}
:root[data-theme="dark"] .sidebar-toggle:hover{background:#26303f;color:var(--ink)}
:root[data-theme="dark"] .violation-popup{background:rgba(26,34,48,.98);border-color:#663a43}
:root[data-theme="dark"] .violation-popup-close{background:#2a3444;color:#b5bfd0}
:root[data-theme="dark"] .notification-item.is-unread{background:linear-gradient(90deg,#222e49,#1a2230 48%)}
:root[data-theme="dark"] .notification-filter,
:root[data-theme="dark"] .attendance-view-switch,
:root[data-theme="dark"] .calendar-view-switch{background:#121923}
:root[data-theme="dark"] .notification-filter a.active,
:root[data-theme="dark"] .attendance-view-switch a.active,
:root[data-theme="dark"] .calendar-view-switch a.active{background:#253047;color:var(--blue)}
:root[data-theme="dark"] .attendance-view-switch b{background:#253047;color:#b5bfd0}
:root[data-theme="dark"] .leave-day,
:root[data-theme="dark"] .leave-year-grid>section{background:#1a2230}
:root[data-theme="dark"] .notification-cal{background:#151c27;border-bottom-color:#2a3444}
:root[data-theme="dark"] .notification-cal-day{background:#1a2230}
:root[data-theme="dark"] .notification-cal-day.has-count{background:#222e49}
:root[data-theme="dark"] .notification-cal-day.is-selected,
:root[data-theme="dark"] .notification-cal-day.has-count.is-selected{background:#253047}
:root[data-theme="dark"] .leave-day.is-weekend{background:#151c27}
:root[data-theme="dark"] .leave-day.is-holiday,
:root[data-theme="dark"] .calendar-event{background:#382f22;border-color:#665438}
:root[data-theme="dark"] .leave-day.is-half-holiday,
:root[data-theme="dark"] .calendar-event.is-half{background:linear-gradient(135deg,#1a2230 50%,#382f22 50%)}
:root[data-theme="dark"] .leave-day-focus{background:linear-gradient(145deg,#263556,#1a2230);border-color:#3c4d70}
:root[data-theme="dark"] .settings-card{background:linear-gradient(160deg,#1a2230 0%,#202a3a 140%)}
:root[data-theme="dark"] .attendance-donut:before{background:#1a2230}
:root[data-theme="dark"] .overview-hero{background:linear-gradient(100deg,#171f2d,#1a2230)}
:root[data-theme="dark"] .progress-track{background:#303a4d}
:root[data-theme="dark"] .empty-hero{background:#182235;border-color:#405477}
:root[data-theme="dark"] .check{background:#202c47;border-color:#3b4c72}
:root[data-theme="dark"] .auth-body,
:root[data-theme="dark"] .setup-body{
  background:
    radial-gradient(900px 420px at 12% 8%,rgba(78,103,190,.2),transparent 55%),
    radial-gradient(780px 380px at 90% 92%,rgba(107,74,156,.16),transparent 50%),
    #101620;
}
:root[data-theme="dark"] .auth-card .auth-brand strong,
:root[data-theme="dark"] .auth-copy h1{color:var(--ink)}
:root[data-theme="dark"] .hub-body{
  background:
    radial-gradient(1200px 500px at 12% -10%,rgba(76,102,190,.2),transparent 55%),
    radial-gradient(900px 420px at 92% 0%,rgba(102,67,148,.16),transparent 50%),
    #101620;
}
:root[data-theme="dark"] .hub-copy h1{color:var(--ink)}
:root[data-theme="dark"] .hub-tile{background:linear-gradient(165deg,#202b3d 0%,#1a2230 72%);border-color:#354157}
:root[data-theme="dark"] .hub-tile strong,
:root[data-theme="dark"] .hub-banner strong{color:var(--ink)}
:root[data-theme="dark"] .hub-tile small,
:root[data-theme="dark"] .hub-banner p{color:var(--muted)}
:root[data-theme="dark"] .hub-chip{background:color-mix(in srgb,var(--tile-color) 18%,#1a2230)}
:root[data-theme="dark"] .hub-banner{background:rgba(26,34,48,.9);border-color:var(--line)}
:root[data-theme="dark"] .hub-user .avatar{box-shadow:0 0 0 3px #1a2230,0 0 0 5px #477a5b}
:root[data-theme="dark"] .hub-user-sep{background:var(--line)}
::root[data-theme="dark"] .hub-logout{color:#adb7c8}
:root[data-theme="dark"] .hub-settings{color:#adb7c8}
:root[data-theme="dark"] .module-modal-dialog,
:root[data-theme="dark"] .module-modal-status,
:root[data-theme="dark"] .module-modal-features li{background:#1a2230;color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] .module-modal-head h2{color:var(--ink)}
:root[data-theme="dark"] .module-modal-head p,
:root[data-theme="dark"] .module-modal-status p,
:root[data-theme="dark"] .module-modal-body{color:#b3bdcd}
:root[data-theme="dark"] .module-modal-x{background:#26303f;color:#adb7c8}
:root[data-theme="dark"] .setup-wizard{background:#1a2230;border-color:var(--line)}
:root[data-theme="dark"] .setup-main,
:root[data-theme="dark"] .setup-card,
:root[data-theme="dark"] .setup-preview,
:root[data-theme="dark"] .wizard-content,
:root[data-theme="dark"] .wizard-panel{background:#1a2230;color:var(--ink);border-color:var(--line)}

.theme-toggle{
  width:36px;
  height:36px;
  flex:0 0 36px;
  display:grid;
  place-items:center;
  padding:0;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--panel);
  color:var(--ink);
  font-size:17px;
  line-height:1;
  cursor:pointer;
  box-shadow:var(--shadow);
}
.theme-toggle:hover{border-color:var(--blue);color:var(--blue)}
.theme-toggle-floating{position:fixed;top:18px;right:18px;z-index:80}
