/* ============================================================
   CastorHole — tema dark premium financial intelligence
   Dark only. Accente: teal (actiune/pozitiv-informational),
   amber (risc/avertisment), rosu (critic), verde (pozitiv).
   WCAG AA: contrast text principal ≥ 7:1, secundar ≥ 4.6:1.
   ============================================================ */

:root {
    --bg: #0B1218;
    --bg-deep: #080E13;
    --panel: #111C26;
    --panel-2: #0E1720;
    --panel-3: #15222E;
    --line: #1D2D3D;
    --line-soft: #16232F;
    --text: #D7E3EC;
    --text-strong: #F0F6FA;
    --muted: #8AA0B2;
    --muted-2: #64798A;
    --teal: #2DD4BF;
    --teal-dim: #1FB9A9;
    --teal-bg: #0E2B2C;
    --amber: #F5B041;
    --amber-bg: #2B230F;
    --red: #FF7B72;
    --red-bg: #2A1214;
    --green: #4ADE80;
    --green-bg: #0F2B1E;
    --blue: #7CC4E3;
    --blue-bg: #0F2028;
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 244px;
    --font: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', sans-serif;
    --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14.5px/1.55 var(--font);
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 21px; margin: 0 0 14px; color: var(--text-strong); }
h2 { font-size: 17px; margin: 22px 0 10px; color: var(--text-strong); }
h3 { font-size: 14.5px; margin: 16px 0 8px; color: var(--teal); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 5px; padding: 1px 6px; }
pre { background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
::selection { background: rgba(45, 212, 191, 0.25); }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 3px; }

/* ── Shell: sidebar + continut ─────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-deep);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    z-index: 40;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid var(--line-soft);
}
.sidebar .brand img { width: 36px; height: 36px; }
.sidebar .brand .t { font-weight: 700; font-size: 16.5px; letter-spacing: 0.3px; color: var(--text-strong); }
.sidebar .brand .t span { color: var(--teal); }
.sidebar .brand .s { font-size: 10px; letter-spacing: 1.8px; color: var(--muted-2); text-transform: uppercase; }

.nav { padding: 10px 8px; flex: 1; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; margin: 1px 0;
    border-radius: var(--radius-sm);
    color: var(--muted); font-size: 13.5px; font-weight: 500;
    text-decoration: none;
}
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--teal-bg); color: var(--teal); }
.nav a.active svg { opacity: 1; }
.nav .sep { margin: 10px 12px 6px; font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted-2); }
.nav .badge-count { margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px; border-radius: 10px; padding: 0 6px; min-width: 17px; text-align: center; }

.sidebar .foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted-2); }
.sidebar .foot form { display: inline; }
.sidebar .foot button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.sidebar .foot button:hover { color: var(--red); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(11, 18, 24, 0.92);
    position: sticky; top: 0; z-index: 30;
    backdrop-filter: blur(6px);
}
.topbar h1 { margin: 0; font-size: 17px; }
.topbar .spacer { flex: 1; }
.topbar .clock { font-size: 12px; color: var(--muted-2); }

.content { padding: 20px 22px 40px; max-width: 1560px; width: 100%; }

/* burger pentru mobil */
.burger { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 6px 10px; cursor: pointer; }

/* ── Carduri, grile ────────────────────────────────────────── */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 16px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card .card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card .card-head h2, .card .card-head h3 { margin: 0; }
.card .card-head .spacer { flex: 1; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1280px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

/* stat tiles */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; }
.stat .k { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat .v { font-size: 20px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12px; margin-top: 3px; }

.up { color: var(--green); }
.down { color: var(--red); }
.flat { color: var(--muted); }

/* ── Tabele ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
    text-align: left; padding: 8px 10px; color: var(--muted);
    font-weight: 600; font-size: 12px; letter-spacing: 0.4px;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:hover td { background: rgba(29, 45, 61, 0.25); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl a { font-weight: 600; }

/* ── Formulare ─────────────────────────────────────────────── */
label.fld { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
input, select, textarea {
    width: 100%; margin-top: 4px; padding: 8px 11px;
    border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--panel-2); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0; accent-color: var(--teal); }
label.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13.5px; color: var(--text); cursor: pointer; }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form label.fld { margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 12px 0; padding: 10px 14px; }
legend { color: var(--muted); font-size: 12.5px; padding: 0 6px; }

/* ── Butoane ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--teal); color: #04222B;
    border: 0; border-radius: var(--radius-sm);
    padding: 8px 15px; font-weight: 600; font-size: 13.5px;
    cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--panel-3); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--red-bg); color: var(--red); border: 1px solid #5c2320; }
.btn.warn { background: var(--amber-bg); color: var(--amber); border: 1px solid #5c4a1e; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.lg { padding: 12px 22px; font-size: 15px; }

/* ── Badge-uri si etichete ─────────────────────────────────── */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.teal { background: var(--teal-bg); color: var(--teal); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.gray { background: var(--panel-3); color: var(--muted); }

/* semafor surse */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.green { background: var(--green); }
.dot.yellow { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--muted-2); }

/* nivel de veridicitate stiri */
.verity { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; border: 1px solid transparent; white-space: nowrap; }
.verity.official { background: var(--green-bg); color: var(--green); border-color: #1e5c40; }
.verity.reported { background: #12303f; color: #a5d8f0; border-color: #23566e; }
.verity.analysis { background: var(--panel-3); color: var(--text); border-color: var(--line); }
.verity.rumor { background: var(--amber-bg); color: var(--amber); border-color: #5c4a1e; }
.verity.denied { background: var(--red-bg); color: var(--red); border-color: #5c2320; }

/* ── Feed de stiri ─────────────────────────────────────────── */
.article-row { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.article-row.bare { padding: 0; border-bottom: 0; }
.article-row .art-title { margin: 6px 0 3px; line-height: 1.35; }
.article-row .art-title a { font-weight: 600; color: var(--text-strong); }
.article-row .art-title a:hover { color: var(--teal); }

.news-item {
    position: relative;
    padding: 12px 12px 11px 18px;
    border-bottom: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    transition: background 0.12s ease;
}
.news-item::before {
    content: ""; position: absolute; left: 4px; top: 13px; bottom: 13px;
    width: 3px; border-radius: 3px; background: var(--muted-2);
}
.news-item:hover { background: var(--panel-2); }
.news-item:last-child { border-bottom: 0; }
.news-item[data-verity="official"]::before { background: var(--green); }
.news-item[data-verity="reported"]::before { background: var(--blue); }
.news-item[data-verity="rumor"]::before    { background: var(--amber); }
.news-item[data-verity="denied"]::before    { background: var(--red); }
.news-more { margin-top: 8px; font-size: 12.5px; }
.news-more a { font-weight: 600; }

.testres { display: inline-block; margin-left: 8px; color: var(--muted); }
.testres.ok { color: var(--green); }
.testres.err { color: var(--red); }

/* ── Alerte / flash ────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); padding: 11px 14px; margin: 10px 0; font-size: 13.5px; border: 1px solid; }
.alert.error { background: var(--red-bg); border-color: #5c2320; color: #ff9d97; }
.alert.success { background: var(--green-bg); border-color: #1e5c40; color: #7ce3ae; }
.alert.warning { background: var(--amber-bg); border-color: #5c4a1e; color: #ecc97c; }
.alert.info { background: var(--blue-bg); border-color: #1e455c; color: var(--blue); }

/* ── Scoruri ───────────────────────────────────────────────── */
.score-bar { background: var(--panel-2); border-radius: 20px; height: 8px; overflow: hidden; border: 1px solid var(--line-soft); }
.score-bar > i { display: block; height: 100%; border-radius: 20px; }
.score-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
.score-row .lbl { width: 190px; color: var(--muted); flex-shrink: 0; }
.score-row .score-bar { flex: 1; }
.score-row .val { width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.gauge { text-align: center; padding: 8px 4px; }
.gauge .big { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gauge .cap { font-size: 12px; color: var(--muted); }

/* ── Skeleton loaders ──────────────────────────────────────── */
@keyframes chSkeleton { 0% { opacity: 0.45; } 50% { opacity: 0.85; } 100% { opacity: 0.45; } }
.skeleton { background: var(--panel-3); border-radius: 6px; animation: chSkeleton 1.4s ease-in-out infinite; min-height: 14px; }

/* ── Consola worker ────────────────────────────────────────── */
.console {
    background: var(--bg-deep); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 10px 12px;
    font-family: var(--mono); font-size: 12.3px; line-height: 1.5;
    max-height: 460px; overflow-y: auto;
}
.console .cline { padding: 1px 0; white-space: pre-wrap; word-break: break-word; }
.console .cline .ts { color: var(--muted-2); margin-right: 8px; }
.console .cline.info { color: var(--text); }
.console .cline.debug { color: var(--muted-2); }
.console .cline.success { color: var(--green); }
.console .cline.warning { color: var(--amber); }
.console .cline.error { color: var(--red); }

.progress { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 20px; height: 18px; overflow: hidden; position: relative; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal-dim), var(--teal)); transition: width 0.6s ease; }
.progress .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text-strong); }

/* ── Taburi ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
    padding: 8px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--teal); border-bottom-color: var(--teal); }

/* ── Grafic container ──────────────────────────────────────── */
.chart-box { position: relative; width: 100%; min-height: 220px; }
.chart-box canvas { max-width: 100%; }
.chart-note { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; }

/* ── Empty states ──────────────────────────────────────────── */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .ico { font-size: 30px; margin-bottom: 8px; opacity: 0.6; }
.empty b { color: var(--text); }

.muted { color: var(--muted); font-size: 12.5px; }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex .spacer { flex: 1; }

/* pagina de autentificare */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 700px at 70% -10%, #10222f 0%, var(--bg) 55%); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; }
.auth-card .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-card .logo img { width: 46px; height: 46px; }
.auth-card h1 { font-size: 19px; margin: 0; }
.auth-card .sub { color: var(--muted); font-size: 12.5px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 980px) {
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        transform: translateX(-100%); transition: transform 0.25s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    }
    .sidebar.open { transform: translateX(0); }
    .burger { display: inline-flex; }
    .content { padding: 14px 14px 34px; }
    .topbar { padding: 10px 14px; }
    .score-row .lbl { width: 120px; font-size: 12px; }
    .stat .v { font-size: 17px; }
}
.backdrop { display: none; }
@media (max-width: 980px) {
    .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 35; }
}

/* print: rapoarte exportate */
@media print {
    .sidebar, .topbar, .btn, .burger { display: none !important; }
    body { background: #fff; color: #111; }
    .card { border-color: #ccc; }
}
