/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Foundation ──
   Design direction: utilitarian ops dashboard.
   Dense, scannable, no decoration. Color is functional only.
   4px base unit. System font stack. No border-radius on data elements. */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f7f7f5;
  color: #1c1c1a;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: #1c1c1a; text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: #000; }

.container { max-width: 1400px; margin: 0 auto; padding: 24px 28px; }

/* ── Bot nav (top-level) ── */
.bot-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #1c1c1a;
  margin-bottom: 0;
}
.bot-nav a {
  padding: 10px 20px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  color: #999;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -2px;
  transition: color 0.1s;
}
.bot-nav a:hover { color: #1c1c1a; }
.bot-nav a.active {
  color: #1c1c1a;
  background: #f7f7f5;
  border-color: #1c1c1a;
  border-bottom: 2px solid #f7f7f5;
}
.bot-nav a.disabled {
  color: #ccc;
  cursor: default;
}
.bot-nav a.disabled:hover { color: #ccc; }

/* ── Header ── */
header {
  border-bottom: 1px solid #ddd;
  padding: 12px 0 16px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
header h1 {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #1c1c1a;
  text-transform: uppercase;
}
nav { display: flex; gap: 20px; }
nav a {
  font-size: 13px;
  color: #888;
  text-decoration: none;
}
nav a:hover { color: #1c1c1a; }
nav a.active { color: #1c1c1a; font-weight: 600; }

/* ── Placeholder page ── */
.placeholder {
  text-align: center;
  padding: 80px 20px;
  color: #999;
}
.placeholder h2 {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #1c1c1a;
  margin-bottom: 12px;
}
.placeholder p {
  font-size: 13px;
  max-width: 400px;
  margin: 0 auto;
}
.placeholder .status-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid #ccc;
  color: #999;
}

/* ── Stat cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  margin-bottom: 24px;
  background: #ddd;
  border: 1px solid #ddd;
}
.card {
  background: #fff;
  padding: 14px 16px;
}
.card .label {
  font-size: 10px;
  text-transform: uppercase;
  color: #999;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.card .value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 2px;
  color: #1c1c1a;
  font-variant-numeric: tabular-nums;
}
.card .value.green { color: #2a7d3f; }
.card .value.yellow { color: #9a6700; }
.card .value.red { color: #c33; }

/* ── Controls ── */
.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  align-items: center;
  flex-wrap: wrap;
}
button {
  background: #fff;
  color: #1c1c1a;
  border: 1px solid #ccc;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
}
button:hover { background: #f0f0ee; }
button:active { background: #e8e8e5; }
button:disabled { opacity: 0.35; cursor: not-allowed; }
button.primary { background: #1c1c1a; border-color: #1c1c1a; color: #fff; }
button.primary:hover { background: #333; }

/* ── Toggle ── */
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.toggle input[type="checkbox"] { width: 14px; height: 14px; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { position: sticky; top: 0; z-index: 1; }
th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid #1c1c1a;
  color: #1c1c1a;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.8px;
  background: #f7f7f5;
}
td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}
tbody tr:hover { background: #f0f0ee; }

/* ── Tags ──
   Minimal. No backgrounds on neutral states.
   Color = meaning, not decoration. */
.tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
  letter-spacing: 0.3px;
  text-transform: lowercase;
}

/* tier tags */
.tag-vip { color: #9a6700; border-color: #9a6700; }
.tag-priority { color: #1a6ed8; border-color: #1a6ed8; }
.tag-standard { color: #888; border-color: #bbb; }
.tag-new { color: #2a7d3f; border-color: #2a7d3f; }
.tag-low { color: #aaa; border-color: #ccc; }
.tag-credit { color: #7c3aed; border-color: #7c3aed; }

/* action/status tags */
.tag-follow_up { color: #2a7d3f; border-color: #2a7d3f; }
.tag-escalate { color: #c33; border-color: #c33; }
.tag-stop_low { color: #9a6700; border-color: #9a6700; }
.tag-too_soon { color: #aaa; border-color: #ccc; }
.tag-sent { color: #2a7d3f; border-color: #2a7d3f; background: #eef6f0; }
.tag-rejected { color: #888; border-color: #ccc; }
.tag-approved { color: #2a7d3f; border-color: #2a7d3f; background: #eef6f0; }

/* ── Status dot ── */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.live { background: #2a7d3f; }
.status-dot.dry { background: #9a6700; }

/* ── Pipeline funnel ── */
.gate-funnel { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 24px; border: 1px solid #ddd; }
.gate-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border-right: 1px solid #ddd;
  font-size: 12px;
}
.gate-pill:last-child { border-right: none; }
.gate-pill .label { color: #888; }
.gate-pill .count { font-weight: 700; color: #1c1c1a; font-size: 15px; font-variant-numeric: tabular-nums; }

/* ── Section headings ── */
h3 {
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #999 !important;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Message preview ── */
.message-preview {
  background: #fff;
  border: 1px solid #ddd;
  padding: 12px 14px;
  font-size: 13px;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
  line-height: 1.6;
}

/* ── Ticket copy ── */
.ticket-copy {
  cursor: pointer;
  color: #1a6ed8;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.ticket-copy:hover { text-decoration: underline; }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1c1c1a;
  color: #fff;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  animation: toast-in 0.15s ease forwards, toast-out 0.15s ease 1s forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.toast svg { flex-shrink: 0; }
@keyframes toast-in { to { opacity: 1; } }
@keyframes toast-out { to { opacity: 0; } }

/* ── Form inputs ── */
.reject-input {
  width: 100%;
  background: #fff;
  color: #1c1c1a;
  border: 1px solid #ccc;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  margin-top: 8px;
}
.reject-input:focus { border-color: #c33; outline: none; }

.filter-input {
  background: #fff;
  color: #1c1c1a;
  border: 1px solid #ccc;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
}
.filter-input:focus { border-color: #1c1c1a; outline: none; }

/* ── Loading ── */
.loading { text-align: center; color: #999; padding: 40px; }
.spinner { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Expanded detail rows ── */
tbody tr[id^="msg-"] td,
tbody tr[id^="detail-"] td {
  background: #fafaf8;
  padding: 14px 16px;
  border-bottom: 1px solid #ddd;
}

/* ── Textarea ── */
textarea { font-family: inherit; }
textarea:focus { border-color: #1c1c1a; outline: none; }

/* ── Select ── */
select { font-family: inherit; }

/* ── Checkbox ── */
input[type="checkbox"] { cursor: pointer; }
