*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:          #F5F4FA;
  --white:       #ffffff;
  --text:        #0F1024;
  --ink:         #0F1024;
  --muted:       #6B6B7D;
  --border:      #E6E5EE;
  --hairline:    #E6E5EE;
  --primary:     #3826E2;
  --accent:      #3826E2;
  --accent-dark: #2a1db8;
  --accent-bg:   #EEF2FF;
  --teal:        #2AC8C8;
  --red:         #F43F5E;
  --sans:        'Inter Tight', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:        'JetBrains Mono', 'Courier New', monospace;
  --radius:      14px;
  --sidebar-w:   232px;
}
html, body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans); min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  display: flex;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: flex; flex-direction: column; gap: 0;
  position: fixed; top: 0; left: 0; bottom: 0;
  padding: 24px 0; z-index: 20; overflow-y: auto;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 9px;
  padding: 0 20px 20px; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 8px;
}
.sidebar-logo-text { font-size: .9rem; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.logo-dot { color: var(--teal); }
.sidebar-ws { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 8px; }
.sidebar-ws-label { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.4); margin-bottom: 6px; }
.sidebar-ws-name { font-size: .875rem; font-weight: 600; color: #fff; }
.sidebar-ws-domain { font-size: .75rem; color: rgba(255,255,255,.45); margin-top: 2px; }
.sidebar-nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  font-size: .875rem; font-weight: 500; color: rgba(255,255,255,.55);
  text-decoration: none; padding: 9px 20px; position: relative;
  border-radius: 8px; margin: 0 8px; transition: color .15s, background .15s;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-link.active { color: #fff; background: rgba(255,255,255,.10); font-weight: 600; }
.sidebar-link.active::after {
  content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; background: var(--teal); border-radius: 2px;
}
.sidebar-link-icon { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-sep { height: 1px; background: rgba(255,255,255,.08); margin: 6px 16px; }
.sidebar-bottom {
  padding: 16px 20px 0; border-top: 1px solid rgba(255,255,255,.1); margin-top: 8px;
}
.sidebar-email { display: block; font-size: .7rem; color: rgba(255,255,255,.4); margin-bottom: 10px; word-break: break-all; }
.sidebar-signout {
  background: none; border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.6);
  font-family: var(--sans); font-size: .75rem; font-weight: 500;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: color .15s, border-color .15s;
}
.sidebar-signout:hover { color: #fff; border-color: rgba(255,255,255,.5); }

/* ── MAIN ── */
.dash-main {
  flex: 1; margin-left: var(--sidebar-w);
  min-height: 100vh; display: flex; flex-direction: column;
}
.dash-loading { padding: 80px 0; text-align: center; color: var(--muted); font-size: .875rem; }
.dash-error { display: none; padding: 80px 0; text-align: center; color: var(--red); font-size: .875rem; }
#content { display: none; padding: 0; flex: 1; }

/* ── TOP BAR ── */
.dash-topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 24px 32px 22px; border-bottom: 1px solid var(--hairline); background: var(--white);
  position: sticky; top: 0; z-index: 10;
}
.dash-eyebrow { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .18em; margin-bottom: 6px; }
.dash-title { font-size: 1.625rem; font-weight: 700; color: var(--ink); letter-spacing: -.03em; line-height: 1.1; }

/* ── STATS ROW ── */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--hairline); background: var(--white);
}
.stat-card { padding: 20px 24px; border-right: 1px solid var(--hairline); position: relative; }
.stat-card:last-child { border-right: none; }
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 22px; bottom: 22px;
  width: 3px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.stat-label { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; margin-bottom: 8px; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--ink); letter-spacing: -.04em; line-height: 1; margin-bottom: 4px; }
.stat-sub { font-size: .72rem; color: var(--muted); }

/* ── PAGE CONTENT ── */

/* ── BUTTONS ── */
.btn {
  display: inline-block; font-family: var(--sans); font-size: .82rem; font-weight: 600;
  padding: 8px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  transition: background .15s, border-color .15s, color .15s; text-decoration: none;
}
.btn:hover { border-color: #bbb; color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* ── ORG CARD ── */
.org-card {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 24px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(14,14,26,.04);
}
.org-name   { font-weight: 600; font-size: .9rem; }
.org-domain { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.org-badge  { font-size: .7rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-dark); }

/* ── SECTION LABEL ── */
.section-label { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; margin-top: 24px; }

/* ── WORKSPACE CARDS ── */
.workspace {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px; background: var(--white);
  box-shadow: 0 1px 3px rgba(14,14,26,.04); overflow: hidden;
}
.workspace-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workspace-name { font-weight: 600; font-size: .88rem; }
.workspace-meta { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.workspace-accent { width: 4px; flex-shrink: 0; align-self: stretch; }
.workspace-body  { display: flex; }
.workspace-inner { flex: 1; min-width: 0; }

/* ── CASE LIST ── */
.cases { list-style: none; }
.case-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.case-row:last-child { border-bottom: none; }
.case-info  { flex: 1; min-width: 0; }
.case-title { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-meta  { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.case-status { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.badge-done { font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #D1FAE5; color: #059669; }
.badge-todo { font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.badge-lost { font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #EEF2FF; color: var(--accent-dark); border: 1px solid #C7D2FE; }
.case-hint  { font-size: .73rem; color: var(--muted); margin-top: 5px; font-style: italic; line-height: 1.4; }
.play-btn {
  font-family: var(--sans); font-size: .78rem; font-weight: 600;
  padding: 6px 16px; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); background: transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, color .12s;
}
.play-btn:hover { background: var(--accent); color: #fff; }
.play-btn.done { border-color: var(--border); color: var(--muted); }
.play-btn.done:hover { border-color: #bbb; color: var(--text); background: var(--bg); }

/* ── PROGRESS SUMMARY ── */
.progress-summary { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.progress-summary-title { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.progress-total { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.progress-fraction { font-size: 1.1rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.progress-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.progress-bar-fill.complete { background: #059669; }
.progress-label { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.progress-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.progress-cat { font-size: .72rem; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); }
.progress-cat.done { background: #D1FAE5; border-color: #6EE7B7; color: #059669; }

/* ── EMPTY / LOADING ── */
.empty { padding: 32px 20px; color: var(--muted); font-size: .85rem; text-align: center; }

/* ── ADMIN BANNER ── */
.admin-banner {
  background: var(--accent-bg); border: 1px solid #C7D2FE; border-radius: var(--radius);
  padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.admin-banner-text { font-size: .85rem; color: var(--text); }
.admin-banner a {
  font-size: .82rem; font-weight: 600; color: var(--accent);
  background: var(--white); border: 1px solid #C7D2FE;
  padding: 6px 16px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  transition: background .15s;
}
.admin-banner a:hover { background: var(--bg); }

/* ── ASSIGNMENT BADGES ── */
.case-row-assigned { background: #EEF2FF; border-left: 3px solid var(--accent); }
.badge-due { font-size: .68rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-due.due-soon  { background: #EEF2FF; color: var(--accent-dark); border-color: #C7D2FE; }
.badge-due.due-today { background: #FFF7ED; color: #C2410C; border-color: #FED7AA; }
.badge-due.overdue   { background: #FFF1F2; color: #E11D48; border-color: #FDA4AF; }

/* ── FOCUS SECTION ── */
.focus-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 20px; overflow: hidden;
}
.focus-list { list-style: none; }
.focus-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.focus-row:last-child { border-bottom: none; }
.focus-row.is-overdue { border-left: 3px solid var(--red); }
.focus-info  { flex: 1; min-width: 0; }
.focus-title { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.focus-meta  { font-size: .73rem; color: var(--muted); margin-top: 2px; }
.focus-status { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.focus-all-done { padding: 16px 20px; display: flex; align-items: center; gap: 10px; font-size: .85rem; color: #059669; }
.focus-done-check { width: 22px; height: 22px; border-radius: 50%; background: #D1FAE5; border: 1.5px solid #6EE7B7; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: #059669; flex-shrink: 0; }

/* ── TOAST ── */
#toast {
  display: none; position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0E0E1A; color: #fff; font-size: .82rem; font-weight: 500;
  padding: 10px 20px; border-radius: 999px; z-index: 999; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(14,14,26,.25);
}

/* ── PAGE CONTENT ── */
.page-content { width: 100%; padding: 28px 32px 48px; }
@media (max-width: 900px) { .page-content { padding: 20px 20px 40px; } }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .dash-main { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-topbar { padding: 20px; }
}
@media (max-width: 560px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 16px; }
}
