/* ============================================================
   AK Fleet Email — dashboard styles
   ============================================================ */

:root {
  --bg-0: #08080a;
  --bg-1: #101013;
  --bg-2: #16161c;
  --bg-3: #1c1c24;
  --line: #27272f;
  --line-2: #3a3a47;
  --text-0: #fafafa;
  --text-1: #d4d4d8;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --text-4: #52525b;
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.14);
  --green-soft: #4ade80;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --red: #f87171;
  --indigo: #a5b4fc;
  --pink: #f9a8d4;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--text-1);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body {
  background-image:
    radial-gradient(circle at 20% 0%, rgba(34,197,94,0.04), transparent 50%),
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; }
.num  { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; color: var(--text-0); font-weight: 600; }
.dim  { color: var(--text-3); font-weight: 400; }
.amber { color: var(--amber); }
.green { color: var(--green-soft); }
.red   { color: var(--red); }
.sep   { color: var(--text-4); margin: 0 6px; }

/* === Topbar === */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(10,10,12,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1700px; margin: 0 auto;
  padding: 8px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand h1 {
  font-size: 16px; font-weight: 700; margin: 0;
  letter-spacing: -0.015em;
}
.brand-sub {
  color: var(--text-4);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
}
.pulse {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
  animation: pulse 2.2s infinite;
}
.pulse-ok  { background: var(--green); box-shadow: 0 0 12px rgba(34,197,94,0.7); }
.pulse-err { background: var(--red); box-shadow: 0 0 12px rgba(239,68,68,0.7); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.topbar-meta {
  display: flex; gap: 22px;
  font-size: 12px;
  color: var(--text-2);
}
.topbar-meta .num { font-size: 13px; }

/* === Page === */
.page {
  max-width: 1700px;
  margin: 0 auto;
  padding: 14px 24px 40px;
  display: flex; flex-direction: column;
  gap: 16px;
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}
.section-head h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-0);
  font-weight: 700;
  margin: 0;
}

.row-2col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}
@media (max-width: 1100px) {
  .row-2col { grid-template-columns: 1fr; }
}

/* ============================================================
   INBOX GRID — primary view
   ============================================================ */
.inbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);  /* 2 × 6 matrix */
  gap: 6px;
}
@media (max-width: 1100px) { .inbox-grid { grid-template-columns: 1fr; } }

.inbox {
  background: linear-gradient(170deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px 8px;
  display: flex; flex-direction: column;
  gap: 5px;
  position: relative;
  transition: border-color 0.18s;
}
.inbox:hover {
  border-color: var(--line-2);
}
.inbox.is-paused {
  background: linear-gradient(170deg, rgba(245,158,11,0.06) 0%, var(--bg-2) 100%);
  border-color: rgba(245,158,11,0.25);
}

/* head row: title + status + speed on one line */
.inbox-head {
  display: flex; align-items: center;
  gap: 10px;
  min-width: 0;
}
.inbox-id { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 10px; }
.inbox-addr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-0);
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.2;
  flex-shrink: 1;
}
.inbox-sender {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.2;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  white-space: nowrap;
}
.inbox-tags { display: flex; gap: 4px; flex-shrink: 0; }
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 700;
}
.tag-fast    { background: var(--green-bg); color: var(--green-soft); }
.tag-medium  { background: rgba(99,102,241,0.18); color: var(--indigo); }
.tag-slow    { background: rgba(244,114,182,0.18); color: var(--pink); }
.tag-active  { background: var(--green-bg); color: var(--green-soft); }
.tag-paused  { background: rgba(245,158,11,0.20); color: var(--amber); }
.tag-pending { background: rgba(82,82,91,0.4); color: var(--text-2); }

/* Tufte sparkline — 21 thin bars, right-anchored, today on the right */
.inbox-chart-wrap {
  display: flex; align-items: flex-end;
  gap: 14px;
  padding: 0;
  background: none;
  border: none;
}
.inbox-chart-head {
  display: none; /* title moved inline; chart speaks for itself */
}
.inbox-chart-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 4px;
}
.inbox-chart {
  display: flex; align-items: flex-end;
  gap: 2px;
  height: 32px;
  padding: 0;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;  /* right-anchor: today pinned to right edge */
  position: relative;
  /* Horizontal grid lines for scale reference */
  background-image: linear-gradient(
    to top,
    transparent 0%,
    transparent calc(100% - 1px),
    rgba(82,82,91,0.18) calc(100% - 1px),
    rgba(82,82,91,0.18) 100%
  );
  background-size: 100% 33.33%;
  background-position: 0 0;
  background-repeat: repeat;
}
/* 21 thin bars — Tufte style */
.inbox-chart-day {
  width: 7px; flex-shrink: 0;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}
.inbox-chart-bar-stack {
  width: 100%;
  display: flex; flex-direction: column-reverse;
  align-items: stretch;
  position: relative;
  min-height: 1px;
  border-bottom: 1px solid rgba(82,82,91,0.35);  /* thin baseline */
}
.inbox-chart-bar {
  width: 100%;
  transition: opacity 0.2s;
}
.inbox-chart-bar:hover { opacity: 0.75; }
.inbox-chart-bar.cold  { background: #22c55e; }       /* bright green */
.inbox-chart-bar.reply { background: var(--violet); }
.inbox-chart-bar.empty-dot {
  height: 1px;
  background: rgba(82,82,91,0.4);
  min-height: 1px;
}
.inbox-chart-day.is-today .inbox-chart-bar-stack {
  border-bottom: 2px solid var(--green);
}
.inbox-chart-day-label {
  display: none;  /* Tufte style: no labels on individual bars */
}

/* Headline row: sends ratio + replies + day */
.inbox-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.inbox-headline {
  display: flex; align-items: baseline; gap: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.inbox-row { display: none; }  /* no separate headline row — info inline */
.inbox-sent, .inbox-divider, .inbox-budget, .inbox-headline-label { display: none; }
.inbox-substats, .inbox-substat, .inbox-substat-label, .inbox-substat-val { display: none; }

/* Compact metadata line above the sparkline — just the facts */
.inbox-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
}
.inbox-meta .today-val {
  color: var(--text-0);
  font-weight: 700;
}
.inbox-meta .today-cap {
  color: var(--text-3);
  font-weight: 500;
}
.inbox-meta-sep { color: var(--line-2); margin: 0 2px; }
.inbox-substat-val.dim {
  color: var(--text-3);
}

.inbox-progress { display: none; }
.inbox-progress-bar {
  height: 100%;
  transition: width 0.4s ease-out;
}
.inbox-progress-bar.normal { background: linear-gradient(90deg, var(--green), #16a34a); }
.inbox-progress-bar.full   { background: linear-gradient(90deg, var(--amber), #f59e0b); }

.inbox-foot { display: none; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: rgba(20,20,24,0.55);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-1);
  margin: 0;
  font-weight: 700;
}

/* === Domains === */
.domains { display: flex; flex-direction: column; gap: 6px; }
.domain-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.domain-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.domain-status.green { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,0.6); }
.domain-status.dim   { background: var(--text-4); }
.domain-name {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.domain-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* === Activity === */
.activity {
  display: flex; flex-direction: column;
  gap: 1px;
  max-height: 380px;
  overflow-y: auto;
}
.activity-row {
  display: grid;
  grid-template-columns: 50px 18px 140px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 4px;
}
.activity-row:hover { background: rgba(39,39,42,0.4); }
.activity-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-4); }
.activity-icon { font-family: 'JetBrains Mono', monospace; font-weight: 600; text-align: center; font-size: 13px; }
.activity-icon.cold    { color: var(--green-soft); }
.activity-icon.reply   { color: var(--violet); }
.activity-icon.inbound { color: var(--amber); }
.activity-inbox {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.activity-subject {
  color: var(--text-1); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* === Inbound table === */
.inbound-table { display: flex; flex-direction: column; gap: 5px; }
.inbound-row {
  display: grid;
  grid-template-columns: 75px 1fr 80px 60px;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
.inbound-row.head {
  background: transparent;
  border: none;
  padding: 4px 12px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-4);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}
.inbound-from-name { color: var(--text-1); font-weight: 500; font-size: 12px; }
.inbound-subject  {
  color: var(--text-0); font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px;
}
.status-unprocessed  { color: var(--text-2); }
.status-reply_queued { color: var(--green-soft); }
.status-ghosted      { color: var(--text-3); }
.status-error        { color: var(--red); }
.empty-row {
  padding: 24px;
  text-align: center;
  color: var(--text-4);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: rgba(15,15,18,0.4);
  border: 1px dashed var(--line);
  border-radius: 6px;
}

/* === Queue === */
.queue { display: flex; flex-direction: column; gap: 5px; max-height: 280px; overflow-y: auto; }
.queue-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
.queue-row .left { display: flex; flex-direction: column; gap: 2px; }
.queue-inbox  { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-1); }
.queue-action { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-3); }
.queue-when   { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--amber); }

/* === Footer === */
footer {
  padding: 28px 0 16px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-4);
}

/* === Scrollbar === */
.scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar::-webkit-scrollbar-track { background: transparent; }
.scrollbar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
.scrollbar::-webkit-scrollbar-thumb:hover { background: var(--text-4); }
