/* VedaProfile - DataVedas theme tokens */
:root, html[data-theme="dark"] {
  --bg: #14161a;
  --bg-soft: #1b1e24;
  --panel: #1e222a;
  --ink: #e8e6e1;
  --ink-dim: #a09c94;
  --border: #2e333d;
  --accent: #e8792b;
  --accent-dim: rgba(232, 121, 43, 0.65);
  --accent-soft: rgba(232, 121, 43, 0.12);
  --hover: rgba(232, 121, 43, 0.07);
  --shadow: rgba(0, 0, 0, 0.4);
  --ok: #4caf7d;
  --warn: #d9a13b;
  --bad: #d96b5b;
  --chart-muted: #5a6270;
}
html[data-theme="light"] {
  --bg: #faf8f5;
  --bg-soft: #f1eee9;
  --panel: #ffffff;
  --ink: #23211e;
  --ink-dim: #6d675e;
  --border: #ddd7cd;
  --accent: #c9611a;
  --accent-dim: rgba(201, 97, 26, 0.6);
  --accent-soft: rgba(201, 97, 26, 0.10);
  --hover: rgba(201, 97, 26, 0.06);
  --shadow: rgba(60, 50, 30, 0.15);
  --ok: #2e8f5f;
  --warn: #a8721c;
  --bad: #b34a3a;
  --chart-muted: #b9b2a6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, sans-serif; line-height: 1.55; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: var(--bg-soft); border-bottom: 1px solid var(--border);
}
.brand, a.brand { font-weight: 700; letter-spacing: 0.02em; color: var(--ink); white-space: nowrap; }
a.brand:hover { text-decoration: none; color: var(--ink); }
.brand .lens { color: var(--accent); }
.topbar .ds-name { flex: 1; text-align: center; font-size: 0.92rem; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn {
  background: transparent; color: var(--ink);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 13px; font-size: 0.85rem; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }

/* landing */
.landing { max-width: 900px; margin: 0 auto; padding: 60px 24px 80px; }
.landing h1 { font-size: 2.2rem; margin: 0 0 6px; }
.landing .tagline { color: var(--ink-dim); font-size: 1.05rem; margin-bottom: 40px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { margin: 0; font-size: 1.1rem; }
.card p { margin: 0; color: var(--ink-dim); font-size: 0.9rem; flex: 1; }
.card .btn { align-self: flex-start; }
.privacy {
  margin-top: 44px; padding: 16px 20px; border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px; color: var(--ink-dim); font-size: 0.9rem;
}

/* studio layout */
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.main { padding: 26px 30px 120px; min-height: 100vh; }
.methods {
  position: sticky; top: 58px; max-height: calc(100vh - 58px); overflow-y: auto;
  padding: 22px 22px 60px; background: var(--bg-soft); border-left: 1px solid var(--border);
  min-height: calc(100vh - 58px);
}
.methods h5, .main h5 { margin: 0 0 10px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; }
.methods .control { margin-bottom: 20px; }
.methods label { display: block; font-size: 0.85rem; margin: 4px 0; cursor: pointer; }
.methods select, .methods input[type="number"] {
  background: var(--bg); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-family: inherit;
}
.methods .explain { color: var(--ink-dim); font-size: 0.8rem; margin-top: 6px; line-height: 1.5; }
.methods .explain em { color: var(--accent); font-style: normal; font-weight: 600; }

/* overview */
.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-tile { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.stat-tile .v { font-size: 1.5rem; font-weight: 650; }
.stat-tile .l { color: var(--ink-dim); font-size: 0.78rem; }
.quality { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; margin-bottom: 26px; }
.quality .score { font-size: 1.6rem; font-weight: 700; }
.quality .formula { color: var(--ink-dim); font-size: 0.82rem; margin-top: 6px; font-family: Consolas, monospace; }
.quality .parts { color: var(--ink-dim); font-size: 0.82rem; margin-top: 4px; }
.q-good { color: var(--ok); } .q-mid { color: var(--warn); } .q-bad { color: var(--bad); }

/* column cards */
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.col-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.col-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.col-head .name { font-weight: 650; font-size: 1.02rem; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 0.7rem; padding: 2px 9px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
.badge.b-cat { background: rgba(79,156,240,0.14); color: #4f9cf0; }
html[data-theme="light"] .badge.b-cat { color: #2b6cb0; background: rgba(43,108,176,0.1); }
.badge.b-dt { background: rgba(76,175,125,0.14); color: var(--ok); }
.badge.b-flat { background: var(--bg-soft); color: var(--ink-dim); }
.col-head select { background: var(--bg); color: var(--ink-dim); border: 1px solid var(--border); border-radius: 6px; font-size: 0.75rem; padding: 2px 4px; }
.reason { color: var(--ink-dim); font-size: 0.78rem; font-style: italic; margin: 2px 0 10px; }
.col-body { display: grid; grid-template-columns: 1fr 170px; gap: 14px; align-items: start; }
.col-body.full { grid-template-columns: 1fr; }
.stats-table { width: 100%; font-size: 0.8rem; border-collapse: collapse; }
.stats-table td { padding: 1.5px 4px; border-bottom: 1px solid var(--border); }
.stats-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table tr.hl td { color: var(--accent); }
.stats-table.half { max-width: 640px; }
.warn-note { color: var(--warn); font-size: 0.78rem; margin-top: 8px; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-cap { color: var(--ink-dim); font-size: 0.72rem; text-align: center; margin-top: 2px; }

/* tabs */
.tabs { display: flex; gap: 6px; margin: 4px 0 18px; border-bottom: 1px solid var(--border); }
.tab-btn {
  background: transparent; color: var(--ink-dim); border: 0; border-bottom: 2px solid transparent;
  padding: 8px 16px; font-size: 0.92rem; cursor: pointer; font-family: inherit;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* relationships + quality */
.rel-section { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.rel-controls { margin-bottom: 12px; font-size: 0.88rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rel-controls label { cursor: pointer; }
.rel-controls select, .rel-controls input[type="number"] { background: var(--bg); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-family: inherit; }
.muted-note { color: var(--ink-dim); font-size: 0.82rem; margin-top: 8px; line-height: 1.5; }
.heat-scroll { overflow-x: auto; }
.heat { border-collapse: collapse; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.heat th { padding: 4px 8px; color: var(--ink-dim); font-weight: 500; text-align: right; max-width: 110px; overflow: hidden; }
.heat td { padding: 5px 10px; border: 1px solid var(--bg); text-align: center; cursor: pointer; min-width: 46px; }
.heat td.diag { color: var(--ink-dim); cursor: default; }
.heat td:hover:not(.diag) { outline: 2px solid var(--accent); }
.heat.ct td { cursor: default; }
.heat.ct td:hover { outline: none; }
.detail-card { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.detail-title { font-weight: 650; margin-bottom: 8px; }
.detail-card svg { max-width: 620px; width: 100%; height: auto; display: block; margin-bottom: 10px; }
.chart-pt { fill: var(--accent); opacity: 0.45; }
.chart-fit { stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 6 3; }

/* svg chart text */
.chart-label { font-family: Georgia, serif; font-size: 10px; fill: var(--ink-dim); }
.chart-axis { stroke: var(--chart-muted); stroke-width: 1; }
.chart-bar { fill: var(--accent); opacity: 0.85; }
.chart-bar:hover { opacity: 1; }
.chart-box { stroke: var(--accent); fill: var(--accent-soft); stroke-width: 1.5; }
.chart-line { stroke: var(--accent); stroke-width: 1.5; }
.chart-dot { fill: var(--bad); }

/* improvement round 1: chips, modal, details, ladder, score table */
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 2px; }
.alert-chip {
  font-size: 0.7rem; padding: 1px 8px; border-radius: 9px; cursor: default;
  border: 1px solid var(--border); color: var(--ink-dim);
}
.alert-chip.a-warn { border-color: var(--warn); color: var(--warn); }
.alert-chip.a-bad { border-color: var(--bad); color: var(--bad); }
.alert-chip.a-flat { border-color: var(--border); color: var(--ink-dim); }
.expand-btn { padding: 2px 9px; font-size: 0.72rem; }
.score-table { font-size: 0.82rem; border-collapse: collapse; margin-top: 8px; }
.score-table td { padding: 1px 14px 1px 0; color: var(--ink-dim); }
.score-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
details.fine { margin-top: 6px; }
details.fine summary {
  cursor: pointer; color: var(--accent); font-size: 0.78rem;
  list-style: none; user-select: none;
}
details.fine summary::before { content: "▸ "; }
details.fine[open] summary::before { content: "▾ "; }
details.fine .explain, details.fine .formula { color: var(--ink-dim); font-size: 0.8rem; line-height: 1.5; margin-top: 4px; }
.modal-mask {
  position: fixed; inset: 0; background: var(--shadow); z-index: 80;
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px;
}
.modal-mask.open { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  width: min(760px, 96vw); max-height: calc(100vh - 80px); overflow-y: auto; padding: 18px 22px 30px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-weight: 650; }
.heat.ladder th { min-width: 0; padding: 3px 7px; }
.heat.ladder td { cursor: default; min-width: 0; padding: 4px 7px; }
.heat.ladder td:hover { outline: none; }
.heat.ladder td.jump { background: var(--accent-soft); color: var(--accent); font-weight: 650; outline: 1px solid var(--accent); }
.chart-kde { fill: none; stroke: var(--accent); stroke-width: 1.8; }

/* the story (M3) */
.finding-row { border-left-width: 4px; border-left-style: solid; border-left-color: var(--border); }
.finding-row.f-high { border-left-color: var(--bad); }
.finding-row.f-note { border-left-color: var(--warn); }
.finding-row.f-info { border-left-color: var(--border); }
.finding-title { font-weight: 650; font-size: 1.0rem; margin-bottom: 4px; }
.finding-row p { margin: 4px 0 8px; font-size: 0.92rem; }
.sev-tag { font-size: 0.68rem; padding: 1px 8px; border-radius: 9px; text-transform: uppercase; letter-spacing: 0.05em; vertical-align: middle; }
.sev-tag.t-high { background: rgba(217,107,91,0.15); color: var(--bad); }
.sev-tag.t-note { background: rgba(217,161,59,0.15); color: var(--warn); }
.sev-tag.t-info { background: var(--bg-soft); color: var(--ink-dim); }
.rule-line { color: var(--ink-dim); font-size: 0.74rem; font-family: Consolas, monospace; margin-bottom: 8px; }
.ev-btn { padding: 3px 11px; font-size: 0.78rem; }

/* responsive */
@media (max-width: 1000px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .methods { position: static; min-height: 0; max-height: none; border-left: 0; border-top: 2px solid var(--accent); }
  .col-grid { grid-template-columns: 1fr; }
}
