/* ════════════════════════════════════════════════════════════════════
   AUTOMATON — Internal Design System (2026-05-08)
   Shared across /caller /data /builder /survey?manual=1 /manager.
   Pages opt in by linking this file + using `.app-shell`, `.panel`,
   `.btn`, `.tab-row`, `.brand` etc. Existing per-page CSS continues
   to work; this file ADDS the shared layer rather than replacing it.
   ════════════════════════════════════════════════════════════════════ */

:root {
  --bg-main:    #050609;
  --bg-shell:   #080a0f;
  --bg-panel:   #0d0f13;
  --bg-card:    #12151d;
  --bg-card-soft: rgba(255,255,255,0.035);

  --border-soft:   rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);

  --lime:      #d4ff3a;
  --lime-soft: rgba(212,255,58,0.12);
  --green:     #08e0a4;
  --blue:      #3b82f6;
  --yellow:    #fbbf24;
  --red:       #ff3b4f;

  --text-main:  #f4f4f5;
  --text-muted: #9aa0b5;
  --text-faint: #646a7d;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  --shadow-panel: 0 18px 70px rgba(0,0,0,0.34);
  --space-1: 4px; --space-2: 8px; --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
}

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Body / typography — only applies if a page wants the shared font */
body.atm-internal {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: Inter, "Inter Tight", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -0.015em;
  margin: 0;
}
body.atm-internal a { color: var(--lime); text-decoration: none; }

/* Mono utility — labels / timers / phones / IDs only */
.atm-mono, .kicker, .meta, .timer, .phone, .id-label {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
}

/* ─── App shell ──────────────────────────────────────────────── */
.app-shell {
  width: min(1560px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 16px 104px;
}
@media (max-width: 820px) {
  .app-shell { width: calc(100vw - 20px); padding: 12px 10px 108px; }
}

/* ─── Brand mark ─────────────────────────────────────────────── */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(212,255,58,0.18), transparent 70%),
    linear-gradient(180deg, #15171c, #0a0c10);
  border: 1px solid rgba(212,255,58,0.18);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6) inset, 0 6px 18px rgba(212,255,58,0.06);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; line-height: 1; }
.brand-name { font-size: 13px; font-weight: 800; color: var(--text-main); letter-spacing: 0.18em; }
.brand-sub  {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px; color: var(--text-faint);
  letter-spacing: 0.16em; text-transform: uppercase; margin-top: 2px;
}

/* ─── Header ─────────────────────────────────────────────────── */
.atm-header {
  display: flex; align-items: center; gap: var(--space-3);
  height: 58px; padding: 0 var(--space-4);
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  margin-bottom: var(--space-4);
}
.atm-header .spacer { flex: 1; }
.atm-header .pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: 999px; padding: 4px 12px;
  font-size: 12px; color: var(--text-muted);
}
.atm-header .pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* ─── Panels ─────────────────────────────────────────────────── */
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)),
              var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-panel);
  margin-bottom: var(--space-3);
}
.panel-flat { box-shadow: none; }
.panel-title {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  margin: 0 0 var(--space-3);
  font-weight: 600;
}
.panel-result   { border-color: rgba(212,255,58,0.22); }
.panel-internal { border-color: rgba(251,191, 36,0.22); }
.panel-build    { border-color: rgba( 59,130,246,0.20); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-card); color: var(--text-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  height: 36px;
  padding: 0 14px;
  font: 600 13px/1 Inter, system-ui, sans-serif;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease;
  white-space: nowrap;
}
.btn:hover { color: var(--text-main); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary       { background: var(--lime);  color: #050609; border-color: var(--lime);  font-weight: 700; }
.btn-primary:hover { background: #c2ed2e; border-color: #c2ed2e; color: #050609; }
.btn-secondary     { background: var(--bg-card); color: var(--text-main); }
.btn-blue          { color: var(--blue);   border-color: rgba(59,130,246,0.4); }
.btn-blue:hover    { background: rgba(59,130,246,0.10); color: var(--blue); }
.btn-green         { color: var(--green);  border-color: rgba(8,224,164,0.4); }
.btn-green:hover   { background: rgba(8,224,164,0.10); color: var(--green); }
.btn-warning       { color: var(--yellow); border-color: rgba(251,191,36,0.4); }
.btn-warning:hover { background: rgba(251,191,36,0.10); color: var(--yellow); }
.btn-danger-outline       { color: var(--red); border-color: rgba(255,59,79,0.4); }
.btn-danger-outline:hover { background: rgba(255,59,79,0.10); color: var(--red); }
.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }

/* ─── Tabs ───────────────────────────────────────────────────── */
.tab-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: var(--space-3);
}
.tab {
  background: var(--bg-card); color: var(--text-muted);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.tab:hover { color: var(--text-main); border-color: var(--border-strong); }
.tab.is-active {
  background: var(--lime); color: #050609; border-color: var(--lime); font-weight: 700;
}

/* ─── Inputs ─────────────────────────────────────────────────── */
.atm-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font: 14px/1.5 Inter, system-ui, sans-serif;
  letter-spacing: -0.005em;
  transition: border-color 120ms;
}
.atm-input:focus { outline: 0; border-color: var(--lime); }
.atm-input::placeholder { color: var(--text-faint); }
.atm-label {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
  font-weight: 600;
}

/* ─── Tables ─────────────────────────────────────────────────── */
.atm-table {
  width: 100%; border-collapse: collapse;
  font-family: Inter, system-ui, sans-serif;
}
.atm-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-panel);
  color: var(--text-faint);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
}
.atm-table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.atm-table tbody tr { transition: background 120ms; }
.atm-table tbody tr:hover { background: var(--bg-card-soft); }

/* ─── Stat cards (Manager) ───────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-3); }
.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015)),
              var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.stat-card .stat-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: 28px; font-weight: 700; color: var(--text-main); letter-spacing: -0.02em;
}
.stat-card .stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-card.empty .stat-value { color: var(--text-faint); }

/* ─── Chips / badges ─────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: 999px; padding: 3px 10px;
  font-size: 11px; color: var(--text-muted); font-weight: 600;
}
.chip-lime  { background: rgba(212,255,58,0.10); color: var(--lime);   border-color: rgba(212,255,58,0.32); }
.chip-green { background: rgba(8,224,164,0.10);  color: var(--green);  border-color: rgba(8,224,164,0.30); }
.chip-blue  { background: rgba(59,130,246,0.10); color: var(--blue);   border-color: rgba(59,130,246,0.30); }
.chip-warn  { background: rgba(251,191,36,0.10); color: var(--yellow); border-color: rgba(251,191,36,0.30); }
.chip-red   { background: rgba(255,59,79,0.10);  color: var(--red);    border-color: rgba(255,59,79,0.30); }

/* ─── Empty states ───────────────────────────────────────────── */
.atm-empty {
  text-align: center; padding: 40px 16px;
  color: var(--text-faint); font-size: 13px;
}
.atm-empty b { color: var(--text-muted); display: block; font-size: 14px; margin-bottom: 4px; font-weight: 700; }

/* ════════════════════════════════════════════════════════════════
   PHASE C — Shared smart-UI system additions
   Used by Manager (operations command center) + Builder (component
   pool) + Caller. Append-only; no existing rules changed. Forest
   tokens live alongside the legacy --lime so existing pages keep
   their primary action color until they opt in.
   ════════════════════════════════════════════════════════════════ */
:root {
  --forest:    #1f5c45;
  --forest2:   #2d7a5b;
  --forest-soft:        rgba(54,179,126,0.12);
  --forest-glow:        rgba(54,179,126,0.30);
  --grad-forest:        linear-gradient(180deg, #2f8763 0%, #1c5b42 100%);
  --grad-forest-hover:  linear-gradient(180deg, #3a9c75 0%, #226b4f 100%);
  --font-display: "Geist", "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono-pref: "Geist Mono", "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
}

/* ─── Forest primary button variant (opt-in) ─── */
.btn-forest {
  background: var(--forest2);
  background-image: var(--grad-forest);
  color: #fff;
  border-color: var(--forest2);
  font-weight: 800;
}
.btn-forest:hover {
  background-image: var(--grad-forest-hover);
  border-color: var(--forest2);
  color: #fff;
}

/* ─── Status chip — Ready / Syncing / Warning / Error / Loading ─── */
.atm-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 var(--space-2) 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-soft);
  font-family: var(--font-mono-pref);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.atm-status-chip .atm-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: background 140ms ease, box-shadow 140ms ease;
}
.atm-status-chip[data-state="ready"]    { color: var(--text-main); border-color: rgba(8,224,164,0.40); }
.atm-status-chip[data-state="ready"]    .atm-status-dot { background: var(--green); box-shadow: 0 0 8px rgba(8,224,164,0.55); }
.atm-status-chip[data-state="syncing"],
.atm-status-chip[data-state="loading"]  { color: var(--text-main); border-color: rgba(251,191,36,0.45); background: rgba(251,191,36,0.06); }
.atm-status-chip[data-state="syncing"]  .atm-status-dot,
.atm-status-chip[data-state="loading"]  .atm-status-dot { background: var(--yellow); box-shadow: 0 0 8px rgba(251,191,36,0.55); animation: atm-status-pulse 1.2s ease-in-out infinite; }
.atm-status-chip[data-state="warning"]  { color: var(--text-main); border-color: rgba(251,191,36,0.55); background: rgba(251,191,36,0.10); }
.atm-status-chip[data-state="warning"]  .atm-status-dot { background: var(--yellow); box-shadow: 0 0 10px rgba(251,191,36,0.65); }
.atm-status-chip[data-state="error"]    { color: var(--text-main); border-color: rgba(255,59,79,0.55); background: rgba(255,59,79,0.10); }
.atm-status-chip[data-state="error"]    .atm-status-dot { background: var(--red); box-shadow: 0 0 10px rgba(255,59,79,0.65); }
@keyframes atm-status-pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ─── Compact identity / avatar chip (header use) ─── */
.atm-avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}
.atm-avatar-chip .atm-avatar-circle {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text-main);
  background: linear-gradient(180deg, rgba(54,179,126,0.30), rgba(31,92,69,0.10));
  border: 1px solid rgba(54,179,126,0.55);
  border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
}
.atm-avatar-chip .atm-avatar-name {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.005em;
}
.atm-avatar-chip .atm-avatar-role {
  font-family: var(--font-mono-pref);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 4px;
}

/* ─── Skeleton loading shimmer (small refresh placeholders) ─── */
.atm-skel {
  display: block;
  border-radius: 6px;
  background:
    linear-gradient(
      90deg,
      rgba(255,255,255,0.04) 0%,
      rgba(255,255,255,0.10) 40%,
      rgba(255,255,255,0.04) 80%
    );
  background-size: 200% 100%;
  animation: atm-skel-shimmer 1.2s linear infinite;
}
.atm-skel.lg { height: 28px; }
.atm-skel.md { height: 18px; }
.atm-skel.sm { height: 12px; }
.atm-skel.w-25 { width: 25%; }
.atm-skel.w-50 { width: 50%; }
.atm-skel.w-75 { width: 75%; }
.atm-skel.w-full { width: 100%; }
@keyframes atm-skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Inline tonal alerts (info / success / warning / error) ─── */
.atm-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  font-family: Inter, system-ui, sans-serif;
}
.atm-alert .atm-alert-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-weight: 700;
}
.atm-alert .atm-alert-body { flex: 1; min-width: 0; }
.atm-alert .atm-alert-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.005em;
}
.atm-alert .atm-alert-meta {
  font-family: var(--font-mono-pref);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-top: 4px;
}
.atm-alert--info    { border-color: rgba(59,130,246,0.32); background: rgba(59,130,246,0.05); }
.atm-alert--info    .atm-alert-icon { background: rgba(59,130,246,0.14); color: var(--blue); }
.atm-alert--success { border-color: rgba(8,224,164,0.32); background: rgba(8,224,164,0.05); }
.atm-alert--success .atm-alert-icon { background: rgba(8,224,164,0.14); color: var(--green); }
.atm-alert--warning { border-color: rgba(251,191,36,0.32); background: rgba(251,191,36,0.05); }
.atm-alert--warning .atm-alert-icon { background: rgba(251,191,36,0.14); color: var(--yellow); }
.atm-alert--error   { border-color: rgba(255,59,79,0.32);  background: rgba(255,59,79,0.05); }
.atm-alert--error   .atm-alert-icon { background: rgba(255,59,79,0.14); color: var(--red); }

/* ─── Component pool grid (Builder) ─── */
.atm-cmpt-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}
.atm-cmpt-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.10)),
    var(--bg-card);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  cursor: default;
  min-height: 130px;
}
.atm-cmpt-card:hover {
  transform: translateY(-1px);
  border-color: rgba(54,179,126,0.45);
  box-shadow: 0 12px 28px rgba(0,0,0,0.30);
}
.atm-cmpt-card .atm-cmpt-cat {
  font-family: var(--font-mono-pref);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.atm-cmpt-card .atm-cmpt-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
  line-height: 1.2;
}
.atm-cmpt-card .atm-cmpt-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  flex: 1;
}
.atm-cmpt-card .atm-cmpt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.atm-cmpt-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono-pref);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
}
.atm-cmpt-pill[data-priority="now"]    { color: var(--green);  border-color: rgba(8,224,164,0.40);  background: rgba(8,224,164,0.08); }
.atm-cmpt-pill[data-priority="later"]  { color: var(--yellow); border-color: rgba(251,191,36,0.40); background: rgba(251,191,36,0.08); }
.atm-cmpt-pill[data-priority="avoid"]  { color: var(--red);    border-color: rgba(255,59,79,0.40);  background: rgba(255,59,79,0.08); }
.atm-cmpt-pill[data-priority="shipped"]{ color: var(--blue);   border-color: rgba(59,130,246,0.40); background: rgba(59,130,246,0.08); }

/* ─── Reduced motion: disable shimmer + status pulse + card hover lift ─── */
@media (prefers-reduced-motion: reduce) {
  .atm-skel,
  .atm-status-chip[data-state="syncing"] .atm-status-dot,
  .atm-status-chip[data-state="loading"] .atm-status-dot { animation: none !important; }
  .atm-cmpt-card:hover { transform: none; }
}
