:root {
    --ink: #e8e8f0;
    --muted: #9898b8;
    --line: #2a2a5a;
    --surface: #161636;
    --wash: #0a0a1a;
    --accent: #6c5ce7;
    --accent-soft: #2b285d;
    --good: #00b894;
    --amber: #d69a22;
    --low: #3a3a5a;
    --shadow: 0 4px 20px #00000040;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--wash);
    color: var(--ink);
    font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, a, select { font: inherit; }
button, a { cursor: pointer; }
a:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid #a29bfe; outline-offset: 2px; }

.topbar {
    align-items: center;
    background: #111128;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 22px;
    height: 64px;
    padding: 0 clamp(18px, 4vw, 56px);
}

.brand {
    align-items: center;
    color: var(--ink);
    display: flex;
    font-weight: 760;
    gap: 9px;
    text-decoration: none;
}

.brand-mark {
    align-items: center;
    background: var(--accent);
    border-radius: 6px;
    color: #fff;
    display: inline-flex;
    font-size: 11px;
    height: 28px;
    justify-content: center;
    letter-spacing: 0;
    width: 28px;
}

.readonly { color: var(--muted); font-size: 12px; margin-right: auto; }
.status-dot { background: var(--good); border-radius: 50%; display: inline-block; height: 7px; margin-right: 6px; width: 7px; }

.button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    display: inline-flex;
    gap: 8px;
    padding: 9px 13px;
    text-decoration: none;
    white-space: nowrap;
}

.primary { background: var(--accent); color: #fff; }
.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button:hover { filter: brightness(1.1); }

.app-shell { margin: auto; max-width: 1240px; padding: 36px clamp(18px, 4vw, 56px) 60px; }
.project-bar { align-items: flex-end; display: flex; gap: 24px; justify-content: space-between; margin-bottom: 26px; }
.kicker { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: 0; margin: 0 0 5px; text-transform: uppercase; }
h1, h2 { letter-spacing: 0; margin: 0; }
h1 { font-size: 26px; }
.domain { color: var(--muted); font-size: 14px; font-weight: 450; margin-left: 10px; }
.project-meta { color: var(--muted); display: flex; flex-wrap: wrap; font-size: 12px; gap: 8px 18px; }

.tabs { border-bottom: 1px solid var(--line); display: flex; gap: 25px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 700; padding: 12px 2px; }
.tab.active { border-bottom-color: var(--accent); color: var(--ink); }
.status-message { color: var(--muted); font-size: 12px; padding: 14px 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 24px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
#reports.panel { background: transparent; border: 0; box-shadow: none; padding: 0; }

.metrics { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); margin-bottom: 34px; }
.metric { border-right: 1px solid var(--line); padding: 4px 18px 4px 0; }
.metric:last-child { border: 0; }
.metric span, .metric small { color: var(--muted); display: block; }
.metric strong { display: block; font-size: 28px; letter-spacing: 0; margin: 6px 0; }
.metric small { font-size: 12px; }
.unit { color: var(--muted); font-size: 14px; }
.positive { color: var(--good) !important; }

.section-heading { align-items: center; display: flex; gap: 16px; justify-content: space-between; margin-bottom: 18px; }
.section-heading h2 { font-size: 18px; }
.select-label { color: var(--muted); font-size: 12px; }
.select-label select { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; color: var(--ink); margin-left: 6px; padding: 7px; }

.heatmap-scroll { max-width: 100%; overflow-x: auto; }
.heatmap { display: grid; gap: 5px; grid-template-columns: minmax(155px, 1.7fr) repeat(7, minmax(44px, 1fr)); min-width: 680px; }
.heat-cell, .heat-label, .heat-date { min-height: 38px; padding: 9px 8px; }
.heat-date { color: var(--muted); font-size: 11px; text-align: center; }
.heat-label { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-cell { border-radius: 4px; color: #fff; font-size: 12px; font-weight: 750; text-align: center; }
.excellent { background: #007f73; }
.good { background: #236b72; }
.watch { background: var(--amber); }
.low { background: var(--low); color: var(--ink); }

.legend { color: var(--muted); display: flex; flex-wrap: wrap; font-size: 11px; gap: 14px; margin-top: 16px; }
.swatch { border-radius: 3px; display: inline-block; height: 10px; margin-right: 5px; vertical-align: -1px; width: 10px; }
.legend .excellent { background: #007f73; }
.legend .good { background: #236b72; }
.legend .watch { background: var(--amber); }
.legend .low { background: var(--low); }

.pill { border-radius: 999px; font-size: 12px; padding: 5px 9px; }
.positive-bg { background: #123e3d; color: #3ee0c7; }
.dynamics-list { border-top: 1px solid var(--line); }
.dynamics-list > div { align-items: center; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 70px 1fr 150px; padding: 15px 5px; }
.dynamics-list strong { color: var(--good); font-size: 20px; }
.dynamics-list small { color: var(--muted); }

.export-actions { display: flex; gap: 8px; }
.report-row { align-items: center; background: #111128; border: 1px solid var(--line); border-radius: 6px; display: grid; gap: 14px; grid-template-columns: 1fr 180px 50px; margin-bottom: 8px; padding: 14px 16px; text-align: left; width: 100%; }
.report-row.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.report-row small { color: var(--muted); display: block; margin-top: 3px; }
.report-type { color: var(--muted); font-size: 12px; }
.report-ready { color: var(--good); font-size: 12px; font-weight: 700; }

.demo-footer { border-top: 1px solid var(--line); color: var(--muted); display: flex; font-size: 12px; justify-content: space-between; padding: 16px clamp(18px, 4vw, 56px); }
.demo-footer a { color: #bcb5ff; }

.report-page { background: #fff; color: #17212b; }
.report-sheet { margin: auto; max-width: 920px; padding: 52px 30px; }
.report-head { align-items: flex-start; border-bottom: 2px solid #17212b; display: flex; justify-content: space-between; padding-bottom: 22px; }
.report-head a { color: #17212b; }
.report-head h1 { margin: 5px 0; }
.report-head p { color: #667482; }
.report-page .secondary { background: #fff; border-color: #dce3e8; color: #17212b; }
.report-summary { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); margin: 28px 0; }
.report-summary div { background: #f4f7f8; padding: 15px; }
.report-summary span, .report-summary strong { display: block; }
.report-summary span { color: #667482; font-size: 12px; }
.report-summary strong { font-size: 23px; margin-top: 5px; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid #dce3e8; padding: 12px 8px; text-align: left; }
th { color: #667482; font-size: 11px; text-transform: uppercase; }
.report-note { color: #667482; font-size: 12px; margin-top: 28px; }

@media (max-width: 700px) {
    .topbar { gap: 10px; }
    .brand span:last-child { display: none; }
    .readonly { font-size: 11px; }
    .app-shell { padding-top: 24px; }
    .project-bar { align-items: flex-start; display: block; }
    .project-meta { margin-top: 12px; }
    .metrics { gap: 18px; grid-template-columns: repeat(2, 1fr); margin-bottom: 26px; }
    .metric { border: 0; padding: 0; }
    .heatmap { font-size: 11px; }
    .heat-cell, .heat-label, .heat-date { padding: 8px 3px; }
    .heat-label { font-size: 11px; }
    .section-heading { align-items: flex-start; display: block; }
    .select-label { display: block; margin-top: 12px; }
    .export-actions { margin-top: 12px; }
    .dynamics-list > div { grid-template-columns: 54px 1fr; }
    .dynamics-list small { grid-column: 2; }
    .report-row { grid-template-columns: 1fr 50px; }
    .report-type { display: none; }
    .demo-footer { display: block; }
    .demo-footer a { display: block; margin-top: 8px; }
    .report-sheet { padding: 24px 16px; }
    .report-summary { grid-template-columns: 1fr; }
    .report-head .button { font-size: 0; }
    .report-head .button::before { content: "Print"; font-size: 14px; }
    table { font-size: 12px; }
    th:nth-child(2), td:nth-child(2) { display: none; }
}

@media print {
    .report-page .button { display: none; }
    .report-sheet { max-width: none; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
