/* Saif Group Portal — design tokens & base styles */
:root {
  --bg: #F6F5F2;            /* warm off-white */
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --surface-3: #F1EFEA;
  --ink: #0F1B2D;           /* deep navy */
  --ink-2: #1A1F2E;         /* charcoal */
  --ink-mute: #4A5568;
  --text: #1A1F2E;
  --text-mute: #6B7280;
  --text-dim: #9AA3AF;
  --line: #E5E2DC;
  --line-2: #EFEDE7;
  --accent: oklch(0.62 0.13 55);    /* warm copper */
  --accent-soft: oklch(0.95 0.04 65);
  --accent-ink: oklch(0.38 0.10 50);
  --green: oklch(0.62 0.12 145);
  --green-soft: oklch(0.94 0.04 145);
  --amber: oklch(0.74 0.13 75);
  --amber-soft: oklch(0.95 0.06 75);
  --red: oklch(0.58 0.18 25);
  --red-soft: oklch(0.94 0.05 25);
  --blue: oklch(0.55 0.10 235);
  --blue-soft: oklch(0.94 0.03 235);
  --shadow-sm: 0 1px 2px rgba(15,27,45,0.06), 0 1px 1px rgba(15,27,45,0.04);
  --shadow-md: 0 4px 12px rgba(15,27,45,0.08), 0 1px 2px rgba(15,27,45,0.04);
  --shadow-lg: 0 12px 32px rgba(15,27,45,0.12), 0 2px 6px rgba(15,27,45,0.06);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --font-serif: 'Newsreader', Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* App shell */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 72px 1fr;
  height: 100vh;
  overflow: hidden;
}
.topbar {
  grid-column: 1 / 3;
  background: var(--ink);
  color: #E8EAF0;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  z-index: 50;
}.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 14px; letter-spacing: -0.01em;
  flex-shrink: 0;
}
.brand-mark {
  height: 44px;
  display: flex; align-items: center;
  flex-shrink: 0;
}
.brand-mark svg { height: 100%; width: auto; display: block; }
.brand-text { font-size: 13px; letter-spacing: 0.02em; }
.brand-text b { font-weight: 600; }
.brand-text span { opacity: 0.55; margin-left: 6px; font-weight: 400; }

.top-search {
  flex: 1; max-width: 480px; margin-left: 16px;
  position: relative;
}
.top-search input {
  width: 100%; padding: 7px 12px 7px 32px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #E8EAF0;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  transition: all 0.15s;
}
.top-search input::placeholder { color: rgba(232,234,240,0.4); }
.top-search input:focus { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.top-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  opacity: 0.45;
}
.top-search-kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px;
  opacity: 0.4;
}

.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  position: relative;
  width: 32px; height: 32px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(232,234,240,0.7);
  display: grid; place-items: center;
  transition: all 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); color: #E8EAF0; }
.icon-btn-dot {
  position: absolute; top: 6px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--ink);
}

.role-switcher {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.role-pill {
  padding: 5px 12px; border-radius: 6px;
  background: transparent; border: none;
  color: rgba(232,234,240,0.6);
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.18s;
}
.role-pill[data-active="true"] {
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.role-pill[data-active="false"]:hover { color: #E8EAF0; background: rgba(255,255,255,0.05); }

.company-selector {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  color: #E8EAF0;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.company-selector:hover { background: rgba(255,255,255,0.1); }
.company-dot { width: 8px; height: 8px; border-radius: 50%; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.15s;
}
.user-chip:hover { background: rgba(255,255,255,0.1); }
.avatar {
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink);
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
.avatar-md { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 36px; height: 36px; font-size: 13px; }
.avatar-xl { width: 48px; height: 48px; font-size: 16px; }

/* Sidebar */
.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  padding: 18px 12px 16px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-section { margin-top: 14px; }
.sidebar-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text);
  font-size: 13px; font-weight: 500;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: all 0.12s;
}
.nav-item:hover { background: var(--surface-3); }
.nav-item[data-active="true"] {
  background: var(--ink);
  color: white;
}
.nav-item[data-active="true"] .nav-count { background: rgba(255,255,255,0.15); color: white; }
.nav-icon { width: 16px; height: 16px; display: grid; place-items: center; flex-shrink: 0; opacity: 0.7; }
.nav-item[data-active="true"] .nav-icon { opacity: 1; }
.nav-count {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  background: var(--surface-3);
  color: var(--text-mute);
  padding: 1px 6px; border-radius: 4px;
  min-width: 18px; text-align: center;
}
.nav-count.accent { background: var(--accent); color: var(--ink); }

.sidebar-companies { padding: 0 6px; }
.company-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-mute);
  cursor: pointer;
  transition: background 0.12s;
}
.company-row:hover { background: var(--surface-3); }
.company-row[data-selected="true"] { color: var(--text); font-weight: 500; }
.company-row .badge-count {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  color: var(--text-dim);
}

/* Main content */
.main {
  overflow-y: auto;
  background: var(--bg);
}
.page { padding: 28px 36px 80px; max-width: 1480px; margin: 0 auto; }
.page-narrow { max-width: 1200px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 24px; }
.page-title { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; color: var(--ink); margin: 0 0 4px; line-height: 1.15; }
.page-subtitle { font-size: 13px; color: var(--text-mute); margin: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #D4D0C8; }
.btn-primary {
  background: var(--ink); color: white; border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-accent {
  background: var(--accent); color: var(--ink); border-color: var(--accent);
  font-weight: 600;
}
.btn-accent:hover { filter: brightness(1.04); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-mute); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: transparent; }
.btn-danger:hover { background: var(--red); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.15s;
}
.kpi:hover { border-color: #D4D0C8; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 11px; font-weight: 600; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; color: var(--ink); line-height: 1; }
.kpi-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-mute); }
.kpi-spark { position: absolute; right: 12px; top: 12px; }
.kpi-trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 500; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
.card-sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.card-body { padding: 16px 18px; }
.card-footer { padding: 10px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); font-size: 12px; color: var(--text-mute); }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-green { background: var(--green-soft); color: oklch(0.42 0.10 145); }
.badge-amber { background: var(--amber-soft); color: oklch(0.48 0.13 65); }
.badge-red { background: var(--red-soft); color: oklch(0.42 0.16 25); }
.badge-blue { background: var(--blue-soft); color: oklch(0.42 0.10 235); }
.badge-grey { background: var(--surface-3); color: var(--text-mute); }
.badge-ink { background: var(--ink); color: white; }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }

.badge-green .badge-dot { background: var(--green); }
.badge-amber .badge-dot { background: var(--amber); }
.badge-red .badge-dot { background: var(--red); }
.badge-blue .badge-dot { background: var(--blue); }
.badge-grey .badge-dot { background: var(--text-dim); }

.priority-high { color: var(--red); font-weight: 600; }
.priority-medium { color: var(--amber); font-weight: 500; }
.priority-low { color: var(--text-mute); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-weight: 500;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  position: sticky; top: 0;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.tbl tbody tr { transition: background 0.1s; }
.tbl tbody tr:hover { background: var(--surface-2); cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-mute); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  padding: 9px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--text-mute);
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.12s;
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text); }
.tab[data-active="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count {
  font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-mute);
  padding: 1px 6px; border-radius: 4px;
}
.tab[data-active="true"] .tab-count { background: var(--accent-soft); color: var(--accent-ink); }

/* Filter bar */
.filter-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 0;
  margin-bottom: 8px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px; font-weight: 500;
  color: var(--text-mute);
  transition: all 0.12s;
}
.filter-chip:hover { border-color: #D4D0C8; color: var(--text); }
.filter-chip[data-active="true"] { background: var(--ink); color: white; border-color: var(--ink); }
.filter-chip .chip-x { opacity: 0.6; }

/* Avatars stack */
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar.more { background: var(--surface-3); color: var(--text-mute); border: 2px solid var(--surface); }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,27,45,0.4);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 200;
  animation: fadeIn 0.18s ease-out;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 92%; max-width: 640px; max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.3, 1.05);
}
.modal-lg { max-width: 880px; }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; color: var(--ink); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line-2);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface-2);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: none; } }
@keyframes slideInUp { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Form */
.form-row { margin-bottom: 14px; }
.form-row-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text); margin-bottom: 5px; }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: all 0.12s;
}
.form-control:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,27,45,0.06); }
.form-help { font-size: 11px; color: var(--text-mute); margin-top: 4px; }
textarea.form-control { min-height: 76px; resize: vertical; }

/* Toasts */
.toast-stack {
  position: fixed; right: 22px; bottom: 22px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 300; pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 320px; max-width: 420px;
  background: var(--ink);
  color: white;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex; gap: 12px; align-items: flex-start;
  animation: slideInUp 0.22s ease-out;
}
.toast-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: var(--ink);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.toast-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.toast-body { font-size: 12px; opacity: 0.8; line-height: 1.45; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 28px; }
.step {
  display: flex; align-items: center; gap: 8px;
  flex: 1;
}
.step-dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-mute);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: all 0.18s;
}
.step[data-state="active"] .step-dot { background: var(--ink); color: white; }
.step[data-state="done"] .step-dot { background: var(--accent); color: var(--ink); }
.step-label { font-size: 12px; color: var(--text-mute); font-weight: 500; }
.step[data-state="active"] .step-label { color: var(--ink); font-weight: 600; }
.step-line { flex: 1; height: 1px; background: var(--line); margin: 0 12px; }
.step[data-state="done"] + .step-line { background: var(--accent); }

/* Doc health pill */
.doc-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 500;
}
.doc-pill .doc-pill-dot { width: 7px; height: 7px; border-radius: 50%; }

/* Activity item */
.activity-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--surface-3);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: var(--text-mute);
}
.activity-icon.alert { background: var(--red-soft); color: var(--red); }
.activity-icon.check { background: var(--green-soft); color: var(--green); }
.activity-icon.po { background: var(--accent-soft); color: var(--accent-ink); }
.activity-icon.reject { background: var(--red-soft); color: var(--red); }
.activity-icon.comment, .activity-icon.eye { background: var(--blue-soft); color: var(--blue); }
.activity-text { font-size: 13px; line-height: 1.5; }
.activity-text b { font-weight: 600; color: var(--ink); }
.activity-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Reminder widget */
.reminder {
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: white;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.reminder-title { font-size: 12px; font-weight: 600; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.reminder-items { display: flex; gap: 22px; flex-wrap: wrap; }
.reminder-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.reminder-item-num { font-family: var(--font-mono); font-weight: 600; font-size: 18px; color: var(--accent); letter-spacing: -0.02em; }

/* Chat widget */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--ink); color: white;
  display: grid; place-items: center;
  box-shadow: var(--shadow-lg);
  border: none;
  z-index: 100;
  transition: all 0.2s;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab-dot {
  position: absolute; top: 8px; right: 8px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--ink);
}
.chat-panel {
  position: fixed; right: 22px; bottom: 22px;
  width: 380px; height: 560px; max-height: calc(100vh - 80px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 110;
  animation: slideInUp 0.22s ease-out;
  border: 1px solid var(--line);
}
.chat-header {
  background: var(--ink); color: white;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-tabs { display: flex; padding: 0 12px; gap: 0; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.chat-tab {
  padding: 10px 14px; font-size: 12px; font-weight: 500;
  color: var(--text-mute); background: transparent; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.chat-tab[data-active="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.chat-channels { flex: 1; overflow-y: auto; padding: 4px 0; }
.chat-channel {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background 0.1s;
}
.chat-channel:hover { background: var(--surface-2); }
.chat-channel-icon { width: 32px; height: 32px; border-radius: 7px; background: var(--surface-3); color: var(--text-mute); display: grid; place-items: center; font-family: var(--font-mono); font-weight: 600; flex-shrink: 0; }
.chat-channel-name { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.chat-channel-last { font-size: 12px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.chat-channel-meta { margin-left: auto; text-align: right; font-size: 11px; color: var(--text-dim); }
.chat-unread { background: var(--accent); color: var(--ink); padding: 1px 6px; border-radius: 9px; font-size: 10px; font-weight: 700; }

.chat-thread { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 10px; }
.chat-msg-body { flex: 1; }
.chat-msg-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.chat-msg-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.chat-msg-time { font-size: 11px; color: var(--text-dim); }
.chat-msg-text { font-size: 13px; line-height: 1.5; color: var(--text); }
.chat-msg.external .chat-msg-name::after {
  content: 'External';
  margin-left: 6px; font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 500;
}
.chat-input-bar {
  border-top: 1px solid var(--line-2);
  padding: 10px 12px;
  display: flex; gap: 8px;
  background: var(--surface);
}
.chat-input-bar input {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 13px; outline: none;
}
.chat-input-bar input:focus { border-color: var(--ink); }

/* Login & registration shell (full-bleed, used outside .app shell) */
.bleed { background: var(--bg); min-height: 100vh; }

/* Notification panel */
.notif-panel {
  position: fixed; top: 72px; right: 16px;
  width: 380px; max-height: 560px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  z-index: 80;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: slideInUp 0.18s ease-out;
}

/* Search dropdown */
.search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  margin-top: 6px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  max-height: 480px;
  overflow-y: auto;
  z-index: 90;
}
.search-section { padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.search-section:last-child { border-bottom: none; }
.search-section-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); padding: 8px 14px 6px;
}
.search-result {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.search-result:hover { background: var(--surface-2); }
.search-result-title { font-size: 13px; color: var(--ink); font-weight: 500; }
.search-result-sub { font-size: 11px; color: var(--text-mute); }

/* Task item (inbox) */
.task-row {
  display: grid;
  grid-template-columns: 22px 1fr 130px 120px 120px 100px 60px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  transition: background 0.1s;
  cursor: pointer;
}
.task-row:hover { background: var(--surface-2); }
.task-checkbox {
  width: 16px; height: 16px;
  border: 1.5px solid var(--line); border-radius: 4px;
  background: var(--surface);
  display: grid; place-items: center;
  cursor: pointer;
}
.task-checkbox[data-checked="true"] {
  background: var(--ink); border-color: var(--ink); color: white;
}
.task-title { font-size: 13px; font-weight: 500; color: var(--ink); }
.task-meta { font-size: 11px; color: var(--text-mute); margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.task-meta .dot-sep::before { content: '·'; margin: 0 5px; opacity: 0.5; }

/* Side detail panel */
.detail-panel {
  position: fixed; top: 72px; right: 0; bottom: 0;
  width: 540px; max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 32px rgba(15,27,45,0.08);
  z-index: 70;
  display: flex; flex-direction: column;
  animation: slideInRight 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
  overflow: hidden;
}

/* Misc */
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin: 18px 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.hint { font-size: 11px; color: var(--text-mute); }
.kbd {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--surface-3); padding: 1px 5px; border-radius: 3px;
  color: var(--text-mute);
  border: 1px solid var(--line);
}

.empty-state {
  text-align: center; padding: 56px 20px;
  color: var(--text-mute);
}
.empty-state h3 { font-size: 15px; color: var(--ink); margin: 8px 0 4px; }
.empty-state p { font-size: 13px; margin: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #D4D0C8; }

/* Utility */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.text-mute { color: var(--text-mute); }
.text-dim { color: var(--text-dim); }
.text-mono { font-family: var(--font-mono); }
.text-xs { font-size: 11px; } .text-sm { font-size: 12px; } .text-md { font-size: 13px; } .text-lg { font-size: 16px; } .text-xl { font-size: 20px; } .text-2xl { font-size: 26px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; }
.full { width: 100%; }
.col-span-2 { grid-column: span 2; }

/* Two-column dashboard layout */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } .app { grid-template-columns: 200px 1fr; } }

/* Login */
.login-wrap {
  min-height: 100vh;
  background: var(--ink);
  display: grid;
  grid-template-columns: 1fr 480px;
}
.login-hero {
  position: relative;
  padding: 44px 56px;
  color: white;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1200px 600px at 80% -10%, oklch(0.55 0.12 50 / 0.25) 0%, transparent 50%),
    radial-gradient(800px 600px at 20% 110%, oklch(0.30 0.08 250 / 0.6) 0%, transparent 50%),
    var(--ink);
  overflow: hidden;
}
.login-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.login-form {
  background: var(--surface);
  padding: 64px 52px;
  display: flex; flex-direction: column; justify-content: center;
}

/* Email preview panel */
.email-preview {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 12px;
}
.email-head { padding: 12px 14px; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.email-head-row { display: flex; gap: 8px; padding: 1px 0; }
.email-head-row span:first-child { color: var(--text-mute); font-weight: 500; min-width: 50px; }
.email-body { padding: 14px; line-height: 1.55; }
.email-body p { margin: 0 0 10px; }

