/* ════════════════════════════════════════════════════════════════════════
   dev-dashboard.css — unified Developer Dashboard (dev view landing)
   ------------------------------------------------------------------------
   A full sidebar-shell dashboard that replaces the old dev landing: a left
   tool rail (future-proof registry) + a live content area. Ships Performance,
   Console, Insights and Permissions tools. Cosmic-glass per UI.md, GSAP-
   animated, reduced-motion safe, light-theme aware.
   Prefix: .dd-*    Owns: #tab-dev
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --dd-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ── Hide the website's left side nav while the dev dashboard is up ─────────── */
/* (the dev dashboard has its own rail — the site nav with Messages/Calendar/…
   is redundant here). Reclaim the freed width so the dashboard goes full-bleed. */
body.dd-active #side-nav-v2,
body.dd-active .sidenav-edge-toggle { display: none !important; }
body.dd-active .dept-dashboard { padding-left: 0 !important; }
body.dd-active .dept-dashboard #main-nav { margin-left: 0 !important; padding-left: 0 !important; }

/* ── Shell ─────────────────────────────────────────────────────────────────── */
.dd-root {
  display: flex;
  gap: 16px;
  min-height: calc(100vh - 190px);
  font-family: var(--font-body);
  color: var(--text-primary);
}
@media (prefers-reduced-motion: no-preference) {
  .dd-anim .dd-card,
  .dd-anim .dd-side-item { animation: dd-rise 0.5s var(--ease-out, cubic-bezier(0.16,1,0.3,1)) both; }
}
@keyframes dd-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ── Sidebar / tool rail ───────────────────────────────────────────────────── */
.dd-side {
  flex: 0 0 232px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(56,189,248,0.08), transparent 55%),
    rgba(9, 14, 30, 0.72);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  position: sticky;
  top: 12px;
  align-self: flex-start;
  max-height: calc(100vh - 24px);
  overflow: auto;
}
html[data-theme="light"] .dd-side { background: rgba(255,255,255,0.78); }

.dd-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 14px; }
.dd-brand-mark {
  width: 38px; height: 38px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px;
  border: 1px solid rgba(56,189,248,0.4);
  background: radial-gradient(120% 120% at 30% 20%, rgba(56,189,248,0.3), rgba(129,140,248,0.12));
  color: var(--accent-cyan);
}
@media (prefers-reduced-motion: no-preference) { .dd-brand-mark svg { animation: dd-spin 14s linear infinite; } }
@keyframes dd-spin { to { transform: rotate(360deg); } }
.dd-brand-txt b { display: block; font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.1; }
.dd-brand-txt span { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-cyan); }

.dd-side-group { font-size: 9.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); padding: 14px 10px 6px; }

.dd-side-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px;
  border-radius: 11px;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: transparent;
  transition: color var(--t-base) var(--ease-out), background var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.dd-side-item svg { flex-shrink: 0; width: 17px; height: 17px; opacity: 0.85; }
.dd-side-item:hover { color: var(--text-primary); background: var(--glass-1); transform: translateX(2px); }
.dd-side-item.is-active {
  color: #fff;
  background: linear-gradient(100deg, rgba(56,189,248,0.18), rgba(129,140,248,0.12));
  border-color: rgba(56,189,248,0.4);
  box-shadow: inset 0 0 16px rgba(56,189,248,0.1);
}
html[data-theme="light"] .dd-side-item.is-active { color: var(--text-primary); }
.dd-side-item.is-active svg { opacity: 1; color: var(--accent-cyan); }
.dd-side-item .dd-side-badge {
  margin-left: auto; font-family: var(--dd-mono);
  font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: rgba(52,211,153,0.16); color: var(--accent-emerald);
  border: 1px solid rgba(52,211,153,0.3);
}
.dd-side-badge.is-crit { background: rgba(251,113,133,0.16); color: var(--accent-rose); border-color: rgba(251,113,133,0.32); }

.dd-side-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid var(--glass-border); display: grid; gap: 7px; }
.dd-side-stat { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.dd-side-stat .k { color: var(--text-dim); font-weight: 600; letter-spacing: 0.04em; }
.dd-side-stat .v { font-family: var(--dd-mono); font-weight: 700; color: var(--text-secondary); }
.dd-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); display: inline-block; margin-right: 6px; }
@media (prefers-reduced-motion: no-preference) { .dd-live-dot { animation: dd-pulse 2s ease-in-out infinite; } }
@keyframes dd-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

/* ── Main column ───────────────────────────────────────────────────────────── */
.dd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.dd-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(129,140,248,0.1), transparent 55%),
    rgba(9, 14, 30, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
html[data-theme="light"] .dd-topbar { background: rgba(255,255,255,0.72); }
.dd-topbar-ic {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 13px; border: 1px solid var(--glass-border-2);
  background: var(--glass-1); color: var(--accent-cyan);
}
.dd-topbar-tt { flex: 1; min-width: 0; }
.dd-topbar-tt h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.dd-topbar-tt p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.dd-topbar-meta { display: flex; gap: 10px; flex-shrink: 0; }
.dd-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--glass-border); background: var(--glass-1);
  font-family: var(--dd-mono); font-size: 12px; font-weight: 700; color: var(--text-secondary);
}
.dd-chip .lbl { color: var(--text-dim); font-family: var(--font-body); font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.dd-chip.is-lite { border-color: rgba(251,191,36,0.4); color: var(--accent-amber); }
.dd-chip.is-full { border-color: rgba(52,211,153,0.35); color: var(--accent-emerald); }

.dd-content { flex: 1; min-width: 0; }

/* FPS-trend sparkline under the gauge */
.dd-spark-wrap { margin-top: 10px; }
.dd-spark-cap { display: block; text-align: center; font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin-top: 3px; }

/* ── Cards & grid ──────────────────────────────────────────────────────────── */
.dd-grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.dd-col-3  { grid-column: span 3; }
.dd-col-4  { grid-column: span 4; }
.dd-col-5  { grid-column: span 5; }
.dd-col-6  { grid-column: span 6; }
.dd-col-7  { grid-column: span 7; }
.dd-col-8  { grid-column: span 8; }
.dd-col-12 { grid-column: span 12; }
@media (max-width: 1100px) {
  .dd-col-3, .dd-col-4, .dd-col-5 { grid-column: span 6; }
  .dd-col-6, .dd-col-7, .dd-col-8 { grid-column: span 12; }
}
@media (max-width: 720px) { .dd-grid > * { grid-column: span 12; } .dd-side { display: none; } }

.dd-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(56,189,248,0.05), transparent 50%),
    rgba(13, 19, 38, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px 17px;
  overflow: hidden;
  transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
html[data-theme="light"] .dd-card { background: rgba(255,255,255,0.7); }
.dd-card:hover { border-color: var(--glass-border-2); box-shadow: 0 12px 34px rgba(0,0,0,0.32); }
.dd-card-h { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.dd-card-h svg { color: var(--accent-cyan); flex-shrink: 0; }
.dd-card-h h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-secondary); }
.dd-card-h .dd-tag { margin-left: auto; font-family: var(--dd-mono); font-size: 11px; font-weight: 700; color: var(--text-dim); }
/* always-visible plain-language explainer — the "understand what I'm looking at" line */
.dd-explain { font-size: 11.5px; line-height: 1.5; color: var(--text-dim); margin: 0 0 12px; }
.dd-explain b { color: var(--text-muted); font-weight: 600; }

.dd-bignum { font-family: var(--dd-mono); font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.dd-bignum small { font-size: 14px; font-weight: 600; opacity: 0.6; margin-left: 3px; }
.dd-sub { font-size: 11px; color: var(--text-muted); margin-top: 5px; }

/* mini stat tiles */
.dd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.dd-tile { padding: 11px 12px; border-radius: 12px; border: 1px solid var(--glass-border); background: var(--glass-1); }
.dd-tile .k { font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.dd-tile .v { font-family: var(--dd-mono); font-size: 19px; font-weight: 700; margin-top: 5px; color: var(--text-primary); }

/* ── Gauge + sparkline ─────────────────────────────────────────────────────── */
.dd-gauge { width: 100%; max-width: 190px; height: auto; display: block; margin: 0 auto; }
.dd-gauge-track { stroke: rgba(255,255,255,0.08); stroke-width: 9; }
.dd-gauge-arc { stroke-width: 9; transition: stroke-dashoffset 0.5s var(--ease-out), stroke 0.4s ease; filter: drop-shadow(0 0 6px currentColor); }
.dd-gauge-needle { stroke-width: 2.4; transition: all 0.4s var(--ease-spring, cubic-bezier(0.34,1.56,0.64,1)); }
.dd-gauge-hub { fill: var(--text-secondary); }
.dd-gauge-val { font-family: var(--dd-mono); font-size: 23px; font-weight: 700; }
.dd-gauge-unit { font-size: 9px; font-weight: 700; letter-spacing: 0.14em; fill: var(--text-dim); }
.dd-verdict { text-align: center; margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

.dd-spark { width: 100%; height: 48px; display: block; }
.dd-spark-area { opacity: 0.16; transition: fill 0.4s ease; }
.dd-spark-line { stroke-width: 2; transition: stroke 0.4s ease; }

/* segmented load timeline */
.dd-timeline { display: flex; flex-direction: column; gap: 8px; }
.dd-tl-seg { position: relative; height: 30px; border-radius: 8px; background: var(--glass-1); overflow: hidden; display: flex; align-items: center; padding: 0 11px; }
.dd-tl-seg::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); border-radius: 8px; opacity: 0.85; transition: width 0.6s var(--ease-out); }
.dd-tl-seg.is-ttfb::before { background: linear-gradient(90deg, var(--accent-cyan), transparent); }
.dd-tl-seg.is-fcp::before  { background: linear-gradient(90deg, var(--accent-teal), transparent); }
.dd-tl-seg.is-dcl::before  { background: linear-gradient(90deg, var(--accent-violet), transparent); }
.dd-tl-seg.is-load::before { background: linear-gradient(90deg, var(--accent-purple), transparent); }
.dd-tl-seg span { position: relative; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; color: var(--text-secondary); }
.dd-tl-seg b { position: relative; margin-left: auto; font-family: var(--dd-mono); font-size: 12px; }

/* donut + legend */
.dd-donut-wrap { display: flex; align-items: center; gap: 18px; }
.dd-donut { width: 116px; height: 116px; flex-shrink: 0; }
.dd-donut-seg { transition: stroke-dashoffset 0.7s var(--ease-out); }
.dd-legend { flex: 1; display: grid; gap: 6px; min-width: 0; }
.dd-legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.dd-legend-row i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.dd-legend-row .k { color: var(--text-muted); text-transform: capitalize; }
.dd-legend-row .v { margin-left: auto; font-family: var(--dd-mono); font-weight: 700; color: var(--text-secondary); }

/* waterfall (slowest assets) */
.dd-wf { display: grid; gap: 8px; }
.dd-wf-row { display: grid; grid-template-columns: 150px 1fr 58px; align-items: center; gap: 10px; }
.dd-wf-name { font-family: var(--dd-mono); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-wf-bar-wrap { height: 9px; border-radius: 5px; background: var(--glass-1); overflow: hidden; }
.dd-wf-bar { display: block; height: 100%; border-radius: 5px; width: var(--w, 0%); transition: width 0.6s var(--ease-out); }
.dd-wf-ms { font-family: var(--dd-mono); font-size: 12px; font-weight: 700; text-align: right; }

/* ── Insights rows ─────────────────────────────────────────────────────────── */
.dd-rows { display: grid; gap: 2px; }
.dd-row { display: grid; grid-template-columns: 160px 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--glass-border); }
.dd-row:last-child { border-bottom: none; }
.dd-row-k { font-size: 12px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 7px; }
.dd-row-k svg { color: var(--accent-cyan); flex-shrink: 0; }
.dd-row-v { font-family: var(--dd-mono); font-size: 13px; color: var(--text-primary); word-break: break-word; }
.dd-row-v .dd-pill { font-family: var(--font-body); }
.dd-row-x { display: block; font-family: var(--font-body); font-size: 11px; color: var(--text-dim); margin-top: 4px; line-height: 1.5; }
.dd-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.dd-pill.ok   { background: rgba(52,211,153,0.16); color: var(--accent-emerald); }
.dd-pill.warn { background: rgba(251,191,36,0.16); color: var(--accent-amber); }
.dd-pill.bad  { background: rgba(251,113,133,0.16); color: var(--accent-rose); }
.dd-pill.info { background: rgba(56,189,248,0.16); color: var(--accent-cyan); }

/* storage bars */
.dd-storage { display: grid; gap: 9px; }
.dd-stor-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.dd-stor-name { font-family: var(--dd-mono); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-stor-bar { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: var(--glass-1); overflow: hidden; margin-top: -3px; }
.dd-stor-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet)); width: var(--w, 0%); transition: width 0.6s var(--ease-out); }
.dd-stor-size { font-family: var(--dd-mono); font-size: 11.5px; font-weight: 700; color: var(--text-secondary); }

/* ── Console ───────────────────────────────────────────────────────────────── */
.dd-console { display: flex; flex-direction: column; height: calc(100vh - 250px); min-height: 420px; }
.dd-con-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.dd-con-filter {
  font-family: var(--font-body); font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em;
  padding: 6px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--glass-border); background: var(--glass-1); color: var(--text-muted);
  transition: all var(--t-base) var(--ease-out);
}
.dd-con-filter:hover { color: var(--text-primary); border-color: var(--glass-border-2); }
.dd-con-filter.is-on { background: rgba(56,189,248,0.16); border-color: rgba(56,189,248,0.4); color: var(--accent-cyan); }
.dd-con-filter .ct { font-family: var(--dd-mono); opacity: 0.7; margin-left: 4px; }
.dd-con-search {
  flex: 1; min-width: 130px;
  font-family: var(--dd-mono); font-size: 12px;
  padding: 7px 12px; border-radius: 9px;
  border: 1px solid var(--glass-border); background: var(--glass-1); color: var(--text-primary);
  outline: none;
}
.dd-con-search:focus { border-color: rgba(56,189,248,0.45); }
.dd-con-clear { padding: 6px 12px; border-radius: 9px; border: 1px solid var(--glass-border); background: var(--glass-1); color: var(--text-muted); cursor: pointer; font-size: 11.5px; font-weight: 700; transition: all var(--t-base) var(--ease-out); }
.dd-con-clear:hover { color: var(--accent-rose); border-color: rgba(251,113,133,0.4); }

.dd-con-scroll {
  flex: 1; overflow: auto;
  border-radius: 12px; border: 1px solid var(--glass-border);
  background: rgba(4, 7, 16, 0.6);
  font-family: var(--dd-mono); font-size: 12.5px; line-height: 1.55;
  padding: 6px 0;
}
html[data-theme="light"] .dd-con-scroll { background: rgba(248,250,255,0.7); }
.dd-con-line { display: flex; gap: 10px; padding: 3px 14px; border-left: 2px solid transparent; white-space: pre-wrap; word-break: break-word; }
.dd-con-line:hover { background: rgba(255,255,255,0.03); }
.dd-con-line.lvl-error { border-left-color: var(--accent-rose); background: rgba(251,113,133,0.06); color: #fecdd3; }
.dd-con-line.lvl-warn  { border-left-color: var(--accent-amber); background: rgba(251,191,36,0.05); color: #fde68a; }
.dd-con-line.lvl-info  { border-left-color: var(--accent-cyan); }
.dd-con-line.lvl-cmd   { border-left-color: var(--accent-violet); color: var(--accent-purple); }
.dd-con-line.lvl-result{ border-left-color: rgba(255,255,255,0.18); color: var(--text-muted); }
.dd-con-time { color: var(--text-dim); flex-shrink: 0; opacity: 0.6; font-size: 11px; }
.dd-con-arrow { flex-shrink: 0; opacity: 0.7; }
.dd-con-msg { flex: 1; min-width: 0; }
.dd-con-empty { padding: 30px; text-align: center; color: var(--text-dim); font-family: var(--font-body); }

.dd-con-input-wrap { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--glass-border-2); background: rgba(4,7,16,0.7); }
.dd-con-input-wrap:focus-within { border-color: rgba(129,140,248,0.5); box-shadow: 0 0 0 3px rgba(129,140,248,0.12); }
.dd-con-prompt { color: var(--accent-violet); font-family: var(--dd-mono); font-weight: 700; flex-shrink: 0; }
.dd-con-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text-primary); font-family: var(--dd-mono); font-size: 13px; padding: 12px 0; }
.dd-con-run { flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-dim); border: 1px solid var(--glass-border); border-radius: 6px; padding: 3px 8px; background: var(--glass-1); }

/* ── Hosted legacy panes (overview + board relocated into the shell) ───────── */
.dd-legacy { width: 100%; }
/* the original pane carries its own big "DEVELOPER MODE / Site Dashboard" header
   and the inner-tab nav — redundant now the shell provides chrome, so hide. */
.dd-content .dev-page-header,
.dd-content .dv-inner-nav { display: none !important; }
/* let the relocated panes fill the content column instead of their own max-width */
.dd-content #dv-pane-overview,
.dd-content #dv-pane-board {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  width: 100% !important;
  animation: none !important;
}

/* delegated-tool host (permissions) */
.dd-host { min-height: 200px; }
.dd-empty-note { padding: 28px; text-align: center; color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.dd-empty-note button { margin-top: 12px; }
.dd-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 9px 16px; border-radius: 10px;
  border: 1px solid rgba(56,189,248,0.4); background: rgba(56,189,248,0.12);
  color: var(--accent-cyan); font-family: var(--font-body); font-size: 13px; font-weight: 700;
  transition: all var(--t-base) var(--ease-out);
}
.dd-btn:hover { background: rgba(56,189,248,0.2); transform: translateY(-1px); }

/* ── Light-theme gap fills ─────────────────────────────────────────────────
   The shell surfaces (side/topbar/card/console-scroll) already have light
   overrides above; these cover the leaks left behind: a dark console-input
   bar, an invisible gauge track, a harsh black card shadow, and the pastel
   log-line text that washes out on the white console. */
html[data-theme="light"] .dd-con-input-wrap { background: rgba(248,250,255,0.8); }
html[data-theme="light"] .dd-card:hover { box-shadow: 0 12px 34px rgba(80,90,160,0.16); }
html[data-theme="light"] .dd-gauge-track { stroke: rgba(130,100,200,0.20); }
html[data-theme="light"] .dd-con-line:hover { background: rgba(15,23,42,0.03); }
html[data-theme="light"] .dd-con-line.lvl-error { color: #b91c1c; background: rgba(220,38,38,0.06); }
html[data-theme="light"] .dd-con-line.lvl-warn  { color: #b45309; background: rgba(217,119,6,0.06); }
html[data-theme="light"] .dd-con-line.lvl-result { border-left-color: var(--glass-border-3); }
