:root {
  --ink: #171614;
  --muted: #746f68;
  --line: #e8e4dc;
  --paper: #fbfaf7;
  --white: #fff;
  --accent: #ff5c35;
  --accent-soft: #fff0ea;
  --green: #1d8d62;
  --green-soft: #e9f7f0;
  --yellow: #b57a00;
  --yellow-soft: #fff7dc;
  --red: #d53a37;
  --red-soft: #ffebe8;
  --shadow: 0 20px 60px rgba(31, 25, 18, .11);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: #978f84; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #fff0e8 0, transparent 28%), radial-gradient(circle at 82% 80%, #eaf6ef 0, transparent 26%), #f6f3ed; }
.login-card { width: min(480px, 100%); padding: 48px; border: 1px solid #e1dbd1; border-radius: 32px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.login-card h1 { margin: 14px 0; font-family: Georgia, serif; font-size: clamp(38px, 6vw, 58px); font-weight: 500; line-height: 1.02; letter-spacing: -.035em; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; color: white; background: var(--ink); font-weight: 900; letter-spacing: -.06em; box-shadow: 0 10px 24px #17161433; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 13px; box-shadow: none; }
.field { display: grid; gap: 8px; margin: 26px 0 14px; color: #5e5952; font-size: 13px; font-weight: 700; }
.field input, .field textarea, .field select, select { width: 100%; border: 1px solid #dcd6cd; border-radius: 12px; padding: 12px 13px; color: var(--ink); background: white; outline: none; }
.field input:focus, .field textarea:focus, select:focus { border-color: #8f8375; box-shadow: 0 0 0 3px #8f83751d; }
.button { border: 0; border-radius: 12px; padding: 12px 17px; font-weight: 800; }
.button-primary { width: 100%; color: white; background: var(--ink); }
.button-secondary { color: var(--ink); background: #f0ede7; }
.button-danger { color: var(--red); background: var(--red-soft); }
.form-error { min-height: 20px; color: var(--red); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px; color: #eee9df; background: #1d1b18; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand span:last-child { display: grid; gap: 2px; }
.brand small { color: #9e978e; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; border: 0; border-radius: 11px; padding: 12px 13px; color: #aaa39a; background: transparent; text-align: left; font-size: 13px; font-weight: 700; }
.nav-item span { width: 18px; color: #777169; text-align: center; }
.nav-item:hover, .nav-item.active { color: white; background: #302d28; }
.nav-item.active span { color: #ff8a69; }
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; padding: 18px 8px 0; border-top: 1px solid #37332e; }
.sidebar-foot a, .text-button { border: 0; padding: 0; color: #9e978e; background: transparent; font-size: 12px; text-decoration: none; text-align: left; }
.main { min-width: 0; }
.topbar { min-height: 100px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 34px; border-bottom: 1px solid var(--line); background: rgba(251,250,247,.9); backdrop-filter: blur(14px); }
.topbar h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions select { width: auto; padding: 9px 34px 9px 12px; font-size: 12px; font-weight: 700; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #cce8da; border-radius: 999px; padding: 8px 11px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 800; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #1d8d621a; }
.content { padding: 30px 34px 70px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 18px; }
.section-head h3 { margin: 0; font-size: 18px; }
.section-head p { margin: 5px 0 0; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel { border: 1px solid var(--line); background: var(--white); box-shadow: 0 7px 28px rgba(34,28,22,.04); }
.metric-card { min-height: 138px; padding: 20px; border-radius: 18px; }
.metric-label { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.metric-value { margin: 18px 0 4px; font-size: 34px; font-weight: 850; letter-spacing: -.05em; }
.metric-note { color: #9a938a; font-size: 11px; }
.panel { margin-top: 18px; padding: 22px; border-radius: 20px; }
.panel-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; }
.funnel { display: grid; gap: 10px; margin-top: 22px; }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 12px; font-size: 12px; font-weight: 700; }
.funnel-track { height: 10px; overflow: hidden; border-radius: 999px; background: #f0ede7; }
.funnel-fill { height: 100%; min-width: 3px; border-radius: inherit; background: linear-gradient(90deg, #ff8a69, var(--accent)); }
.issue-list { display: grid; gap: 10px; margin-top: 16px; }
.issue { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #fdfcf9; }
.issue-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--yellow); }
.issue.high .issue-dot { background: var(--red); }
.issue strong { display: block; font-size: 13px; }
.issue p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 8px; color: #655f57; background: #f0ede7; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.badge.high { color: var(--red); background: var(--red-soft); }
.badge.medium { color: var(--yellow); background: var(--yellow-soft); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: white; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #8c857c; background: #faf8f4; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; text-align: left; }
th, td { padding: 13px 14px; border-bottom: 1px solid #efebe5; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffaf7; }
.path { max-width: 330px; overflow: hidden; color: #3f3a35; text-overflow: ellipsis; }
.cell-action { border: 0; border-radius: 9px; padding: 7px 9px; color: #5a5047; background: #f2eee8; font-size: 11px; font-weight: 800; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 125px; padding: 9px 30px 9px 11px; font-size: 11px; }
.empty { display: grid; place-items: center; min-height: 240px; color: var(--muted); text-align: center; }
.empty strong { display: block; margin-bottom: 7px; color: var(--ink); }
.journey { display: flex; align-items: center; overflow: auto; padding: 26px 8px 12px; }
.journey-step { min-width: 150px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.journey-step strong { display: block; margin: 8px 0 3px; font-size: 24px; }
.journey-arrow { padding: 0 12px; color: #b3aaa0; }
.change-layout { display: grid; grid-template-columns: minmax(270px, .65fr) 1.35fr; gap: 18px; }
.change-form { margin: 0; }
.change-form .field { margin: 0 0 14px; }
.change-form textarea { min-height: 90px; resize: vertical; }
.change-card { padding: 18px 0; border-bottom: 1px solid var(--line); }
.change-card:first-child { padding-top: 0; }
.change-card:last-child { border-bottom: 0; }
.change-title { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.change-title h4 { margin: 0; }
.change-title p { margin: 5px 0 0; }
.compare { display: grid; grid-template-columns: 1fr 28px 1fr; gap: 8px; align-items: center; margin-top: 14px; }
.compare-box { padding: 12px; border-radius: 12px; background: #f7f4ee; font-size: 11px; }
.compare-box strong { display: block; margin-top: 5px; font-size: 18px; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(19,17,14,.67); backdrop-filter: blur(8px); }
.modal-card { position: relative; width: min(1120px, 100%); max-height: calc(100vh - 48px); overflow: hidden; border-radius: 24px; background: var(--paper); box-shadow: 0 35px 100px #0006; }
.modal-card > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); background: white; }
.modal-card h2 { margin: 0; }
.modal-body { max-height: calc(100vh - 145px); overflow: auto; padding: 22px 24px 30px; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; color: #625b53; background: #f0ede7; font-size: 25px; }
.session-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.summary-chip { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.summary-chip span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.summary-chip strong { display: block; margin-top: 5px; font-size: 13px; }
.replay-controls { display: flex; align-items: center; gap: 10px; margin: 15px 0 10px; }
.replay-stage, .heatmap-stage { position: relative; width: 100%; min-height: 560px; overflow: hidden; border: 1px solid #d8d1c8; border-radius: 16px; background: linear-gradient(#f9f6f1 1px, transparent 1px), linear-gradient(90deg,#f9f6f1 1px,transparent 1px), white; background-size: 30px 30px; }
.replay-stage iframe, .heatmap-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: white; pointer-events: none; }
.replay-cursor { position: absolute; z-index: 4; width: 20px; height: 20px; border: 3px solid white; border-radius: 50%; background: var(--accent); box-shadow: 0 3px 12px #0006; transform: translate(-50%, -50%); transition: left .12s linear, top .12s linear; }
.replay-cursor.rage { width: 34px; height: 34px; background: #e73531aa; }
.heatmap-stage canvas { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; }
.timeline { margin-top: 18px; border-left: 2px solid #e6e0d7; }
.timeline-row { position: relative; display: grid; grid-template-columns: 90px 130px 1fr; gap: 12px; padding: 9px 0 9px 18px; font-size: 11px; }
.timeline-row::before { content: ''; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border: 2px solid var(--paper); border-radius: 50%; background: #a79f95; }
.timeline-row.rage_tap::before, .timeline-row.dead_click::before { background: var(--red); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 360px; padding: 13px 17px; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; }
.skeleton { min-height: 120px; border-radius: 18px; background: linear-gradient(90deg,#f0ede7 25%,#faf8f4 37%,#f0ede7 63%); background-size: 400% 100%; animation: shine 1.4s ease infinite; }
@keyframes shine { to { background-position: -100% 0; } }
@media (max-width: 1050px) { .cards { grid-template-columns: repeat(2, 1fr); } .panel-grid, .change-layout { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 15px; }
  .brand { padding-bottom: 12px; }
  nav { display: flex; overflow: auto; }
  .nav-item { min-width: max-content; }
  .sidebar-foot { display: none; }
  .topbar { align-items: flex-start; padding: 20px; }
  .live-pill { display: none; }
  .content { padding: 20px; }
  .cards { grid-template-columns: 1fr; }
  .session-summary { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; border-radius: 0; }
  .replay-stage, .heatmap-stage { min-height: 480px; }
}
