/* NYU Langone Design Tokens + Shared Styles — Violet ITSM */

:root {
  /* Brand */
  --nyu-purple: #580F8B;
  --nyu-indigo: #8000FF;
  --nyu-deep-purple: #390063;
  --nyu-digital: #B341FF;
  --nyu-text: #53565A;
  --nyu-disabled: #B3B5BA;
  --nyu-gray: #E0E0DE;
  --nyu-gray-50: #F6F6F5;
  --nyu-gray-100: #EFEFEE;
  --nyu-black: #000000;
  --nyu-white: #FFFFFF;

  /* Status */
  --nyu-red: #FF0057;
  --nyu-orange: #FF9400;
  --nyu-mint: #00DCA5;
  --nyu-green: #8CFF00;

  /* Tints */
  --purple-tint: #F4ECFA;
  --purple-tint-2: #E9DAF5;
  --mint-tint: #D9FBF1;
  --orange-tint: #FFEED6;
  --red-tint: #FFDDE8;

  /* Type */
  --font-head: 'Archivo', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Inter', 'Arial', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Surface */
  --surface: #FFFFFF;
  --surface-muted: #F6F6F5;
  --border: #E8E6E3;
  --border-strong: #D4D1CC;

  /* Radii (capsule per brand) */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(57, 0, 99, 0.06);
  --shadow-md: 0 8px 24px rgba(57, 0, 99, 0.08), 0 2px 4px rgba(57, 0, 99, 0.04);
  --shadow-lg: 0 24px 64px rgba(57, 0, 99, 0.18), 0 4px 12px rgba(57, 0, 99, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--nyu-black);
  background: var(--nyu-white);
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
}

/* Buttons — capsule per brand */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}
.btn-primary {
  background: var(--nyu-purple);
  color: var(--nyu-white);
}
.btn-primary:hover { background: var(--nyu-deep-purple); }
.btn-primary:active { background: var(--nyu-deep-purple); transform: translateY(1px); }
.btn-secondary {
  background: var(--nyu-white);
  color: var(--nyu-purple);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { border-color: var(--nyu-purple); background: var(--purple-tint); }
.btn-ghost {
  background: transparent;
  color: var(--nyu-text);
}
.btn-ghost:hover { background: var(--nyu-gray-50); color: var(--nyu-black); }
.btn-danger {
  background: var(--nyu-white);
  color: var(--nyu-red);
  border: 1px solid var(--nyu-red);
}
.btn-danger:hover { background: var(--nyu-red); color: var(--nyu-white); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* Chip / pill */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--nyu-gray-100);
  color: var(--nyu-text);
  line-height: 1.4;
  white-space: nowrap;
}
.chip-mint { background: var(--mint-tint); color: #006B51; }
.chip-orange { background: var(--orange-tint); color: #8A4E00; }
.chip-red { background: var(--red-tint); color: #B00045; }
.chip-purple { background: var(--purple-tint); color: var(--nyu-purple); }
.chip-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--nyu-text); }
.chip-agent { background: var(--nyu-purple); color: var(--nyu-white); }

/* Dot */
.dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}
.dot-pulse {
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Spinning dot ring */
.ring-spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--purple-tint-2);
  border-top-color: var(--nyu-purple);
  animation: spin 900ms linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--nyu-indigo);
  outline-offset: 2px;
}

/* Mono */
.mono { font-family: var(--font-mono); font-feature-settings: 'zero'; }

/* Scrollbar */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--surface); }
.scroll::-webkit-scrollbar-thumb:hover { background: var(--nyu-disabled); }

/* Global app shell */
.app-shell {
  display: grid;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  background: var(--nyu-white);
}

.app-header {
  background: var(--nyu-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
  position: relative;
  z-index: 40;
}

/* NYULH Wordmark */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--nyu-purple);
  line-height: 1;
}
.wordmark .pipe {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  transform: translateY(3px);
}
.wordmark .sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
  color: var(--nyu-text);
}

.violet-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  background: var(--nyu-purple);
  color: var(--nyu-white);
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.violet-badge .dot {
  background: var(--nyu-mint);
}

/* Nav tabs */
.nav-tabs {
  display: flex;
  gap: 2px;
  margin-left: 20px;
}
.nav-tab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--nyu-text);
  border-radius: var(--r-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 120ms ease;
}
.nav-tab:hover { background: var(--nyu-gray-50); color: var(--nyu-black); }
.nav-tab.active { background: var(--purple-tint); color: var(--nyu-purple); font-weight: 600; }

/* Kbd */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 2px 5px;
  background: var(--nyu-white);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--nyu-text);
  line-height: 1;
}

/* Utility */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.p-8 { padding: 8px; } .p-12 { padding: 12px; } .p-16 { padding: 16px; } .p-20 { padding: 20px; } .p-24 { padding: 24px; }

/* Agent plan streaming step */
.plan-step {
  opacity: 0;
  transform: translateY(4px);
  animation: slideIn 320ms ease forwards;
}
@keyframes slideIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Typewriter caret */
.caret {
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--nyu-purple);
  vertical-align: -2px;
  margin-left: 2px;
  animation: blink 900ms steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Tooltip helpers */
.hint {
  font-size: 11px;
  color: var(--nyu-text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Paused state overlay */
.paused-banner {
  background: linear-gradient(90deg, #FFDDE8, #FFEED6);
  border-bottom: 1px solid #FFB7C8;
  color: #B00045;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Fade-in shared across modals, overlays, toasts */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Ripple pulse (box-shadow outward) — for "live/active" dots where a ring is desired.
   Distinct from the scale-based `pulse` used by .dot-pulse. */
@keyframes pulseRipple {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Modal (generic centered dialog) */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(24, 3, 48, 0.55);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 160ms;
}
.modal {
  background: white; border-radius: 16px;
  width: 640px; max-width: 92vw; max-height: 82vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 40px 100px rgba(24, 3, 48, 0.3);
}
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 12px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* Toast (bottom-center notification) */
.toast-wrap {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  z-index: 600; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--nyu-black); color: white;
  padding: 10px 16px; border-radius: 10px; font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 10px 30px rgba(24, 3, 48, 0.2);
  animation: slideUp 200ms ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
