/* ==========================================================================
   Flowspace — design system
   Font: Plus Jakarta Sans (headings / display / body / UI)
   Theme:  light default, dark via [data-theme="dark"] on <html>
   ========================================================================== */

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f0eee7;
  --surface-hover: #eae8e0;
  --border: rgba(21, 23, 28, 0.09);
  --border-strong: rgba(21, 23, 28, 0.16);
  --ink: #15171c;
  --ink-dim: rgba(21, 23, 28, 0.64);
  --ink-faint: rgba(21, 23, 28, 0.42);

  --accent: #10b981;
  --accent-2: #059669;
  --accent-ink: #ffffff;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-soft-strong: rgba(16, 185, 129, 0.28);

  --sidebar-ink: #383b42;

  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.12);
  --success: #1fa971;
  --success-soft: rgba(31, 169, 113, 0.12);
  --info: #3d8bfd;
  --info-soft: rgba(61, 139, 253, 0.12);

  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(21, 23, 28, 0.05);
  --shadow-md: 0 10px 30px rgba(21, 23, 28, 0.08);
  --shadow-lg: 0 20px 50px rgba(21, 23, 28, 0.14);

  --sidebar-w: 256px;
  --topbar-h: 76px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101115;
  --surface: #17181e;
  --surface-2: #1d1f26;
  --surface-hover: #252831;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --ink: #f3f3f1;
  --ink-dim: rgba(243, 243, 241, 0.66);
  --ink-faint: rgba(243, 243, 241, 0.44);

  --accent-ink: #ffffff;
  --accent-soft: rgba(16, 185, 129, 0.18);
  --accent-soft-strong: rgba(16, 185, 129, 0.3);
  --sidebar-ink: rgba(243, 243, 241, 0.7);
  --danger-soft: rgba(229, 72, 77, 0.18);
  --success-soft: rgba(31, 169, 113, 0.18);
  --info-soft: rgba(61, 139, 253, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
h1, h2, h3, h4, h5 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
svg { display: block; flex-shrink: 0; }

.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 26px 24px 22px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s ease;
}
.sidebar-brand:hover {
  opacity: 0.75;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-word {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 18.5px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-word span { color: var(--accent-2); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 14px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-ink);
  transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 18px; height: 18px; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}
.nav-item.active svg { opacity: 1; }

.sidebar-foot {
  padding: 16px 16px 68px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
}
.sidebar-user:hover { background: var(--surface-2); }
.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.js-profile-initials img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-name { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.sidebar-user-role { font-size: 11.5px; color: var(--ink-faint); }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 400;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  align-items: center;
  justify-content: center;
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10, 10, 12, 0.4);
  z-index: 190;
}

/* ---------- Main column ---------- */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 150;
}
.search-field {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  color: var(--ink-faint);
}
.search-field svg { flex-shrink: 0; }
.search-field input {
  border: none; outline: none; background: none;
  width: 100%; font-size: 13.5px; color: var(--ink);
}
.search-field input::placeholder { color: var(--ink-faint); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-dim);
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2);
  border: 1.5px solid var(--bg);
}

/* Header dropdown panels (messages / notifications) */
.header-menu { position: relative; }
.header-popover {
  position: absolute; top: calc(100% + 10px); right: -6px;
  width: 320px; max-width: calc(100vw - 32px); max-height: 380px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 8px; z-index: 300; display: none;
}
.header-popover.is-open { display: block; }
.popover-head {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint); padding: 8px 10px 6px;
}
.popover-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; border-radius: var(--radius-md);
}
.popover-item:hover { background: var(--surface-2); }
.popover-item.is-unread .popover-item-text { font-weight: 700; color: var(--ink); }
.popover-dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; margin-top: 6px; flex-shrink: 0; }
.popover-item.is-unread .popover-dot { background: var(--accent-2); }
.popover-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.popover-avatar img { width: 100%; height: 100%; object-fit: cover; }
.popover-item-text { font-size: 12.5px; line-height: 1.45; color: var(--ink-dim); }
.popover-item-time { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-pill);
}
.topbar-user:hover { background: var(--surface-2); }
.topbar-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: var(--accent-2);
}
.topbar-user-text { line-height: 1.25; }
.topbar-user-name { font-size: 13px; font-weight: 700; }
.topbar-user-role { font-size: 11px; color: var(--ink-faint); }

/* ---------- Page container ---------- */
.page {
  padding: 28px 32px 56px;
  max-width: 1400px;
  width: 100%;
}
.page-head { margin-bottom: 22px; }
.page-eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent-2); margin-bottom: 6px;
  display: block;
}
.page-title { font-size: 26px; font-weight: 700; }
.page-sub { color: var(--ink-dim); font-size: 14px; margin-top: 6px; }

/* ---------- Generic cards / grids ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.section-title {
  font-size: 19px; font-weight: 700; margin-bottom: 14px;
}
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}

/* ---------- Greeting + tasks ---------- */
.greeting-eyebrow { color: var(--ink-dim); font-size: 15px; margin-bottom: 2px; }
.greeting-title { font-size: 25px; font-weight: 700; margin-bottom: 18px; }
.greeting-title .accent { color: var(--accent-2); }

.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
  margin: 22px 0 18px;
}
.tab-btn {
  padding: 6px 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-faint);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--accent-2); border-color: var(--accent-2); }

.task-list { display: flex; flex-direction: column; gap: 14px; }
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.task-card.is-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: #f4f3ef;
}
:root[data-theme="dark"] .task-card.is-dark { background: #0b0c0f; }
.task-card.is-dark .task-project { color: var(--accent); }
.task-card.is-dark .task-desc { color: rgba(244, 243, 239, 0.68); }
.task-card.is-dark .progress-track { background: rgba(255, 255, 255, 0.14); }

.task-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.task-project {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--accent-2); margin-bottom: 4px; display: block;
}
.task-title { font-size: 15.5px; font-weight: 700; margin-bottom: 4px; }
.task-desc {
  font-size: 13px; color: var(--ink-dim);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1;
  overflow: hidden; text-overflow: ellipsis;
}

.menu-btn {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: inherit; opacity: .55; flex-shrink: 0;
}
.menu-btn:hover { opacity: 1; background: var(--surface-2); }
.task-card.is-dark .menu-btn:hover { background: rgba(255, 255, 255, 0.1); }

.task-bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 16px;
}
.avatar-stack { display: flex; }
.avatar-stack .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--surface);
  margin-left: -9px; overflow: hidden;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700;
  flex-shrink: 0;
}
.task-card.is-dark .avatar-stack .avatar { border-color: var(--ink); }
:root[data-theme="dark"] .task-card.is-dark .avatar-stack .avatar { border-color: #0b0c0f; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar img { width: 100%; height: 100%; object-fit: cover; }

.task-progress { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 220px; }
.progress-track {
  flex: 1; height: 6px; border-radius: var(--radius-pill);
  background: var(--surface-2); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.progress-pct { font-size: 12.5px; font-weight: 700; color: var(--accent-2); min-width: 32px; text-align: right; }
.task-card.is-dark .progress-pct { color: var(--accent); }

.task-empty {
  text-align: center; padding: 40px 20px; color: var(--ink-faint);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  font-size: 13.5px;
}

.add-task-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 700;
  padding: 11px 18px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.add-task-btn:hover { opacity: .88; }
:root[data-theme="dark"] .add-task-btn { background: var(--surface-2); color: var(--ink); }

/* ---------- Right rail ---------- */
.rail { display: flex; flex-direction: column; gap: 20px; }
.tracker-teaser {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
}
.tracker-teaser-title { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; }
.tracker-teaser-sub { font-size: 12.5px; color: var(--ink-dim); }
.play-btn {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(155deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
  color: var(--accent-ink);
  transition: transform .15s ease;
}
.play-btn:hover { transform: scale(1.06); }

.rail-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.rail-date { font-size: 12.5px; color: var(--ink-faint); margin-bottom: 2px; }
.rail-today { font-size: 20px; font-weight: 700; }
.add-task-btn-sm {
  background: var(--ink); color: var(--bg);
  font-size: 12px; font-weight: 700;
  padding: 9px 14px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
:root[data-theme="dark"] .add-task-btn-sm { background: var(--surface-2); color: var(--ink); }

.calendar-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}
.calendar-day {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 2px;
  border-radius: var(--radius-md);
  font-size: 11.5px; font-weight: 600; color: var(--ink-dim);
  border: 1px solid transparent;
}
.calendar-day:hover { background: var(--surface-2); }
.calendar-day .dow { text-transform: uppercase; font-size: 10px; letter-spacing: .03em; color: var(--ink-faint); }
.calendar-day .dnum { font-size: 14px; font-weight: 700; color: var(--ink); }
.calendar-day.is-today .dnum {
  background: var(--ink); color: var(--bg);
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.calendar-day.is-selected { border-color: var(--accent-2); background: var(--accent-soft); }
.calendar-day.has-events::after {
  content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--accent-2);
}

.event-list { display: flex; flex-direction: column; gap: 12px; }
.event-card {
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  background: var(--surface-2);
  position: relative;
}
.event-card.is-accent {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
}
.event-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.event-title { font-size: 14px; font-weight: 700; }
.event-time { font-size: 12px; font-weight: 700; white-space: nowrap; opacity: .8; }
.event-desc {
  font-size: 12.5px; opacity: .78; margin-bottom: 12px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; text-overflow: ellipsis;
}
.event-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.event-check {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(21, 23, 28, 0.08); color: inherit;
  border: 1.5px solid rgba(21, 23, 28, 0.16);
}
.event-card.is-accent .event-check { background: rgba(255, 255, 255, 0.22); border-color: rgba(255, 255, 255, 0.32); }
.event-check.is-done { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.event-card.is-accent .event-check.is-done { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
.event-empty { text-align: center; padding: 26px 10px; color: var(--ink-faint); font-size: 13px; }

/* Recent Activity card (dashboard rail) */
.activity-list { display: flex; flex-direction: column; gap: 14px; }
.activity-item { display: flex; align-items: flex-start; gap: 10px; }
.activity-avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.activity-avatar img { width: 100%; height: 100%; object-fit: cover; }
.activity-text { font-size: 12.5px; line-height: 1.45; color: var(--ink-dim); }
.activity-target { font-weight: 700; color: var(--accent-2); }
.activity-time { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- Below-fold widget row ---------- */
.widget-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 24px;
  margin-top: 28px;
}

/* Circular timer widget */
.timer-widget {
  background: linear-gradient(155deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-xl);
  padding: 22px 22px 26px;
  color: var(--accent-ink);
  display: flex; flex-direction: column;
}
.timer-widget-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.timer-widget-title { font-size: 13px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.timer-widget-total { font-size: 12px; font-weight: 600; opacity: .78; }
.timer-widget-task { font-size: 12px; opacity: .82; }
.timer-widget-task strong { font-weight: 700; }
.timer-dial-wrap { display: flex; align-items: center; justify-content: center; padding: 14px 0 18px; }
.timer-dial { position: relative; width: 168px; height: 168px; }
.timer-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-dial-bg { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 8; }
.timer-dial-fg { fill: none; stroke: var(--accent-ink); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.timer-readout {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.timer-time { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.timer-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin-top: 2px; }
.timer-controls { display: flex; align-items: center; justify-content: center; gap: 12px; }
.timer-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink);
  transition: background .15s ease, transform .15s ease;
}
.timer-btn:hover { background: rgba(255, 255, 255, 0.3); transform: translateY(-1px); }
.timer-btn.primary { width: 54px; height: 54px; background: var(--accent-ink); color: var(--accent); }
.timer-btn.primary:hover { background: #eef7f2; }
.timer-btn[disabled] { opacity: .4; pointer-events: none; }

/* New project mini queue */
.queue-widget { padding: 20px; display: flex; flex-direction: column; }
.queue-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.queue-head-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; }
.queue-add {
  width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
}
.queue-list { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.queue-item { background: var(--surface-2); border-radius: var(--radius-md); padding: 12px 14px; }
.queue-item.is-dark { background: var(--ink); color: #f4f3ef; }
:root[data-theme="dark"] .queue-item.is-dark { background: #0b0c0f; }
.queue-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 9px; border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink-dim); margin-bottom: 8px;
}
.queue-item.is-dark .queue-status { background: rgba(255,255,255,0.1); color: rgba(244,243,239,.75); }
.queue-item-row { display: flex; align-items: flex-start; gap: 10px; }
.queue-avatar {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px;
}
.queue-avatar img { width: 100%; height: 100%; object-fit: cover; }
.queue-item-title { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.queue-item-sub { font-size: 11.5px; color: var(--ink-dim); }
.queue-item.is-dark .queue-item-sub { color: rgba(244,243,239,.65); }
.queue-item-progress { margin-top: 10px; }

/* Upload card */
.upload-widget {
  padding: 26px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px;
  border: 1.5px dashed var(--border-strong);
  background: var(--surface);
  transition: background .15s ease, border-color .15s ease;
}
.upload-widget.is-dragover { background: var(--accent-soft); border-color: var(--accent-2); }
.upload-icon {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
}
.upload-title { font-size: 14px; font-weight: 700; line-height: 1.4; }
.upload-title .accent { color: var(--accent-2); }
.upload-sub { font-size: 12px; color: var(--ink-faint); }
.upload-sub a { color: var(--accent-2); font-weight: 700; text-decoration: underline; }
.upload-btn {
  margin-top: 4px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 700;
  padding: 10px 22px; border-radius: var(--radius-pill);
}
.upload-btn:hover { background: var(--accent-2); }

/* ---------- KPI cards (analytics) ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.kpi-card { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.kpi-head { display: flex; align-items: center; gap: 8px; }
.kpi-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-label { font-size: 12.5px; color: var(--ink); font-weight: 700; }
.kpi-value { font-size: 24px; font-weight: 900; font-family: 'Inter Tight', sans-serif; }
.kpi-sub { font-size: 12px; color: var(--ink-dim); }
.kpi-delta { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 3px 9px; border-radius: var(--radius-pill); }
.kpi-delta.up { color: var(--success); background: var(--success-soft); }
.kpi-delta.down { color: var(--danger); background: var(--danger-soft); }

.analytics-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; }
.chart-card { padding: 22px; }
.chart-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-dim); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--accent-2); display: inline-block; }

.bar-chart-row { display: flex; gap: 12px; }
.bar-chart-yaxis {
  display: flex; flex-direction: column; justify-content: space-between;
  height: 220px; padding: 10px 0 26px; text-align: right;
  font-size: 11px; font-weight: 700; color: var(--ink-faint);
}
.bar-chart { flex: 1; display: flex; align-items: flex-end; gap: 14px; height: 220px; padding-top: 10px; min-width: 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.bar-fill-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.bar-fill {
  width: 60%; max-width: 40px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  position: relative;
  min-height: 4px;
}
.bar-value {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; color: var(--ink-dim); white-space: nowrap;
}
.bar-label { font-size: 11.5px; font-weight: 700; color: var(--ink-faint); }

.expenditure-list { display: flex; flex-direction: column; gap: 14px; }
.expenditure-item { }
.expenditure-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.expenditure-name { font-size: 13px; font-weight: 700; }
.expenditure-amt { font-size: 12.5px; color: var(--ink-dim); }
.expenditure-track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.expenditure-fill { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.spend-card {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-radius: var(--radius-lg);
  padding: 20px;
  color: var(--accent-ink);
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
}
.spend-card::after {
  content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,0.18); top: -60px; right: -50px;
}
.spend-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; position: relative; }
.spend-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.spend-value { font-size: 27px; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; position: relative; margin-bottom: 4px; }
.spend-card-foot { font-size: 11.5px; opacity: .78; position: relative; }

.chart-toggle { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-pill); }
.chart-toggle-btn { font-size: 12px; font-weight: 700; padding: 7px 14px; border-radius: var(--radius-pill); color: var(--ink-dim); }
.chart-toggle-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.line-chart { width: 100%; height: 220px; overflow: visible; }
.line-chart-path { fill: none; stroke: url(#lineChartGradient); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.line-chart-area { fill: url(#lineChartFill); opacity: .5; }
.line-chart-dot { fill: var(--surface); stroke: var(--accent-2); stroke-width: 2.5; }
.line-chart-dot:hover { stroke: var(--ink); }
.line-chart-label { font-size: 9.5px; fill: var(--ink-faint); font-weight: 700; }

/* ---------- Teams page ---------- */
.team-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.team-toolbar .search-field { max-width: 320px; }
.team-count { font-size: 13px; color: var(--ink-dim); font-weight: 600; margin-left: auto; }
.filter-select {
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 10px 16px; background: var(--surface); font-size: 13px; font-weight: 600;
  color: var(--ink); outline: none;
}
.filter-select:focus { border-color: var(--accent-2); }
.status-filter { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-pill); }
.status-filter-btn { font-size: 12px; font-weight: 700; padding: 8px 14px; border-radius: var(--radius-pill); color: var(--ink-dim); }
.status-filter-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.team-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.team-card { padding: 22px 18px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.team-avatar {
  width: 78px; height: 78px; border-radius: 50%; overflow: hidden; margin-bottom: 14px;
  border: 3px solid var(--surface-2);
}
.team-avatar img { width: 100%; height: 100%; object-fit: cover; }
.team-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.team-role { font-size: 12.5px; color: var(--ink-dim); margin-bottom: 12px; }
.team-project-tag {
  font-size: 11px; font-weight: 700; color: var(--accent-2);
  background: var(--accent-soft); padding: 5px 11px; border-radius: var(--radius-pill);
  margin-bottom: 14px;
}
.team-stats { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; border-top: 1px solid var(--border); padding-top: 12px; }
.team-stat-value { font-size: 15px; font-weight: 700; }
.team-stat-label { font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .03em; }
.team-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; }
.team-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
.team-status.active::before { background: var(--success); }
.team-status.away::before { background: var(--ink-faint); }
.team-empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--ink-faint); }
.team-card { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.team-card:hover, .team-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-md); outline: none; }

/* Team member modal */
.member-modal-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.member-modal-avatar { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 3px solid var(--surface-2); }
.member-modal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-modal-name { font-size: 17px; font-weight: 700; }
.member-modal-role { font-size: 12.5px; color: var(--ink-dim); margin-bottom: 6px; }
.member-modal-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-dim); flex-wrap: wrap; }
.member-modal-section-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin: 18px 0 10px; }
.member-workload-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.member-workload-row .progress-track { flex: 1; }
.member-workload-row span:last-child { font-size: 12.5px; font-weight: 700; color: var(--ink-dim); min-width: 60px; text-align: right; }
.member-task-list { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; }
.member-task-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--surface-2); border-radius: var(--radius-md); padding: 11px 14px; }
.member-task-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.member-task-project { font-size: 11.5px; color: var(--ink-faint); }
.member-task-row .task-progress { max-width: 110px; }

/* ---------- Documents page ---------- */
.doc-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.doc-quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.doc-quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px; border-radius: var(--radius-md);
  background: var(--surface-2); font-size: 11.5px; font-weight: 700;
  border: 1.5px solid transparent;
}
.doc-quick-btn:hover { background: var(--surface-hover); }
.doc-quick-btn.active { border-color: var(--accent-2); background: var(--accent-soft); color: var(--accent-2); }
.doc-quick-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
}

.doc-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.doc-count { font-size: 13px; color: var(--ink-dim); font-weight: 600; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-faint); font-weight: 700; padding: 0 14px 10px;
}
.doc-table td { padding: 14px; border-top: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.doc-table tr:hover td { background: var(--surface-2); }
.doc-name-cell { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.doc-type-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.doc-tag {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill);
  text-transform: capitalize;
}
.doc-empty-row td { text-align: center; padding: 50px 10px; color: var(--ink-faint); }

.new-doc-btn {
  background: var(--ink); color: var(--bg);
  font-size: 12.5px; font-weight: 700; padding: 10px 16px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 6px;
}
:root[data-theme="dark"] .new-doc-btn { background: var(--surface-2); color: var(--ink); }

.doc-uploader-name { display: flex; align-items: center; gap: 8px; }
.doc-uploader-initials {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}

.storage-card {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  padding: 18px; min-height: 130px; display: flex; flex-direction: column; justify-content: flex-end;
  margin-bottom: 18px; color: #fff;
}
.storage-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.storage-card::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(16,17,21,0.15), rgba(16,17,21,0.85));
}
.storage-card-body { position: relative; z-index: 2; }
.storage-card-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .85; margin-bottom: 4px; }
.storage-card-value { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.storage-card-track { height: 6px; border-radius: var(--radius-pill); background: rgba(255,255,255,0.25); overflow: hidden; }
.storage-card-fill { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- Settings page ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: stretch; }
.settings-col-right { display: flex; flex-direction: column; }
.settings-card { padding: 24px; margin-bottom: 20px; }
.settings-card:last-child { margin-bottom: 0; }
.settings-card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.settings-card-sub { font-size: 12.5px; color: var(--ink-dim); margin-bottom: 20px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12.5px; font-weight: 700; color: var(--ink-dim); }
.form-field input, .form-field textarea, .form-field select {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; background: var(--surface); font-size: 13.5px; color: var(--ink);
  outline: none; transition: border-color .15s ease;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--accent-2); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-primary {
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 13px;
  padding: 11px 20px; border-radius: var(--radius-pill);
}
:root[data-theme="dark"] .btn-primary { background: var(--surface-2); color: var(--ink); }
.btn-ghost {
  background: var(--surface-2); color: var(--ink); font-weight: 700; font-size: 13px;
  padding: 11px 20px; border-radius: var(--radius-pill);
}

.profile-photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.profile-photo { width: 68px; height: 68px; border-radius: 50%; overflow: hidden; background: var(--accent-soft); color: var(--accent-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; }
.profile-photo-actions { display: flex; gap: 8px; }
.btn-sm { font-size: 12px; font-weight: 700; padding: 8px 14px; border-radius: var(--radius-pill); background: var(--surface-2); }
.btn-sm.danger { color: var(--danger); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.toggle-row:first-of-type { border-top: none; padding-top: 0; }
.toggle-row-title { font-size: 13.5px; font-weight: 700; margin-bottom: 2px; }
.toggle-row-sub { font-size: 12px; color: var(--ink-dim); }

.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute; inset: 0; background: var(--surface-2); border-radius: var(--radius-pill);
  border: 1px solid var(--border); transition: background .2s ease;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .2s ease;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track + .switch-thumb { transform: translateX(18px); background: #fff; }

.theme-toggle-card { display: flex; flex-direction: column; gap: 14px; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-opt {
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 12.5px; font-weight: 700;
}
.theme-opt.active { border-color: var(--accent-2); background: var(--accent-soft); color: var(--accent-2); }
.theme-opt-swatch { width: 100%; height: 46px; border-radius: 8px; border: 1px solid var(--border); }
.theme-opt-swatch.light { background: linear-gradient(180deg, #fff 55%, #f0eee7 55%); }
.theme-opt-swatch.dark { background: linear-gradient(180deg, #17181e 55%, #1d1f26 55%); }

.contact-card { display: flex; flex-direction: column; gap: 14px; flex: 1; justify-content: center; }
.contact-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.contact-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-row a, .contact-row span.val { font-weight: 700; }

/* ---------- Toast ---------- */
#demoToast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 700;
  padding: 11px 20px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9999; white-space: nowrap;
}
:root[data-theme="dark"] #demoToast { background: var(--surface-2); color: var(--ink); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,10,12,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 440px; padding: 26px;
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--surface-2); }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr; }
  .widget-row { grid-template-columns: 1fr 1fr; }
  .team-grid { grid-template-columns: repeat(3, 1fr); }
  .analytics-grid { grid-template-columns: 1fr; }
  .doc-layout { grid-template-columns: 260px 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .sidebar-backdrop.is-open { display: block; }
  .topbar { padding: 0 20px 0 68px; }
  .page { padding: 20px 20px 48px; }
  .widget-row { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .doc-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .search-field { max-width: 220px; }
}
@media (max-width: 560px) {
  .team-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .doc-quick-actions { grid-template-columns: repeat(2, 1fr); }
  .search-field { display: none; }
}
