:root {
  --page-plane:   #0d0d0d;
  --surface-1:    #1a1a19;
  --surface-2:    #222221;
  --surface-3:    #2a2a28;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:   #898781;
  --gridline:     #2c2c2a;
  --border:       rgba(255,255,255,0.10);

  --series-blue:    #3987e5;
  --series-green:   #008300;
  --series-magenta: #d55181;
  --series-yellow:  #c98500;
  --series-aqua:    #199e70;
  --series-orange:  #d95926;
  --series-violet:  #9085e9;
  --series-red:     #e66767;

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --badge-good-text:     #4ad24a;
  --badge-critical-text: #f08787;
  --email-in-text:       #7ab2f2;
  --email-out-text:      #b3aaf5;

  --sidebar-width: 250px;
  --topbar-height: 60px;

  color-scheme: dark;
}

html[data-theme="light"] {
  --page-plane:   #f3f2ef;
  --surface-1:    #ffffff;
  --surface-2:    #f6f5f1;
  --surface-3:    #ebe9e3;
  --text-primary: #1c1c18;
  --text-secondary: #4c4a43;
  --text-muted:   #7c7a71;
  --gridline:     #e4e2db;
  --border:       rgba(0,0,0,0.10);

  --status-good:     #0a8a0a;
  --status-warning:  #9a6a00;
  --status-serious:  #b8481e;
  --status-critical: #b52e2e;

  --badge-good-text:     #0a7d0a;
  --badge-critical-text: #b83232;
  --email-in-text:       #1f5fb8;
  --email-out-text:      #5a4fc2;

  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page-plane);
  color: var(--text-primary);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--series-blue), var(--series-violet));
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

nav.nav-list {
  padding: 12px 8px;
  flex: 1;
}

.nav-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--surface-2);
  color: var(--text-primary);
  border-left: 3px solid var(--series-blue);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.nav-icon svg { width: 100%; height: 100%; }

.nav-badge {
  margin-left: auto;
  background: var(--status-critical);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------- Topbar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 5;
}

.page-title-inline {
  font-size: 16px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.icon-btn svg { width: 18px; height: 18px; }

.dot-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--status-critical);
  border: 2px solid var(--surface-1);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
}
.user-chip:hover { background: var(--surface-2); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--series-aqua);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #08201a;
}

.user-meta { line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ---------- Main ---------- */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 28px 28px 60px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-header h1 {
  font-size: 24px;
  margin: 0;
}

.page-header p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.btn {
  background: var(--series-blue);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

/* Theme toggle button: colored as a preview of the mode clicking it switches you INTO,
   so the colors are hardcoded to each literal mode rather than the --surface-* variables,
   which shift with the current theme. */
html[data-theme="light"] #themeToggleBtn {
  background: #1a1a19;
  border-color: #1a1a19;
  color: #ffffff;
}
html[data-theme="light"] #themeToggleBtn:hover { filter: brightness(1.3); }
html[data-theme="dark"] #themeToggleBtn {
  background: #ffffff;
  border-color: #ffffff;
  color: #1c1c18;
}
html[data-theme="dark"] #themeToggleBtn:hover { filter: brightness(0.92); }

.view { display: none; }
.view.active { display: block; }

/* ---------- Widget grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.card {
  grid-column: span 12;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-link {
  font-size: 12.5px;
  color: var(--series-blue);
  cursor: pointer;
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

/* stat tile */
.stat {
  grid-column: span 3;
}
.stat-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}
.stat-delta {
  margin-top: 8px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.stat-delta.good { color: var(--status-good); }
.stat-delta.bad { color: var(--status-critical); }
.stat-delta .neutral-text { color: var(--text-muted); }

.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

@media (max-width: 1000px) {
  .stat, .span-4, .span-6, .span-8 { grid-column: span 12; }
}

/* table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--gridline);
}
tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--gridline);
  color: var(--text-secondary);
}
tbody tr:last-child td { border-bottom: none; }
tbody td.primary { color: var(--text-primary); font-weight: 500; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge .badge-dot { width: 6px; height: 6px; border-radius: 50%; }

.badge.good { background: rgba(12,163,12,0.15); color: var(--badge-good-text); }
.badge.good .badge-dot { background: var(--status-good); }

.badge.warning { background: rgba(250,178,25,0.15); color: var(--status-warning); }
.badge.warning .badge-dot { background: var(--status-warning); }

.badge.serious { background: rgba(236,131,90,0.15); color: var(--status-serious); }
.badge.serious .badge-dot { background: var(--status-serious); }

.badge.critical { background: rgba(208,59,59,0.15); color: var(--badge-critical-text); }
.badge.critical .badge-dot { background: var(--status-critical); }

.badge.neutral { background: var(--surface-3); color: var(--text-secondary); }
.badge.neutral .badge-dot { background: var(--text-muted); }

/* list rows (messages, activity) */
.list-row {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--gridline);
}
.list-row:last-child { border-bottom: none; }
.list-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
}
.list-icon svg { width: 16px; height: 16px; }
.list-body { flex: 1; min-width: 0; }
.list-title { font-size: 13.5px; color: var(--text-primary); font-weight: 500; }
.list-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.list-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

/* small left-side marker for an unseen/unread case or conversation */
.new-marker {
  display: inline-block;
  color: var(--series-yellow);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  margin-right: 6px;
  width: 8px;
}
.list-row.unread { cursor: pointer; }
.list-row.unread .list-title { font-weight: 700; }

/* Messages view: conversation list + thread panel */
.messages-layout { display: flex; gap: 18px; align-items: flex-start; }
.conversation-list { width: 320px; flex-shrink: 0; }
.conversation-list .list-row { cursor: pointer; }
.conversation-list .list-row.active { background: var(--surface-2); border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.thread-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 520px; }
.thread-messages { flex: 1; overflow-y: auto; padding: 4px 2px; }
.thread-message { max-width: 70%; margin-bottom: 12px; }
.thread-message.mine { margin-left: auto; text-align: right; }
.thread-message .thread-sender { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.thread-message .thread-bubble { display: inline-block; background: var(--surface-3); border-radius: 10px; padding: 8px 12px; font-size: 13px; text-align: left; }
.thread-message.mine .thread-bubble { background: var(--series-blue); color: #fff; }
.thread-empty { color: var(--text-muted); font-size: 13px; padding: 20px 0; text-align: center; }
.participant-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.participant-option { padding: 4px 10px; border-radius: 14px; border: 1px solid var(--border); font-size: 12.5px; cursor: pointer; user-select: none; }
.participant-option.selected { background: var(--series-blue); border-color: var(--series-blue); color: #fff; }
.case-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--series-blue);
  background: rgba(57,135,229,0.12);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 6px;
  vertical-align: middle;
}

/* simple bar chart (css-only, decorative) */
.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
}
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 90px; flex-shrink: 0; color: var(--text-secondary); }
.bar-track {
  flex: 1;
  height: 10px;
  background: var(--surface-3);
  border-radius: 6px;
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 6px; }
.bar-value { width: 40px; text-align: right; color: var(--text-muted); flex-shrink: 0; }

/* property card grid */
.property-card {
  grid-column: span 4;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.property-photo {
  height: 90px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-1));
}
.property-body { padding: 14px 16px; }
.property-name { font-size: 14px; font-weight: 600; }
.property-addr { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.property-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.property-meta b { color: var(--text-primary); }

.info-banner {
  grid-column: span 12;
  background: rgba(57,135,229,0.12);
  border: 1px solid rgba(57,135,229,0.35);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.info-banner svg { width: 16px; height: 16px; color: var(--series-blue); flex-shrink: 0; }

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field-row label { font-size: 12.5px; color: var(--text-secondary); }
.field-row input, .field-row select {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Role switcher ---------- */
.role-select {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.role-select:focus { outline: none; }

/* ---------- Task filter bar ---------- */
.filter-bar {
  grid-column: span 12;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.filter-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.filter-group select {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.filter-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-left: auto;
  align-self: center;
  max-width: 260px;
  text-align: right;
}

/* sortable table headers */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text-secondary); }
.sort-arrow { display: inline-block; margin-left: 3px; opacity: 0.5; font-size: 10px; }
th.sortable.active .sort-arrow { opacity: 1; color: var(--series-blue); }
tbody tr.clickable-row { cursor: pointer; }
tbody tr.clickable-row:hover td { background: var(--surface-2); }
td.zone-cell { color: var(--text-muted); font-size: 12.5px; }
td.zone-cell .zone-geo { color: var(--text-secondary); }

/* ---------- Task detail modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.modal-overlay.open { display: flex; }
.modal-panel {
  width: 920px;
  max-width: 100%;
  height: 86vh;
  max-height: 840px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-eyebrow { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.modal-header h2 { font-size: 20px; margin: 0; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--surface-2); color: var(--text-primary); }

.modal-body-split {
  display: flex;
  flex: 1;
  min-height: 0;
}
.modal-sidebar {
  width: 280px;
  flex-shrink: 0;
  padding: 20px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.modal-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  overflow: hidden;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.modal-meta div b { color: var(--text-primary); font-weight: 500; }
.modal-meta .meta-label { display: block; color: var(--text-muted); margin-bottom: 2px; }

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 5px 3px 5px;
  font-size: 12px;
  color: var(--text-primary);
}
.tag-chip .tag-avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--series-violet);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tag-chip .tag-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 0 3px;
}
.tag-chip .tag-remove:hover { color: var(--status-critical); }
.tag-add-btn {
  font-size: 12px;
  color: var(--series-blue);
  cursor: pointer;
  padding: 4px 10px;
  border: 1px dashed var(--border);
  border-radius: 999px;
}
.tag-add-btn:hover { border-color: var(--series-blue); }

.related-doc-link {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-primary);
  text-decoration: none;
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.related-doc-link:hover { border-color: var(--series-blue); color: var(--series-blue); }
.related-doc-link span.doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-picker {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.tag-picker.open { display: flex; }
.tag-picker-option {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid transparent;
}
.tag-picker-option:hover { border-color: var(--series-blue); color: var(--text-primary); }

.query-chip {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
}
.query-chip:hover { border-color: var(--series-blue); color: var(--text-primary); }
.query-chip.active { border-color: var(--series-blue); color: var(--text-primary); background: rgba(57,135,229,0.12); }

.doc-search-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.doc-search-row input[type="text"] {
  flex: 1;
  min-width: 240px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
}
.doc-search-row select {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.doc-row .list-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-row .doc-summary { color: var(--text-secondary); font-size: 12.5px; margin-top: 5px; line-height: 1.4; }
.doc-row .doc-tags { margin-top: 7px; }
.doc-row .doc-tags .tag-chip { padding: 3px 10px; }

.modal-section-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 20px 0 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.modal-sidebar .modal-section-title:first-child,
.modal-main .modal-section-title:first-child { margin-top: 0; }

/* timeline */
.timeline { position: relative; flex: 1; overflow-y: auto; padding-right: 6px; margin-right: -6px; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 18px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px; top: 32px; bottom: 0;
  width: 1px;
  background: var(--gridline);
}
.timeline-item:last-child::before { display: none; }
.timeline-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  background: var(--surface-3);
  z-index: 1;
}
.timeline-icon.status { background: rgba(12,163,12,0.15); }
.timeline-icon.email-in { background: rgba(57,135,229,0.15); }
.timeline-icon.email-out { background: rgba(144,133,233,0.15); }
.timeline-icon.comment { background: rgba(250,178,25,0.15); }
.timeline-icon.tag { background: rgba(236,131,90,0.15); }
.timeline-content { flex: 1; min-width: 0; padding-top: 3px; }
.timeline-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.timeline-title { font-size: 13.5px; color: var(--text-primary); font-weight: 500; }
.timeline-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.timeline-detail { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.45; }
.timeline-detail .mention { color: var(--series-blue); font-weight: 500; }
.email-card {
  margin-top: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
}
.email-card .email-subject { color: var(--text-primary); font-weight: 500; margin-bottom: 3px; }
.email-card .email-addr { color: var(--text-muted); font-size: 11.5px; }
.email-dir-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 6px;
}
.email-dir-badge.in { background: rgba(57,135,229,0.18); color: var(--email-in-text); }
.email-dir-badge.out { background: rgba(144,133,233,0.18); color: var(--email-out-text); }
.timeline-item.completed-step .timeline-title { color: var(--status-good); }

.modal-compose {
  flex-shrink: 0;
  margin-top: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

@media (max-width: 760px) {
  .modal-panel { height: 92vh; }
  .modal-body-split { flex-direction: column; overflow-y: auto; }
  .modal-sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); overflow-y: visible; }
  .modal-main { overflow: visible; }
  .timeline { overflow-y: visible; }
}
.modal-compose textarea {
  width: 100%;
  min-height: 60px;
  resize: vertical;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.compose-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.compose-hint { font-size: 11px; color: var(--text-muted); }
.future-banner {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  gap: 7px;
  align-items: flex-start;
}

/* ---------- Login screen ---------- */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--page-plane);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-screen.hidden { display: none; }
.login-card {
  width: 360px;
  max-width: calc(100vw - 40px);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.25);
}
.login-card .brand { padding: 0 0 22px; border: none; justify-content: center; }
.login-card h1 { font-size: 18px; margin: 0 0 4px; text-align: center; }
.login-card p.login-sub { margin: 0 0 22px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.login-error {
  display: none;
  background: rgba(208,59,59,0.12);
  border: 1px solid rgba(208,59,59,0.35);
  color: var(--status-critical);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
}
.login-error.visible { display: block; }
#appShell.hidden { display: none; }
