/* ── RESET & ROOT ── */
:root {
  --bg:        #080c18;
  --surface:   #0d1426;
  --surface2:  #111827;
  --border:    #1a2540;
  --border2:   #243050;
  --teal:      #4ECDC4;
  --teal-dim:  rgba(78,205,196,0.12);
  --blue:      #4B7BF5;
  --blue-dim:  rgba(75,123,245,0.12);
  --text:      #e2e8f0;
  --muted:     #64748b;
  --muted2:    #94a3b8;
  --green:     #10b981;
  --orange:    #f59e0b;
  --red:       #ef4444;
  --purple:    #a78bfa;
  --radius:    10px;
  --radius-sm: 6px;
  --topbar-h:  56px;
  --filter-h:  56px;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Sora',sans-serif; background:var(--bg); color:var(--text); min-height:100vh; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:var(--bg); }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:3px; }

/* ══════════════════════════════════════
   AUTH
══════════════════════════════════════ */
#auth-screen {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(ellipse 80% 60% at 50% -10%, rgba(78,205,196,0.08) 0%, transparent 70%);
}
.auth-card {
  width:460px; background:var(--surface); border:1px solid var(--border2);
  border-radius:16px; padding:40px; box-shadow:0 40px 80px rgba(0,0,0,.5);
}
@media (max-width:520px) { .auth-card { width:100%; border-radius:0; border:none; padding:28px 20px; } }

.auth-logo { display:flex; align-items:center; gap:10px; margin-bottom:28px; }
.auth-logo-img { border-radius:8px; }
.auth-logo-name { font-size:18px; font-weight:700; display:block; }
.auth-logo small { color:var(--muted); font-size:12px; }
.auth-card h2 { font-size:22px; font-weight:600; margin-bottom:6px; }
.auth-card > p { color:var(--muted2); font-size:14px; margin-bottom:24px; line-height:1.6; }
.auth-error { color:var(--red); font-size:13px; margin-top:10px; text-align:center; min-height:18px; }

.field { margin-bottom:16px; }
.field label { display:block; font-size:11px; font-weight:600; color:var(--muted2); margin-bottom:5px; letter-spacing:.06em; text-transform:uppercase; }
.field input, .field select {
  width:100%; background:var(--bg); border:1px solid var(--border2); border-radius:var(--radius-sm);
  padding:10px 14px; color:var(--text); font-family:'Sora',sans-serif; font-size:14px; outline:none; transition:border-color .2s;
}
.field input:focus, .field select:focus { border-color:var(--teal); }

.btn-primary {
  width:100%; background:var(--teal); color:#000; border:none; border-radius:var(--radius-sm);
  padding:12px; font-family:'Sora',sans-serif; font-size:15px; font-weight:600; cursor:pointer; transition:opacity .2s;
}
.btn-primary:hover { opacity:.85; }
.btn-primary:disabled { opacity:.4; cursor:not-allowed; }

/* ══════════════════════════════════════
   GROUP PICKER
══════════════════════════════════════ */
#group-picker {
  display:none; min-height:100vh; align-items:center; justify-content:center;
  background:radial-gradient(ellipse 80% 60% at 50% -10%, rgba(78,205,196,0.08) 0%, transparent 70%);
}
.group-picker-card {
  width:520px; background:var(--surface); border:1px solid var(--border2);
  border-radius:16px; padding:40px; box-shadow:0 40px 80px rgba(0,0,0,.5);
}
@media (max-width:560px) { .group-picker-card { width:100%; border-radius:0; padding:24px 16px; } }

#group-list { max-height:340px; overflow-y:auto; display:flex; flex-direction:column; gap:8px; }
.group-loading { display:flex; align-items:center; gap:10px; color:var(--muted2); font-size:13px; padding:16px 0; }

.group-card {
  display:flex; align-items:center; gap:14px; padding:14px 16px;
  border:1px solid var(--border); border-radius:var(--radius);
  cursor:pointer; transition:all .15s; background:var(--bg);
}
.group-card:hover    { border-color:var(--border2); background:rgba(255,255,255,.02); }
.group-card.selected { border-color:var(--teal); background:var(--teal-dim); }
.group-card-avatar {
  width:38px; height:38px; border-radius:8px; overflow:hidden; flex-shrink:0;
  background:var(--teal); display:flex; align-items:center; justify-content:center;
  font-size:16px; font-weight:700; color:#000;
}
.group-card-avatar img { width:100%; height:100%; object-fit:cover; }
.group-card-name { font-size:14px; font-weight:600; }
.group-card-path { font-size:12px; color:var(--muted); margin-top:2px; font-family:'JetBrains Mono',monospace; }

/* ══════════════════════════════════════
   APP SHELL
══════════════════════════════════════ */
#app { display:none; }

/* ── TOPBAR ── */
.topbar {
  height:var(--topbar-h); border-bottom:1px solid var(--border);
  display:flex; align-items:center; padding:0 20px; gap:12px;
  background:var(--surface); position:sticky; top:0; z-index:200;
}
.logo { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.logo-img { border-radius:6px; }
.logo-text { font-size:15px; font-weight:700; }
.logo-sep  { color:var(--border2); }
.logo-sub  { color:var(--muted); font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:200px; }
.topbar-right { margin-left:auto; display:flex; align-items:center; gap:8px; }
.last-updated-text { font-size:11px; color:var(--muted); white-space:nowrap; }
@media (max-width:640px) { .last-updated-text { display:none; } .logo-sub { max-width:120px; } }

.btn-sm {
  background:transparent; border:1px solid var(--border2); color:var(--muted2);
  border-radius:var(--radius-sm); padding:6px 12px; font-family:'Sora',sans-serif;
  font-size:12px; cursor:pointer; transition:all .2s; white-space:nowrap;
}
.btn-sm:hover   { border-color:var(--teal); color:var(--teal); }
.btn-refresh    { background:var(--teal-dim); border-color:var(--teal); color:var(--teal); }
.btn-export     { background:var(--blue-dim); border-color:var(--blue); color:var(--blue); }
.btn-clear      { color:var(--muted); }
.btn-clear:hover { border-color:var(--red); color:var(--red); }
.topbar-icon-btn { padding:6px 10px; }

/* ── FILTER BAR ── */
.filter-bar {
  background:var(--surface2); border-bottom:1px solid var(--border);
  position:sticky; top:var(--topbar-h); z-index:190;
}

/* Mobile toggle button */
.filter-toggle-btn {
  display:none; width:100%; background:transparent; border:none;
  color:var(--muted2); font-family:'Sora',sans-serif; font-size:13px;
  padding:14px 20px; cursor:pointer; text-align:left; align-items:center; gap:8px;
}
.filter-active-badge {
  background:var(--teal); color:#000; border-radius:20px;
  padding:1px 7px; font-size:11px; font-weight:600;
}
.filter-active-badge.hidden { display:none; }

/* Filter panel */
.filter-panel { padding:10px 20px; }

.filter-row {
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
}

.filter-group { display:flex; align-items:center; gap:6px; }
.filter-group label { font-size:11px; color:var(--muted); white-space:nowrap; font-weight:500; }
.filter-group select,
.filter-group input[type="date"] {
  background:var(--bg); border:1px solid var(--border2); color:var(--text);
  border-radius:var(--radius-sm); padding:6px 10px; font-family:'Sora',sans-serif;
  font-size:12px; outline:none; cursor:pointer; transition:border-color .2s;
}
.filter-group select:focus,
.filter-group input[type="date"]:focus { border-color:var(--teal); }
.filter-sep { width:1px; height:22px; background:var(--border); flex-shrink:0; }
.filter-actions { display:flex; gap:6px; margin-left:auto; }

/* ── MOBILE FILTER STYLES ── */
@media (max-width:900px) {
  .filter-toggle-btn { display:flex; }
  .filter-panel {
    display:none; padding:0 16px 16px;
    border-top:1px solid var(--border);
  }
  .filter-panel.open { display:block; }
  .filter-row { flex-direction:column; align-items:stretch; gap:12px; }
  .filter-group { flex-direction:column; align-items:flex-start; gap:4px; }
  .filter-group label { font-size:11px; text-transform:uppercase; letter-spacing:.05em; }
  .filter-group select,
  .filter-group input[type="date"] { width:100%; font-size:14px; padding:10px 12px; }
  .filter-sep { display:none; }
  .filter-actions { margin-left:0; }
  .filter-actions .btn-sm { flex:1; padding:10px; text-align:center; font-size:13px; }
}

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
.main { padding:20px; }
@media (max-width:600px) { .main { padding:12px; } }

/* ── VELOCITY ROW ── */
.velocity-row {
  display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:20px;
}
@media (max-width:800px) { .velocity-row { grid-template-columns:repeat(2,1fr); } }
@media (max-width:400px) { .velocity-row { grid-template-columns:1fr 1fr; gap:8px; } }

.vel-card {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px;
}
.vel-val  { font-family:'JetBrains Mono',monospace; font-size:26px; font-weight:600; line-height:1; }
.vel-label { font-size:10px; color:var(--muted); margin-top:5px; text-transform:uppercase; letter-spacing:.06em; }
.vel-sub   { font-size:11px; color:var(--muted2); margin-top:5px; }

/* ── DEV CARDS ── */
.summary-grid {
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:14px;
  margin-bottom:20px;
}
@media (max-width:1100px) { .summary-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width:800px)  { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width:480px)  { .summary-grid { grid-template-columns: 1fr; } }
.dev-card {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px; cursor:pointer; transition:border-color .2s;
}
.dev-card:hover  { border-color:var(--border2); }
.dev-card.active { border-color:var(--teal); background:var(--teal-dim); }
.dev-card-header { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.dev-avatar {
  width:38px; height:38px; border-radius:50%; flex-shrink:0; overflow:hidden;
  display:flex; align-items:center; justify-content:center; font-size:15px; font-weight:600; color:#000;
}
.dev-avatar img { width:100%; height:100%; object-fit:cover; }
.dev-name  { font-size:14px; font-weight:600; }
.dev-role  { font-size:11px; color:var(--muted); margin-top:1px; font-family:'JetBrains Mono',monospace; }
.dev-stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.stat-val  { font-family:'JetBrains Mono',monospace; font-size:20px; font-weight:600; line-height:1; }
.stat-label { font-size:10px; color:var(--muted); margin-top:2px; text-transform:uppercase; letter-spacing:.05em; }
.progress-bar { height:3px; background:var(--border); border-radius:2px; margin-top:12px; overflow:hidden; }
.progress-fill { height:100%; border-radius:2px; transition:width .5s ease; }

/* ── CHARTS ── */
.charts-row {
  display:grid;
  grid-template-columns: minmax(0,2fr) minmax(0,1fr) minmax(0,1fr);
  gap:14px;
  margin-bottom:20px;
}
/* Large screens — prevent cards from becoming too wide */
@media (min-width:1400px) {
  .charts-row { grid-template-columns: minmax(0,2fr) minmax(0,1fr) minmax(0,1fr); }
}
@media (max-width:1100px) {
  .charts-row { grid-template-columns: 1fr 1fr; }
  .chart-card-wide { grid-column: span 2; }
}
@media (max-width:640px) {
  .charts-row { grid-template-columns: 1fr; }
  .chart-card-wide { grid-column: span 1; }
}

.chart-card {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px;
}
.chart-title { font-size:11px; font-weight:500; color:var(--muted2); text-transform:uppercase; letter-spacing:.05em; margin-bottom:14px; }
.chart-wrap    { position:relative; height:200px; }
.chart-wrap-sm { height:180px; }

/* ── SECTION HEADER ── */
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.section-title  { font-size:14px; font-weight:600; }
.count-badge {
  background:var(--surface2); border:1px solid var(--border); border-radius:20px;
  padding:2px 10px; font-size:11px; color:var(--muted2); font-family:'JetBrains Mono',monospace;
}

/* ── TABLE ── */
.table-wrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; margin-bottom:40px; }
.table-scroll { overflow-x:auto; }

table { width:100%; border-collapse:collapse; min-width:640px; }
thead th {
  padding:10px 14px; text-align:left; font-size:10px; font-weight:600; color:var(--muted);
  text-transform:uppercase; letter-spacing:.06em; border-bottom:1px solid var(--border);
  background:var(--surface2); white-space:nowrap;
}
tbody tr { border-bottom:1px solid var(--border); transition:background .15s; cursor:pointer; }
tbody tr:last-child { border-bottom:none; }
tbody tr:hover { background:rgba(255,255,255,.02); }
tbody tr.expanded-main { background:var(--teal-dim); }
td { padding:10px 14px; font-size:13px; vertical-align:middle; }

.issue-title { font-size:13px; font-weight:500; }
.issue-title small { display:block; font-size:10px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-top:2px; }

/* Badges */
.pts-badge {
  display:inline-flex; align-items:center; justify-content:center;
  width:24px; height:24px; border-radius:6px; font-family:'JetBrains Mono',monospace; font-size:12px; font-weight:600;
}
.pts-1 { background:rgba(16,185,129,.15);  color:#10b981; }
.pts-2 { background:rgba(75,123,245,.15);  color:#4B7BF5; }
.pts-3 { background:rgba(245,158,11,.15);  color:#f59e0b; }
.pts-4 { background:rgba(239,68,68,.15);   color:#ef4444; }
.pts-5 { background:rgba(167,139,250,.15); color:#a78bfa; }

.status-chip {
  display:inline-flex; align-items:center; gap:5px; padding:3px 8px;
  border-radius:20px; font-size:11px; font-weight:500; white-space:nowrap;
}
.status-dot { width:5px; height:5px; border-radius:50%; flex-shrink:0; }

.layer-chip { display:inline-block; padding:2px 8px; border-radius:4px; font-size:11px; font-weight:500; }
.layer-backend  { background:rgba(239,68,68,.1);   color:#f87171; }
.layer-frontend { background:rgba(75,123,245,.1);  color:#60a5fa; }
.layer-mobile   { background:rgba(167,139,250,.1); color:#c4b5fd; }
.layer-other    { background:rgba(100,116,139,.1); color:#94a3b8; }

.time-cell  { font-family:'JetBrains Mono',monospace; font-size:12px; white-space:nowrap; }
.time-over  { color:var(--red); }
.time-under { color:var(--green); }
.time-none  { color:var(--muted); }

.dev-cell { display:flex; align-items:center; gap:7px; }
.dev-cell-avatar {
  width:26px; height:26px; border-radius:50%; flex-shrink:0; overflow:hidden;
  display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:600; color:#000;
}
.dev-cell-avatar img { width:100%; height:100%; object-fit:cover; }
.dev-cell-name { font-size:13px; white-space:nowrap; }

.expand-arrow { color:var(--muted); font-size:10px; text-align:center; user-select:none; width:28px; }

/* ── EXPANDED ROW ── */
.expanded-row td { padding:0; }
.expanded-content { padding:16px 20px; background:var(--bg); border-top:1px solid var(--border); }
.phase-timeline   { display:flex; gap:5px; align-items:stretch; margin-bottom:14px; flex-wrap:wrap; }
.phase-block {
  flex:1; min-width:80px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 10px; text-align:center;
}
.phase-block.current  { border-color:var(--teal); background:var(--teal-dim); }
.phase-block.visited  { border-color:var(--border2); }
.phase-block.unvisited { opacity:.35; }
.phase-name { font-size:9px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; margin-bottom:5px; }
.phase-time { font-family:'JetBrains Mono',monospace; font-size:14px; font-weight:600; color:var(--teal); }
.phase-time.slow { color:var(--orange); }
.phase-time.na   { color:var(--muted); font-size:11px; }
.phase-current-label { font-size:9px; color:var(--teal); margin-top:3px; }
.expand-meta {
  display:flex; gap:20px; font-size:12px; color:var(--muted2); flex-wrap:wrap; align-items:center;
}
.expand-meta strong { color:var(--text); }
.expand-meta a { margin-left:auto; color:var(--teal); text-decoration:none; font-size:12px; }
.expand-meta a:hover { text-decoration:underline; }
.loading-phases { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; padding:8px 0; }
.phases-error { color:var(--red); font-size:12px; }

/* ── EMPTY ── */
.empty { text-align:center; padding:60px 20px; color:var(--muted); }
.empty h3 { font-size:15px; margin-bottom:6px; color:var(--muted2); }

/* ══════════════════════════════════════
   EXPORT MODAL
══════════════════════════════════════ */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.7); display:flex;
  align-items:center; justify-content:center; z-index:500; padding:16px;
}
.modal-overlay.hidden { display:none; }
.modal-card {
  width:460px; background:var(--surface); border:1px solid var(--border2);
  border-radius:14px; overflow:hidden; box-shadow:0 40px 80px rgba(0,0,0,.6);
}
@media (max-width:500px) { .modal-card { width:100%; } }
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 20px; border-bottom:1px solid var(--border);
}
.modal-title { font-size:15px; font-weight:600; }
.modal-close { background:none; border:none; color:var(--muted); cursor:pointer; font-size:16px; padding:4px; }
.modal-close:hover { color:var(--text); }
.modal-body   { padding:20px; }
.modal-footer { padding:16px 20px; border-top:1px solid var(--border); display:flex; gap:10px; justify-content:flex-end; }

.export-option {
  display:flex; align-items:flex-start; gap:12px; padding:12px 14px; border-radius:var(--radius-sm);
  cursor:pointer; transition:background .15s; margin-bottom:6px; border:1px solid var(--border);
}
.export-option:hover { background:rgba(255,255,255,.03); }
.export-option input[type="checkbox"] { margin-top:2px; accent-color:var(--teal); flex-shrink:0; width:15px; height:15px; cursor:pointer; }
.export-option strong { display:block; font-size:13px; margin-bottom:2px; }
.export-option span   { font-size:12px; color:var(--muted2); line-height:1.4; }

/* ══════════════════════════════════════
   LOADING OVERLAY
══════════════════════════════════════ */
#loading {
  position:fixed; inset:0; background:rgba(8,12,24,.92);
  display:flex; flex-direction:column; align-items:center; justify-content:center; z-index:999; gap:14px;
}
#loading.hidden { display:none; }
.load-spinner { width:38px; height:38px; border:3px solid var(--border2); border-top-color:var(--teal); border-radius:50%; animation:spin .8s linear infinite; }
#loading p { color:var(--muted2); font-size:14px; }

/* ── SPINNER ── */
.spinner { width:14px; height:14px; border:2px solid var(--border2); border-top-color:var(--teal); border-radius:50%; animation:spin .6s linear infinite; flex-shrink:0; }
@keyframes spin { to { transform:rotate(360deg); } }
