/* ==========================================================================
   German Scout — Outreach Dashboard
   Internal ops tool for Iron Mind AI. Dense, functional, dark.
   Colors/typography echo docs/brandbook.md (iron-mind.ai) — not the full
   marketing system, just the palette + type stack, applied to an
   admin-density layout (see brandbook "Admin Panel (CMS)" section).
   ========================================================================== */

:root {
  --color-bg-primary: #0E0E0E;
  --color-bg-surface: #161616;
  --color-bg-elevated: #1C1C1C;
  --color-accent: #E87C2E;
  --color-accent-hover: #F08C3E;
  --color-accent-subtle: rgba(232, 124, 46, 0.12);
  --color-text-primary: #FFFFFF;
  --color-text-secondary: #E8EAED;
  --color-text-muted: #888888;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(255, 255, 255, 0.16);

  --color-success: #22c55e;
  --color-warning: #E87C2E;
  --color-danger: #ef4444;
  --color-danger-bg: rgba(224, 82, 82, 0.08);
  --color-danger-border: rgba(224, 82, 82, 0.25);

  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;

  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 8px;

  --nav-height: 56px;

  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg-primary);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 var(--space-2);
}

h1 { font-size: 28px; letter-spacing: 0.01em; text-transform: uppercase; }
h2 { font-size: 20px; letter-spacing: 0.02em; text-transform: uppercase; }
h3 { font-size: 16px; font-family: var(--font-body); font-weight: 500; text-transform: none; }

code, .mono { font-family: var(--font-mono); }

::selection { background: var(--color-accent-subtle); color: var(--color-text-primary); }

/* Focus states — accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Top Nav
   ========================================================================== */

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-3);
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.topnav__brand-dot { color: var(--color-accent); }

.topnav__links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.topnav__link {
  position: relative;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 4px 2px;
  transition: color var(--transition-fast);
}

.topnav__link:hover { color: var(--color-text-primary); }

.topnav__link.is-active {
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-accent);
}

.topnav__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 6px;
  border-radius: 8px;
  background: var(--color-accent);
  color: var(--color-bg-primary);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
}

.topnav__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.logout-form { margin: 0; }

/* Mobile nav collapse */
@media (max-width: 900px) {
  .topnav { flex-wrap: wrap; height: auto; padding: var(--space-1) var(--space-2); gap: var(--space-1); }
  .topnav__links { gap: var(--space-2); }
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-3);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.section {
  margin-bottom: var(--space-4);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  line-height: 1;
}

.btn--primary {
  background: var(--color-accent);
  color: #0E0E0E;
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

.btn--ghost {
  background: transparent;
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.btn--ghost:hover { background: var(--color-accent-subtle); }

.btn--muted {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-muted);
}
.btn--muted:hover { color: var(--color-text-primary); border-color: var(--color-border-hover); }

.btn--danger {
  background: transparent;
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}
.btn--danger:hover { background: var(--color-danger-bg); }

.btn--sm { padding: 6px 12px; font-size: 11px; }
.btn--block { width: 100%; }

/* ==========================================================================
   Forms
   ========================================================================== */

label {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 9px 12px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input::placeholder, textarea::placeholder { color: var(--color-text-muted); opacity: 0.7; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(232, 124, 46, 0.25);
}

textarea { resize: vertical; font-family: var(--font-body); line-height: 1.5; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.field { margin-bottom: var(--space-2); }

/* ==========================================================================
   Cards / Surfaces
   ========================================================================== */

.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.card + .card { margin-top: var(--space-2); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-2);
}

/* ==========================================================================
   Login
   ========================================================================== */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-primary);
  padding: var(--space-3);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

.login-card__logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.login-card__sub {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-bottom: var(--space-4);
}

.login-card form { text-align: left; }

/* ==========================================================================
   Chips / Badges
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}

.chip--dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chip--green   { background: rgba(34, 197, 94, 0.1);  color: #22c55e; border-color: rgba(34, 197, 94, 0.2); }
.chip--amber   { background: var(--color-accent-subtle); color: var(--color-accent); border-color: rgba(232, 124, 46, 0.3); }
.chip--red     { background: var(--color-danger-bg); color: var(--color-danger); border-color: var(--color-danger-border); }
.chip--muted   { background: rgba(255, 255, 255, 0.05); color: var(--color-text-muted); border-color: var(--color-border); }
.chip--blue    { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border-color: rgba(59, 130, 246, 0.2); }

/* ==========================================================================
   Ops Strip (overview)
   ========================================================================== */

.ops-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.ops-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  font-size: 13px;
}

.ops-banner--paused {
  background: rgba(232, 124, 46, 0.08);
  border: 1px solid rgba(232, 124, 46, 0.25);
  color: var(--color-accent);
}

.stat-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}

.stat-card__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.stat-card__value .stat-card__unit {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-text-muted);
  margin-left: 4px;
}

.tool-health-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.mode-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  text-transform: uppercase;
}

/* ==========================================================================
   Funnel
   ========================================================================== */

.funnel-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 8px;
}

.funnel-row__label {
  width: 160px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--color-text-secondary);
  text-transform: capitalize;
}

.funnel-row__bar-wrap {
  flex: 1;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 22px;
  border: 1px solid var(--color-border);
}

.funnel-row__bar {
  height: 100%;
  background: var(--color-accent);
  opacity: 0.85;
  transition: width var(--transition-base);
}

.funnel-row__count {
  width: 48px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Filter Bar
   ========================================================================== */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-end;
  margin-bottom: var(--space-2);
  padding: var(--space-2);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.filter-bar .field { margin-bottom: 0; min-width: 140px; }
.filter-bar label { margin-bottom: 4px; }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr.is-link { cursor: pointer; transition: background var(--transition-fast); }
tbody tr.is-link:hover { background: var(--color-bg-elevated); }

.table-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Prospect Detail
   ========================================================================== */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-2);
}

.detail-field {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}
.detail-field:last-child { border-bottom: none; }
.detail-field dt { color: var(--color-text-muted); }
.detail-field dd { margin: 0; color: var(--color-text-primary); text-align: right; }

.score-table th, .score-table td { padding: 6px 10px; }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
@media (max-width: 700px) { .compare-grid { grid-template-columns: 1fr; } }

.compare-grid__label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.compare-grid__body {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.6;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 8px 0 8px 20px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}
.timeline li:last-child { border-bottom: none; }
.timeline li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 15px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

.timeline .timeline__meta {
  color: var(--color-text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  margin-left: 8px;
}

/* ==========================================================================
   Drafts / Approval Queue
   ========================================================================== */

.draft-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.draft-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.draft-card__recipient { font-size: 13px; }
.draft-card__recipient strong { color: var(--color-text-primary); }
.draft-card__recipient .muted { color: var(--color-text-muted); }

.draft-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: var(--space-2);
  align-items: center;
}

.word-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
}
.word-count.is-warning { color: var(--color-accent); }

.draft-result {
  margin-top: 8px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.draft-result--ok { background: rgba(34,197,94,0.1); color: #22c55e; }
.draft-result--error { background: var(--color-danger-bg); color: var(--color-danger); }

/* ==========================================================================
   Samples
   ========================================================================== */

.sample-card {
  position: relative;
}

.sample-card__star {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  padding: 2px;
  line-height: 1;
}
.sample-card__star.is-favorite { color: var(--color-accent); }
.sample-card__star:hover { color: var(--color-accent); }

.sample-card__subject {
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: 6px;
  padding-right: 28px;
}

.sample-card__body {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  margin-bottom: var(--space-2);
  line-height: 1.6;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-2);
}

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.sample-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sample-card__actions { display: flex; gap: 6px; }

/* ==========================================================================
   Config
   ========================================================================== */

.pause-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.pause-toggle-card__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 24px;
  transition: background var(--transition-fast);
}
.toggle-switch .slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
}
.toggle-switch input:checked + .slider { background: var(--color-accent); }
.toggle-switch input:checked + .slider::before { transform: translateX(20px); }

.config-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.config-row input { max-width: 220px; }

/* ==========================================================================
   Journal
   ========================================================================== */

.journal-article {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: 14px;
  line-height: 1.7;
}

.journal-article h1,
.journal-article h2,
.journal-article h3 { text-transform: none; margin-top: var(--space-3); }

.journal-article p { color: var(--color-text-secondary); }
.journal-article a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.journal-article code { background: var(--color-bg-elevated); padding: 1px 5px; border-radius: 3px; font-size: 13px; }
.journal-article pre { background: var(--color-bg-elevated); padding: var(--space-2); border-radius: var(--radius-sm); overflow-x: auto; }

.review-list { list-style: none; margin: 0; padding: 0; }
.review-list li { padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.review-list li:last-child { border-bottom: none; }
.review-list a { color: var(--color-accent); }
.review-list a:hover { color: var(--color-accent-hover); }

/* ==========================================================================
   Toast
   ========================================================================== */

#toast-region {
  position: fixed;
  bottom: var(--space-3);
  right: var(--space-3);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toast-in 200ms ease-out;
}

.toast--error {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger);
}

.toast--success {
  background: var(--color-bg-elevated);
  border: 1px solid rgba(34,197,94,0.3);
  color: #22c55e;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Utility
   ========================================================================== */

.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--space-2); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
