/* =========================================================
   Gentelella v4 Core Shell & UI Stylesheet (Standalone)
   ========================================================= */
:root {
  --primary: #1abb9c;
  --primary-dk: #14967d;
  --primary-soft: rgba(26, 187, 156, 0.12);
  --blue: #3498db;
  --green: #26b99a;
  --yellow: #f39c12;
  --red: #e74c3c;
  --purple: #9b59b6;

  --bg-body: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f8fafc;
  --sidebar-bg: #2a3f54;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(255, 255, 255, 0.1);
  --sidebar-text: #e7e7e7;
  --sidebar-muted: #9eb1c4;
  --sidebar-width: 240px;
  --topbar-height: 56px;

  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-color-light: #f1f5f9;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-secondary: #162032;
  --sidebar-bg: #0b1120;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --border-color-light: #1e293b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-body);
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 16px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-name small {
  font-size: 11px;
  font-weight: 500;
  color: var(--sidebar-muted);
  margin-left: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}

.nav-group { margin-bottom: 18px; }

.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-muted);
  padding: 0 10px 6px;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.nav-link:hover { background: var(--sidebar-hover); text-decoration: none; }
.nav-link.active, .nav-tree.has-active > .nav-toggle {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 500;
}

.nav-text { flex: 1; }
.nav-chev { transition: transform 0.2s ease; }
.nav-tree.open .nav-chev { transform: rotate(90deg); }

.nav-sub {
  display: none;
  padding-left: 28px;
}
.nav-tree.open .nav-sub { display: block; }

.nav-sublink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--sidebar-muted);
  border-radius: 6px;
}
.nav-sublink:hover { color: #fff; text-decoration: none; }
.nav-sublink.active { color: var(--primary); font-weight: 500; }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}

.avatar .online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--sidebar-bg);
  position: absolute;
  bottom: 0;
  right: 0;
}

.sidebar-user-info .name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user-info .role { font-size: 11px; color: var(--sidebar-muted); }

/* ── Main & Topbar ── */
.main {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: calc(100vh - 46px);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle, .tb-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sidebar-toggle { display: none; }
.tb-btn:hover { background: var(--bg-surface-secondary); color: var(--text); }

.tb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.breadcrumb .current { color: var(--text); font-weight: 500; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 260px;
  width: 100%;
}
.search-box .s-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
}
.search-box input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-surface-secondary);
  color: var(--text);
  font: inherit;
}

/* ── Page Wrapper & Header ── */
.page-wrapper {
  padding: 22px 24px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header { margin-bottom: 20px; }
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page-pretitle {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.page-title {
  margin: 2px 0 0;
  font-size: 21px;
  font-weight: 700;
}
.page-actions { display: flex; gap: 8px; }

/* ── Grid System ── */
.row {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}
.row.col-1 { grid-template-columns: 1fr; }
.row.col-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row.col-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.col-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row.col-8-4 { grid-template-columns: 2fr 1fr; }
.row.col-4-8 { grid-template-columns: 1fr 2fr; }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title { font-size: 14.5px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.p-0 { padding: 0; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color-light);
  background: var(--bg-surface-secondary);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font: inherit;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14.5px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-outline { background: var(--bg-surface); border-color: var(--border-color); color: var(--text); }
.btn-outline:hover { background: var(--bg-surface-secondary); }
.btn-success { background: var(--green); color: #fff; }
.btn-warning { background: var(--yellow); color: #fff; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-surface-secondary); }

/* ── Forms ── */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 8px 11px;
  font: inherit;
  color: var(--text);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-help { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.form-actions.right { justify-content: flex-end; }

/* ── Tables, Badges & Statuses ── */
.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th {
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-color);
}
.table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-color-light);
}
.table tbody tr:hover { background: var(--bg-surface-secondary); }
.cell-strong { font-weight: 600; }
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 999px;
}
.badge-teal { background: var(--primary-soft); color: var(--primary); }
.badge-red  { background: rgba(231, 76, 60, 0.14); color: var(--red); }
.badge-blue { background: rgba(52, 152, 219, 0.14); color: var(--blue); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-green  { background: rgba(38, 185, 154, 0.14); color: var(--green); }
.status-yellow { background: rgba(243, 156, 18, 0.14); color: var(--yellow); }
.status-red    { background: rgba(231, 76, 60, 0.14); color: var(--red); }
.status-blue   { background: rgba(52, 152, 219, 0.14); color: var(--blue); }

/* ── Footer ── */
.footer {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 14px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* ── Responsive Breakpoints ── */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main, .footer { margin-left: 0; width: 100%; }
  .sidebar-toggle { display: inline-flex; }
  .row.col-3, .row.col-4, .row.col-8-4, .row.col-4-8 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .row.col-2, .form-row { grid-template-columns: 1fr; }
  .search-box { display: none; }
}

/* Gentelella 2026 v4 — main entry */
/* Self-contained design system, no Bootstrap (uses own .row/.col-* grid). */

/* Last: RTL overrides only fix what logical properties can't express */
/* (transforms, background-position, box-shadow), so they must win the cascade. */

/* Page-specific layouts for the app pages added beyond upstream parity: */
/* chat, settings, notifications. */

/* ──────────────────────── */
/* CHAT */
/* ──────────────────────── */
.chat-card { padding: 0; overflow: hidden; }
.chat-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 56px - 40px - 60px); /* viewport - topbar - page header */
  min-height: 540px;
  max-height: 800px;
}

.chat-rail {
  border-inline-end: 1px solid var(--border-color-light);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-rail-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}
.chat-rail-search svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.chat-rail-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
}
.chat-rail-search input::placeholder { color: var(--text-disabled); }

.chat-rail-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}

.chat-conversations {
  flex: 1 1 auto;
  overflow-y: auto;
}
.chat-conversation {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color-light);
  cursor: pointer;
  text-align: start;
  font: inherit;
  transition: background 100ms;
}
.chat-conversation:hover { background: var(--bg-surface-secondary); }
.chat-conversation.active { background: var(--primary-lt); }
.chat-conversation .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
  position: relative;
}
.chat-conversation .av .online {
  position: absolute; bottom: -1px; inset-inline-end: -1px;
  width: 9px; height: 9px;
  background: var(--green);
  border: 2px solid var(--bg-surface);
  border-radius: 50%;
}
.chat-conversation .info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-conversation .row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}
.chat-conversation .name {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-conversation .name small { color: var(--text-muted); font-weight: normal; font-size: 11px; }
.chat-conversation .time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.chat-conversation .preview-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-conversation .preview {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-conversation .unread {
  flex-shrink: 0;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.4;
}

/* Active thread */
.chat-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}
.chat-thread-peer { display: flex; align-items: center; gap: 10px; }
.chat-thread-peer .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: var(--font-weight-bold);
}
.chat-thread-peer .name { font-size: 14px; font-weight: var(--font-weight-bold); color: var(--text); line-height: 1.2; }
.chat-thread-peer .presence { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.chat-thread-peer .presence .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.chat-thread-peer .presence .dot.off { background: var(--text-disabled); }

.chat-thread-actions { display: flex; gap: var(--space-1); align-items: center; }

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--bg-surface-secondary);
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}
.chat-bubble.theirs { align-items: flex-start; align-self: flex-start; }
.chat-bubble.mine   { align-items: flex-end;   align-self: flex-end; }
.chat-bubble .bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  word-wrap: break-word;
}
.chat-bubble.theirs .bubble {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border-color);
  border-end-start-radius: 4px;
}
.chat-bubble.mine .bubble {
  background: var(--primary);
  color: white;
  border-end-end-radius: 4px;
}
.chat-bubble .meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.chat-composer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-color-light);
  flex-shrink: 0;
  background: var(--bg-surface);
}
.chat-composer input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--bg-surface-secondary);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.chat-composer input:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.composer-btn {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 100ms, color 100ms;
}
.composer-btn:hover { background: var(--bg-surface-secondary); color: var(--text); }
.composer-send { height: 32px; padding: 0 12px; }

@media (max-width: 768px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-rail { display: none; }
}

/* ──────────────────────── */
/* SETTINGS */
/* ──────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: flex-start;
}
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; }
}

.settings-nav {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}
.settings-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transition: background 120ms, color 120ms;
}
.settings-nav-link:hover { background: var(--bg-surface-secondary); color: var(--text); text-decoration: none; }
.settings-nav-link.active { background: var(--primary-lt); color: var(--primary); }
.settings-nav-link svg { width: 14px; height: 14px; opacity: 0.7; flex-shrink: 0; }
.settings-nav-link.active svg { opacity: 1; }
.settings-nav-link.danger { color: var(--red); }
.settings-nav-link.danger:hover { background: var(--red-lt); color: var(--red); }
.settings-nav-sep { height: 1px; background: var(--border-color-light); margin: 6px 4px; }

.settings-content { display: flex; flex-direction: column; gap: 20px; }
.settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  scroll-margin-top: 72px;
}
.settings-section-title {
  font-size: 16px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  margin: 0 0 4px;
}
.settings-section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.settings-form { display: flex; flex-direction: column; gap: 14px; }
.settings-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-4);
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color-light);
}
.settings-row:last-of-type { border-bottom: none; }
.settings-row > label {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  padding-top: 8px;
}
.settings-row .form-control { max-width: 360px; }
.settings-control { display: flex; flex-direction: column; gap: 6px; }
.settings-hint { font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 600px) {
  .settings-row { grid-template-columns: 1fr; gap: 6px; }
}

.profile-control { flex-direction: row; align-items: center; gap: 14px; }
.profile-preview {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: 14px;
  border-top: 1px solid var(--border-color-light);
}

.settings-toggle-list { display: flex; flex-direction: column; }
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color-light);
}
.settings-toggle-row:last-child { border-bottom: none; }
.settings-toggle-row .label { font-size: 13px; font-weight: var(--font-weight-medium); color: var(--text); }
.settings-toggle-row .desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.session-list { display: flex; flex-direction: column; gap: 6px; }
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 12px;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius);
}
.session-row .device { font-size: 13px; font-weight: var(--font-weight-medium); color: var(--text); }
.session-row .meta   { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.theme-options { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.theme-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 120ms, border-color 120ms, color 120ms;
}
.theme-option input[type="radio"] { accent-color: var(--primary); margin: 0; }
.theme-option:has(input:checked) {
  background: var(--primary-lt);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: var(--font-weight-medium);
}

.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
}
.integration {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius);
}
.integration-head { display: flex; align-items: center; gap: var(--space-3); }
.integration .logo {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}
.integration .title { font-size: 13px; font-weight: var(--font-weight-medium); color: var(--text); }
.integration .desc  { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.billing-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 16px;
  background: linear-gradient(135deg, var(--primary-lt), var(--azure-lt));
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.billing-current .plan-name { font-size: 16px; font-weight: var(--font-weight-bold); color: var(--text); }
.billing-current .plan-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color-light);
}
.danger-row:last-child { border-bottom: none; }
.danger-row .label { font-size: 13px; font-weight: var(--font-weight-medium); color: var(--text); }
.danger-row .desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.danger-row.danger-critical { background: var(--red-lt); padding: 14px; border-radius: var(--radius); border: none; margin-top: 6px; }
.danger-row.danger-critical .label { color: var(--red); }

/* ──────────────────────── */
/* NOTIFICATIONS PAGE */
/* ──────────────────────── */
.notif-tabs .notif-tab-count {
  display: inline-block;
  margin-inline-start: 4px;
  padding: 0 6px;
  background: var(--primary-lt);
  color: var(--primary);
  border-radius: 10px;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  line-height: 1.6;
}

.notifications-list { display: flex; flex-direction: column; }
.notification-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 14px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color-light);
  cursor: pointer;
  text-align: start;
  font: inherit;
  transition: background 100ms;
  position: relative;
}
.notification-row:last-child { border-bottom: none; }
.notification-row:hover { background: var(--bg-surface-secondary); }
.notification-row.unread::before {
  content: '';
  position: absolute;
  inset-inline-start: 8px; top: 22px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.notification-row .notif-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notification-row .notif-info    { background: var(--blue-lt);    color: var(--blue); }
.notification-row .notif-task    { background: var(--primary-lt); color: var(--primary); }
.notification-row .notif-alert   { background: var(--red-lt);     color: var(--red); }
.notification-row .notif-mention { background: var(--purple-lt);  color: var(--purple); }
.notification-row .notif-body { flex: 1 1 auto; min-width: 0; }
.notification-row .notif-from {
  display: block;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  margin-bottom: 1px;
}
.notification-row.unread .notif-from { font-weight: var(--font-weight-bold); }
.notification-row .notif-text {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.notification-row .notif-time {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 4px;
}

.notifications-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.notifications-empty svg { color: var(--text-disabled); margin-bottom: 12px; }
.notifications-empty .empty-title { font-size: 14px; font-weight: var(--font-weight-bold); color: var(--text); margin-bottom: 4px; }
.notifications-empty .empty-desc  { font-size: 12.5px; }

/* ──────────────────────── */
/* LOCK SCREEN */
/* ──────────────────────── */
.lock-screen { padding-top: 24px; }
.lock-avatar {
  position: relative;
  width: 80px; height: 80px;
  margin: 0 auto;
}
.lock-avatar-circle {
  width: 100%; height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  font-weight: var(--font-weight-bold);
}
.lock-icon {
  position: absolute;
  bottom: -2px; inset-inline-end: -4px;
  width: 26px; height: 26px;
  background: var(--bg-surface);
  border: 2px solid var(--bg-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.1);
}

/* ──────────────────────── */
/* 2FA OTP */
/* ──────────────────────── */
.otp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-2);
  margin-bottom: 12px;
}
.otp-input {
  width: 100%;
  height: 48px;
  text-align: center;
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms, background 120ms;
  color: var(--text);
}
.otp-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
  background: var(--bg-surface);
}
.otp-input:not(:placeholder-shown) { background: var(--primary-lt); border-color: var(--primary); }
.otp-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 20px;
  font-size: 12px;
  color: var(--text-muted);
}
.otp-meta strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ──────────────────────── */
/* FAQ / HELP */
/* ──────────────────────── */
.faq-hero {
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary-lt), var(--azure-lt));
  border-color: transparent;
}
.faq-hero-inner {
  padding: 32px;
  text-align: center;
  max-width: 580px;
  margin: 0 auto;
}
.faq-hero h2 {
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.3px;
  margin: 0 0 6px;
  color: var(--text);
}
.faq-hero p { font-size: 14px; color: var(--text-secondary); margin: 0 0 18px; }
.faq-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.faq-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.faq-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 14px;
  color: var(--text);
}

.faq-quick { margin-bottom: 16px; }
.faq-card {
  display: block;
  text-decoration: none;
  padding: 18px;
  cursor: pointer;
  transition: border-color 120ms, transform 120ms;
}
.faq-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  text-decoration: none;
}
.faq-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.faq-card .title { font-size: 14px; font-weight: var(--font-weight-bold); color: var(--text); margin-bottom: 4px; }
.faq-card .desc  { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

.faq-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 0 4px;
}
.faq-list { display: flex; flex-direction: column; }
.faq-item {
  border-bottom: 1px solid var(--border-color-light);
}
.faq-item:last-child { border-bottom: none; }
.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 4px;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  text-align: start;
  cursor: pointer;
}
.faq-q:hover { color: var(--primary); }
.faq-chev { color: var(--text-muted); transition: transform 180ms; flex-shrink: 0; }
.faq-item.open .faq-chev { transform: rotate(180deg); color: var(--primary); }
.faq-a {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-height: 0;
  overflow: hidden;
  transition: max-height 220ms ease, padding 180ms ease;
  padding: 0 4px;
}
.faq-item.open .faq-a {
  max-height: 320px;
  padding: 0 4px 14px;
}
.faq-a a { color: var(--primary); }
.faq-a strong { color: var(--text); font-weight: var(--font-weight-medium); }
.faq-empty { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.faq-empty .title { font-size: 14px; font-weight: var(--font-weight-bold); color: var(--text); margin-bottom: 4px; }

.contact-channel {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color-light);
  text-decoration: none;
}
.contact-channel:last-child { border-bottom: none; }
.contact-channel:hover { text-decoration: none; }
.contact-channel:hover .title { color: var(--primary); }
.contact-channel .ch-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.contact-channel .title { font-size: 13px; font-weight: var(--font-weight-medium); color: var(--text); }
.contact-channel .meta  { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* ──────────────────────── */
/* ORDER TIMELINE */
/* ──────────────────────── */
.order-timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-2);
  position: relative;
}
.order-timeline::before {
  content: '';
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  inset-inline-end: 12px;
  height: 2px;
  background: var(--border-color-light);
  z-index: 0;
}
.order-timeline .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.order-timeline .step .dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
}
.order-timeline .step.done .dot {
  background: var(--primary);
  border-color: var(--primary);
}
.order-timeline .step.done .dot::after {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M3 8l3 3 7-7'/%3E%3C/svg%3E") center/14px no-repeat;
}
.order-timeline .step.active .dot {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.order-timeline .step .label { font-size: 12px; font-weight: var(--font-weight-medium); color: var(--text); text-align: center; }
.order-timeline .step:not(.done):not(.active) .label { color: var(--text-muted); }
.order-timeline .step .meta  { font-size: 10.5px; color: var(--text-muted); text-align: center; }

.order-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  padding: 5px 0;
  gap: var(--space-3);
}
.order-info-row .label { color: var(--text-muted); }
.order-info-row .value { color: var(--text); font-weight: var(--font-weight-medium); text-align: end; }

/* ──────────────────────── */
/* USER MANAGEMENT */
/* ──────────────────────── */
.users-filters { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.users-filters .search-box .s-icon { width: 14px; height: 14px; }
.role-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: var(--font-weight-bold);
  border-radius: 12px;
  border: none;
  background: var(--bg-surface-secondary);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: var(--font-weight-bold);
  font-size: 11.5px;
}
.role-chip:hover { background: var(--border-color-light); }
.role-chip.role-purple { background: var(--purple-lt); color: var(--purple); }
.role-chip.role-red    { background: var(--red-lt);    color: var(--red); }
.role-chip.role-blue   { background: var(--blue-lt);   color: var(--blue); }
.role-chip.role-green  { background: var(--green-lt);  color: var(--green); }
.cell-avatar.pending {
  border: 1.5px dashed var(--border-color);
  background: transparent !important;
  color: var(--text-muted) !important;
}

/* ──────────────────────── */
/* PRODUCT DETAIL */
/* ──────────────────────── */
.product-gallery { display: flex; flex-direction: column; gap: var(--space-3); }
.gallery-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
}
.gallery-image {
  width: 100%; height: 100%;
  position: relative;
}
.gallery-svg {
  width: 100%; height: 100%;
  display: block;
}
.gallery-svg svg { display: block; }
.gallery-badge {
  position: absolute;
  top: 12px; inset-inline-start: 12px;
  padding: 3px 9px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 3px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}
.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-2);
}
.gallery-thumb {
  aspect-ratio: 4 / 3;
  border: 2px solid var(--border-color);
  background: var(--bg-surface-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: border-color 120ms, transform 120ms;
}
.gallery-thumb:hover { transform: translateY(-1px); border-color: var(--text-muted); }
.gallery-thumb.active { border-color: var(--primary); }
.gallery-thumb svg { display: block; width: 100%; height: 100%; }

.related-card .thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
}
.related-card .thumb svg { display: block; width: 100%; height: 100%; }

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.product-meta .rating { font-size: 12px; color: var(--yellow); font-weight: var(--font-weight-medium); }
.product-meta .rating small { color: var(--text-muted); font-weight: normal; margin-inline-start: 4px; }

.product-title {
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.3px;
  color: var(--text);
  margin: 0 0 8px;
}
.product-tagline {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 18px;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 22px;
}
.product-price-row .price {
  font-size: 28px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  letter-spacing: -0.5px;
}
.product-price-row .price-old {
  font-size: 16px;
  color: var(--text-muted);
  text-decoration: line-through;
}
.product-price-row .price-discount {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  padding: 2px 8px;
  background: var(--red-lt);
  color: var(--red);
  border-radius: 10px;
}

.product-option { margin-bottom: 16px; }
.option-label {
  font-size: 11.5px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.option-values { display: flex; gap: 6px; flex-wrap: wrap; }
.option-value {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font: inherit;
  font-size: 12.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 100ms, color 100ms, background 100ms;
}
.option-value:hover { color: var(--text); }
.option-value.active {
  border-color: var(--primary);
  background: var(--primary-lt);
  color: var(--primary);
}

.product-quantity-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.qty-label {
  font-size: 11.5px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}
.qty-controls {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.qty-btn {
  width: 32px; height: 34px;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
}
.qty-btn:hover { background: var(--bg-surface-secondary); }
.qty-controls input {
  width: 48px;
  height: 34px;
  text-align: center;
  border: none;
  border-inline-start: 1px solid var(--border-color);
  border-inline-end: 1px solid var(--border-color);
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  outline: none;
  background: var(--bg-surface);
  color: var(--text);
}
.qty-controls input::-webkit-inner-spin-button,
.qty-controls input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stock-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--green);
  font-weight: var(--font-weight-medium);
}
.stock-indicator .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.product-actions {
  display: flex;
  gap: var(--space-2);
  margin-bottom: 18px;
}
.product-actions .btn { flex: 1; justify-content: center; height: 40px; }

.product-perks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color-light);
}
.product-perks .perk {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12.5px;
  color: var(--text-secondary);
}
.product-perks .perk svg { color: var(--green); }

.reviews-summary {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-5);
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-color-light);
  align-items: center;
}
.reviews-summary .rating-big { text-align: center; }
.rating-big .num {
  font-size: 42px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
}
.rating-big .stars { color: var(--yellow); margin: 4px 0 2px; }
.rating-big .meta { font-size: 11.5px; color: var(--text-muted); }
.rating-bars { display: flex; flex-direction: column; gap: var(--space-1); }
.r-bar {
  display: grid;
  grid-template-columns: 28px 1fr 36px;
  gap: var(--space-2);
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.r-bar .lbl { color: var(--yellow); font-weight: var(--font-weight-medium); }
.r-bar .bar {
  height: 6px;
  background: var(--bg-surface-secondary);
  border-radius: 3px;
  overflow: hidden;
}
.r-bar .fill { height: 100%; }
.r-bar .cnt { text-align: end; }

.reviews-list { display: flex; flex-direction: column; gap: 18px; }
.review { padding-bottom: 16px; border-bottom: 1px solid var(--border-color-light); }
.review:last-child { border-bottom: none; padding-bottom: 0; }
.review-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.review-head .stars { color: var(--yellow); font-size: 13px; }
.review-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}
.related-card {
  display: block;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 120ms, transform 120ms;
}
.related-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  text-decoration: none;
}
.related-card .thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.related-card .title {
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  margin-bottom: 2px;
}
.related-card .meta { font-size: 11px; color: var(--yellow); margin-bottom: 4px; }
.related-card .price { font-size: 15px; font-weight: var(--font-weight-bold); color: var(--text); }

@media (max-width: 900px) {
  .product-detail-grid { grid-template-columns: 1fr !important; }
  .reviews-summary { grid-template-columns: 1fr; }
}

/* ──────────────────────── */
/* FILE MANAGER */
/* ──────────────────────── */
.file-manager { padding: 0; overflow: hidden; }
.fm-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  height: calc(100vh - 56px - 40px - 60px);
  min-height: 540px;
  max-height: 800px;
}
.fm-tree-wrap {
  border-inline-end: 1px solid var(--border-color-light);
  display: flex;
  flex-direction: column;
  padding: 8px;
}
.fm-tree {
  flex: 1 1 auto;
  overflow-y: auto;
}
.tree-group { margin-bottom: 4px; }
.tree-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: start;
  cursor: pointer;
  transition: background 100ms, color 100ms;
}
.tree-link:hover { background: var(--bg-surface-secondary); color: var(--text); }
.tree-link.active { background: var(--primary-lt); color: var(--primary); font-weight: var(--font-weight-medium); }
.tree-link svg { color: var(--text-muted); flex-shrink: 0; }
.tree-link.active svg { color: var(--primary); }
.tree-sub { padding-inline-start: 24px; }
.tree-sub-sub { padding-inline-start: 40px; }

.fm-storage {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border-color-light);
}
.fm-storage-label {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.fm-storage .storage-bar { height: 5px; background: var(--bg-surface-secondary); border-radius: 3px; overflow: hidden; display: flex; }
.fm-storage-meta { font-size: 11px; color: var(--text-muted); margin-top: 5px; }

.fm-main { display: flex; flex-direction: column; min-height: 0; }
.fm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}
.fm-breadcrumb { display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; }
.bc-link {
  background: transparent;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background 100ms, color 100ms;
}
.bc-link:hover { background: var(--bg-surface-secondary); color: var(--text); }
.bc-link.current { color: var(--text); font-weight: var(--font-weight-medium); cursor: default; }
.bc-link.current:hover { background: transparent; }
.fm-toolbar-actions { display: flex; align-items: center; gap: var(--space-2); }
.fm-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-btn {
  width: 32px; height: 32px;
  border: none;
  background: var(--bg-surface);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms, color 100ms;
}
.view-btn:hover { background: var(--bg-surface-secondary); color: var(--text); }
.view-btn.active { background: var(--primary-lt); color: var(--primary); }

.fm-grid {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
}
.fm-grid.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: var(--space-3);
}
.fm-grid.view-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.fm-item {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  text-align: start;
  transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}
.fm-grid.view-grid .fm-item {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}
.fm-grid.view-list .fm-item {
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 36px 1fr auto auto auto;
  gap: var(--space-3);
  align-items: center;
}
.fm-grid.view-list .fm-item .fm-item-icon { width: 36px; height: 36px; }
.fm-grid.view-list .fm-item .fm-item-meta { white-space: nowrap; font-size: 11.5px; }
.fm-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.fm-item-icon {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-surface-secondary);
}
.fm-grid.view-grid .fm-item-icon { width: 100%; }
.fm-item-icon .ext {
  font-size: 12px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.5px;
}
.fm-item-name {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}
.fm-item-meta { font-size: 11.5px; color: var(--text-muted); }
.fm-star {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  color: var(--text-disabled);
  opacity: 0;
  transition: opacity 100ms, color 100ms, background 100ms;
}
.fm-grid.view-list .fm-star { position: static; opacity: 1; }
.fm-item:hover .fm-star,
.fm-item.starred .fm-star { opacity: 1; }
.fm-star.on { color: var(--yellow); }
.fm-star:hover { background: var(--bg-surface-secondary); color: var(--yellow); }

.fm-item-menu {
  position: absolute;
  bottom: 6px;
  inset-inline-end: 6px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 100ms, background 100ms;
}
.fm-grid.view-list .fm-item-menu { position: static; opacity: 1; }
.fm-item:hover .fm-item-menu { opacity: 1; }
.fm-item-menu:hover { background: var(--bg-surface-secondary); color: var(--text); }

.fm-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.fm-empty svg { color: var(--text-disabled); margin-bottom: 12px; }
.fm-empty .empty-title { font-size: 14px; font-weight: var(--font-weight-bold); color: var(--text); margin-bottom: 4px; }
.fm-empty .empty-desc  { font-size: 12.5px; }

.upload-zone {
  padding: 32px;
  text-align: center;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background: var(--bg-surface-secondary);
}
.upload-zone svg { color: var(--text-muted); margin-bottom: 12px; }
.upload-zone .upload-title { font-size: 14px; font-weight: var(--font-weight-medium); color: var(--text); margin-bottom: 4px; }
.upload-zone .upload-meta  { font-size: 11.5px; }

@media (max-width: 768px) {
  .fm-layout { grid-template-columns: 1fr; }
  .fm-tree-wrap { display: none; }
}

/* ──────────────────────── */
/* KANBAN */
/* ──────────────────────── */
.kanban-page { max-width: none !important; padding-bottom: 24px !important; }
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: var(--space-4);
  align-items: flex-start;
}
@media (max-width: 1100px) {
  .kanban-board {
    grid-template-columns: repeat(4, minmax(260px, 320px));
    overflow-x: auto;
    padding-bottom: 8px;
  }
}

.kanban-column {
  background: var(--bg-surface-secondary);
  border-radius: var(--radius-lg);
  padding: 8px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.kanban-column-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 8px;
}
.kanban-column-head .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kanban-column-head .title {
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
}
.kanban-column-head .count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: var(--font-weight-medium);
}
.kanban-add {
  margin-inline-start: auto;
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.kanban-add:hover { background: var(--bg-surface); color: var(--text); }

.kanban-column-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 40px;
  padding: 4px 0;
  border-radius: var(--radius);
  transition: background 100ms;
}
.kanban-column-body.drop-target {
  background: var(--primary-lt);
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
}
.kanban-column-foot {
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: start;
  transition: background 100ms, color 100ms;
}
.kanban-column-foot:hover { background: var(--bg-surface); color: var(--text); }

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  cursor: grab;
  transition: border-color 120ms, box-shadow 120ms, transform 120ms, opacity 120ms;
  user-select: none;
}
.kanban-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(1deg);
  cursor: grabbing;
}

.kanban-card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: 8px;
}
.kanban-label {
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--primary-lt);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.kanban-label-purple { background: var(--purple-lt); color: var(--purple); }
.kanban-label-blue   { background: var(--blue-lt);   color: var(--blue); }
.kanban-label-green  { background: var(--green-lt);  color: var(--green); }
.kanban-label-red    { background: var(--red-lt);    color: var(--red); }
.kanban-label-yellow { background: var(--yellow-lt); color: #b45309; }

.kanban-card-title {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}
.kanban-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}
.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 11px;
  color: var(--text-muted);
}
.kanban-card-meta .due-date { font-weight: var(--font-weight-medium); }
.kanban-card-avatars {
  display: flex;
  align-items: center;
}
.kanban-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 9.5px;
  font-weight: var(--font-weight-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
  flex-shrink: 0;
}
.kanban-avatar + .kanban-avatar { margin-inline-start: -6px; }

.kanban-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}
.kanban-assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--text-secondary);
  transition: border-color 100ms, background 100ms, color 100ms;
}
.kanban-assignee-chip:hover { color: var(--text); }
.kanban-assignee-chip.active {
  background: var(--primary-lt);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: var(--font-weight-medium);
}
.kanban-assignee-chip .av {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 9.5px;
  font-weight: var(--font-weight-bold);
}

/* Auth + standalone (no-sidebar) layouts: login, register, error pages */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 80% at 20% 30%, rgba(26,187,156,0.06), transparent),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(66,153,225,0.05), transparent),
    var(--body-bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.auth-brand .brand-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
}
.auth-brand .brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}
.auth-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
  font-size: 12.5px;
}
.auth-actions a { color: var(--primary); font-weight: var(--font-weight-medium); }
.auth-divider {
  display: flex; align-items: center; gap: var(--space-3);
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 11.5px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}
.auth-footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 20px;
}
.auth-footer a { color: var(--primary); font-weight: var(--font-weight-medium); }

/* Error pages (404, 500, 403) */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--body-bg);
  text-align: center;
}
.error-content { max-width: 500px; }
.error-code {
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -3px;
  background: linear-gradient(135deg, var(--primary), var(--azure));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}
.error-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.error-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}
.error-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
}

.auth-success {
  text-align: center;
  padding: 16px 0;
}
.auth-success svg { margin: 0 auto 8px; display: block; }
.auth-success .success-title { font-size: 16px; font-weight: var(--font-weight-bold); color: var(--text); margin-bottom: 4px; }
.auth-success .success-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Status pages (maintenance, coming_soon) — shared helpers on top of .error-page */
.status-page-icon {
  width: 80px; height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--primary-lt);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-page-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: 20px 0 24px;
  text-align: start;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.status-page-meta .meta-label {
  font-size: 10.5px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.status-page-meta .meta-value {
  font-size: 13px;
  color: var(--text);
  font-weight: var(--font-weight-medium);
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  margin: 24px 0;
}
.countdown-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 8px;
}
.countdown-cell .num {
  font-size: 28px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.countdown-cell .lbl {
  font-size: 10.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
@media (max-width: 480px) {
  .countdown-cell .num { font-size: 22px; }
}

.coming-soon-form {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}
.coming-soon-form .input-group { flex: 1; }
.coming-soon-success {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--green-lt);
  color: var(--green);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: var(--font-weight-medium);
}

/* Reusable components: buttons, cards, tables, status, progress, toggles */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms, border-color 120ms, color 120ms, box-shadow 120ms;
  line-height: 1;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dk);
}
.btn-primary:hover { background: var(--primary-dk); }
.btn-outline {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-color);
  box-shadow: var(--shadow);
}
.btn-outline:hover { background: var(--bg-surface-secondary); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* Card */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 150ms;
}
.card.is-refreshing {
  position: relative;
  pointer-events: none;
}
.card.is-refreshing::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent 0%, rgba(26, 187, 156, 0.10) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: card-refresh-sweep 700ms ease-out;
  pointer-events: none;
  z-index: 5;
}
@keyframes card-refresh-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .card.is-refreshing::before { animation: none; opacity: 0.3; }
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Always keep at least 16px between the title group and any right-side */
  /* controls (dropdowns, action buttons, "View all" links). Without this, */
  /* wider title blocks could end up flush against the controls when */
  /* space-between has nothing left to distribute. */
  gap: var(--space-4);
  /* Let the title group and controls wrap on narrow screens instead of */
  /* pushing the page wider than the viewport. */
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color-light);
  min-height: 44px;
}
.card-title {
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
}
.card-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: var(--font-weight-normal);
  margin-top: 1px;
}
.card-options { display: flex; align-items: center; gap: 2px; }
.card-opt-btn {
  width: 26px; height: 26px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background 100ms, color 100ms;
}
.card-opt-btn:hover { background: var(--body-bg); color: var(--text-secondary); }
.card-opt-btn svg { width: 14px; height: 14px; }

.card-body { padding: 16px; }
.card-body.p-0 { padding: 0; }
.card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-color-light);
}

/* Table */
.table-responsive { overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.table th {
  text-align: start;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  background: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-color);
}
table.table td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color-light);
  color: var(--text-secondary);
  vertical-align: middle;
}
table.table tr:last-child td { border-bottom: none; }
table.table tbody tr { transition: background 80ms; }
table.table tbody tr:hover { background: var(--bg-surface-secondary); }

.cell-strong { color: var(--text); font-weight: var(--font-weight-medium); }
.cell-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  font-weight: var(--font-weight-medium);
}
.cell-customer {
  display: flex; align-items: center; gap: var(--space-2);
}
.cell-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 11.5px;
  font-weight: var(--font-weight-medium);
}
.status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-green { color: var(--green); }
.status-green::before { background: var(--green); }
.status-yellow { color: #b45309; }
.status-yellow::before { background: var(--yellow); }
.status-blue { color: var(--blue); }
.status-blue::before { background: var(--blue); }
.status-red { color: var(--red); }
.status-red::before { background: var(--red); }

/* Progress bar (inline) — used in stat tiles, plan/quota progress, KPI rows. */
.progress-thin {
  height: 5px;
  background: var(--bg-surface-secondary);
  border-radius: 3px;
  overflow: hidden;
}
.progress-thin .bar {
  height: 100%;
  border-radius: 3px;
  transition: width 200ms ease;
}

/* Pulsing dot — for "LIVE" / "online" / "active" indicators. Used inline: */
/* <span class="live-pulse"></span> */
/* or with a custom color via a wrapping span style background. The animation */
/* is a soft expanding-ring shadow. */
.live-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(47, 179, 68, 0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(47, 179, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 179, 68, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .live-pulse { animation: none; }
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color-light);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .label { font-size: 13px; color: var(--text); }
.toggle-row .desc { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.toggle {
  width: 36px; height: 20px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 150ms;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; inset-inline-start: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: transform 150ms;
}
.toggle.on::after { transform: translateX(16px); }

/* ──────────────────────── */
/* TOAST */
/* ──────────────────────── */
.toast-host {
  position: fixed;
  inset-inline-end: 16px;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 0 0 1px var(--border-translucent);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  max-width: 360px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.2, 0, 0, 1);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-inline-start: 3px solid var(--green); padding-inline-start: 11px; }
.toast-error   { border-inline-start: 3px solid var(--red);   padding-inline-start: 11px; }
.toast-warning { border-inline-start: 3px solid var(--yellow); padding-inline-start: 11px; }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 80ms; transform: none; }
}

/* ──────────────────────── */
/* POPOVER MENU */
/* ──────────────────────── */
.menu-popover {
  position: fixed;
  z-index: 1100;
  min-width: 160px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 0 0 1px var(--border-translucent);
  padding: 4px;
  display: flex;
  flex-direction: column;
  animation: menu-in 140ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.menu-item {
  appearance: none;
  background: transparent;
  border: none;
  text-align: start;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 100ms;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-surface-secondary); }
.menu-separator {
  height: 1px;
  background: var(--border-color-light);
  margin: 4px 2px;
}

/* Panel variant — a wider popover with header / list / footer for */
/* notifications, messages, etc. */
.menu-panel { padding: 0; min-width: 320px; max-width: 380px; }
.menu-panel .panel-content {
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 520px);
}
.menu-panel .panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}
.menu-panel .panel-title {
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
}
.menu-panel .panel-badge {
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--primary-lt);
  color: var(--primary);
}
.menu-panel .panel-action {
  margin-inline-start: auto;
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  padding: 0;
}
.menu-panel .panel-action:hover { text-decoration: underline; }
.menu-panel .panel-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1 1 auto;
}
.menu-panel .panel-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color-light);
  cursor: pointer;
  text-align: start;
  font: inherit;
  transition: background 100ms;
  position: relative;
}
.menu-panel .panel-row:last-child { border-bottom: none; }
.menu-panel .panel-row:hover { background: var(--bg-surface-secondary); }
.menu-panel .panel-row.unread::before {
  content: '';
  position: absolute;
  inset-inline-start: 5px; top: 18px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--primary);
}
.menu-panel .panel-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-panel .panel-icon-info  { background: var(--blue-lt);   color: var(--blue); }
.menu-panel .panel-icon-task  { background: var(--primary-lt); color: var(--primary); }
.menu-panel .panel-icon-alert { background: var(--red-lt);    color: var(--red); }
.menu-panel .panel-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 10.5px;
  font-weight: var(--font-weight-bold);
}
.menu-panel .panel-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.menu-panel .panel-from {
  font-size: 12.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
}
.menu-panel .panel-row.unread .panel-from { font-weight: var(--font-weight-bold); }
.menu-panel .panel-text {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-panel .panel-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}
.menu-panel .panel-footer {
  padding: 10px 14px;
  text-align: center;
  border-top: 1px solid var(--border-color-light);
  flex-shrink: 0;
}
.menu-panel .panel-link {
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--primary);
}

/* ──────────────────────── */
/* CHIP CLOSE */
/* ──────────────────────── */
/* Allow any .chip to host an inline ✕ closer (.chip-close). */
.chip { transition: background 120ms, color 120ms, opacity 150ms, transform 150ms; }
.chip.active { background: var(--primary-lt); color: var(--primary); }
.chip-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline-start: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.chip-close:hover { opacity: 1; background: rgba(0,0,0,0.08); }

/* ──────────────────────── */
/* MODAL */
/* ──────────────────────── */
body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 180ms ease;
}
.modal-backdrop.show { opacity: 1; }

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18), 0 0 0 1px var(--border-translucent);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 220ms cubic-bezier(0.2, 0, 0, 1), opacity 180ms ease;
}
.modal-backdrop.show .modal-dialog { transform: translateY(0) scale(1); opacity: 1; }
.modal-sm { max-width: 360px; }
.modal-lg { max-width: 720px; }

@media (max-width: 480px) {
  .modal-backdrop { padding: var(--space-3); }
  .modal-dialog,
  .modal-sm,
  .modal-lg { max-width: calc(100vw - var(--space-5)); }
  .modal-header { padding: var(--space-3) var(--space-4); }
  .modal-body { padding: var(--space-3) var(--space-4); }
  .modal-footer { padding: var(--space-3) var(--space-4); flex-wrap: wrap; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}
.modal-title {
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  letter-spacing: -0.1px;
  margin: 0;
}
.modal-close {
  width: 28px; height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 100ms, color 100ms;
}
.modal-close:hover { background: var(--bg-surface-secondary); color: var(--text); }

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: 12px 18px;
  border-top: 1px solid var(--border-color-light);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal-dialog { transition: opacity 80ms; transform: none; }
}

/* Modal form helpers */
.modal-form-row { margin-bottom: 14px; }
.modal-form-row:last-child { margin-bottom: 0; }
.modal-form-row label {
  display: block;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.modal-form-row input[type="text"],
.modal-form-row input[type="date"],
.modal-form-row textarea,
.modal-form-row select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.modal-form-row textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; }
.modal-form-row input:focus,
.modal-form-row textarea:focus,
.modal-form-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}

/* Color swatch radio group */
.color-swatches {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.color-swatches input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.color-swatches label {
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  margin-bottom: 0;
  display: inline-block;
  position: relative;
  border: 2px solid transparent;
  transition: transform 120ms, border-color 120ms;
}
.color-swatches label:hover { transform: scale(1.08); }
.color-swatches input[type="radio"]:checked + label::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--text);
  border-radius: 50%;
}
.color-swatches input[type="radio"]:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Day events list inside modal */
.modal-events-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: 14px;
}
.modal-events-list:empty { display: none; }
.modal-event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-secondary);
  font-size: 13px;
  color: var(--text);
}
.modal-event-row .swatch {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.modal-event-row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-event-row .row-actions {
  display: flex;
  gap: 2px;
  opacity: 0.6;
  transition: opacity 120ms;
}
.modal-event-row:hover .row-actions { opacity: 1; }
.modal-event-row .row-btn {
  width: 26px; height: 26px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-event-row .row-btn:hover { background: var(--bg-surface); color: var(--text); }
.modal-events-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

/* ──────────────────────── */
/* EXTENDED BUTTONS — color variants, sizes, states, groups */
/* ──────────────────────── */
.btn-lg { height: 38px; padding: 0 16px; font-size: 13.5px; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 28px; }
.btn-icon.btn-lg { width: 38px; }
.btn-success {
  background: var(--green);
  color: white;
  border-color: #1a8a32;
}
.btn-success:hover { background: #1a8a32; }
.btn-warning {
  background: var(--yellow);
  color: white;
  border-color: #c97f00;
}
.btn-warning:hover { background: #c97f00; }
.btn-danger {
  background: var(--red);
  color: white;
  border-color: #a82b2b;
}
.btn-danger:hover { background: #a82b2b; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  box-shadow: none;
}
.btn-ghost:hover { background: var(--bg-surface-secondary); color: var(--text); }

.btn[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.85;
}
.btn-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 700ms linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spinner { animation-duration: 1.6s; } }

.btn-group { display: inline-flex; }
.btn-group .btn {
  border-radius: 0;
  margin-inline-end: -1px;
}
.btn-group .btn:hover,
.btn-group .btn.active { z-index: 1; }
.btn-group .btn:first-child {
  border-start-start-radius: var(--radius-sm);
  border-end-start-radius: var(--radius-sm);
}
.btn-group .btn:last-child {
  border-start-end-radius: var(--radius-sm);
  border-end-end-radius: var(--radius-sm);
  margin-inline-end: 0;
}
.btn-group .btn.active {
  background: var(--primary-lt);
  color: var(--primary);
  border-color: var(--primary);
}

/* ──────────────────────── */
/* AVATARS */
/* ──────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: var(--font-weight-bold);
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  flex-shrink: 0;
  position: relative;
  text-transform: uppercase;
  font-size: 11px;
  line-height: 1;
  width: 32px; height: 32px;
  overflow: hidden;
}
.avatar.avatar-image { background: var(--bg-surface-secondary); overflow: hidden; }
.avatar.avatar-image img, .avatar.avatar-image svg { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 20px; height: 20px; font-size: 8.5px; }
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-md { width: 32px; height: 32px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 14px; }
.avatar-xl { width: 64px; height: 64px; font-size: 20px; }
.avatar-xxl { width: 96px; height: 96px; font-size: 30px; }

.avatar-status {
  position: absolute;
  bottom: 0; inset-inline-end: 0;
  width: 28%; height: 28%;
  min-width: 6px; min-height: 6px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-surface);
}
.avatar-status.offline { background: var(--text-disabled); }
.avatar-status.busy    { background: var(--red); }
.avatar-status.away    { background: var(--yellow); }

.avatar-stack { display: inline-flex; }
.avatar-stack .avatar {
  border: 2px solid var(--bg-surface);
  margin-inline-start: -8px;
}
.avatar-stack .avatar:first-child { margin-inline-start: 0; }
.avatar-stack .avatar.more {
  background: var(--bg-surface-secondary);
  color: var(--text-secondary);
}

/* ──────────────────────── */
/* SPINNERS & LOADERS */
/* ──────────────────────── */
.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 2.5px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: btn-spin 700ms linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
.spinner-azure  { border-top-color: var(--azure); }
.spinner-yellow { border-top-color: var(--yellow); }
.spinner-red    { border-top-color: var(--red); }

.spinner-dots {
  display: inline-flex;
  gap: var(--space-1);
  align-items: center;
}
.spinner-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
  animation: dot-pulse 1.2s infinite ease-in-out;
}
.spinner-dots span:nth-child(2) { animation-delay: 200ms; }
.spinner-dots span:nth-child(3) { animation-delay: 400ms; }
@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .spinner-dots span { animation-duration: 2s; } }

.loading-bar {
  height: 3px;
  background: var(--bg-surface-secondary);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  width: 100%;
}
.loading-bar::before {
  content: '';
  position: absolute;
  top: 0; inset-inline-start: -40%;
  width: 40%; height: 100%;
  background: var(--primary);
  border-radius: 3px;
  animation: loading-bar-slide 1.4s ease-in-out infinite;
}
@keyframes loading-bar-slide {
  0%   { inset-inline-start: -40%; }
  60%  { inset-inline-start: 100%; }
  100% { inset-inline-start: 100%; }
}
@media (prefers-reduced-motion: reduce) { .loading-bar::before { animation-duration: 2.4s; } }

/* ──────────────────────── */
/* SKELETONS */
/* ──────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-surface-secondary) 0%,
    var(--border-color-light) 50%,
    var(--bg-surface-secondary) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}
.skeleton-text { height: 10px; margin-bottom: 8px; }
.skeleton-text:last-child { margin-bottom: 0; }
.skeleton-text-lg { height: 14px; }
.skeleton-circle { border-radius: 50%; }
.skeleton-rect { border-radius: var(--radius); }
/* Charts host a fixed-height container; cover it fully while ECharts loads. */
.chart-skeleton { width: 100%; height: 100%; min-height: inherit; }
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; opacity: 0.6; } }

/* ──────────────────────── */
/* TOOLTIPS (CSS-only, attribute-driven) */
/* ──────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text);
  color: white;
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms, transform 120ms;
  z-index: 100;
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  border: 4px solid transparent;
  border-top-color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms, transform 120ms;
  z-index: 100;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip-pos="bottom"]::after { bottom: auto; top: calc(100% + 6px); transform: translateX(-50%) translateY(-4px); }
[data-tooltip-pos="bottom"]::before { bottom: auto; top: 100%; border-top-color: transparent; border-bottom-color: var(--text); transform: translateX(-50%) translateY(-2px); }
[data-tooltip-pos="bottom"]:hover::after, [data-tooltip-pos="bottom"]:hover::before { transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) {
  [data-tooltip]::after, [data-tooltip]::before { transition: opacity 80ms; }
}

/* ──────────────────────── */
/* TABS — pill + underlined */
/* ──────────────────────── */
.tabs-pill {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  background: var(--bg-surface-secondary);
  padding: 3px;
  border-radius: var(--radius);
  gap: 2px;
}
.tabs-pill .tab {
  padding: 6px 14px;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 100ms, color 100ms;
}
.tabs-pill .tab:hover { color: var(--text); }
.tabs-pill .tab.active {
  background: var(--bg-surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.tabs-underline {
  display: flex;
  /* wrap, not scroll: the active tab's underline overlaps the container's */
  /* border by 1px and overflow clipping would cut it off. */
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color-light);
  gap: var(--space-1);
}
.tabs-underline .tab {
  padding: 9px 14px 11px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 100ms, border-color 100ms;
  margin-bottom: -1px;
}
.tabs-underline .tab:hover { color: var(--text); }
.tabs-underline .tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ──────────────────────── */
/* PAGINATION (standalone) */
/* ──────────────────────── */
.pagination {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.pagination .page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms, color 100ms, border-color 100ms;
}
.pagination .page-btn:hover { background: var(--bg-surface-secondary); color: var(--text); }
.pagination .page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.pagination .page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pagination .page-btn svg { width: 12px; height: 12px; }
.pagination .page-ellipsis { color: var(--text-disabled); padding: 0 4px; font-size: 12px; }

/* ──────────────────────── */
/* BREADCRUMBS — standalone */
/* ──────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}
.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 100ms;
}
.breadcrumbs a:hover { color: var(--primary); text-decoration: none; }
.breadcrumbs .sep { color: var(--text-disabled); user-select: none; }
.breadcrumbs .current {
  color: var(--text);
  font-weight: var(--font-weight-medium);
}

/* ──────────────────────── */
/* STEPPER */
/* ──────────────────────── */
.stepper {
  display: flex;
  align-items: flex-start;
  width: 100%;
  overflow-x: auto;
  gap: 0;
}
.stepper .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 80px;
}
.stepper .step .num {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.stepper .step .label {
  font-size: 11.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  text-align: center;
}
.stepper .step.done .num {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.stepper .step.done .num::after {
  content: '';
  width: 14px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5'%3E%3Cpath d='M3 8l3 3 7-7'/%3E%3C/svg%3E") center/14px no-repeat;
  position: absolute;
}
.stepper .step.done .num span { display: none; }
.stepper .step.active .num {
  background: var(--bg-surface);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-lt);
}
.stepper .step.active .label,
.stepper .step.done   .label { color: var(--text); }
.stepper .line {
  flex: 1 1 auto;
  height: 2px;
  background: var(--border-color);
  margin: 15px 4px 0;
  min-width: 16px;
  transition: background 120ms;
}
.stepper .line.done { background: var(--primary); }

/* ──────────────────────── */
/* RATING STARS (interactive) */
/* ──────────────────────── */
.rating-stars {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}
.rating-stars button {
  width: 24px; height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: var(--text-disabled);
  transition: color 100ms, transform 100ms;
}
.rating-stars button.on { color: var(--yellow); }
.rating-stars button:hover { transform: scale(1.15); }
.rating-stars svg { width: 22px; height: 22px; display: block; margin: 0 auto; }
.rating-stars-readonly button { pointer-events: none; }

/* ──────────────────────── */
/* EMPTY STATE */
/* ──────────────────────── */
.empty-state {
  text-align: center;
  padding: 36px 20px;
}
.empty-state-icon {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg-surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.empty-state-icon svg { width: 30px; height: 30px; }
.empty-state-title {
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  margin-bottom: 4px;
}
.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ──────────────────────── */
/* LIST GROUP */
/* ──────────────────────── */
.list-group {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.list-group-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 14px;
  background: var(--bg-surface);
  border: none;
  border-bottom: 1px solid var(--border-color-light);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 100ms, color 100ms;
  text-align: start;
  width: 100%;
}
.list-group-item:last-child { border-bottom: none; }
.list-group-item:hover {
  background: var(--bg-surface-secondary);
  text-decoration: none;
}
.list-group-item.active {
  background: var(--primary-lt);
  color: var(--primary);
  font-weight: var(--font-weight-medium);
}
.list-group-item .meta {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-size: 11.5px;
}

/* ──────────────────────── */
/* CODE & KBD */
/* ──────────────────────── */
code, .code-inline {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-surface-secondary);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-color-light);
}
pre {
  background: var(--bg-surface-secondary);
  color: var(--text);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-x: auto;
  margin: 0;
}
pre code {
  background: transparent;
  padding: 0;
  border: none;
  font-size: inherit;
}
kbd {
  font-family: var(--font);
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.5;
  display: inline-block;
}

/* ──────────────────────── */
/* BLOCKQUOTE */
/* ──────────────────────── */
blockquote {
  margin: 0;
  padding: 4px 16px;
  border-inline-start: 3px solid var(--primary);
  font-size: 14px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.6;
}
blockquote footer {
  margin-top: 10px;
  font-size: 12px;
  font-style: normal;
  color: var(--text-muted);
}
blockquote footer cite {
  font-style: normal;
  color: var(--text);
  font-weight: var(--font-weight-medium);
}

/* ──────────────────────── */
/* DIVIDERS (with optional label) */
/* ──────────────────────── */
.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 16px 0;
}
.divider-label::before, .divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}
.divider-plain {
  height: 1px;
  background: var(--border-color);
  border: none;
  margin: 16px 0;
}
.divider-dashed {
  height: 0;
  background: none;
  border: none;
  border-top: 1px dashed var(--border-color);
  margin: 16px 0;
}

/* ──────────────────────── */
/* COMMAND PALETTE (⌘K) */
/* ──────────────────────── */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 35, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  animation: cmdk-fade-in 120ms ease-out;
}
@keyframes cmdk-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.cmdk-dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: 70vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18), 0 0 0 1px var(--border-translucent);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cmdk-pop-in 140ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes cmdk-pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color-light);
}
.cmdk-search-icon { color: var(--text-muted); flex-shrink: 0; }
.cmdk-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
}
.cmdk-input::placeholder { color: var(--text-muted); }
.cmdk-esc {
  font-family: var(--font);
  font-size: 10.5px;
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.cmdk-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.cmdk-section {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 10px 10px 4px;
}
.cmdk-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: start;
}
.cmdk-item:hover,
.cmdk-item.active {
  background: var(--primary-lt);
  color: var(--primary);
}
.cmdk-item-icon {
  width: 24px;
  height: 24px;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cmdk-item.active .cmdk-item-icon { background: rgba(26, 187, 156, 0.14); color: var(--primary); }
.cmdk-item-label { flex: 1; }
.cmdk-item-kbd {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0;
}
.cmdk-item.active .cmdk-item-kbd { opacity: 1; }
.cmdk-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.cmdk-footer {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  padding: 8px 16px;
  border-top: 1px solid var(--border-color-light);
  font-size: 11px;
  color: var(--text-muted);
}
.cmdk-footer kbd {
  font-family: var(--font);
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  margin-inline-end: 4px;
}
body.cmdk-open { overflow: hidden; }

/* ──────────────────────── */
/* ACCORDION */
/* ──────────────────────── */
.accordion { display: flex; flex-direction: column; gap: 6px; }
.accordion-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 120ms;
}
.accordion-item:hover { border-color: var(--text-muted); }
.accordion-item[open] { border-color: var(--primary); }
.accordion-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  user-select: none;
  list-style: none;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-summary .chev {
  margin-inline-start: auto;
  width: 14px; height: 14px;
  color: var(--text-muted);
  transition: transform 200ms;
}
.accordion-item[open] .accordion-summary .chev { transform: rotate(180deg); color: var(--primary); }
.accordion-content {
  padding: 0 16px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ──────────────────────── */
/* DRAWER / OFF-CANVAS */
/* ──────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 35, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--bg-surface);
  z-index: 260;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer.left { inset-inline-end: auto; inset-inline-start: 0; transform: translateX(-100%); box-shadow: 10px 0 30px rgba(0, 0, 0, 0.12); }
.drawer.left.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color-light);
}
.drawer-title { font-size: 15px; font-weight: var(--font-weight-bold); color: var(--text); flex: 1; }
.drawer-close {
  width: 28px; height: 28px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawer-close:hover { background: var(--bg-surface-secondary); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-footer { padding: 12px 16px; border-top: 1px solid var(--border-color-light); display: flex; gap: var(--space-2); justify-content: flex-end; }

/* ──────────────────────── */
/* TIMELINE */
/* ──────────────────────── */
.timeline {
  position: relative;
  padding-inline-start: 24px;
}
.timeline::before {
  content: '';
  position: absolute;
  inset-inline-start: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-color);
  border-radius: 2px;
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  inset-inline-start: -22px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
}
.timeline-item.is-primary::before { border-color: var(--primary); background: var(--primary); }
.timeline-item.is-green::before   { border-color: var(--green); background: var(--green); }
.timeline-item.is-yellow::before  { border-color: var(--yellow); background: var(--yellow); }
.timeline-item.is-red::before     { border-color: var(--red); background: var(--red); }
.timeline-item.is-blue::before    { border-color: var(--blue); background: var(--blue); }
.timeline-item .ti-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.timeline-item .ti-title {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
}
.timeline-item .ti-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.5;
}

/* ──────────────────────── */
/* BANNER / CALLOUT */
/* ──────────────────────── */
.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--primary-lt);
  border: 1px solid rgba(26, 187, 156, 0.18);
  font-size: 13px;
  color: var(--text);
}
.banner.banner-warning { background: var(--yellow-lt); border-color: rgba(245, 159, 0, 0.22); }
.banner.banner-danger  { background: var(--red-lt);    border-color: rgba(214, 57, 57, 0.22); }
.banner.banner-info    { background: var(--blue-lt);   border-color: rgba(6, 111, 209, 0.22); }
.banner-icon { flex-shrink: 0; color: var(--primary); }
.banner.banner-warning .banner-icon { color: var(--yellow); }
.banner.banner-danger  .banner-icon { color: var(--red); }
.banner.banner-info    .banner-icon { color: var(--blue); }
.banner-body { flex: 1; }
.banner-body strong { color: var(--text); }
.banner-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ──────────────────────── */
/* POPOVER (rich content) */
/* ──────────────────────── */
.popover-trigger { position: relative; display: inline-flex; }
.popover-trigger > .popover-content {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: 240px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.10);
  font-size: 12.5px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms, transform 120ms;
  z-index: 50;
}
.popover-trigger:hover > .popover-content,
.popover-trigger:focus-within > .popover-content {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.popover-title { font-weight: var(--font-weight-bold); font-size: 12.5px; color: var(--text); margin-bottom: 4px; }
.popover-text  { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* ──────────────────────── */
/* EMPTY STATE */
/* ──────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  gap: 6px;
}
.empty-state .empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface-secondary);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.empty-state .empty-state-icon svg { width: 22px; height: 22px; }
.empty-state .empty-state-title {
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
}
.empty-state .empty-state-text {
  font-size: 12.5px;
  max-width: 320px;
  line-height: 1.5;
}
.empty-state .empty-state-actions {
  margin-top: 12px;
  display: flex;
  gap: var(--space-2);
}


/* DataTables (v2) UI overrides — match v4 design system */

/* Row selection — applied when any row checkbox is checked. */
table.has-selection tbody tr:has(input[type="checkbox"]:checked) {
  background: var(--primary-lt);
}
.bulk-selection-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-inline-end: 12px;
}
.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}


/* DataTables wraps its rendered table in `.dt-container` and adds layout slots */
/* `.dt-layout-row`, `.dt-search`, `.dt-info`, `.dt-paging`. */
.dt-container {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-secondary);
}

/* Top toolbar (search + length) */
.dt-layout-row.dt-layout-table { padding: 0; }
.dt-layout-row:not(.dt-layout-table) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: var(--space-3);
}
.dt-layout-row + .dt-layout-row.dt-layout-table { border-top: 1px solid var(--border-color-light); }
.dt-layout-row.dt-layout-table + .dt-layout-row { border-top: 1px solid var(--border-color-light); }

/* Search input */
.dt-search {
  position: relative;
  width: 220px;
}
.dt-search label { display: none; }
.dt-search input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  background: var(--body-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.dt-search::before {
  content: '';
  position: absolute;
  inset-inline-start: 9px; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239ba5b1' stroke-width='1.5'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  pointer-events: none;
}
.dt-search input::placeholder { color: var(--text-disabled); }
.dt-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}

/* Info text (Showing 1–10 of 100) */
.dt-info {
  font-size: 12px;
  color: var(--text-muted);
}

/* Pagination */
.dt-paging {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.dt-paging .dt-paging-button {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 100ms, color 100ms, border-color 100ms;
}
.dt-paging .dt-paging-button:hover:not(.disabled):not(.current) {
  background: var(--bg-surface-secondary);
  color: var(--text);
}
.dt-paging .dt-paging-button.current {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dk);
}
.dt-paging .dt-paging-button.disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
  opacity: 0.6;
}
.dt-paging .ellipsis { color: var(--text-disabled); padding: 0 4px; font-size: 12px; }

/* Table sort indicators — DataTables emits <span class="dt-column-order"> */
/* inside <th><div class="dt-column-header">…</div></th>. We render a small */
/* stacked-chevron icon there with three states: idle (both muted), asc (top */
/* chevron in primary), desc (bottom chevron in primary). */
table.dataTable thead th {
  position: relative;
  user-select: none;
}
table.dataTable thead th .dt-column-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
table.dataTable thead th.dt-orderable-asc,
table.dataTable thead th.dt-orderable-desc { cursor: pointer; }
table.dataTable thead th[data-orderable="false"],
table.dataTable thead th.dt-orderable-none { cursor: default; }
table.dataTable thead th.dt-orderable-none .dt-column-order { display: none; }

/* The order indicator */
.dt-column-order {
  display: inline-block;
  width: 10px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 14px;
  border-radius: 3px;
  opacity: 0.7;
  transition: opacity 120ms, background-color 120ms;
  /* Idle state: both chevrons muted. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath fill='%239ba5b1' d='M5 1L1 5h8z'/%3E%3Cpath fill='%239ba5b1' d='M5 13L1 9h8z'/%3E%3C/svg%3E");
}
table.dataTable thead th:hover .dt-column-order { opacity: 1; }

/* Active ascending */
table.dataTable thead th.dt-ordering-asc .dt-column-order {
  opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath fill='%231ABB9C' d='M5 1L1 5h8z'/%3E%3Cpath fill='%23d8dee5' d='M5 13L1 9h8z'/%3E%3C/svg%3E");
}
/* Active descending */
table.dataTable thead th.dt-ordering-desc .dt-column-order {
  opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath fill='%23d8dee5' d='M5 1L1 5h8z'/%3E%3Cpath fill='%231ABB9C' d='M5 13L1 9h8z'/%3E%3C/svg%3E");
}
/* Subtle bg + clear focus on the order span (it has tabindex=0) */
.dt-column-order:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
/* Highlight active sort column header */
table.dataTable thead th.dt-ordering-asc .dt-column-title,
table.dataTable thead th.dt-ordering-desc .dt-column-title { color: var(--text); }

/* "No matches found" empty row */
table.dataTable .dt-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

/* Form components: inputs, labels, selects, textareas, checkboxes, file upload */

.form-group {
  display: block;
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red); margin-inline-start: 2px; }
.form-help {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  font-family: var(--font);
}
.form-control::placeholder { color: var(--text-disabled); }
.form-control:hover:not(:focus) { border-color: var(--text-muted); }
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.form-control:disabled {
  background: var(--bg-surface-secondary);
  color: var(--text-muted);
  cursor: not-allowed;
}
.form-control.is-invalid {
  border-color: var(--red);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--red-lt);
}
.form-error {
  font-size: 11.5px;
  color: var(--red);
  margin-top: 4px;
}

textarea.form-control {
  height: auto;
  min-height: 90px;
  padding: 8px 12px;
  resize: vertical;
  line-height: 1.5;
}

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%239ba5b1' stroke-width='1.5'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

/* Checkboxes & radios */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 0;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin: 0;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  flex-shrink: 0;
  position: relative;
}
.form-check input[type="radio"] { border-radius: 50%; }
.form-check input:hover { border-color: var(--primary); }
.form-check input:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.form-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -55%) rotate(45deg);
  width: 4px; height: 8px;
  border-inline-end: 1.5px solid white;
  border-bottom: 1.5px solid white;
}
.form-check input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: white;
}
.form-check input:focus-visible {
  box-shadow: 0 0 0 3px var(--primary-lt);
}

/* Form row (inline group) */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
}
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 768px) {
  .form-row, .form-row.cols-3 { grid-template-columns: 1fr; }
}

/* Input group (icon prefix/suffix) */
.input-group {
  position: relative;
}
.input-group .form-control { padding-inline-start: 36px; }
.input-group .input-icon {
  position: absolute;
  inset-inline-start: 11px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Form actions row */
.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color-light);
}
.form-actions.right { justify-content: flex-end; }

/* ──────────────────────── */
/* INPUT WITH SUFFIX (e.g. .com, %, kg) */
/* ──────────────────────── */
.input-affix {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 150ms, box-shadow 150ms;
}
.input-affix:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.input-affix .form-control {
  border: 0;
  border-radius: 0;
  flex: 1;
  min-width: 0;
}
.input-affix .form-control:focus { box-shadow: none; }
.input-affix .affix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-surface-secondary);
  white-space: nowrap;
  border-inline-start: 1px solid var(--border-color);
}
.input-affix .affix.prefix {
  border-inline-start: 0;
  border-inline-end: 1px solid var(--border-color);
}

/* ──────────────────────── */
/* SEGMENTED CONTROL (compact tab-like radio) */
/* ──────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.segmented label {
  position: relative;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.segmented label:hover { color: var(--text); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span,
.segmented label:has(input:checked) {
  background: var(--bg-surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 0 0 1px var(--border-translucent);
}

/* ──────────────────────── */
/* SWITCH (toggle styled like an iOS switch) */
/* ──────────────────────── */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 10px;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 36px;
  height: 20px;
  background: var(--border-color);
  border-radius: 999px;
  position: relative;
  transition: background 150ms;
  flex-shrink: 0;
}
.switch .track::before {
  content: '';
  position: absolute;
  inset-inline-start: 2px; top: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
  transition: transform 150ms;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--primary-lt); }
.switch .switch-label {
  font-size: 13px;
  color: var(--text);
}

/* ──────────────────────── */
/* SLIDER (range) */
/* ──────────────────────── */
.slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.slider-row .slider-value {
  font-size: 12.5px;
  color: var(--text);
  font-weight: var(--font-weight-medium);
  min-width: 40px;
  text-align: end;
  font-variant-numeric: tabular-nums;
}
input[type="range"].slider {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 1px var(--primary), 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}
input[type="range"].slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 1px var(--primary), 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}
input[type="range"].slider:focus-visible {
  box-shadow: 0 0 0 3px var(--primary-lt);
}

/* ──────────────────────── */
/* COLOR PICKER (swatch grid) */
/* ──────────────────────── */
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 100ms, box-shadow 100ms;
  position: relative;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active {
  border-color: var(--bg-surface);
  box-shadow: 0 0 0 2px var(--text);
}

/* ──────────────────────── */
/* CHIP / TAG INPUT */
/* ──────────────────────── */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  min-height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  align-items: center;
  cursor: text;
  transition: border-color 150ms, box-shadow 150ms;
}
.tag-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.tag-input .tag-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 4px 2px 8px;
  background: var(--primary-lt);
  color: var(--primary);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  border-radius: 12px;
}
.tag-input .tag-pill button {
  width: 16px; height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: inherit;
  cursor: pointer;
  opacity: 0.65;
}
.tag-input .tag-pill button:hover { opacity: 1; background: rgba(26, 187, 156, 0.18); }
.tag-input input {
  flex: 1;
  min-width: 100px;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  padding: 4px;
}

/* ──────────────────────── */
/* RATING STARS */
/* ──────────────────────── */
.rating {
  display: inline-flex;
  gap: var(--space-1);
}
.rating button {
  background: transparent;
  border: 0;
  padding: 2px;
  cursor: pointer;
  color: var(--border-color);
  transition: color 100ms;
}
.rating button.on,
.rating:hover button:hover,
.rating:hover button:hover ~ button { color: var(--border-color); }
.rating button.on { color: var(--yellow); }
.rating:hover button { color: var(--border-color); }
.rating:hover button:hover,
.rating button:hover ~ button.on { color: var(--yellow); }
/* Cleaner version using sibling selectors — light up all preceding stars on hover: */
.rating:hover button:hover ~ button { color: var(--border-color); }
.rating button svg { width: 16px; height: 16px; fill: currentColor; }

/* ──────────────────────── */
/* SEARCH WITH SUGGESTIONS (visible card) */
/* ──────────────────────── */
.search-suggest {
  margin-top: 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}
.search-suggest-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color-light);
}
.search-suggest-row:last-child { border-bottom: 0; }
.search-suggest-row:hover { background: var(--bg-surface-secondary); }
.search-suggest-row .meta { margin-inline-start: auto; font-size: 11px; color: var(--text-muted); }
.search-suggest-row mark {
  background: var(--yellow-lt);
  color: var(--text);
  padding: 0 1px;
  border-radius: 2px;
}

/* ──────────────────────── */
/* PASSWORD STRENGTH METER */
/* ──────────────────────── */
.password-strength {
  display: flex;
  gap: var(--space-1);
  margin-top: 6px;
}
.password-strength .seg {
  flex: 1;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  transition: background 150ms;
}
.password-strength.s1 .seg:nth-child(-n+1),
.password-strength.s2 .seg:nth-child(-n+2),
.password-strength.s3 .seg:nth-child(-n+3),
.password-strength.s4 .seg { background: var(--red); }
.password-strength.s2 .seg:nth-child(-n+2) { background: var(--orange); }
.password-strength.s3 .seg:nth-child(-n+3) { background: var(--yellow); }
.password-strength.s4 .seg { background: var(--green); }
.password-strength-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.password-strength-label strong { color: var(--text); font-weight: var(--font-weight-medium); }

/* ──────────────────────── */
/* OTP / PIN BOXES */
/* ──────────────────────── */
.otp-grid {
  display: flex;
  gap: var(--space-2);
}
.otp-input {
  width: 44px;
  height: 48px;
  text-align: center;
  font-family: var(--font);
  font-size: 18px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: 0;
  transition: border-color 120ms, box-shadow 120ms;
}
.otp-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.otp-input:not(:placeholder-shown) { border-color: var(--primary); }

/* ──────────────────────── */
/* FILE INPUT (compact) */
/* ──────────────────────── */
.file-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
}
.file-input-trigger {
  padding: 0 14px;
  display: flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  background: var(--bg-surface-secondary);
  border-inline-end: 1px solid var(--border-color);
  cursor: pointer;
}
.file-input-name {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-input input[type="file"] { display: none; }

/* ──────────────────────── */
/* AVATAR UPLOAD */
/* ──────────────────────── */
.avatar-upload {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  cursor: pointer;
}
.avatar-upload .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity 150ms;
}
.avatar-upload:hover .overlay { opacity: 1; }
.avatar-upload .overlay svg { width: 22px; height: 22px; }

/* ──────────────────────── */
/* STEPPER (number with +/-) */
/* ──────────────────────── */
.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
}
.stepper button {
  width: 32px;
  background: var(--bg-surface-secondary);
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 100ms, color 100ms;
}
.stepper button:hover { background: var(--primary-lt); color: var(--primary); }
.stepper input {
  width: 56px;
  text-align: center;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text);
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}


/* ──────────────────────── */
/* DATE-RANGE PICKER */
/* ──────────────────────── */
.date-range { position: relative; }
.date-range input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237e8896' stroke-width='1.5'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 4v6M16 4v6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-inline-end: 36px;
}
.dr-popover {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12), 0 0 0 1px var(--border-translucent);
  display: flex;
  z-index: 220;
  font-family: var(--font);
  overflow: hidden;
}
.dr-presets {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 8px 14px 14px;
  border-inline-end: 1px solid var(--border-color-light);
  background: var(--bg-surface-secondary);
  min-width: 140px;
}
.dr-preset {
  background: transparent;
  border: 0;
  padding: 7px 12px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: start;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.dr-preset:hover { background: var(--bg-surface); color: var(--text); }
.dr-cal { padding: 14px; }
.dr-nav {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.dr-nav button {
  width: 26px; height: 26px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.dr-nav button:hover { color: var(--primary); border-color: var(--primary); }
.dr-spacer { flex: 1; }
.dr-months { display: flex; gap: 18px; }
.dr-month-head {
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  text-align: center;
  margin-bottom: 8px;
}
.dr-dow {
  display: grid;
  grid-template-columns: repeat(7, 30px);
  gap: 2px;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
  margin-bottom: 4px;
}
.dr-grid { display: grid; grid-template-columns: repeat(7, 30px); gap: 2px; }
.dr-cell {
  width: 30px; height: 30px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  transition: background 100ms, color 100ms;
}
.dr-cell.empty { cursor: default; visibility: hidden; }
.dr-cell:hover:not(.empty) { background: var(--bg-surface-secondary); }
.dr-cell.today { font-weight: 600; color: var(--primary); }
.dr-cell.in-range {
  background: var(--primary-lt);
  color: var(--primary);
  border-radius: 0;
}
.dr-cell.preview { opacity: 0.55; }
.dr-cell.selected {
  background: var(--primary);
  color: white;
  font-weight: 600;
  border-radius: 50%;
}
.dr-cell.range-start { border-start-end-radius: 0; border-end-end-radius: 0; }
.dr-cell.range-end   { border-start-start-radius: 0;  border-end-start-radius: 0; }
.dr-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.dr-summary { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .dr-popover { flex-direction: column; }
  .dr-presets { flex-direction: row; flex-wrap: wrap; min-width: 0; border-inline-end: 0; border-bottom: 1px solid var(--border-color-light); padding: 10px; }
  .dr-months { flex-direction: column; gap: var(--space-4); }
}

/* ──────────────────────── */
/* RICH TEXT EDITOR */
/* ──────────────────────── */
.rich-text {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 150ms, box-shadow 150ms;
}
.rich-text:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.rt-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color-light);
  background: var(--bg-surface-secondary);
  flex-wrap: wrap;
}
.rt-toolbar button {
  width: 28px; height: 28px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font);
  font-size: 13px;
  transition: background 100ms, color 100ms;
}
.rt-toolbar button:hover { background: var(--bg-surface); color: var(--text); }
.rt-toolbar button:active { background: var(--primary-lt); color: var(--primary); }
.rt-toolbar code { font-family: var(--font-mono); font-size: 11px; }
.rt-sep {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 4px;
}
.rt-editor {
  min-height: 140px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  outline: none;
}
.rt-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-disabled);
  pointer-events: none;
}
.rt-editor h2 { font-size: 17px; font-weight: 600; margin: 12px 0 6px; }
.rt-editor blockquote {
  border-inline-start: 3px solid var(--primary);
  padding-inline-start: 12px;
  margin: 8px 0;
  color: var(--text-secondary);
}
.rt-editor pre {
  background: var(--bg-surface-secondary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  margin: 8px 0;
  overflow-x: auto;
}
.rt-editor ul, .rt-editor ol { padding-inline-start: 22px; margin: 6px 0; }
.rt-editor a { color: var(--primary); text-decoration: underline; }

/* ──────────────────────── */
/* MULTI-SELECT */
/* ──────────────────────── */
.multi-select { position: relative; }
.ms-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 8px 4px 4px;
  min-height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color 150ms, box-shadow 150ms;
}
.multi-select.open .ms-input,
.ms-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.ms-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 4px 2px 8px;
  background: var(--primary-lt);
  color: var(--primary);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  border-radius: 12px;
  white-space: nowrap;
}
.ms-chip button {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.65;
}
.ms-chip button:hover { opacity: 1; background: rgba(26, 187, 156, 0.18); }
.ms-search {
  flex: 1;
  min-width: 80px;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 4px 6px;
}
.ms-chev {
  margin-inline-start: auto;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 150ms;
}
.multi-select.open .ms-chev { transform: rotate(180deg); }
.ms-menu {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 0;
  inset-inline-end: 0;
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10);
  padding: 4px;
}
.ms-option {
  display: block;
  width: 100%;
  text-align: start;
  padding: 7px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.ms-option:hover, .ms-option.active {
  background: var(--primary-lt);
  color: var(--primary);
}
.ms-empty {
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Layout: sidebar, topbar, main, grid, footer, responsive */

/* ──────────────────────── */
/* SKIP LINK + FOCUS */
/* ──────────────────────── */
.skip-link {
  position: fixed;
  top: 8px;
  inset-inline-start: 8px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 150ms ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Single visible focus style for keyboard users. :focus-visible avoids */
/* rings on mouse clicks while preserving the accessibility cue on Tab. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.nav-link:focus-visible { outline-color: var(--primary); outline-offset: -2px; }
.search-box input:focus-visible { outline: none; } /* input's own box-shadow handles it */
#main-content:focus { outline: none; } /* programmatic focus target only */

/* ──────────────────────── */
/* SIDEBAR */
/* ──────────────────────── */
.sidebar {
  position: fixed;
  inset-inline-start: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Animate width changes when the rail-mode toggle fires; on mobile the */
  /* sidebar uses a transform-based slide instead so this is harmless there. */
  transition: width 220ms cubic-bezier(0.2, 0, 0, 1);
}

.sidebar-brand {
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.brand-icon {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
}
.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.2px;
}
.brand-name small {
  font-weight: 400;
  color: var(--sidebar-text);
  font-size: 13px;
  margin-inline-start: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.nav-group { padding: 0 8px; margin-bottom: 2px; }
.nav-label {
  padding: 16px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(123,143,163,0.5);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: var(--font-weight-normal);
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms, color 120ms;
  margin-bottom: 1px;
  min-height: 32px;
}
.nav-link:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-hover);
  text-decoration: none;
}
.nav-link.active {
  color: var(--sidebar-text-active);
  background: var(--sidebar-active);
  font-weight: var(--font-weight-medium);
}
.nav-link .icon {
  width: 18px; height: 18px;
  opacity: 0.5;
  flex-shrink: 0;
}
.nav-link:hover .icon, .nav-link.active .icon { opacity: 0.85; }
.nav-link .badge {
  margin-inline-start: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  line-height: 1.6;
}
.badge-red { background: rgba(214,57,57,0.15); color: #f87171; }
.badge-teal { background: var(--primary-lt); color: var(--primary); }
.badge-blue { background: rgba(66,153,225,0.12); color: #60a5fa; }

/* ──────────────────────── */
/* SIDEBAR SUBMENU */
/* ──────────────────────── */
/* Collapsed by default; only the group containing the active page auto-opens. */
/* Click a parent to expand/collapse — accordion behavior: opening one closes */
/* other open groups in the sidebar (one open at a time). */
.nav-tree { display: flex; flex-direction: column; }

/* Parent ("toggle") — same shape as a flat .nav-link, plus a chevron. */
.nav-toggle {
  background: transparent;
  border: 0;
  font: inherit;
  width: 100%;
  text-align: start;
  cursor: pointer;
}
.nav-toggle .nav-text { flex: 1; }
.nav-chev {
  margin-inline-start: auto;
  opacity: 0.55;
  transition: transform 200ms cubic-bezier(0.2, 0, 0, 1), opacity 120ms;
  flex-shrink: 0;
}
.nav-toggle:hover .nav-chev { opacity: 0.9; }
.nav-tree.open > .nav-toggle .nav-chev { transform: rotate(90deg); opacity: 1; }

/* When the active page lives inside a tree, give the parent a subtle accent */
/* even when the tree is collapsed, so the user knows "they're in this group". */
.nav-tree.has-active > .nav-toggle {
  color: var(--sidebar-text-hover);
}
.nav-tree.has-active > .nav-toggle .icon { opacity: 0.85; }

/* Smooth expand/collapse using grid-template-rows trick (no JS height calc). */
.nav-tree .nav-sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 220ms cubic-bezier(0.2, 0, 0, 1);
}
.nav-tree.open .nav-sub { grid-template-rows: 1fr; }
.nav-tree .nav-sub > .nav-sub-inner {
  overflow: hidden;
  min-height: 0;
  /* Left guide rail that connects parent → children visually. */
  position: relative;
  padding: 4px 0 4px 28px;
}
/* Vertical guide line — sits flush with the icon column above. */
.nav-tree .nav-sub > .nav-sub-inner::before {
  content: '';
  position: absolute;
  inset-inline-start: 19px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--sidebar-border);
}
.nav-tree.open .nav-sub > .nav-sub-inner::before {
  background: rgba(255, 255, 255, 0.10);
}

.nav-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--sidebar-text);
  border-radius: var(--radius-sm);
  text-decoration: none;
  position: relative;
  margin: 1px 0;
  transition: background 120ms, color 120ms, transform 120ms;
}
/* Tiny horizontal "tick" connecting the rail to the link — a subtle but */
/* effective hierarchy cue without using bullets. */
.nav-sublink::before {
  content: '';
  position: absolute;
  inset-inline-start: -9px;
  top: 50%;
  width: 8px;
  height: 1px;
  background: var(--sidebar-border);
  transform: translateY(-50%);
  transition: background 120ms, width 120ms;
}
.nav-sublink:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-hover);
  text-decoration: none;
}
.nav-sublink:hover::before { background: rgba(255, 255, 255, 0.25); }
.nav-sublink.active {
  color: var(--sidebar-text-active);
  background: var(--sidebar-active);
  font-weight: var(--font-weight-medium);
  /* Active rail tick becomes primary teal and slightly bolder. */
  &::before { background: var(--primary); width: 12px; inset-inline-start: -13px; }
}
.nav-sublink .badge {
  margin-inline-start: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  line-height: 1.6;
}

/* Sidebar footer / profile */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: 8px;
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 120ms;
  cursor: pointer;
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
  position: relative;
}
.sidebar-user .avatar .online {
  position: absolute; bottom: -1px; inset-inline-end: -1px;
  width: 8px; height: 8px;
  background: var(--green);
  border: 2px solid var(--sidebar-bg);
  border-radius: 50%;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name {
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-info .role {
  color: var(--sidebar-text);
  font-size: 11px;
  line-height: 1.2;
}
.sidebar-user .more-btn {
  width: 24px; height: 24px;
  border: none; background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 120ms;
}
.sidebar-user:hover .more-btn { opacity: 1; }

/* ──────────────────────── */
/* TOPBAR */
/* ──────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  inset-inline-start: var(--sidebar-w);
  inset-inline-end: 0;
  height: 56px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  transition: left 220ms cubic-bezier(0.2, 0, 0, 1);
}
.topbar-left { display: flex; align-items: center; gap: var(--space-3); }

/* Sidebar toggle is now always visible — collapses to rail on desktop, */
/* opens drawer on mobile. The legacy media-query that hid it is gone. */
.sidebar-toggle {
  display: inline-flex;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 120ms, color 120ms;
}
.sidebar-toggle:hover { background: var(--body-bg); color: var(--text); }
.sidebar-toggle svg { width: 18px; height: 18px; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 95;
  opacity: 1;
  transition: opacity 180ms ease;
}
.sidebar-backdrop[hidden] { display: none; }
.breadcrumb {
  display: flex; align-items: center; gap: var(--space-1);
  font-size: 13px; color: var(--text-muted);
}
.breadcrumb .current { color: var(--text); font-weight: var(--font-weight-medium); }
.breadcrumb .sep { color: var(--text-disabled); }
.breadcrumb a {
  color: inherit;
  text-decoration: none;
  transition: color 100ms;
}
.breadcrumb a:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

.search-box {
  position: relative;
  width: 240px;
}
.search-box input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  background: var(--body-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.search-box input::placeholder { color: var(--text-disabled); }
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.search-box .s-icon {
  position: absolute;
  inset-inline-start: 9px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-muted);
}
.search-box kbd {
  position: absolute;
  inset-inline-end: 6px; top: 50%;
  transform: translateY(-50%);
  padding: 0 5px;
  font-family: inherit;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  line-height: 18px;
}

.topbar-right { display: flex; align-items: center; gap: 2px; }
.tb-btn {
  width: 32px; height: 32px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 120ms, color 120ms;
  position: relative;
}
.tb-btn:hover { background: var(--body-bg); color: var(--text); }
.tb-btn svg { width: 18px; height: 18px; }
.tb-btn.tb-docs {
  width: auto; height: 32px;
  padding: 0 12px;
  gap: 6px;
  margin-inline-end: 6px;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}
.tb-btn.tb-docs:hover {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary-dk, var(--primary));
}
.tb-btn.tb-docs svg { width: 15px; height: 15px; }
.tb-btn .dot {
  position: absolute; top: 6px; inset-inline-end: 6px;
  width: 6px; height: 6px;
  background: var(--red);
  border: 1.5px solid white;
  border-radius: 50%;
}
.tb-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  display: flex; align-items: center; justify-content: center;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: white;
  margin-inline-start: 6px;
  cursor: pointer;
  padding: 0;
  transition: transform 120ms;
}
.tb-avatar:hover { transform: scale(1.06); }

/* ──────────────────────── */
/* MAIN LAYOUT */
/* ──────────────────────── */
.main {
  margin-inline-start: var(--sidebar-w);
  padding-top: 56px;
  min-height: 100vh;
  transition: margin-left 220ms cubic-bezier(0.2, 0, 0, 1);
}
.page-wrapper { padding: 20px 24px 40px; }

/* Page header */
.page-header { margin-bottom: 20px; }
.page-pretitle {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.page-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin: 0;
}
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.page-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ──────────────────────── */
/* GRID */
/* ──────────────────────── */
.row { display: grid; gap: var(--space-4); margin-bottom: 16px; }
.row:last-child { margin-bottom: 0; }
/* minmax(0, …) lets wide intrinsic content (tables, charts, long text) */
/* stay contained within its grid track instead of pushing the track wider */
/* than its share. Critical for tables and chart cards. */
.col-4   { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-3   { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col-2   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-8-4 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.col-4-8 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.col-1   { grid-template-columns: minmax(0, 1fr); }

/* ──────────────────────── */
/* FOOTER */
/* ──────────────────────── */
.footer {
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color-light);
}
.footer a { color: var(--primary); }

/* ──────────────────────── */
/* RESPONSIVE */
/* ──────────────────────── */
/* Asymmetric 8-4 / 4-8 splits stack first — the narrow column gets cramped */
/* well before 3-col rows do (charts legend, sidebar widgets need ~340px). */
@media (max-width: 1100px) {
  .col-8-4, .col-4-8 { grid-template-columns: minmax(0, 1fr); }
}
/* col-4 → col-2 first since 4 wide tiles cramp earliest */
@media (max-width: 1200px) {
  .col-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* 3-col rows drop to 2 here — at this width with the sidebar visible the */
/* content area is ~640px, so 3 cards (~210px each) become uncomfortably */
/* narrow for stat sparklines + value rows. */
@media (max-width: 920px) {
  .col-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 220ms ease;
    will-change: transform;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-inline-start: 0; }
  .topbar { inset-inline-start: 0; padding: 0 12px; }
  /* The 240px search box, breadcrumb, and notification/message buttons can't */
  /* coexist with a 32px avatar inside a 375px viewport without forcing the */
  /* layout viewport to scale. Drop the wide pieces; cmd-K still works for */
  /* hardware-keyboard users, and page-pretitle/page-title carry breadcrumb */
  /* context. Avatar gets a real touch target. */
  .topbar .breadcrumb,
  .topbar .search-box,
  .topbar .tb-notifications,
  .topbar .tb-messages { display: none; }
  .topbar .tb-avatar { width: 32px; height: 32px; }
  /* minmax(0, 1fr) — without it a wide intrinsic child (table, code block, */
  /* long unbroken text) pushes the column wider than the viewport, which */
  /* forces the mobile browser to scale the whole layout to fit. */
  .col-4, .col-3, .col-2 { grid-template-columns: minmax(0, 1fr); }
  .page-wrapper { padding: 12px; }
  body.sidebar-open { overflow: hidden; }
  /* Mobile rail mode never applies — drawer handles narrow viewports. */
  body.sidebar-rail .sidebar { width: var(--sidebar-w); }
}
@media (min-width: 769px) {
  .sidebar-backdrop { display: none !important; }
}

/* ──────────────────────── */
/* RAIL MODE (desktop sidebar collapsed to icons) */
/* ──────────────────────── */
/* Activated by `body.sidebar-rail`. Shrinks the sidebar to a 64px icon column */
/* while keeping all click targets reachable. Submenus collapse and re-open as */
/* flyout menus (handled in shell.js). Only applies above 768px — mobile uses */
/* the drawer instead. */
@media (min-width: 769px) {
  body.sidebar-rail {
    --sidebar-w: 64px;
  }
  body.sidebar-rail .sidebar { overflow: visible; }
  body.sidebar-rail .sidebar-brand {
    padding: 0;
    justify-content: center;
  }
  body.sidebar-rail .brand-name { display: none; }
  body.sidebar-rail .nav-group { padding: 0 8px; }
  body.sidebar-rail .nav-label { display: none; }
  body.sidebar-rail .nav-link {
    justify-content: center;
    gap: 0;
    padding: 8px;
    position: relative;
  }
  body.sidebar-rail .nav-link .nav-text,
  body.sidebar-rail .nav-link .badge { display: none; }
  body.sidebar-rail .nav-chev { display: none; }
  /* Submenu inline tree is hidden in rail mode — flyout takes over. */
  body.sidebar-rail .nav-tree .nav-sub { display: none; }
  body.sidebar-rail .sidebar-user {
    padding: 8px;
    justify-content: center;
  }
  body.sidebar-rail .sidebar-user-info,
  body.sidebar-rail .sidebar-user .more-btn { display: none; }

  /* Hover tooltip — uses ::after off the nav-link so we don't add markup. */
  /* The tooltip text comes from a `data-rail-label` attribute that we set */
  /* dynamically in shell.js when rail mode is enabled. */
  body.sidebar-rail .nav-link[data-rail-label]::after {
    content: attr(data-rail-label);
    position: absolute;
    inset-inline-start: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: var(--text);
    color: var(--bg-surface);
    font-size: 11.5px;
    font-weight: var(--font-weight-medium);
    padding: 5px 9px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 120ms, transform 120ms;
    z-index: 110;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  }
  body.sidebar-rail .nav-link[data-rail-label]:hover::after,
  body.sidebar-rail .nav-link[data-rail-label]:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }

  /* Rotate the toggle icon when collapsed for visual affordance. */
  body.sidebar-rail .sidebar-toggle svg { transform: rotate(180deg); }
  .sidebar-toggle svg { transition: transform 200ms ease; }
}

/* Page-specific components: pagination, alerts, chips, calendar, inbox, invoice, project/product cards */

/* ──────────────────────── */
/* PAGINATION */
/* ──────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color-light);
}
.pagination .page-info {
  margin-inline-end: auto;
  font-size: 12px;
  color: var(--text-muted);
}
.page-link {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 100ms, color 100ms, border-color 100ms;
  text-decoration: none;
}
.page-link:hover { background: var(--bg-surface-secondary); color: var(--text); text-decoration: none; }
.page-link.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dk);
}
.page-link.disabled { color: var(--text-disabled); cursor: not-allowed; }

/* ──────────────────────── */
/* ALERTS */
/* ──────────────────────── */
.alert {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 12px;
}
.alert .alert-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert .alert-body { flex: 1; }
.alert strong { font-weight: var(--font-weight-medium); }
.alert-info    { color: var(--blue);   border-color: rgba(6,111,209,0.2);   background: var(--blue-lt); }
.alert-success { color: var(--green);  border-color: rgba(47,179,68,0.2);   background: var(--green-lt); }
.alert-warning { color: #b45309;       border-color: rgba(245,159,0,0.2);   background: var(--yellow-lt); }
.alert-error   { color: var(--red);    border-color: rgba(214,57,57,0.2);   background: var(--red-lt); }

/* ──────────────────────── */
/* CHIPS / TAGS */
/* ──────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 22px;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 11px;
  white-space: nowrap;
}
.chip-primary { color: var(--primary); background: var(--primary-lt); border-color: rgba(26,187,156,0.2); }
.chip-blue    { color: var(--blue);    background: var(--blue-lt);    border-color: rgba(6,111,209,0.2); }
.chip-green   { color: var(--green);   background: var(--green-lt);   border-color: rgba(47,179,68,0.2); }
.chip-yellow  { color: #b45309;        background: var(--yellow-lt);  border-color: rgba(245,159,0,0.2); }
.chip-red     { color: var(--red);     background: var(--red-lt);     border-color: rgba(214,57,57,0.2); }
.chip-purple  { color: var(--purple);  background: var(--purple-lt);  border-color: rgba(174,62,201,0.2); }

/* ──────────────────────── */
/* CALENDAR (month grid) */
/* ──────────────────────── */
.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color-light);
}
.calendar-month {
  font-size: 14px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
}
.calendar-toolbar .nav-btns { display: flex; gap: var(--space-1); }
.calendar-toolbar .spacer { flex: 1; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-color-light);
  border-bottom: 1px solid var(--border-color-light);
}
.calendar-grid .dow {
  background: var(--bg-surface-secondary);
  padding: 8px;
  font-size: 10.5px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: center;
}
.calendar-day {
  background: var(--bg-surface);
  min-height: 90px;
  padding: 6px 8px;
  font-size: 12px;
  position: relative;
  cursor: pointer;
  transition: background 100ms;
}
.calendar-day:hover { background: var(--bg-surface-secondary); }
.calendar-day.muted { color: var(--text-disabled); background: var(--bg-surface-secondary); }
.calendar-day.today .day-num {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--font-weight-bold);
}
.calendar-day .day-num {
  font-weight: var(--font-weight-medium);
  font-size: 12px;
}
.calendar-event {
  display: block;
  margin-top: 4px;
  padding: 2px 6px;
  font-size: 10.5px;
  line-height: 1.4;
  border-radius: 3px;
  background: var(--primary-lt);
  color: var(--primary);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: filter 120ms;
}
.calendar-event:hover { filter: brightness(0.95); }
.calendar-day { cursor: pointer; }
.calendar-event.blue   { background: var(--blue-lt);   color: var(--blue); }
.calendar-event.yellow { background: var(--yellow-lt); color: #b45309; }
.calendar-event.red    { background: var(--red-lt);    color: var(--red); }
.calendar-event.purple { background: var(--purple-lt); color: var(--purple); }

@media (max-width: 700px) {
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(72px, 1fr));
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }
  .calendar-grid > * { scroll-snap-align: start; }
  .calendar-day { min-height: 70px; padding: 4px 6px; }
  .calendar-event {
    font-size: 10px;
    padding: 1px 4px;
  }
}

/* ──────────────────────── */
/* INBOX */
/* ──────────────────────── */
.inbox-layout {
  display: grid;
  grid-template-columns: 200px 320px 1fr;
  min-height: 640px;
  height: calc(100vh - 240px);
  position: relative;
}
.inbox-sidebar {
  border-inline-end: 1px solid var(--border-color-light);
  padding: 12px 8px;
  overflow-y: auto;
}
.inbox-sidebar-label {
  padding: 14px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.inbox-folder {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 100ms, color 100ms;
  text-decoration: none;
  margin-bottom: 1px;
}
.inbox-folder:hover { background: var(--bg-surface-secondary); color: var(--text); text-decoration: none; }
.inbox-folder.active { background: var(--primary-lt); color: var(--primary); font-weight: var(--font-weight-medium); }
.inbox-folder .count {
  margin-inline-start: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface-secondary);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.inbox-folder.active .count { color: var(--primary); background: rgba(26, 187, 156, 0.14); }
.inbox-folder svg { width: 14px; height: 14px; flex-shrink: 0; }
.inbox-label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* List pane (middle column) */
.inbox-list-pane {
  border-inline-end: 1px solid var(--border-color-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.inbox-list-toolbar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color-light);
}
.inbox-search {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text);
}
.inbox-search:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
}
.inbox-list { overflow-y: auto; flex: 1; }
.inbox-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: var(--space-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color-light);
  cursor: pointer;
  transition: background 80ms;
  font-size: 13px;
  align-items: start;
}
.inbox-item:hover { background: var(--bg-surface-secondary); }
.inbox-item.unread { background: var(--bg-surface); }
.inbox-item.unread .sender,
.inbox-item.unread .subject { color: var(--text); font-weight: var(--font-weight-bold); }
.inbox-item.selected {
  background: var(--primary-lt);
  border-inline-start: 2px solid var(--primary);
  padding-inline-start: 10px;
}
.inbox-item-body { min-width: 0; }
.inbox-item .sender { font-size: 12.5px; font-weight: var(--font-weight-medium); color: var(--text-secondary); margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item .subject {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-item .preview {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-item .meta { text-align: end; font-size: 11px; color: var(--text-muted); white-space: nowrap; padding-top: 2px; }
.inbox-star-btn {
  width: 22px;
  height: 22px;
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.inbox-star-btn:hover { background: rgba(0, 0, 0, 0.04); }
.inbox-star-btn .star {
  width: 14px;
  height: 14px;
  color: var(--border-color);
}
.inbox-star-btn .star.on { color: var(--yellow); fill: var(--yellow); }

/* Label pills inside list and reader */
.inbox-label-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: capitalize;
  flex-shrink: 0;
}
.inbox-label-pill[data-label="work"]       { background: var(--primary-lt);  color: var(--primary); }
.inbox-label-pill[data-label="personal"]   { background: var(--blue-lt);     color: var(--blue); }
.inbox-label-pill[data-label="promotions"] { background: var(--yellow-lt);   color: var(--yellow); }
.inbox-label-pill[data-label="urgent"]     { background: var(--red-lt);      color: var(--red); }
.inbox-label-pill-lg {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}

/* Reader pane (right column) */
.inbox-reader {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
}
.inbox-reader-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color-light);
  flex-wrap: wrap;
}
.inbox-reader-toolbar [data-action="back"] { display: none; }
.inbox-reader-spacer { flex: 1; }
.inbox-reader-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
.inbox-reader-subject {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px;
  line-height: 1.3;
}
.inbox-reader-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 0 18px;
  border-bottom: 1px solid var(--border-color-light);
  margin-bottom: 18px;
}
.inbox-reader-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.inbox-reader-meta-text { flex: 1; font-size: 13px; }
.inbox-reader-meta-text strong { color: var(--text); font-weight: var(--font-weight-medium); }
.inbox-reader-email { color: var(--text-muted); font-size: 12px; }
.inbox-reader-to { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.inbox-reader-time { font-size: 12px; color: var(--text-muted); }
.inbox-reader-body {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.inbox-reader-empty { height: 100%; }

/* Compose modal: textarea sized for messages */
.compose-form .form-control[id="compose-body"] {
  min-height: 180px;
  resize: vertical;
  font-family: var(--font);
}

/* Responsive */
@media (max-width: 1100px) {
  .inbox-layout { grid-template-columns: 180px 280px 1fr; }
}
@media (max-width: 900px) {
  .inbox-layout { grid-template-columns: 1fr; }
  .inbox-sidebar { display: none; }
  .inbox-list-pane,
  .inbox-reader { grid-row: 1; grid-column: 1; }
  .inbox-reader { display: none; }
  #inbox-root.reader-open .inbox-list-pane { display: none; }
  #inbox-root.reader-open .inbox-reader { display: flex; }
  .inbox-reader-toolbar [data-action="back"] { display: inline-flex; }
}

/* ──────────────────────── */
/* INVOICE */
/* ──────────────────────── */
.invoice {
  background: var(--bg-surface);
  padding: 32px;
}
.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}
.invoice-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 4px;
}
.invoice-meta { font-size: 12.5px; color: var(--text-muted); }
.invoice-meta strong { color: var(--text); font-weight: var(--font-weight-medium); }
.invoice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: 28px;
}
.invoice-grid h4 {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.invoice-grid p { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.invoice-grid p strong { color: var(--text); font-weight: var(--font-weight-medium); }

/* Invoice ships a 32px padded paper-style block with a 2-col header and */
/* 2-col billed-to/pay-to grid. None of that fits a phone — stack and */
/* shrink the padding so the long IBAN / address blocks have room. */
@media (max-width: 768px) {
  .invoice { padding: 16px; }
  .invoice-header { flex-direction: column; gap: var(--space-3); margin-bottom: 20px; }
  .invoice-grid { grid-template-columns: 1fr; gap: var(--space-3); margin-bottom: 20px; }
}

.invoice-totals {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}
.invoice-totals table { font-size: 13px; }
.invoice-totals td { padding: 4px 16px 4px 0; color: var(--text-secondary); }
.invoice-totals td:last-child { text-align: end; padding-inline-end: 0; min-width: 100px; color: var(--text); font-weight: var(--font-weight-medium); }
.invoice-totals tr.grand td {
  border-top: 2px solid var(--border-color);
  padding-top: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* ── Invoice line-item editor ────────────────────────────────────────── */
/* Used on invoice.html for the editable items table + payment status row. */
.invoice-editor {
  margin-top: 18px;
  border-top: 1px solid var(--border-color-light);
  padding-top: var(--space-3);
}
.invoice-editor-header,
.line-row {
  display: grid;
  grid-template-columns: 1fr 60px 90px 100px 28px;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.line-row {
  font-size: 13px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  border-top: 1px solid var(--border-color-light);
  padding: var(--space-2) 0;
}
.line-row input[type="text"],
.line-row input[type="number"] {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: var(--space-1) 6px;
  border-radius: var(--radius-sm);
  transition: border-color 100ms, background 100ms;
}
.line-row input[type="text"]:hover,
.line-row input[type="number"]:hover { border-color: var(--border-color); }
.line-row input[type="text"]:focus,
.line-row input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.line-row input[type="number"] { text-align: end; -moz-appearance: textfield; appearance: textfield; }
.line-row input[type="number"]::-webkit-outer-spin-button,
.line-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.line-row .desc-wrap input.desc-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.line-row .amount {
  text-align: end;
  font-weight: var(--font-weight-medium);
  color: var(--text);
}
.line-row .remove-btn {
  width: 24px; height: 24px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 100ms, background 100ms, color 100ms;
}
.line-row:hover .remove-btn { opacity: 1; }
.line-row .remove-btn:hover { background: var(--red-lt); color: var(--red); }

/* The 5-col grid (1fr 60 90 100 28 + 4×10gap = 1fr + 318px) needs at least */
/* 318px just for fixed columns, which doesn't leave room for the description */
/* on a 375px phone. Drop the column header and stack qty/rate/amount on a */
/* second visual row with the description spanning above. */
@media (max-width: 600px) {
  .invoice-editor-header { display: none; }
  .line-row {
    grid-template-columns: 1fr 60px 90px 28px;
    grid-template-areas:
      "desc desc desc remove"
      "qty rate amount amount";
    row-gap: 6px;
  }
  .line-row .desc-wrap   { grid-area: desc; }
  .line-row .qty         { grid-area: qty; }
  .line-row .rate        { grid-area: rate; }
  .line-row .amount      { grid-area: amount; }
  .line-row .remove-btn  { grid-area: remove; opacity: 1; }
}

.totals-input {
  width: 50px;
  margin: 0 var(--space-1);
  padding: 1px 6px;
  font: inherit;
  font-size: 12.5px;
  text-align: end;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text);
  -moz-appearance: textfield;
  appearance: textfield;
}
.totals-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-lt); }
.totals-input::-webkit-outer-spin-button,
.totals-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Invoice payment status (horizontal step indicator) ──────────────── */
.invoice-payment-status {
  margin-top: var(--space-6);
  padding: 18px;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  position: relative;
  gap: var(--space-3);
}
.invoice-payment-status::before {
  content: '';
  position: absolute;
  inset-inline-start: 32px; inset-inline-end: 32px; top: 28px;
  height: 2px;
  background: var(--border-color);
  z-index: 0;
}
.ips-step {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.ips-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
}
.ips-step.done .ips-dot { background: var(--primary); border-color: var(--primary); }
.ips-step.active .ips-dot {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-lt);
}
.ips-step.paid .ips-dot { background: var(--green); border-color: var(--green); }
.ips-step .ips-title { font-size: 12.5px; font-weight: var(--font-weight-medium); color: var(--text); }
.ips-step:not(.done):not(.active):not(.paid) .ips-title { color: var(--text-muted); }
.ips-step .ips-time { font-size: 11px; color: var(--text-muted); }

/* Strip editor chrome from the printed invoice — keeps it looking like a */
/* finished document instead of an in-progress form. */
@media print {
  .invoice-editor-header { display: none; }
  .line-row .remove-btn,
  #add-line,
  .totals-input { display: none; }
  .line-row input { border: 0; padding: 0; background: transparent; }
  .invoice-payment-status { display: none; }
}

/* ──────────────────────── */
/* PROJECT CARD */
/* ──────────────────────── */
.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 120ms, box-shadow 120ms;
  cursor: pointer;
}
.project-card:hover {
  border-color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(30,38,51,0.06);
}
.project-card .top { display: flex; justify-content: space-between; align-items: flex-start; }
.project-card .title { font-size: 14px; font-weight: var(--font-weight-bold); color: var(--text); margin-bottom: 2px; }
.project-card .client { font-size: 11.5px; color: var(--text-muted); }
.project-card .desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.project-card .footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-color-light);
  font-size: 11.5px;
  color: var(--text-muted);
}
.project-card .avatars { display: flex; }
.project-card .avatars .av {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; color: white;
  margin-inline-start: -4px;
}
.project-card .avatars .av:first-child { margin-inline-start: 0; }

/* ──────────────────────── */
/* PRODUCT CARD (e-commerce) */
/* ──────────────────────── */
.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 120ms, box-shadow 120ms, transform 120ms;
  display: block;
  text-decoration: none;
  color: inherit;
}
.product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(30,38,51,0.08);
  transform: translateY(-1px);
  text-decoration: none;
}
.product-thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-surface-secondary);
  position: relative;
  overflow: hidden;
}
.product-thumb svg { display: block; width: 100%; height: 100%; }
.product-thumb .product-badge {
  position: absolute;
  top: 8px; inset-inline-start: 8px;
}
.product-info { padding: 12px; }
.product-info .name { font-size: 13px; font-weight: var(--font-weight-medium); color: var(--text); margin-bottom: 2px; }
.product-info .category { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.product-info .price-row { display: flex; align-items: baseline; gap: 6px; }
.product-info .price { font-size: 15px; font-weight: 600; color: var(--text); }
.product-info .price-old { font-size: 12px; color: var(--text-muted); text-decoration: line-through; }
.product-info .stars { color: var(--yellow); font-size: 12px; margin-top: 4px; }

/* ──────────────────────── */
/* CONTACT CARD */
/* ──────────────────────── */
.contact-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}
.contact-card .av {
  width: 56px; height: 56px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 600;
}
.contact-card .name { font-size: 14px; font-weight: var(--font-weight-bold); color: var(--text); }
.contact-card .role { font-size: 11.5px; color: var(--text-muted); margin-bottom: 12px; }
.contact-card .stats {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  padding-top: 12px;
  border-top: 1px solid var(--border-color-light);
  font-size: 11px;
  color: var(--text-muted);
}
.contact-card .stats strong { display: block; font-size: 13px; color: var(--text); font-weight: var(--font-weight-bold); }

/* ──────────────────────── */
/* ICON GRID (icons.html) */
/* ──────────────────────── */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}
.icon-category {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 22px 4px 10px;
  margin-top: 8px;
  border-bottom: 1px solid var(--border-color-light);
}
.icon-category:first-child { margin-top: 0; padding-top: 4px; }
.icon-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px 12px;
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius);
  background: var(--bg-surface);
  cursor: pointer;
  transition: background 100ms, border-color 100ms, transform 100ms;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  text-align: center;
  position: relative;
}
.icon-cell:hover {
  background: var(--bg-surface);
  border-color: var(--primary);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.icon-cell svg {
  width: 48px;
  height: 48px;
  color: var(--text-secondary);
  transition: color 100ms;
  stroke-width: 1.4;
}
.icon-cell:hover svg { color: var(--primary); }
.icon-cell .copied {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-lt);
  color: var(--primary);
  border-radius: var(--radius);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms;
}
.icon-cell.was-copied .copied { opacity: 1; }
.icon-cell.was-copied { border-color: var(--primary); }

/* ──────────────────────── */
/* TYPOGRAPHY SHOWCASE */
/* ──────────────────────── */
.type-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--space-4);
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color-light);
}
.type-row:last-child { border-bottom: none; }
.type-label { font-size: 11px; color: var(--text-muted); padding-top: 4px; font-family: var(--font-mono); }
/* Display samples (56px / 42px headlines) blow past a ~250px column on */
/* phones; stack the spec label above the sample and let long words break. */
.type-row .type-sample, .type-row > :last-child { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .type-row { grid-template-columns: 1fr; gap: var(--space-1); }
}


/* ──────────────────────── */
/* DETAIL MODALS (project / contact) */
/* ──────────────────────── */
.detail-project {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.detail-project .detail-header {
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  align-items: flex-start;
}
.detail-project .head-left { flex: 1; min-width: 0; }
.detail-project .client-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.detail-project .desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
  padding: 14px 0;
  border-top: 1px solid var(--border-color-light);
  border-bottom: 1px solid var(--border-color-light);
}
.detail-stats .stat-block .label {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.detail-stats .stat-block .value {
  font-size: 18px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  margin-bottom: 6px;
}
.detail-stats .stat-block .progress-thin { margin-top: 4px; }

.detail-section .detail-section-title {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.detail-members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-2);
}
.detail-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-secondary);
}
.detail-member .av {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}
.detail-member .meta { display: flex; flex-direction: column; min-width: 0; }
.detail-member .name { font-size: 12.5px; font-weight: var(--font-weight-medium); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-member .role { font-size: 11px; color: var(--text-muted); }

.detail-tasks { display: flex; flex-direction: column; gap: var(--space-1); }
.detail-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  font-size: 13px;
  color: var(--text);
}
.detail-task .checkbox {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}
.detail-task.done .checkbox {
  background: var(--primary);
  border-color: var(--primary);
}
.detail-task.done .task-title { color: var(--text-muted); text-decoration: line-through; }

.detail-activity { display: flex; flex-direction: column; gap: var(--space-2); }
.detail-activity-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.detail-activity-item .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 7px;
  flex-shrink: 0;
}
.detail-activity-item strong { color: var(--text); font-weight: var(--font-weight-medium); }
.detail-activity-item .time { color: var(--text-muted); }

/* Contact modal */
.detail-contact { display: flex; flex-direction: column; gap: 18px; }
.detail-contact-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.detail-contact-head .big-av {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}
.detail-contact-head .name { font-size: 18px; font-weight: var(--font-weight-bold); color: var(--text); margin-bottom: 2px; }
.detail-contact-head .role { font-size: 13px; color: var(--text-muted); }

.detail-contact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  padding: 14px 0;
  border-top: 1px solid var(--border-color-light);
  border-bottom: 1px solid var(--border-color-light);
}
.detail-contact-fields > div { display: flex; flex-direction: column; gap: 2px; }
.detail-contact-fields .label {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.detail-contact-fields .value { font-size: 13px; color: var(--text); }
.detail-contact-fields a.value { color: var(--primary); }

.detail-contact-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  text-align: center;
}
.detail-contact-stats > div {
  padding: 12px;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius);
}
.detail-contact-stats strong {
  display: block;
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  color: var(--text);
  margin-bottom: 2px;
}
.detail-contact-stats span { font-size: 11px; color: var(--text-muted); }

/* Make project cards focusable buttons look like cards */
button.project-card {
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  text-align: start;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button.project-card:hover { border-color: var(--primary); }
.contact-card { cursor: pointer; }

/* ──────────────────────── */
/* FIXED FOOTER (page-scoped) */
/* ──────────────────────── */
.page-fixed-footer .footer {
  position: fixed;
  inset-inline-start: var(--sidebar-w);
  inset-inline-end: 0;
  bottom: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  z-index: 80;
}
.page-fixed-footer .page-wrapper { padding-bottom: 80px; }
@media (max-width: 768px) {
  .page-fixed-footer .footer { inset-inline-start: 0; }
}

/* ──────────────────────── */
/* FILE UPLOAD (form_upload.html) */
/* ──────────────────────── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  transition: border-color 150ms, background 150ms;
  cursor: pointer;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--primary);
  background: var(--primary-lt);
  color: var(--primary);
}
.dropzone svg { width: 36px; height: 36px; margin-bottom: 8px; opacity: .6; }
.dropzone .hint {
  font-size: 13px;
  color: var(--text);
  font-weight: var(--font-weight-medium);
  margin-bottom: 4px;
}
.dropzone .sub { font-size: 11.5px; }
.upload-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: var(--space-3);
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color-light);
  font-size: 13px;
}
.upload-row:last-child { border-bottom: none; }
.upload-row .icon {
  width: 32px;
  height: 32px;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

/* ──────────────────────── */
/* WIZARD (form_wizards.html) */
/* ──────────────────────── */
.wizard-steps {
  display: flex;
  gap: 0;
  padding: 16px;
  border-bottom: 1px solid var(--border-color-light);
}
.wizard-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: .6;
}
.wizard-step.active, .wizard-step.done { opacity: 1; }
.wizard-step .num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-surface-secondary);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}
.wizard-step.active .num {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dk);
}
.wizard-step.done .num {
  background: var(--green);
  color: white;
  border-color: transparent;
}
.wizard-step .label {
  font-size: 12.5px;
  color: var(--text);
  font-weight: var(--font-weight-medium);
}
.wizard-step .sub { font-size: 11px; color: var(--text-muted); }
.wizard-step + .wizard-step::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--border-color);
  margin: 0 14px 0 -14px;
  align-self: center;
}
.wizard-panel { display: none; padding: 20px; }

/* Step row stays on one line by default; under 600px it stacks the steps */
/* vertically — connector line and the secondary "sub" label add width that */
/* causes the row to overflow on phones. */
@media (max-width: 600px) {
  .wizard-steps { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px; }
  .wizard-step { flex: none; width: 100%; }
  .wizard-step .sub { display: none; }
  .wizard-step + .wizard-step::before { display: none; }
  .wizard-panel { padding: 14px; }
}
.wizard-panel.active { display: block; }

/* ──────────────────────── */
/* MEDIA GALLERY */
/* ──────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}
.media-tile {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 150ms;
  border: 1px solid var(--border-color);
}
.media-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 38, 51, 0.08);
}
.media-tile .meta {
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  bottom: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  color: white;
  font-size: 11.5px;
  font-weight: var(--font-weight-medium);
  display: flex;
  justify-content: space-between;
}
.media-tile .meta .size { opacity: .8; font-weight: 400; }

/* ──────────────────────── */
/* PRICING TABLES */
/* ──────────────────────── */
.pricing-tier {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.pricing-tier.popular {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 4px 16px rgba(26, 187, 156, 0.12);
  position: relative;
}
.pricing-tier.popular::before {
  content: 'Most popular';
  position: absolute;
  top: -10px;
  inset-inline-end: 16px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pricing-tier .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pricing-tier .price {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
}
.pricing-tier .price small {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-inline-start: 4px;
}
.pricing-tier .desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.pricing-tier ul {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.pricing-tier ul li {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.pricing-tier ul li svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ──────────────────────── */
/* LANDING PAGE */
/* ──────────────────────── */
.landing-body { background: var(--bg-surface); }
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}
[data-theme="dark"] .landing-nav { background: rgba(20, 29, 43, 0.85); }
.landing-nav .brand { display: flex; align-items: center; gap: 10px; }
.landing-nav .brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}
.landing-nav .brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.2px;
}
.landing-nav nav {
  display: flex;
  gap: var(--space-5);
  margin-inline-start: 32px;
  font-size: 13px;
}
.landing-nav nav a { color: var(--text-secondary); }
.landing-nav nav a:hover { color: var(--text); text-decoration: none; }
.landing-nav .cta { margin-inline-start: auto; display: flex; gap: var(--space-2); }

.hero {
  padding: 80px 32px 60px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 80% at 30% 20%, rgba(26, 187, 156, 0.08), transparent),
    radial-gradient(ellipse 60% 80% at 70% 60%, rgba(66, 153, 225, 0.06), transparent);
}
.hero h1 {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.05;
  max-width: 820px;
  margin: 0 auto 18px;
  color: var(--text);
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--azure));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .subhead {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 28px;
  line-height: 1.5;
}
.hero .cta { display: inline-flex; gap: 10px; }

.features {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}
.feature .icon {
  width: 44px;
  height: 44px;
  background: var(--primary-lt);
  color: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.feature .icon svg { width: 22px; height: 22px; }
.feature h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.feature p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; }

.cta-band {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: white;
  padding: 60px 32px;
  text-align: center;
}
.cta-band h2 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.8px;
  margin-bottom: 12px;
}
.cta-band p {
  font-size: 15px;
  opacity: .9;
  max-width: 520px;
  margin: 0 auto 24px;
}

.landing-footer {
  padding: 32px;
  border-top: 1px solid var(--border-color-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
@media (max-width: 768px) {
  .hero h1 { font-size: 36px; letter-spacing: -1px; }
  .features { grid-template-columns: 1fr; }
  .landing-nav nav { display: none; }
}

/* ──────────────────────── */
/* PRINT */
/* ──────────────────────── */
/* Hide chrome (sidebar, topbar, footer, action bars) and let the page content */
/* flow on plain white. Targets invoice and order detail by default; any page */
/* can opt in by adding `class="print-friendly"` to <body>. */
@media print {
  @page { margin: 16mm; size: auto; }

  body { background: white; color: #000; }
  .sidebar,
  .topbar,
  .footer,
  .skip-link,
  .sidebar-backdrop,
  .toast-host,
  .menu-popover,
  .modal-backdrop,
  .page-actions,
  .breadcrumb,
  .card-opt-btn { display: none !important; }

  .main { margin-inline-start: 0 !important; padding: 0 !important; }
  .page-wrapper { padding: 0 !important; max-width: none !important; }
  .card,
  .invoice {
    box-shadow: none !important;
    border: none !important;
    page-break-inside: avoid;
  }
  /* Don't break inside table rows. */
  tr, .invoice-row { page-break-inside: avoid; }
  /* Re-enable link URLs after the link text for printed pages. */
  a[href]:not([href^="#"]):not([href^="javascript:"])::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
  /* Charts are pixel-rendered canvases; print at the surface size. */
  [data-chart] { break-inside: avoid; }
}

/* RTL overrides. */
/*  */
/* The bulk of right-to-left support comes from logical properties */
/* (margin-inline-*, padding-inline-*, inset-inline-*, border-inline-*, */
/* text-align: start/end) used throughout the other partials — those flip on */
/* their own and need nothing here. */
/*  */
/* This file covers only what has no logical equivalent: */
/* 1. translateX() — transforms are physical by definition */
/* 2. background-position — no logical keyword with usable support */
/* 3. box-shadow offsets — physical x/y */
/* 4. Chevrons that point along the inline axis */
/*  */
/* Anything centred with `left: 50%` + `translateX(-50%)` is deliberately NOT */
/* here: that pattern is direction-neutral and already correct in both modes. */

/* --------------------------------------------------------------------------- */
/* 1. Sidebar mobile drawer — slides in from the inline-start edge */
/* --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  [dir='rtl'] .sidebar {
    transform: translateX(100%);
  }

  [dir='rtl'] .sidebar.open {
    transform: translateX(0);
  }
}

/* --------------------------------------------------------------------------- */
/* 2. Rail-mode flyout label — nudges away from the rail, so it mirrors */
/* --------------------------------------------------------------------------- */
[dir='rtl'] body.sidebar-rail .nav-link[data-rail-label]::after {
  transform: translateY(-50%) translateX(4px);
}

[dir='rtl'] body.sidebar-rail .nav-link[data-rail-label]:hover::after,
[dir='rtl'] body.sidebar-rail .nav-link[data-rail-label]:focus-visible::after {
  transform: translateY(-50%) translateX(0);
}

/* The rail collapse chevron points along the inline axis. */
[dir='rtl'] body.sidebar-rail .sidebar-toggle svg {
  transform: rotate(0deg);
}

[dir='rtl'] .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------- */
/* 3. Slide-out drawer — default edge is inline-end, `.left` is inline-start */
/* --------------------------------------------------------------------------- */
[dir='rtl'] .drawer {
  transform: translateX(-100%);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.12);
}

[dir='rtl'] .drawer.open {
  transform: translateX(0);
}

[dir='rtl'] .drawer.left {
  transform: translateX(100%);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);
}

[dir='rtl'] .drawer.left.open {
  transform: translateX(0);
}

/* --------------------------------------------------------------------------- */
/* 4. Switch + toggle knobs travel along the inline axis */
/* --------------------------------------------------------------------------- */
[dir='rtl'] .switch input:checked + .track::before,
[dir='rtl'] .toggle.on::after {
  transform: translateX(-16px);
}

/* --------------------------------------------------------------------------- */
/* 5. Native select arrow — background-position has no logical form */
/* --------------------------------------------------------------------------- */
[dir='rtl'] select.input,
[dir='rtl'] .input select,
[dir='rtl'] select.form-control {
  background-position: left 10px center;
}

/* --------------------------------------------------------------------------- */
/* 6. Sidebar accordion chevron — points inline-end when closed, down when open */
/* --------------------------------------------------------------------------- */
/* Only the closed state is mirrored. The open state points *down*, which is */
/* direction-neutral, and the base `.nav-tree.open > .nav-toggle .nav-chev` */
/* rule (4 classes) already outranks this one (1 attribute + 1 class) — so it */
/* keeps winning for open groups without an override here. Adding one is how */
/* this got broken the first time: `scaleX(-1) rotate(-90deg)` applies the */
/* rotation first and lands on "up". */
[dir='rtl'] .nav-chev {
  transform: scaleX(-1);
}

/* Gentelella 2026 v4 — Design tokens */
/* DNA: Dark sidebar · Teal #1ABB9C · Light #f9fafb */
/* Font: Inter · 14px base · line-height 1.4286 */
/* Radius: 4/6/8 · Shadows: near-invisible */

:root {
  --sidebar-bg: #1a2332;
  --sidebar-hover: rgba(255,255,255,0.04);
  --sidebar-active: rgba(26,187,156,0.08);
  --sidebar-text: #7b8fa3;
  --sidebar-text-hover: #c5d0dc;
  --sidebar-text-active: #ffffff;
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-w: 252px;

  --primary: #1ABB9C;
  --primary-lt: rgba(26,187,156,0.06);
  --primary-dk: #169f85;

  --body-bg: #f5f7fb;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f9fafb;

  --border-color: #e6e7eb;
  --border-color-light: #eff0f3;
  --border-translucent: rgba(4,32,69,0.08);

  --text: #1e2633;
  --text-secondary: #626d7d;
  --text-muted: #7e8896;
  --text-disabled: #c0c7cf;

  --blue: #066fd1;
  --azure: #4299e1;
  --green: #2fb344;
  --lime: #74b816;
  --yellow: #f59f00;
  --orange: #f76707;
  --red: #d63939;
  --pink: #d6336c;
  --purple: #ae3ec9;
  --indigo: #4263eb;
  --cyan: #17a2b8;

  --green-lt: rgba(47,179,68,0.06);
  --red-lt: rgba(214,57,57,0.06);
  --yellow-lt: rgba(245,159,0,0.06);
  --blue-lt: rgba(6,111,209,0.06);
  --azure-lt: rgba(66,153,225,0.06);
  --purple-lt: rgba(174,62,201,0.06);
  --cyan-lt: rgba(23,162,184,0.06);

  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;

  /* Spacing scale — 4px base, matches Tailwind's mental model (var(--space-4) */
  /* is 16px just like Tailwind's `p-4` is 16px). Use these instead of raw */
  /* pixel values for paddings, margins, and grid gaps. Going off-scale is */
  /* sometimes correct (e.g. 14px between two specific labels) but should be */
  /* the exception. Six steps cover ~95% of UI needs. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --shadow: rgba(30,38,51,0.04) 0 2px 4px 0;
  --shadow-card: 0 0 0 1px var(--border-translucent), rgba(30,38,51,0.04) 0 2px 4px 0;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace;
  --font-size: 0.875rem;
  --line-height: 1.4286;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 600;
}

/* Dark theme — applied via `<html data-theme="dark">`. The pre-paint script */
/* in vite.config.js reads localStorage('theme') / prefers-color-scheme and */
/* sets this attribute before <body> renders so dark mode never flashes. */
[data-theme="dark"] {
  --body-bg: #0f1623;
  --bg-surface: #1a2332;
  --bg-surface-secondary: #141d2b;

  --border-color: rgba(255,255,255,0.08);
  --border-color-light: rgba(255,255,255,0.05);
  --border-translucent: rgba(255,255,255,0.08);

  --text: #e6ebf2;
  --text-secondary: #b3bccb;
  --text-muted: #8a93a3;
  --text-disabled: #5a6473;

  --primary-lt: rgba(26,187,156,0.14);
  --green-lt: rgba(47,179,68,0.16);
  --red-lt: rgba(214,57,57,0.16);
  --yellow-lt: rgba(245,159,0,0.16);
  --blue-lt: rgba(6,111,209,0.18);
  --azure-lt: rgba(66,153,225,0.16);
  --purple-lt: rgba(174,62,201,0.16);
  --cyan-lt: rgba(23,162,184,0.16);

  --shadow: rgba(0,0,0,0.4) 0 2px 4px 0;
  --shadow-card: 0 0 0 1px var(--border-translucent), rgba(0,0,0,0.3) 0 2px 4px 0;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }
[data-theme="dark"] .topbar { background: rgba(20,29,43,0.85); }
[data-theme="dark"] .tb-btn .dot { border-color: var(--bg-surface); }
[data-theme="dark"] .sidebar-user .avatar .online { border-color: var(--sidebar-bg); }
/* Theme toggle: show only the icon for the *next* state */
.theme-toggle .theme-icon-light { display: none; }
.theme-toggle .theme-icon-dark { display: block; }
[data-theme="dark"] .theme-toggle .theme-icon-light { display: block; }
[data-theme="dark"] .theme-toggle .theme-icon-dark { display: none; }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  font-size: var(--font-size);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Inline SVG icons in HTML pages don't always have width/height attributes. */
/* Without them, browsers render unsized SVGs at the default 300×150 — which */
/* causes a giant-icon flash during navigation in dev (CSS injected via JS) */
/* and on slow networks. Default unsized SVGs to 1em so they render close to */
/* their final size on first paint. Specific .icon / .tb-btn svg / etc. rules */
/* have higher specificity and override this. */
/* :where() keeps the rule but drops it to 0-specificity so any class-based */
/* override (.icon-cell svg, .feature .icon svg, etc.) wins cleanly. */
:where(svg):not([width]):not([height]) { width: 1em; height: 1em; }

/* Cross-document view transitions: smooth cross-fade between same-origin */
/* pages in Chrome 126+. Other browsers ignore the at-rule. The default */
/* transition duration (250ms) feels slightly heavy; trim to 180ms. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: 0s; }
}

/* Dashboard widgets: stat cards, chart, activity, visitors, todo, donut, storage, versions, profile */

/* ──────────────────────── */
/* STAT CARDS (top row) */
/* ──────────────────────── */
.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.teal { background: var(--primary-lt); color: var(--primary); }
.stat-icon.blue { background: var(--blue-lt); color: var(--blue); }
.stat-icon.green { background: var(--green-lt); color: var(--green); }
.stat-icon.yellow { background: var(--yellow-lt); color: var(--yellow); }
.stat-icon.red { background: var(--red-lt); color: var(--red); }
.stat-icon.purple { background: var(--purple-lt); color: var(--purple); }

.stat-content { flex: 1; min-width: 0; }
.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
}
.stat-value-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}
.stat-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.stat-change {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  display: inline-flex;
  align-items: center;
  gap: 1px;
}
.stat-change svg { width: 12px; height: 12px; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-subtext {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Sparkline bar in stat */
.stat-spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  flex-shrink: 0;
}
.stat-spark .bar {
  width: 4px;
  border-radius: 2px;
  background: var(--primary);
  opacity: 0.25;
  transition: height 0.3s ease;
}
.stat-spark .bar:nth-child(odd) { opacity: 0.4; }
.stat-spark .bar:last-child { opacity: 0.8; }

/* ──────────────────────── */
/* CHART CARD */
/* ──────────────────────── */
.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px 0;
}
.chart-header-left .chart-stat {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
}
.chart-tabs {
  display: flex;
  gap: 0;
  background: var(--body-bg);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.chart-tab {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 3px;
  border: none;
  background: transparent;
  transition: background 120ms, color 120ms;
}
.chart-tab.active {
  background: var(--bg-surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chart-tab:hover:not(.active) { color: var(--text-secondary); }
/* On touch devices the segmented chip is too small to hit reliably; pad it */
/* vertically so the row reaches ~28px without making the desktop UI shouty. */
@media (pointer: coarse) {
  .chart-tab { padding: 6px 12px; font-size: 12px; }
}

.chart-area {
  padding: 16px;
  height: 200px;
  position: relative;
}
.chart-area svg { width: 100%; height: 100%; display: block; }
.chart-grid-line {
  stroke: var(--border-color-light);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.chart-label {
  font-family: var(--font);
  font-size: 10px;
  fill: var(--text-muted);
}
.chart-path {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-fill { opacity: 0.04; }

/* ──────────────────────── */
/* ACTIVITY LIST */
/* ──────────────────────── */
.activity-list { list-style: none; }
.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.activity-body {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.activity-body strong { color: var(--text); font-weight: var(--font-weight-medium); }
.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-top: 1px;
}

/* ──────────────────────── */
/* VISITORS LIST */
/* ──────────────────────── */
.visitor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-color-light);
  font-size: 13px;
}
.visitor-row:last-child { border-bottom: none; }
.visitor-flag { font-size: 16px; line-height: 1; }
.visitor-name { flex: 1; color: var(--text); font-weight: var(--font-weight-normal); }
.visitor-pct { font-weight: var(--font-weight-bold); color: var(--text); min-width: 32px; text-align: end; font-size: 12.5px; }
.visitor-bar {
  width: 80px;
  height: 4px;
  background: var(--border-color-light);
  border-radius: 2px;
  overflow: hidden;
}
.visitor-bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
}

/* ──────────────────────── */
/* TODO LIST */
/* ──────────────────────── */
.todo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-color-light);
}
.todo-row:last-child { border-bottom: none; }
.todo-cb {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms, border-color 120ms;
  /* Pure-CSS checkmark — appears whenever .done is set, regardless of whether */
  /* any child SVG exists. This makes the click-to-toggle behavior look */
  /* identical to pre-rendered done states. */
  position: relative;
}
.todo-cb svg { display: none; } /* legacy inline SVGs are hidden — ::after handles it */
.todo-cb::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: translate(-55%, -65%) rotate(45deg);
  opacity: 0;
  transition: opacity 100ms;
}
.todo-cb:hover { border-color: var(--primary); }
.todo-cb.done {
  background: var(--primary);
  border-color: var(--primary);
}
.todo-cb.done::after { opacity: 1; }
.todo-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}
.todo-row.done .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.todo-date {
  font-size: 11px;
  color: var(--text-muted);
}
.todo-prio {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ──────────────────────── */
/* DONUT (small) */
/* ──────────────────────── */
.donut-block { display: flex; align-items: center; gap: var(--space-4); }
.donut-svg { width: 110px; height: 110px; flex-shrink: 0; position: relative; }
.donut-svg svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-center-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.donut-center-label .num { font-size: 18px; font-weight: 600; line-height: 1; }
.donut-center-label .sub { font-size: 10px; color: var(--text-muted); }
.donut-legend { flex: 1; }
.donut-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
  padding: 3px 0;
}
.donut-legend-item .dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.donut-legend-item .pct { margin-inline-start: auto; font-weight: var(--font-weight-bold); color: var(--text); font-size: 11.5px; }

/* ──────────────────────── */
/* APP VERSIONS (progress) */
/* ──────────────────────── */
.version-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
}
.version-label { font-size: 12.5px; color: var(--text-secondary); width: 48px; font-weight: var(--font-weight-medium); }
.version-bar { flex: 1; height: 4px; background: var(--border-color-light); border-radius: 2px; overflow: hidden; }
.version-bar .fill { height: 100%; border-radius: 2px; }
.version-pct { font-size: 12px; color: var(--text-muted); width: 30px; text-align: end; font-weight: var(--font-weight-medium); }

/* ──────────────────────── */
/* STORAGE WIDGET */
/* ──────────────────────── */
.storage-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border-color-light);
  margin-bottom: 12px;
}
.storage-bar > div { height: 100%; }
.storage-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}
.storage-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
}
.storage-legend-item .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.storage-legend-item .val { margin-inline-start: auto; font-weight: var(--font-weight-medium); color: var(--text); }

/* ──────────────────────── */
/* PROFILE COMPLETION */
/* ──────────────────────── */
.profile-ring-box { text-align: center; padding: 8px 0; }
.profile-ring-box .ring-wrap {
  width: 80px; height: 80px;
  margin: 0 auto 8px;
  position: relative;
}
.profile-ring-box .ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border-color-light); stroke-width: 5; }
.ring-fill { fill: none; stroke: var(--primary); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 213.6; }
.profile-ring-box .ring-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 18px; font-weight: 600;
}
.profile-ring-box .ring-center span { font-size: 10px; color: var(--text-muted); font-weight: 400; }
.profile-ring-box .note { font-size: 12px; color: var(--text-muted); }
.profile-ring-box .ring-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--primary);
  font-weight: var(--font-weight-medium);
}
