:root {
  /* Palette */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --surface-sunk: #e2e8f0;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --subtle: #cbd5e1;

  /* Sidebar: deep navy */
  --side-bg: #0f172a;
  --side-surface: #1e293b;
  --side-border: #334155;
  --side-text: #cbd5e1;
  --side-text-soft: #64748b;
  --side-active: rgba(14, 165, 233, 0.15);

  /* Accents: sky blue */
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-soft: #e0f2fe;
  --accent-glow: rgba(14, 165, 233, 0.22);
  --coral: #f97066;
  --teal: #10b981;
  --gold: #f4b740;

  --success: #047857;
  --danger: #b8310f;
  --warn: #b45309;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px -8px rgba(15, 23, 42, 0.18);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --side-w: 220px;
  --list-w: 340px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01", "ss03";
}
a { color: var(--accent); text-decoration: none; transition: opacity 0.12s; }
a:hover { opacity: 0.75; }

/* ============ Shared primitives ============ */

.container {
  max-width: 460px;
  margin: 0 auto;
  padding: 80px 24px 60px;
}

h1 { font-size: 32px; margin: 0 0 10px; letter-spacing: -0.025em; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 10px; letter-spacing: -0.01em; font-weight: 600; }
h3 { font-size: 16px; margin: 0 0 8px; letter-spacing: -0.01em; font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
}

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: var(--ink-soft); }
input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.12s, transform 0.04s, box-shadow 0.12s;
  letter-spacing: 0.005em;
}
button:hover { background: var(--accent-hover); box-shadow: 0 4px 12px -2px var(--accent-glow); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
button.ghost:hover { background: var(--surface-alt); border-color: var(--ink-soft); }
button.sm { padding: 7px 13px; font-size: 13px; margin-top: 0; }
button.icon-btn {
  padding: 8px;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.icon-btn:hover { background: var(--surface-alt); color: var(--ink); box-shadow: none; }

.error { color: var(--danger); font-size: 14px; margin-top: 10px; }
.success { color: var(--success); font-size: 14px; margin-top: 10px; }

.tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 0;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-weight: 500;
  font-size: 14px;
  transition: color 0.12s, border-color 0.12s;
}
.tab:hover { color: var(--ink-soft); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink-soft);
  font-weight: 500;
}

/* ============ Landing / auth layout ============ */

.landing-tagline {
  color: var(--ink-soft);
  font-size: 16px;
  margin: 0 0 28px;
  line-height: 1.6;
}
.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.landing-brand .mark {
  width: 24px; height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--coral));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

/* ============ Landing feature strip ============ */
.landing-features {
  display: flex;
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.landing-features li {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.feat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.feat-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* ============ App shell — three-column layout ============ */

.app {
  display: grid;
  grid-template-columns: var(--side-w) var(--list-w) 1fr;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ------ Sidebar ------ */
.sidebar {
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--side-border);
}
.side-brand {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.side-brand .mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--coral));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.4);
}
.side-search {
  margin: 4px 12px 8px;
  background: var(--side-surface);
  border: 1px solid var(--side-border);
  color: var(--side-text-soft);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: default;
}
.side-search .shortcut { margin-left: auto; display: flex; gap: 3px; }
.side-search kbd {
  background: #2a2635;
  border-color: #2f2c3a;
  color: var(--side-text-soft);
}
.side-nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.side-section {
  padding: 14px 10px 6px;
  color: var(--side-text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--side-text-soft);
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--side-surface); color: var(--side-text); }
.nav-item.active { background: var(--side-active); color: var(--accent); font-weight: 600; }
.nav-item.active .icon { stroke: var(--accent); }
.nav-item.disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}
.warn-count { background: #b45309 !important; color: #fff !important; }
.badge-soon {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--side-text-soft);
  background: var(--side-surface);
  border: 1px solid var(--side-border);
  border-radius: 10px;
  padding: 1px 6px;
}
.side-spacer { flex: 1; }
.side-foot {
  border-top: 1px solid var(--side-border);
  padding: 10px;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.1s;
}
.side-user:hover { background: var(--side-surface); }
.side-user .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--coral));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.side-user .meta { flex: 1; min-width: 0; }
.side-user .name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user .addr {
  font-size: 11.5px;
  color: var(--side-text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ------ Email list column ------ */
.list-col {
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.list-resize-handle {
  position: absolute;
  top: 0; right: -3px; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 20;
  background: transparent;
  transition: background 0.15s;
}
.list-resize-handle:hover,
.list-resize-handle.dragging {
  background: var(--accent);
  opacity: 0.5;
}
.list-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
}
.list-title-row { display: flex; align-items: center; justify-content: space-between; }
.list-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.list-title .muted { font-weight: 500; font-size: 13px; margin-left: 8px; }
.list-search {
  position: relative;
}
.list-search input {
  padding: 8px 12px 8px 34px;
  font-size: 13.5px;
  border-radius: var(--radius-xs);
  background: var(--surface-alt);
  border: 1px solid transparent;
}
.list-search input:focus { background: var(--surface); border-color: var(--border-strong); box-shadow: none; }
.list-search .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--muted);
  pointer-events: none;
}
.list-body { overflow-y: auto; flex: 1; }
.email-list { list-style: none; margin: 0; padding: 0; }
.email-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  min-height: 60px;
}
.email-list li:hover { background: var(--surface-alt); }
.email-list li.active { background: var(--accent-soft); }
.email-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.email-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.email-row1 {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.email-row1 .from {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-row1 .from.has-draft-name { color: var(--accent); }
.email-row1 .date {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.email-row2 {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.email-row2 .subject-preview {
  font-size: 12.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.draft-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.tag {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-sunk);
  color: var(--ink-soft);
}
.tag.accent { background: var(--accent-soft); color: var(--accent-hover); }
.tag.coral { background: rgba(249, 112, 102, 0.14); color: #c14a41; }
.tag.teal { background: rgba(16, 185, 129, 0.14); color: #047857; }

/* ------ Detail column ------ */
.detail-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.detail-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.detail-toolbar .sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.detail-toolbar .right { margin-left: auto; display: flex; gap: 4px; color: var(--muted); font-size: 12px; align-items: center; }
.detail-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.detail-content-wrap {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}
.draft-resize-handle {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  border-left: 1px solid var(--border);
  transition: background 0.15s;
  z-index: 10;
}
.draft-resize-handle:hover,
.draft-resize-handle.dragging {
  background: var(--accent);
  border-color: var(--accent);
}
.draft-panel {
  width: 340px;
  flex-shrink: 0;
  border-left: none;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.draft-panel-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.draft-panel-head {
  padding: 14px 18px 12px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  border-bottom: 1px solid rgba(14,165,233,0.25);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.draft-panel-head .sparkle-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 5px;
}
.draft-panel-head .draft-summary {
  font-size: 12px;
  color: rgba(203,213,225,0.85);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}
.draft-panel-fields {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.draft-panel label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 5px;
  display: block;
}
.draft-panel input[type="text"] {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
}
.draft-panel textarea {
  font-size: 13px;
  line-height: 1.65;
  min-height: 220px;
  border-radius: var(--radius-xs);
  resize: vertical;
}
.draft-panel-actions {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-alt);
}
.draft-panel-actions .btn-row { display: flex; gap: 6px; justify-content: flex-end; }
.draft-panel-actions button { margin-top: 0; }
.draft-panel-actions .draft-status { font-size: 12px; color: var(--muted); }
.draft-panel-actions .draft-status.err { color: var(--danger); }
.draft-panel-actions .draft-status.ok { color: var(--success); }
.draft-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.mail-detail-header {
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--border);
}
.mail-detail-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 14px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.mail-from-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mail-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.mail-sender-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.mail-sender-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.mail-sender-email { font-size: 12px; color: var(--muted); }
.mail-date { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.sender {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.avatar.me { background: linear-gradient(135deg, #2a2635, var(--ink)); }
.avatar.coral { background: linear-gradient(135deg, var(--coral), #ef4444); }
.sender-meta { flex: 1; min-width: 0; }
.sender-name { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.sender-email { color: var(--muted); font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sender-date { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.mail-body {
  padding: 24px 36px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--surface);
}
.mail-body pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: 15px;
  margin: 0;
}

.thread-item {
  border-top: 1px solid var(--border);
  padding: 24px 36px;
  background: var(--surface);
}
.thread-item.sent { background: var(--surface-alt); }
.thread-item .sender { margin-bottom: 14px; }
.thread-item .mail-body { padding: 4px 0 0 54px; background: transparent; }

/* ---- Gmail-style compose ---- */
.reply-box {
  padding: 20px 32px 32px;
  background: var(--bg);
}
.reply-box-collapsed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: text;
  color: var(--muted);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reply-box-collapsed:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  color: var(--ink-soft);
}
.reply-prompt { flex: 1; }
.reply-prompt strong { color: var(--ink-soft); font-weight: 600; }
.reply-box-collapsed .hint-keys { margin-left: auto; color: var(--subtle); font-size: 12px; }
.reply-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.compose-card {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.compose-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.compose-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.compose-meta { flex: 1; min-width: 0; }
.compose-to-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
}
.compose-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.compose-to { color: var(--ink); font-weight: 500; }
.compose-subject { font-size: 12px; color: var(--muted); margin-top: 2px; }
.compose-close { color: var(--muted); margin: 0; flex-shrink: 0; }
.compose-close:hover { color: var(--ink); background: var(--surface-sunk); box-shadow: none; }
.compose-body {
  width: 100%;
  border: none;
  border-radius: 0;
  resize: none;
  min-height: 160px;
  padding: 18px 20px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.65;
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
  margin: 0;
}
.compose-body:focus { outline: none; box-shadow: none; border: none; }
.compose-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  gap: 8px;
}
.compose-fmt { display: flex; align-items: center; gap: 1px; }
.fmt-btn {
  background: transparent;
  border: none;
  margin: 0;
  padding: 5px 9px;
  font-size: 13px;
  color: var(--ink-soft);
  border-radius: var(--radius-xs);
  cursor: pointer;
  min-width: 30px;
  display: flex; align-items: center; justify-content: center;
}
.fmt-btn:hover { background: var(--border); color: var(--ink); box-shadow: none; }
.fmt-sep { width: 1px; height: 16px; background: var(--border); margin: 0 5px; flex-shrink: 0; }
.compose-send-row { display: flex; align-items: center; gap: 10px; }
.compose-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.12s, box-shadow 0.12s;
  box-shadow: 0 2px 8px rgba(14,165,233,0.3);
}
.compose-send-btn:hover { background: var(--accent-hover); box-shadow: 0 4px 14px rgba(14,165,233,0.45); }
.compose-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.reply-status { font-size: 13px; color: var(--muted); }
.reply-status.err { color: var(--danger); }
.reply-status.ok { color: var(--success); }

.empty {
  text-align: center;
  padding: 72px 24px;
  color: var(--muted);
}
.empty .emoji { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty strong { color: var(--ink-soft); display: block; font-weight: 600; margin-bottom: 4px; font-size: 15px; }

.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  padding: 72px 24px;
  text-align: center;
  flex-direction: column;
  gap: 12px;
  min-height: 400px;
}
.detail-empty .glyph {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--subtle);
  box-shadow: var(--shadow-sm);
}
.detail-empty .hints { display: flex; gap: 10px; margin-top: 4px; color: var(--subtle); font-size: 12px; }

/* ------ Claim handle screen ------ */
.claim-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 24px;
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 60%);
}
.claim-screen .claim-hero {
  max-width: 480px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.claim-screen .claim-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 18px;
  color: var(--ink-soft);
}
.claim-screen .claim-brand .mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--coral));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.claim-screen h2 { font-size: 24px; margin-bottom: 8px; }
.preview-box {
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  color: var(--accent-hover);
  min-height: 20px;
}

/* ------ Responsive ------ */
@media (max-width: 960px) {
  .app {
    grid-template-columns: 64px var(--list-w) 1fr;
  }
  .sidebar { overflow: hidden; }
  .side-brand span, .nav-item span, .side-search span, .side-user .meta, .side-section, .nav-item .count, .badge-soon {
    display: none;
  }
  .nav-item { justify-content: center; }
}
@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar, .list-col { display: none; }
  .app.view-list .list-col { display: flex; }
  .app.view-detail .detail-col { display: flex; }
  .app:not(.view-detail) .detail-col { display: none; }
}

/* ============ AI draft card + analyze button (inbox) ============ */

.analyze-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(14,165,233,0.35);
  transition: opacity 0.15s, box-shadow 0.15s;
}
.analyze-btn:hover {
  opacity: 0.9;
  box-shadow: 0 4px 14px rgba(14,165,233,0.5);
  background: linear-gradient(135deg, var(--accent), #6366f1);
}
.analyze-btn:disabled { opacity: 0.5; }

.pending-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-hover);
  letter-spacing: 0.02em;
}

.draft-card {
  margin: 20px 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fffdf7, var(--surface));
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.draft-card .draft-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(109, 40, 217, 0.04);
}
.draft-card .draft-head .label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-hover);
}
.draft-card .draft-head .summary {
  flex: 1;
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.draft-card .draft-head .flags { display: flex; gap: 6px; }
.draft-card .draft-body { padding: 14px 16px; }
.draft-card .draft-body label {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.draft-card .draft-body input[type="text"],
.draft-card .draft-body textarea {
  margin-bottom: 12px;
}
.draft-card .draft-body textarea {
  min-height: 180px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}
.draft-card .draft-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 14px;
}
.draft-card .draft-actions .right { display: flex; gap: 8px; }
.draft-card .draft-status { font-size: 12.5px; color: var(--muted); min-height: 16px; }
.draft-card .draft-status.err { color: var(--danger); }
.draft-card .draft-status.ok { color: var(--success); }

/* Risk flag chips (yellow = warn, red = danger). Shown on the draft card
   header AND inside the confirm modal. */
.risk-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.risk-chip.warn { background: #fff4d6; color: var(--warn); border-color: #f0d488; }
.risk-chip.danger { background: #fde1d8; color: var(--danger); border-color: #f1a890; }

/* ============ Modal overlay ============ */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 14, 19, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade-in 0.12s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 460px;
  width: 100%;
  padding: 24px;
}
.modal h3 { font-size: 17px; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--ink-soft); margin: 0 0 12px; }
.modal .risk-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 4px 0 14px;
}
.modal .modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 16px;
}
.modal .ack-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--ink-soft);
}
.modal .ack-row input[type="checkbox"] { margin-top: 3px; }

/* ============ Chip input (rule keywords) ============ */

.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px;
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.chips input {
  flex: 1;
  min-width: 120px;
  border: none;
  padding: 4px 6px;
  font-size: 14px;
  outline: none;
  background: transparent;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 12.5px;
  font-weight: 600;
}
.chip button {
  background: none; border: none;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}

/* ============ Settings page ============ */

.settings-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.settings-wrap header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.settings-wrap header .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px;
  color: var(--ink-soft);
}
.settings-wrap header .brand .mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--coral));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 800;
}
.settings-wrap header nav a {
  font-size: 14px;
  color: var(--muted);
  margin-left: 16px;
  font-weight: 500;
}
.settings-wrap header nav a:hover { color: var(--ink); opacity: 1; }

.settings-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.settings-tabs a {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.settings-tabs a.active {
  color: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.section-card h3 { margin-bottom: 4px; }
.section-card .section-help { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.section-card .section-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 12px;
}
.section-card .status { font-size: 13px; min-height: 18px; color: var(--muted); }
.section-card .status.ok { color: var(--success); }
.section-card .status.err { color: var(--danger); }

.rules-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.rule-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.rule-row .meta { flex: 1; min-width: 0; }
.rule-row .meta .name { font-weight: 600; font-size: 14px; }
.rule-row .meta .desc { font-size: 12.5px; color: var(--muted); }
.rule-row .actions { display: flex; gap: 6px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }

/* Change-email OTP code input — matches verify.html styling conventions. */
.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  letter-spacing: 0.4em;
  text-align: center;
}

/* Auto AI Reply toggle */
.auto-reply-wrap {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--side-border);
}
.auto-reply-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--side-surface);
  border: 1px solid var(--side-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--side-text-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.auto-reply-toggle:hover {
  background: var(--side-surface);
  color: var(--side-text);
}
.auto-reply-toggle.is-on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(14, 165, 233, 0.08);
}
.toggle-track {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--side-border);
  flex-shrink: 0;
  position: relative;
  transition: background 0.2s;
}
.auto-reply-toggle.is-on .toggle-track {
  background: var(--accent);
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.auto-reply-toggle.is-on .toggle-thumb {
  transform: translateX(12px);
}

/* Filtered / deals list items */
.stage-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stage-pending  { background: var(--accent-soft); color: var(--accent-hover); }
.stage-replied  { background: #d1fae5; color: #065f46; }
.stage-sent     { background: #dcfce7; color: #14532d; }
.filtered-item  { opacity: 0.75; }
.list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  gap: 8px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  padding: 32px;
}
.list-empty .glyph { font-size: 28px; margin-bottom: 4px; }
