
:root {
  color-scheme: light dark;
  --ink: #17253c;
  --muted: #637082;
  --line: #dfdcd2;
  --line-soft: #e9e6dd;
  --soft: #f1efe7;
  --surface: #ffffff;
  --surface-2: #f8f6f0;
  --brand: #16406b;
  --brand-strong: #0a1f3c;
  --brand-soft: #edf2f8;
  --brand-ring: rgba(201, 168, 76, 0.45);
  --accent: #c9a84c;
  --gold: #c9a84c;
  --gold-strong: #a98a33;
  --gold-ink: #8a6d24;
  --gold-soft: #f6efdc;
  --success: #14855c;
  --success-soft: #e9f7f0;
  --warn: #a05a00;
  --warn-soft: #fdf4e3;
  --danger: #b42318;
  --danger-soft: #fdf0ef;
  --info: #1d4ed8;
  --info-soft: #eef3fe;
  --shadow-1: 0 1px 2px rgba(10, 31, 60, 0.06);
  --shadow-2: 0 2px 4px rgba(10, 31, 60, 0.05), 0 12px 32px -16px rgba(10, 31, 60, 0.28);
  --radius: 12px;
  --radius-lg: 16px;
  --side-ink: #e9edf5;
  --side-muted: #8b9ab5;
  --side-line: rgba(233, 237, 245, 0.12);
  --side-bg: linear-gradient(180deg, #0c2444 0%, #0a1f3c 55%, #081729 100%);
  --side-active: rgba(201, 168, 76, 0.13);
  --btn-ink: #ffffff;
  --btn-bg: linear-gradient(180deg, #1b3a66 0%, #0a1f3c 100%);
  --btn-border: #0a1f3c;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --page-bg: radial-gradient(1200px 400px at 85% -10%, rgba(201, 168, 76, 0.10), transparent 60%),
             linear-gradient(180deg, #f2f0e9 0%, #f8f7f2 100%);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ecf5;
    --muted: #93a1b8;
    --line: #253550;
    --line-soft: #1e2b43;
    --soft: #15213a;
    --surface: #101b2e;
    --surface-2: #15223a;
    --brand: #d9bc6b;
    --brand-strong: #c9a84c;
    --brand-soft: rgba(201, 168, 76, 0.12);
    --brand-ring: rgba(217, 188, 107, 0.4);
    --gold: #d9bc6b;
    --gold-strong: #c9a84c;
    --gold-ink: #d9bc6b;
    --gold-soft: rgba(201, 168, 76, 0.13);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.13);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --info: #93b4f8;
    --info-soft: rgba(96, 141, 247, 0.14);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 34px -16px rgba(0, 0, 0, 0.65);
    --side-bg: linear-gradient(180deg, #0c2140 0%, #0a1c36 55%, #081326 100%);
    --btn-ink: #14213a;
    --btn-bg: linear-gradient(180deg, #d9bc6b 0%, #b4913a 100%);
    --btn-border: #a98a33;
    --page-bg: radial-gradient(1200px 400px at 85% -10%, rgba(201, 168, 76, 0.07), transparent 60%),
               linear-gradient(180deg, #0a111e 0%, #0d1626 100%);
  }
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: "Avenir Next", "Avenir", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(201, 168, 76, 0.35); }
a { color: var(--brand); }
button, .button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-ink);
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s ease, filter 0.15s ease;
}
button::after, .button::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -80%;
  width: 50%;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.28) 50%, transparent 80%);
  transform: skewX(-18deg) translateX(0);
  transition: transform 0.55s var(--ease-out);
  pointer-events: none;
}
button:hover, .button:hover { filter: brightness(1.06); box-shadow: var(--shadow-2); transform: translateY(-1px); }
button:hover::after, .button:hover::after { transform: skewX(-18deg) translateX(320%); }
button:active, .button:active { transform: translateY(0) scale(0.98); }
button:focus-visible, .button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
}
button.secondary, .button.secondary {
  background: var(--surface);
  color: var(--brand);
  border-color: var(--line);
  box-shadow: var(--shadow-1);
}
button.secondary::after, .button.secondary::after { background: linear-gradient(100deg, transparent 20%, rgba(201, 168, 76, 0.16) 50%, transparent 80%); }
button.secondary:hover, .button.secondary:hover { background: var(--brand-soft); border-color: var(--gold); filter: none; }
button.danger, .button.danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--line);
  box-shadow: var(--shadow-1);
}
button.danger:hover, .button.danger:hover { background: var(--danger-soft); border-color: var(--danger); filter: none; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--gold-strong); }
textarea, input[type="email"], input[type="text"], input[type="password"], input[type="file"], select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
input[type="file"] { padding: 8px 10px; }
textarea { min-height: 130px; resize: vertical; }
h1, h2 { letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 22px; font-weight: 700; line-height: 1.15; }
h2 { font-size: 15px; font-weight: 650; line-height: 1.2; margin-bottom: 10px; text-transform: none; }
main { padding: 22px; }
.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  background: var(--side-bg);
  border-right: 1px solid var(--side-line);
  padding: 20px 14px 18px;
  scrollbar-width: thin;
}
.sidebar::after {
  content: "";
  position: fixed;
  left: 0;
  bottom: 0;
  width: 264px;
  height: 220px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='264' height='220' viewBox='0 0 264 220'%3E%3Cg fill='none' stroke='%23C9A84C' stroke-width='1.2' stroke-dasharray='1 7' stroke-linecap='round' opacity='0.5'%3E%3Cpath d='M-30 215 Q 132 40 300 165'/%3E%3Cpath d='M-30 170 Q 120 105 300 60'/%3E%3C/g%3E%3Cg fill='%23C9A84C' opacity='0.55'%3E%3Ccircle cx='52' cy='163' r='2.6'/%3E%3Ccircle cx='208' cy='103' r='2.6'/%3E%3Ccircle cx='140' cy='128' r='1.8'/%3E%3C/g%3E%3C/svg%3E") bottom left / 264px 220px no-repeat;
  opacity: 0.5;
}
@media (max-width: 1100px) { .sidebar::after { display: none; } }
.sidebar > * { position: relative; z-index: 1; }
.brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 6px 16px;
  border-bottom: 1px solid var(--side-line);
  margin-bottom: 12px;
}
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(201, 168, 76, 0.45);
  box-shadow: 0 4px 14px -4px rgba(201, 168, 76, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.brand-mark img {
  width: 68%;
  height: 68%;
  object-fit: contain;
  display: block;
}
.brand h1 { font-size: 15px; color: var(--side-ink); font-weight: 650; }
.brand .eyebrow {
  font-size: 10.5px;
  color: #c9a84c;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 650;
}
.brand .tagline {
  font-size: 10px;
  color: var(--side-muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 600;
  padding-left: 2px;
}
.brand .muted { color: var(--side-muted); font-size: 12px; line-height: 1.45; }
.brand .status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 4px 10px;
  border: 1px solid rgba(201, 168, 76, 0.38);
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.1);
  color: #e4c87a;
  font-size: 11.5px;
  font-weight: 550;
}
.status-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c9a84c;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.24);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.24); }
  50% { box-shadow: 0 0 0 6px rgba(201, 168, 76, 0.08); }
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 12px 0 14px;
}
.nav-label {
  font-size: 10.5px;
  color: var(--side-muted);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 650;
  padding: 0 10px 6px;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--side-ink);
  opacity: 0.82;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 480;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s var(--ease-out);
}
.sidebar nav a svg { width: 16px; height: 16px; flex: none; opacity: 0.75; transition: opacity 0.15s ease; }
.sidebar nav a:hover { background: rgba(233, 237, 245, 0.07); opacity: 1; transform: translateX(2px); }
.sidebar nav a.active {
  background: var(--side-active);
  border-color: rgba(201, 168, 76, 0.32);
  color: #e4c87a;
  opacity: 1;
  font-weight: 600;
}
.sidebar nav a.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e4c87a, #b08f35);
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.6);
}
.sidebar nav a.active svg { opacity: 1; }
.sidebar .footer-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--side-line);
  color: var(--side-muted);
  font-size: 11.5px;
  line-height: 1.55;
}
.sidebar .footer-note .muted { color: var(--side-muted); }
.sidebar .footer-note .ui-stamp {
  margin-top: 6px;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.7);
}
.page {
  min-width: 0;
  padding: 24px 28px 40px;
}
.page-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.page-top::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 72px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.page-top .crumb {
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--gold-ink);
  margin-bottom: 7px;
}
.page-top h1 { font-size: 29px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 7px; }
.page-top .muted { max-width: 760px; font-size: 13.5px; }
.page-top .actions { justify-content: flex-end; }
.day-stamp {
  flex: none;
  text-align: right;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  line-height: 1.5;
}
.day-stamp strong { display: block; font-size: 13.5px; font-weight: 700; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.day-stamp span { display: block; font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.day-stamp .origin { color: var(--gold-ink); }
@media (max-width: 760px) { .day-stamp { display: none; } }
.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.toolbar h2 { margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline-flex; align-items: center; gap: 10px; margin: 0; }
.actions form:has(label) {
  padding: 4px 5px 4px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
}
.actions form label { white-space: nowrap; }
label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  margin: 0 0 16px;
  background: var(--gold-soft);
  color: var(--ink);
  border-radius: var(--radius);
  font-weight: 500;
  box-shadow: var(--shadow-1);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.lead-ring {
  display: inline-block;
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 3px solid var(--ring, #7c8794);
  vertical-align: -2px;
  margin-right: 6px;
}
.lead-ring-hot { box-shadow: 0 0 0 2px rgba(192, 57, 43, .18); }
/* Mission Control: one dark panel, and exactly one number allowed to pulse.
   The reason priority and due-date stopped meaning anything on this system is
   that everything got flagged - 623 of 772 tasks were High. A hero that pulses
   three metrics becomes wallpaper inside a week, so the markup only ever
   renders a single .hero-alert. */
.hero {
  background: linear-gradient(135deg, #0A1F3C 0%, #132f57 100%);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 22px;
  color: #eef2f7;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px;
  align-items: end;
}
.hero-item strong { display: block; font-size: 1.7rem; line-height: 1.1; color: #ffffff; }
.hero-item span { font-size: .78rem; color: #9fb0c6; letter-spacing: .3px; }
.hero-alert strong { color: var(--gold, #c9a84c); animation: heroPulse 2.2s ease-in-out infinite; }
.hero-alert span { color: var(--gold, #c9a84c); }
@keyframes heroPulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 0 rgba(201, 168, 76, 0); }
  50%      { opacity: .72; text-shadow: 0 0 18px rgba(201, 168, 76, .55); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-alert strong { animation: none; }
}
.metric {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 15px 13px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s ease, border-color 0.18s ease;
}
.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), transparent 70%);
  opacity: 0.75;
}
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: rgba(201, 168, 76, 0.45); }
.metric strong {
  display: block;
  font-size: 27px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}
section { margin-top: 24px; }
section > h2 { margin-bottom: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
th, td { border-bottom: 1px solid var(--line-soft); padding: 11px 10px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
tbody tr { transition: background 0.12s ease, box-shadow 0.12s ease; }
tbody tr:hover { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--gold); }
tbody tr:last-child td { border-bottom: 0; }
th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 650;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: auto;
  max-height: 560px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.muted { color: var(--muted); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.pill.a { border-color: transparent; color: var(--success); background: var(--success-soft); }
.pill.a::before { background: var(--success); }
.pill.b { border-color: transparent; color: var(--warn); background: var(--warn-soft); }
.pill.b::before { background: var(--warn); }
.pill.c { border-color: transparent; color: var(--danger); background: var(--danger-soft); }
.pill.c::before { background: var(--danger); }
.pill.high { border-color: transparent; color: var(--danger); background: var(--danger-soft); }
.pill.high::before { background: var(--danger); }
.pill.normal { border-color: transparent; color: var(--info); background: var(--info-soft); }
.pill.normal::before { background: var(--info); }
.pill.low { border-color: transparent; color: var(--muted); background: var(--soft); }
.pill.replied { border-color: transparent; color: var(--info); background: var(--info-soft); }
.pill.replied::before { background: var(--info); }
pre {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}
.draft-body { max-height: 220px; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px; }
.inbox-list { display: flex; flex-direction: column; gap: 12px; }
.inbox-item { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-1); transition: box-shadow 0.18s ease; }
.inbox-item:hover { box-shadow: var(--shadow-2); }
.inbox-item summary { cursor: pointer; list-style: none; padding: 14px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; background: var(--surface); }
.inbox-item summary::-webkit-details-marker { display: none; }
.inbox-item .summary-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.inbox-item .summary-title { font-weight: 600; overflow-wrap: anywhere; }
.inbox-item .summary-meta { color: var(--muted); font-size: 12px; }
.inbox-item .panel { padding: 0 16px 16px; border-top: 1px solid var(--line-soft); }
.inbox-item pre { margin-top: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px; max-height: 260px; overflow: auto; }
.reply-form-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.reply-form-grid textarea { min-height: 280px; width: 100%; font-size: 14px; line-height: 1.55; padding: 12px; }
.reply-actions { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; justify-content: flex-start; }
.reply-actions button { min-height: 46px; min-width: 170px; padding: 12px 18px; font-size: 15px; font-weight: 600; }
.inline-form { display: flex; flex-direction: column; gap: 6px; }
.reply-form { display: grid; grid-template-columns: minmax(220px, 320px) 1fr auto; gap: 8px; align-items: end; margin: 10px 0 16px; }
.lead-form { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.lead-form label { display: flex; flex-direction: column; align-items: stretch; gap: 5px; color: var(--muted); }
.lead-form label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; gap: 8px; }
.lead-form .wide { grid-column: 1 / -1; }
.lead-form .half { grid-column: span 2; }
.narrow { max-width: 760px; }
.page-section {
  margin-top: 22px;
}
.page-section > h2 {
  margin-bottom: 10px;
}
.page-section .muted {
  max-width: 900px;
}
.mail-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.mail-rail { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 18px; }
.mail-rail .folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s ease, transform 0.15s var(--ease-out);
}
.mail-rail .folder:hover { background: var(--surface-2); transform: translateX(2px); }
.mail-rail .folder.active { background: var(--gold-soft); color: var(--gold-ink); font-weight: 650; border-color: transparent; }
.mail-rail .folder .count {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  background: var(--soft);
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}
.mail-rail .folder.active .count { background: rgba(201, 168, 76, 0.2); color: var(--gold-ink); }
.mail-rail form { margin-top: 8px; }
.mail-rail form button { width: 100%; }
.mail-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.mail-row { border-bottom: 1px solid var(--line-soft); }
.mail-row:last-child { border-bottom: 0; }
.mail-row summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  list-style: none;
  transition: background 0.12s ease;
}
.mail-row summary::-webkit-details-marker { display: none; }
/* Bulk selection in the inbox */
.mail-pick { display: flex; align-items: center; padding-right: 4px; cursor: pointer; }
.mail-pick input { width: 16px; height: 16px; cursor: pointer; accent-color: #b07f22; }
.mail-bulk-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 10px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  position: sticky; top: 0; z-index: 5;
}
.mail-bulk-all { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; }
.mail-bulk-all input { width: 16px; height: 16px; cursor: pointer; accent-color: #b07f22; }
.mail-bulk-bar button { margin-left: auto; }
.mail-bulk-bar button:disabled { opacity: .45; cursor: not-allowed; }
.mail-row summary:hover { background: var(--surface-2); }
.mail-row[open] summary { background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.mail-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
}
.mail-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mail-from { font-weight: 550; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.mail-subject { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subject .snippet { color: var(--muted); font-weight: 400; }
.mail-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.mail-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-row.unread .mail-from, .mail-row.unread .mail-subject { font-weight: 700; }
.mail-row.unread .mail-avatar { background: var(--brand); color: var(--surface); }
.mail-row.cold summary { box-shadow: inset 3px 0 0 #5b8dc9; }
.mail-row.organic summary { box-shadow: inset 3px 0 0 #fb923c; }
.mail-row.needs-reply summary { box-shadow: inset 4px 0 0 #c9a84c; background: rgba(201, 168, 76, 0.07); }
.mail-row.needs-reply[open] summary { background: rgba(201, 168, 76, 0.10); }
.pill.needs-reply-pill { background: #c9a84c; color: #0a1f3c; font-weight: 700; }
.kind-icon { font-size: 13px; line-height: 1; }
.mail-legend { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface); font-size: 12px; color: var(--muted); }
.mail-open { padding: 16px 18px 18px 62px; }
.mail-open pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 340px; overflow: auto; font-size: 12.5px; }
.mail-open .mail-html { width: 100%; min-height: 160px; max-height: 620px; border: 1px solid var(--line); border-radius: 10px; background: #ffffff; display: block; }
.mail-open .mail-plain-toggle { margin-top: 8px; }
/* A message is clipped to a readable height with a fade, and opens on request.
   620px of frame plus a reply form plus an opportunity form made one opened
   email longer than a screen and pushed the next one out of view. */
.mail-body { position: relative; }
.mail-body.clipped { max-height: 420px; overflow: hidden; }
.mail-body.clipped::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 90px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--surface-1, #0d1a2b)); }
.mail-expand { position: relative; z-index: 2; margin-top: 8px; font-size: 12px;
  padding: 5px 12px; border-radius: 999px; }
.mail-body.clipped .mail-expand { position: absolute; bottom: 8px; left: 50%;
  transform: translateX(-50%); }
/* The two forms below a message are collapsed until wanted. Reading the inbox
   and answering it are different jobs; only one of them needs to be on screen. */
.mail-panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); }
.mail-panel > summary { cursor: pointer; padding: 10px 14px; font-weight: 600;
  font-size: 13px; list-style: none; }
.mail-panel > summary::-webkit-details-marker { display: none; }
.mail-panel > summary::before { content: "B8 "; opacity: .6; }
.mail-panel[open] > summary::before { content: "BE "; }
.mail-panel > *:not(summary) { padding: 0 14px 14px; }
/* Opened, the blocked list is still capped: it only ever grows. */
.blocked-scroll { max-height: 320px; overflow: auto; }
.mail-open .mail-plain-toggle > summary { cursor: pointer; font-size: 12px; color: var(--muted); list-style: none; }
.mail-open .mail-plain-toggle > summary::-webkit-details-marker { display: none; }
.mail-open .mail-plain-toggle > summary::before { content: "▸ "; }
.mail-open .mail-plain-toggle[open] > summary::before { content: "▾ "; }
.mail-open .mail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.mail-trash-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.mail-open textarea { min-height: 120px; margin-top: 10px; }
.mail-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.mail-thread-msg { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.mail-thread-msg.out { box-shadow: inset 3px 0 0 #5b8dc9; }
.mail-thread-msg.in { box-shadow: inset 3px 0 0 #fb923c; background: var(--surface-2); }
.mail-thread-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; }
.mail-thread-subject { font-size: 12px; margin-top: 2px; }
.mail-thread-msg pre { margin-top: 8px; max-height: 220px; }
.attachment-field { display: grid; gap: 6px; margin-top: 10px; }
.attachment-field span { font-weight: 600; color: var(--ink); }
.attachment-field small { color: var(--muted); line-height: 1.35; }
.mail-empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.compose-box { border-bottom: 1px solid var(--line-soft); }
.compose-box summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px;
  cursor: pointer;
  list-style: none;
  border-radius: 999px;
  padding: 10px 20px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-weight: 650;
  font-size: 13px;
  box-shadow: var(--shadow-1);
}
.compose-box summary::-webkit-details-marker { display: none; }
.compose-box form { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px 16px; }
.mail-search { border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.mail-search summary { cursor: pointer; list-style: none; padding: 12px 16px; color: var(--gold-ink); font-weight: 650; font-size: 13px; }
.mail-search summary::-webkit-details-marker { display: none; }
.mail-search summary::before { content: '\2315'; display: inline-block; margin-right: 8px; }
.mail-search[open] summary::after { content: 'Close'; float: right; color: var(--muted); font-weight: 500; }
.mail-search input { width: calc(100% - 32px); margin: 0 16px 14px; }
.zf-anim .zf-in {
  animation: zf-rise 0.5s var(--ease-out) both;
}
@keyframes zf-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.zf-anim .war-bar i { transition: width 0.9s var(--ease-out); }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1100px 500px at 78% -10%, rgba(201, 168, 76, 0.16), transparent 60%),
              radial-gradient(800px 500px at -10% 110%, rgba(91, 141, 201, 0.12), transparent 60%),
              linear-gradient(165deg, #081729 0%, #0e2542 55%, #0a1f3c 100%);
}
.login-card {
  width: min(400px, 100%);
  border-radius: 20px;
  padding: 34px 32px 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 70px -30px rgba(2, 8, 18, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #e9edf5;
}
.login-card .brand-mark { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 16px; }
.login-card .eyebrow { font-size: 11px; color: #c9a84c; text-transform: uppercase; letter-spacing: 0.18em; font-weight: 650; margin-bottom: 5px; }
.login-card h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; color: #f4f6fb; }
.login-card .sub { color: #8b9ab5; font-size: 12.5px; line-height: 1.6; margin-bottom: 22px; }
.login-card .rule { height: 1px; margin: 0 0 22px; background: linear-gradient(90deg, rgba(201, 168, 76, 0.55), transparent); }
.login-card label { display: flex; flex-direction: column; align-items: stretch; gap: 6px; color: #8b9ab5; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 650; margin-bottom: 14px; }
.login-card input[type="text"], .login-card input[type="password"] {
  background: rgba(8, 17, 30, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f0f4fa;
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  font-weight: 400;
}
.login-card input:focus { border-color: #c9a84c; box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.25); }
.login-card .remember { flex-direction: row; align-items: center; text-transform: none; letter-spacing: normal; font-size: 12.5px; font-weight: 500; }
.login-card button { width: 100%; min-height: 44px; margin-top: 4px; background: linear-gradient(180deg, #d9bc6b, #b4913a); border-color: #a98a33; color: #14213a; font-size: 14px; font-weight: 700; }
.login-card .flash { background: rgba(201, 168, 76, 0.12); border-color: rgba(201, 168, 76, 0.3); border-left-color: #c9a84c; color: #e9edf5; }
.login-card .foot { margin-top: 18px; font-size: 10px; color: #6d7d99; text-transform: uppercase; letter-spacing: 0.2em; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (max-width: 900px) {
  .mail-shell { grid-template-columns: 1fr; }
  .mail-rail { position: static; flex-direction: row; flex-wrap: wrap; }
  .mail-open { padding-left: 18px; }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--side-line);
  }
  .page { padding: 18px; }
}
@media (max-width: 760px) {
  .page-top, .toolbar { align-items: flex-start; flex-direction: column; }
  .page-top .actions { justify-content: flex-start; }
  .page-top h1 { font-size: 24px; }
  th, td { min-width: 130px; }
  .reply-form, .lead-form { grid-template-columns: 1fr; }
  .lead-form .half { grid-column: auto; }
}
/* ── Badges (nav + inline) ── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-left: auto;
  line-height: 1;
  box-shadow: 0 0 8px rgba(239,68,68,0.5);
  animation: badge-pop 0.4s var(--ease-out);
}
@keyframes badge-pop { from { transform:scale(0.6); opacity:0; } to { transform:scale(1); opacity:1; } }
.nav-badge.warn { background: #f59e0b; color: #0f172a; box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.nav-badge.gold { background: var(--gold-strong); color: #0a1f3c; box-shadow: 0 0 8px rgba(201,168,76,0.5); }
/* ── Trend arrows ── */
.trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.trend.up { background: rgba(20,133,92,0.12); color: var(--success); }
.trend.down { background: rgba(180,35,24,0.10); color: var(--danger); }
.trend.flat { background: rgba(99,112,130,0.08); color: var(--muted); }
/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  font-size: 13.5px;
  font-weight: 550;
  max-width: 400px;
  animation: toast-in 0.3s var(--ease-out);
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
}
.toast.removing { opacity: 0; transform: translateX(40px); }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast .toast-msg { flex: 1; min-width: 0; }
.toast .toast-close { cursor: pointer; opacity: 0.45; font-size: 18px; line-height: 1; font-weight: 400; }
.toast .toast-close:hover { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
/* ── Quick-actions in table rows ── */
td.quick-act { white-space: nowrap; vertical-align: middle; }
td.quick-act button, td.quick-act .button {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  font-weight: 650;
  transition: all 0.15s var(--ease-out);
}
td.quick-act button.secondary:hover { background: var(--success-soft); border-color: var(--success); color: var(--success); }
/* ── Live refresh badge ── */
@keyframes live-pulse { 0%,100% { opacity:1; } 50% { opacity:0.45; } }
.live-dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--success); animation:live-pulse 1.6s ease-in-out infinite; margin-right:6px; box-shadow: 0 0 6px rgba(20,133,92,0.6); }
/* ── Update notice banner ── */
.update-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: var(--gold-soft);
  border: 1px solid rgba(201,168,76,0.35);
  font-size: 13px;
  font-weight: 550;
  color: var(--gold-ink);
}
.update-notice strong { color: var(--gold-strong); }
