/* ─────────────────────────────────────────────────────────────
   Session Replay – bright design system
   Color palette: indigo-600 primary, violet accent, clean white bg
   ───────────────────────────────────────────────────────────── */
:root {
  /* palette */
  --c-bg:        #f6f7fb;
  --c-surface:   #ffffff;
  --c-surface-2: #f1f2f8;
  --c-border:    #e4e6f0;
  --c-border-strong: #c8cbe0;

  --c-primary:   #4f46e5;
  --c-primary-h: #4338ca;
  --c-primary-lt:#eef2ff;
  --c-primary-text: #ffffff;

  --c-violet:    #7c3aed;
  --c-violet-lt: #f5f3ff;

  --c-green:     #059669;
  --c-green-lt:  #ecfdf5;
  --c-red:       #dc2626;
  --c-red-lt:    #fef2f2;
  --c-amber:     #d97706;
  --c-amber-lt:  #fffbeb;
  --c-blue:      #2563eb;
  --c-blue-lt:   #eff6ff;

  --c-text:      #111827;
  --c-text-2:    #374151;
  --c-muted:     #6b7280;
  --c-muted-lt:  #9ca3af;

  /* typography */
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.1), 0 2px 6px rgba(0,0,0,.06);
}

/* ── reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.2; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; line-height: 1.6; }
pre, code { font-family: var(--mono); }

/* ── layout ── */
.app-wrap { min-height: 100vh; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: 700px; margin: 0 auto; padding: 0 1.25rem; }
.container-xs { max-width: 460px; margin: 0 auto; padding: 0 1.25rem; }

/* ── topbar / nav ── */
.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  height: 60px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: -.01em;
  color: var(--c-text);
  text-decoration: none;
}
.brand-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-violet));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .75rem; font-weight: 900;
}
.nav-actions { display: flex; align-items: center; gap: .5rem; }
.nav-user {
  font-size: .82rem;
  color: var(--c-muted);
  padding: .3rem .65rem;
  background: var(--c-surface-2);
  border-radius: 999px;
  border: 1px solid var(--c-border);
}

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--font); font-weight: 600; font-size: .875rem;
  padding: .55rem 1.1rem; border-radius: var(--radius-sm);
  border: 1.5px solid transparent; cursor: pointer;
  transition: all .15s ease; text-decoration: none; white-space: nowrap;
  line-height: 1;
}
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-h); border-color: var(--c-primary-h); text-decoration: none; color: #fff; }
.btn-ghost { background: transparent; color: var(--c-text-2); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-surface-2); text-decoration: none; color: var(--c-text); }
.btn-danger { background: var(--c-red); color: #fff; border-color: var(--c-red); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; text-decoration: none; color: #fff; }
.btn-sm { font-size: .8rem; padding: .35rem .75rem; }
.btn-lg { font-size: 1rem; padding: .75rem 1.6rem; border-radius: var(--radius); }
.btn-icon { padding: .5rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── cards ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.25rem; }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
  gap: 1rem;
}
.card-header h2, .card-header h3, .card-header h4 { margin: 0; }
.card-body { padding: 1.25rem; }

/* ── KPI strip ── */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--c-border); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; }
.kpi-cell { background: var(--c-surface); padding: 1.1rem 1.25rem; }
.kpi-label { font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--c-muted); margin-bottom: .35rem; }
.kpi-value { font-size: 1.65rem; font-weight: 800; color: var(--c-text); line-height: 1; }
.kpi-value.good { color: var(--c-green); }
.kpi-value.warn { color: var(--c-amber); }
.kpi-value.bad { color: var(--c-red); }

/* ── badges ── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 700; padding: .2rem .55rem;
  border-radius: 999px; letter-spacing: .02em; text-transform: uppercase;
}
.badge-live { background: #fef2f2; color: var(--c-red); border: 1px solid #fecaca; }
.badge-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c-red); animation: pulse 1.5s infinite; }
.badge-ended { background: var(--c-surface-2); color: var(--c-muted); border: 1px solid var(--c-border); }
.badge-ok { background: var(--c-green-lt); color: var(--c-green); border: 1px solid #a7f3d0; }
.badge-warn { background: var(--c-amber-lt); color: var(--c-amber); border: 1px solid #fcd34d; }
.badge-info { background: var(--c-blue-lt); color: var(--c-blue); border: 1px solid #93c5fd; }

@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.4} }

/* ── table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); padding: .75rem 1rem; border-bottom: 2px solid var(--c-border); text-align: left; white-space: nowrap; }
.data-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover { background: var(--c-primary-lt); }

/* ── forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--c-text-2); margin-bottom: .4rem; }
.form-input {
  width: 100%; padding: .6rem .85rem; font-size: .9rem; font-family: var(--font);
  background: var(--c-surface); border: 1.5px solid var(--c-border); border-radius: var(--radius-sm);
  color: var(--c-text); transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.form-input::placeholder { color: var(--c-muted-lt); }
.form-error { color: var(--c-red); font-size: .83rem; margin-top: .35rem; }

/* ── code block ── */
.code-block {
  background: #1e1e2e; color: #cdd6f4;
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  font-family: var(--mono); font-size: .82rem; line-height: 1.6;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  border: 1px solid #313244;
}

/* ── tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--c-border); margin-bottom: 1rem; }
.tab-btn {
  padding: .6rem 1.1rem; font-size: .86rem; font-weight: 600; color: var(--c-muted);
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; cursor: pointer; transition: all .15s;
}
.tab-btn.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-btn:hover:not(.active) { color: var(--c-text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── status dot ── */
.status-row { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-live { background: var(--c-red); box-shadow: 0 0 0 4px rgba(220,38,38,.15); animation: pulse 1.5s infinite; }
.dot-ended { background: var(--c-muted-lt); }
.dot-warn { background: var(--c-amber); }

/* ── misc ── */
.text-muted { color: var(--c-muted); }
.text-sm { font-size: .85rem; }
.mono { font-family: var(--mono); font-size: .82rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; }
.divider { border: none; border-top: 1px solid var(--c-border); margin: 1.25rem 0; }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--c-muted); }
.empty-state h3 { color: var(--c-text); }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h2 { margin: 0; }
.back-link { font-size: .83rem; color: var(--c-muted); display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .75rem; }
.back-link:hover { color: var(--c-text); text-decoration: none; }
.flex { display: flex; align-items: center; }
.gap-sm { gap: .5rem; }
.gap { gap: 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px,1fr)); gap: 1rem; }

/* ── progress bar ── */
.progress-bar { width: 100%; height: 6px; background: var(--c-border); border-radius: 999px; overflow: hidden; margin-top: .75rem; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--c-primary), var(--c-violet)); border-radius: 999px; transition: width .4s ease; }

/* ── issue item ── */
.issue-item { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem .9rem; border: 1px solid var(--c-border); border-radius: var(--radius-sm); margin-bottom: .5rem; background: var(--c-surface); transition: box-shadow .15s; }
.issue-item:hover { box-shadow: var(--shadow-sm); }
.sev-high { border-left: 3px solid var(--c-red); }
.sev-medium { border-left: 3px solid var(--c-amber); }
.sev-low { border-left: 3px solid var(--c-blue); }
.issue-type { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); margin-bottom: .15rem; }
.issue-detail { font-size: .875rem; color: var(--c-text-2); }
.issue-time { font-size: .8rem; color: var(--c-muted); white-space: nowrap; font-family: var(--mono); }

/* ── telemetry ── */
.tele-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: .6rem; margin: .75rem 0; }
.tele-cell { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: .65rem .8rem; }
.tele-cell .lbl { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); }
.tele-cell .val { font-size: 1.15rem; font-weight: 800; margin-top: .2rem; color: var(--c-text); }
.tele-cell .val.red { color: var(--c-red); }
.tele-cell .val.amber { color: var(--c-amber); }
.tele-list-item { padding: .6rem .8rem; border: 1px solid var(--c-border); border-radius: var(--radius-sm); font-size: .83rem; margin-bottom: .4rem; background: var(--c-surface); font-family: var(--mono); }

/* ── onboarding steps ── */
.step-indicator { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5rem; }
.step-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--c-primary); color: #fff; font-size: .72rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

/* ── sidebar dashboard layout ── */
.dash-layout {
  display: flex;
  min-height: 100vh;
  background: var(--c-bg);
}
.sidebar {
  width: 224px;
  min-height: 100vh;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--c-border);
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-brand span.brand-icon { flex-shrink: 0; }
.sidebar-brand-name { font-weight: 800; font-size: .9rem; color: var(--c-text); }
.sidebar-nav { flex: 1; padding: .75rem 0; }
.nav-section-title {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--c-muted-lt);
  padding: .85rem 1.1rem .3rem;
}
.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1.1rem; font-size: .875rem; font-weight: 500;
  color: var(--c-text-2); text-decoration: none; cursor: pointer;
  border-radius: 0; transition: background .12s, color .12s;
  position: relative;
}
.nav-item:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.nav-item.active {
  background: var(--c-primary-lt); color: var(--c-primary); font-weight: 700;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--c-primary); border-radius: 0 2px 2px 0;
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}
.sidebar-user { font-size: .78rem; color: var(--c-muted); margin-bottom: .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* main area */
.dash-main {
  margin-left: 224px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.dash-topbar {
  height: 58px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 80;
  box-shadow: var(--shadow-sm);
}
.dash-topbar-left { display: flex; align-items: center; gap: .75rem; }
.dash-topbar-right { display: flex; align-items: center; gap: .75rem; }

/* site switcher */
.site-switcher-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--c-surface-2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: .35rem .65rem .35rem .5rem;
  cursor: pointer;
  min-width: 200px;
  max-width: 320px;
  transition: border-color .15s;
}
.site-switcher-wrap:focus-within { border-color: var(--c-primary); }
.site-switcher-globe { font-size: 1rem; flex-shrink: 0; }
.site-switcher {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  color: var(--c-text);
  cursor: pointer;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
.site-switcher option { font-weight: 500; }
.site-switcher-arrow { color: var(--c-muted); font-size: .7rem; flex-shrink: 0; }

.dash-page-title {
  font-size: .82rem; font-weight: 700; color: var(--c-muted);
  letter-spacing: .03em; text-transform: uppercase;
}

/* dash content */
.dash-content { flex: 1; padding: 1.5rem; }

/* mobile */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .dash-main { margin-left: 0; }
}

/* ── landing ── */
.hero { text-align: center; padding: 5rem 1rem 4rem; }
.hero h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); letter-spacing: -.03em; line-height: 1.1; background: linear-gradient(135deg, var(--c-text), var(--c-primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-sub { font-size: 1.125rem; color: var(--c-muted); max-width: 560px; margin: 1rem auto 2rem; line-height: 1.6; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 1.5rem; margin: 3rem 0; }
.feature-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.feature-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--c-primary-lt); color: var(--c-primary); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; margin-bottom: 1rem; }
.feature-card h4 { margin-bottom: .4rem; }
.feature-card p { color: var(--c-muted); font-size: .9rem; margin: 0; }

/* ── auth ── */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--c-primary-lt) 0%, var(--c-bg) 60%); padding: 2rem 1rem; }
.auth-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
.auth-card h2 { margin-bottom: .25rem; }
