/**
 * ACG Legal CRM — global design system (intake + shared primitives)
 * Command center surface styles: acg-os-command-center.css
 */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* ── ACG warm-neutral surfaces ─────────────────── */
  --void: #F7F7F7;
  --bg: #F4F2EC;
  --surface: #FFFFFF;
  --surface-raised: #F7F7F7;
  --card: #FFFFFF;
  --overlay: #F1EEE7;
  --chrome: #FFFFFF;

  --border: rgba(196, 188, 170, 0.45);
  --border-md: rgba(196, 188, 170, 0.75);
  --border-sub: rgba(196, 188, 170, 0.28);
  --border-focus: #A88328;

  --text-0: #191A1A;
  --text-1: #191A1A;
  --text-2: #55524A;
  --text-3: #8F8A7F;

  /* ── ACG Gold — primary CTA / active states (token name kept as --blue) ──────────── */
  --blue: #A88328;
  --blue-bright: #A88328;
  --blue-d: rgba(168, 131, 40, 0.1);
  --blue-dim: rgba(168, 131, 40, 0.15);

  /* ── ACG Gold, muted — secondary accent ──────────── */
  --gold: #9B8553;
  --gold-bright: #BBAC8A;
  --gold-d: rgba(155, 133, 83, 0.1);
  --gold-dim: rgba(155, 133, 83, 0.14);

  --green: #16a34a;
  --green-d: rgba(22, 163, 74, 0.1);
  --green-dim: rgba(22, 163, 74, 0.14);

  --red: #dc2626;
  --red-d: rgba(220, 38, 38, 0.1);

  --purple: #7c3aed;
  --purple-d: rgba(124, 58, 237, 0.1);
  --purple-dim: rgba(124, 58, 237, 0.13);

  --shadow-sm: 0 1px 4px rgba(26, 23, 18, 0.08), 0 0 0 1px rgba(196, 188, 170, 0.35);
  --shadow-md: 0 4px 20px rgba(26, 23, 18, 0.1), 0 0 0 1px rgba(196, 188, 170, 0.25);
  --shadow-lg: 0 12px 48px rgba(26, 23, 18, 0.16);

  --glow-blue: 0 0 0 2px rgba(168, 131, 40, 0.3);
  --glow-gold: 0 0 0 1px rgba(155, 133, 83, 0.25);
  --glow-panel: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  --sidebar-w: 232px;
  --detail-w: 400px;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-orbit: cubic-bezier(0.22, 1, 0.36, 1);

  --font-display: "DM Serif Display", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace;
  --font-ui: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font: var(--font-ui);

  /* Spacing scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* Type scale */
  --text-xs: 10px;
  --text-sm: 12px;
  --text-md: 13px;
  --text-base: 14px;
  --text-lg: 15px;
  --text-xl: 17px;
  --text-2xl: 22px;
  --text-hero: clamp(28px, 2.4vw, 40px);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --dur-fast: 120ms;
  --dur-mid: 220ms;
  --dur-slow: 420ms;
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: var(--font);
  color: var(--text-1);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(168, 131, 40, 0.3);
  color: #0B0B0B;
}

/* ── Reusable primitives (global) ───────────────────────── */
.acg-pr-panel {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 42%), var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), var(--glow-panel);
}

.acg-pr-eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.acg-pr-eyebrow--gold {
  color: var(--gold);
  opacity: 0.85;
}

.acg-pr-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

@keyframes acg-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes acg-pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes acg-scanline {
  0% { background-position: 0 0; }
  100% { background-position: 0 200%; }
}

.acg-pr-enter {
  animation: acg-fade-up var(--dur-slow) var(--ease-orbit) both;
}

.pulsing { animation: acg-pulse-soft 1.8s ease-in-out infinite; }

/* ══════════════════════════════════════════════════════════════
   VIEW CONTAINERS
   ══════════════════════════════════════════════════════════════ */

.view {
  position: fixed;
  inset: 0;
  display: none;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease);
}

.view.active {
  display: flex;
  flex-direction: column;
}

.view.visible {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════════
   INTAKE VIEW
   ══════════════════════════════════════════════════════════════ */

#view-intake {
  align-items: center;
  background: var(--bg);
}

.intake-shell {
  width: 100%;
  max-width: 420px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
  overflow: hidden;
}

.shell {
  width: 100%;
  max-width: 420px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
  overflow: hidden;
}

.header {
  padding: 22px 24px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-sub);
  flex-shrink: 0;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, #A88328 0%, #8C6D1F 100%);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(168, 131, 40, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.logo-text { font-size: 15px; font-weight: 700; color: var(--text-1); letter-spacing: -0.025em; }
.logo-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.progress-wrap { padding: 16px 24px 20px; border-bottom: 1px solid var(--border-sub); }

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.progress-labels span.active { color: var(--blue-bright); }
.progress-labels span.done { color: var(--green); }

.progress-track {
  width: 100%;
  height: 2px;
  background: rgba(196, 188, 170, 0.35);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #8C6D1F 0%, #A88328 100%);
  transition: width 420ms var(--ease-out);
  box-shadow: none;
}

.step-dots { display: flex; gap: 5px; margin-top: 10px; justify-content: center; }

.step-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(196, 188, 170, 0.5);
  transition: all 280ms var(--ease-out);
}

.step-dot.active { background: var(--blue); width: 16px; border-radius: 3px; }
.step-dot.done { background: var(--green); }

.steps-container { flex: 1; position: relative; overflow: hidden; min-height: 500px; }

.step {
  position: absolute;
  inset: 0;
  padding: 0 24px 32px;
  transition: transform 380ms var(--ease), opacity 380ms;
  overflow-y: auto;
}

.step.hidden-right { transform: translateX(100%); opacity: 0; pointer-events: none; }
.step.hidden-left { transform: translateX(-15%); opacity: 0; pointer-events: none; }

.step-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.step-title {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--text-0);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.step-sub {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 30px;
}

.field { margin-bottom: 14px; }

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-label .required { color: var(--blue); font-size: 11px; }

.input, .select, .textarea {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--border-md);
  border-radius: 14px;
  font-family: var(--font);
  font-size: 17px;
  color: var(--text-1);
  outline: none;
  transition: border-color 200ms, box-shadow 200ms, background 200ms;
  -webkit-appearance: none;
}

.input { height: 56px; padding: 0 18px; }
.input::placeholder { color: var(--text-3); font-size: 16px; }

.input:focus, .select:focus, .textarea:focus {
  border-color: #A88328;
  background: rgba(168, 131, 40, 0.04);
  box-shadow: 0 0 0 3px rgba(168, 131, 40, 0.15);
}

.select {
  height: 56px;
  padding: 0 40px 0 18px;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%238585A0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  color-scheme: dark;
}

.select option {
  background-color: #12121a !important;
  color: #e4e4ec !important;
  font-size: 15px;
  padding: 6px 0;
}

.select option:checked {
  background-color: var(--blue) !important;
  color: #ffffff !important;
}

.select optgroup {
  background-color: #0a0a0f !important;
  color: #5c5c6e !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.select optgroup[label*="High"] { color: #7a6528 !important; }
.select optgroup[label*="High"] option {
  background-color: #14120c !important;
  color: var(--gold-bright) !important;
}

.textarea { padding: 14px 16px; height: 120px; resize: none; line-height: 1.5; font-size: 16px; }
.textarea::placeholder { color: var(--text-3); }
.char-count { font-size: 11px; color: var(--text-3); text-align: right; margin-top: 5px; }

.priority-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid;
  margin-top: 10px;
  transition: all 300ms;
}

.priority-badge.high { background: var(--gold-dim); border-color: rgba(155, 133, 83, 0.3); }
.priority-badge.std { background: var(--blue-dim); border-color: rgba(168, 131, 40, 0.3); }
.priority-badge.hidden { display: none; }

.pb-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.priority-badge.high .pb-icon { background: var(--gold-dim); }
.priority-badge.std .pb-icon { background: var(--blue-dim); }

.pb-title { font-size: 14px; font-weight: 600; }
.priority-badge.high .pb-title { color: var(--gold-bright); }
.priority-badge.std .pb-title { color: var(--blue-bright); }
.pb-desc { font-size: 12px; color: var(--text-2); margin-top: 1px; }

.input-group { position: relative; }

.input-prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--text-2);
  pointer-events: none;
}

.input.with-prefix { padding-left: 36px; }

.cta {
  width: 100%;
  height: 58px;
  background: linear-gradient(150deg, #A88328 0%, #8C6D1F 100%);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.015em;
  transition: all 200ms var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
  box-shadow: 0 4px 14px rgba(168, 131, 40, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.cta::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.cta:hover { box-shadow: 0 6px 20px rgba(168, 131, 40, 0.38); transform: translateY(-1px); }
.cta:active { transform: scale(0.975) translateY(0); box-shadow: 0 2px 8px rgba(168, 131, 40, 0.22); }
.cta:disabled {
  background: rgba(196, 188, 170, 0.25);
  color: rgba(26, 23, 18, 0.35);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.cta-ghost {
  width: 100%;
  height: 44px;
  background: none;
  color: var(--text-3);
  border: none;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 15px;
  cursor: pointer;
  margin-top: 8px;
  transition: color 150ms;
}

.cta-ghost:hover { color: var(--text-2); }

.trust-row { display: flex; gap: 16px; justify-content: center; padding: 0 24px; margin-top: 20px; }
.trust-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); }

.confirm-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 52px 28px 44px;
  flex: 1;
  overflow-y: auto;
  animation: acg-fade-up 420ms var(--ease-out) forwards;
}

.confirm-screen.visible { display: flex; }

@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.7; }
}

.confirm-icon-wrap {
  width: 88px;
  height: 88px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 50%;
  border: 1px solid rgba(34, 197, 94, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  position: relative;
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.12);
}

.confirm-icon-wrap::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.04);
  animation: ring-pulse 2.4s ease-in-out infinite;
}

.confirm-title {
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--text-0);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.confirm-sub { font-size: 16px; color: var(--text-2); line-height: 1.6; margin-bottom: 28px; max-width: 300px; }
.confirm-sub strong { color: var(--text-1); font-weight: 600; }

.confirm-card {
  width: 100%;
  background: #F7F7F7;
  border: 1px solid var(--border-md);
  border-radius: 18px;
  padding: 4px 20px;
  margin-bottom: 20px;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

/* Intake confirm rows — keep .cc-* for backwards compatibility */
.cc-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; }
.cc-row + .cc-row { border-top: 1px solid var(--border-sub); }
.cc-key { font-size: 12px; color: var(--text-3); font-weight: 500; }
.cc-val { font-size: 13px; font-weight: 600; color: var(--text-1); }
.cc-val-green { color: #4ade80; }
.cc-val-gold { color: var(--gold-bright); }
.cc-val-mono { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); letter-spacing: 0.03em; }

.response-timer {
  background: linear-gradient(135deg, rgba(168, 131, 40, 0.08) 0%, rgba(168, 131, 40, 0.03) 100%);
  border: 1px solid rgba(168, 131, 40, 0.22);
  border-radius: 16px;
  padding: 20px 24px;
  width: 100%;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: none;
}

.rt-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.rt-value {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--blue-bright);
  line-height: 1;
  letter-spacing: -0.03em;
}

.rt-unit { font-size: 16px; color: var(--text-2); font-family: var(--font); }
.rt-sub { font-size: 13px; color: var(--text-2); margin-top: 8px; }

.new-case-btn {
  width: 100%;
  height: 50px;
  background: rgba(26, 23, 18, 0.04);
  color: var(--text-3);
  border: 1px solid var(--border-md);
  border-radius: 14px;
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  transition: all 160ms;
}

.new-case-btn:hover {
  background: rgba(26, 23, 18, 0.08);
  color: var(--text-2);
  border-color: rgba(168, 131, 40, 0.4);
}

.field-error { font-size: 12px; color: #f87171; margin-top: 5px; display: none; }
.field-error.visible { display: block; }
.input.error { border-color: var(--red) !important; }
.form-section { transition: opacity 200ms; }
