/* =============================================================================
   Személyes tudástár (personal-kb-web) — Tokyo Night Dark + Pastel

   A paletta, az elrendezés és az alapelemek (kártya, táblázat, badge, gomb) a k8s-lxbrain-dashboard
   dashboard.css-ének másolata (az pedig a k8s-lxbrain lxbrain.css-éé), hogy a felületek egy rendszernek
   látszódjanak. A saját kiegészítések (űrlap, belépés, válasz, források) a fájl VÉGÉN.
============================================================================= */
:root {
    --bg-page:       #1a1b26;
    --bg-card:       #24283b;
    --bg-header:     #1f2335;
    --bg-row-alt:    #1f2231;
    --bg-row-hover:  #2a2e44;
    --bg-deep:       #16161e;
    --border:        #414868;
    --border-light:  #2a2e44;

    --text:          #c0caf5;
    --text-muted:    #9aa5ce;
    --text-dim:      #6b7394;

    --pastel-cyan:   #7dcfff;
    --pastel-mint:   #9ece6a;
    --pastel-peach:  #e0af68;
    --pastel-red:    #f7768e;
    --pastel-lilac:  #bb9af7;
    --pastel-blue:   #a9b1d6;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    --radius: 8px;
    --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}

a { color: var(--pastel-cyan); text-decoration: none; }
a:hover { color: var(--pastel-lilac); text-decoration: underline; }
code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; color: var(--pastel-blue); }

* { scrollbar-width: thin; scrollbar-color: var(--border) var(--bg-page); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg-page); }
*::-webkit-scrollbar-thumb { background: var(--border); border: 2px solid var(--bg-page); border-radius: 5px; }

/* =============================================================================
   ELRENDEZÉS — bal oldali navigáció + tartalom
============================================================================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 218px; flex: 0 0 218px;
    background: var(--bg-deep);
    border-right: 1px solid var(--border-light);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 16px 18px 14px; border-bottom: 1px solid var(--border-light); }
.sidebar-brand .logo { font-size: 17px; font-weight: 700; letter-spacing: 0.4px; color: var(--pastel-cyan); }
.sidebar-brand .tagline { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.nav-section { padding: 12px 0 4px; }
.nav-link {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 18px;
    color: var(--text-muted); font-size: 13px;
    border-left: 2px solid transparent;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.nav-link:hover { background: var(--bg-row-hover); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--bg-header); color: var(--pastel-cyan); border-left-color: var(--pastel-cyan); }
.nav-icon { width: 16px; text-align: center; opacity: 0.85; }

.sidebar-footer {
    margin-top: auto; padding: 12px 18px;
    border-top: 1px solid var(--border-light);
    font-size: 11.5px; color: var(--text-dim);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 50;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 11px 20px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.topbar-name { font-size: 16px; font-weight: 600; letter-spacing: 0.2px; }
.topbar .subtitle { color: var(--text-muted); font-size: 12px; margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }

/* A voiceassist-kapcsolat jelzője a fejlécben. */
.conn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
        background: var(--bg-header); border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.conn-ok::before   { background: var(--pastel-mint); box-shadow: 0 0 6px var(--pastel-mint); }
.conn-bad::before  { background: var(--pastel-red); }
.conn-bad { color: var(--pastel-red); }

.content { padding: 18px 20px 40px; flex: 1; }

.page-title { font-size: 19px; font-weight: 600; margin-bottom: 14px; }
.page-title:focus { outline: none; }

h3 { font-size: 12.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
     letter-spacing: 0.5px; margin: 16px 0 8px; }

/* =============================================================================
   KÁRTYA, STAT
============================================================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.card > h2, .split-col > h2 {
    font-size: 15px; font-weight: 600; color: var(--text);
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
/* 0.3.2: a Költségek lapon a napi diagram a számla-táblázat mellett, alattuk teljes szélességben a magyarázat (a user
   rajza). Mérve: a számla-táblázat a záró oszloppal 790 px — két oszlop onnan, ahol mellette egy legalább ~440 px-es
   diagram is kifér; alatta egymás alatt. Számla nélkül a diagram a saját kártyájában (ugyanígy max. 760 px).
   0.3.3: a két oszlop egy-egy sötétebb, keretes belső kártya (a user: „egybefolynak”) — a lap háttere, nem a
   --bg-header, mert azon a táblázat fejléce és csíkozása eltűnne. A keret 2 × 15 px-et vesz el: táblázat ≥ 820, diagram
   ≤ 790 (a tartalma ≤ 760), a határ 1620 px. */
.card-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.split-col { min-width: 0; }
.card-split > .split-col {
    background: var(--bg-page); border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); padding: 12px 14px;
}
/* A két fejléc alatti vonal egy magasságban (mérve: gombok nélkül 30,4, gombokkal 33,6 px). */
.card-split > .split-col > h2 { min-height: 34px; }
.split-chart .chart { max-width: 760px; }
@media (min-width: 1620px) {
    .card-split { grid-template-columns: minmax(820px, 1fr) minmax(0, 790px); }
}
.small { font-size: 12px; font-weight: 400; }
.spacer-flex { flex: 1; }

.card-grid {
    display: grid;
    /* 🔴 `min(…, 100%)`: a csupasz minmax szűk képernyőn vízszintes görgetést kényszerítene (lxbrain-lecke, 390 px). */
    grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
    gap: 12px;
}
.stats { margin-bottom: 14px; }
/* 0.5.0: a Költségek lap hat doboza (Ma, Hét, Hónap, Várható, Múlt hónap, Összesen) 6 / 3 / 2 oszlopban — az auto-fill
   1216 px-en 4 + 2-t adott (mérve: 948 px-es rács), így a „Várható” és a „Múlt hónap” külön sorba esett. A csomagoló
   SAJÁT szélességéhez igazodik (container query), mert az oldalsáv miatt a képernyő-szélesség nem mérvadó. */
.stats-wrap { container-type: inline-size; margin-bottom: 14px; }
.stats-wrap > .stats { margin-bottom: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 660px) { .stats-wrap > .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (min-width: 1320px) { .stats-wrap > .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat-flag { font-size: 15px; margin-left: 6px; vertical-align: 2px; }

.stat { background: var(--bg-header); border: 1px solid var(--border-light);
        border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.stat-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 22px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.stat-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-top: 4px;
            font-variant-numeric: tabular-nums; }
.stat-click { cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.stat-click:hover { border-color: var(--border); background: var(--bg-row-hover); }
.stat-selected { border-color: var(--pastel-cyan); }
/* 0.4.1: az összegdoboz appsorai (a user: „téglalap boxokban … ne egy sima táblázatban”; 0.4.0-ban táblázat volt). */
.stat-app { color: var(--text-muted); }
.stat-app > span { white-space: nowrap; }
.total-row td { font-weight: 600; border-top: 1px solid var(--border); }
.app-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }

.meter { height: 6px; border-radius: 3px; background: var(--bg-deep); margin-top: 8px; overflow: hidden; }
.meter-bar { height: 100%; border-radius: 3px; }
.meter-ok   { background: var(--pastel-mint); }
.meter-warn { background: var(--pastel-peach); }
.meter-bad  { background: var(--pastel-red); }

.hint { font-size: 12px; color: var(--text-dim); margin-top: 10px; }
.hint .btn { margin-left: 8px; }

.alert { border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 12px; font-size: 13px; border: 1px solid transparent; }
.alert-bad { background: rgba(247, 118, 142, 0.12); border-color: rgba(247, 118, 142, 0.35); color: var(--pastel-red); }
.alert-warn { background: rgba(224, 175, 104, 0.12); border-color: rgba(224, 175, 104, 0.35); color: var(--pastel-peach); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* =============================================================================
   GOMBOK
============================================================================= */
.btn {
    background: var(--bg-header); color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit; line-height: 1.3;
    cursor: pointer; display: inline-block;
    transition: all 0.12s;
}
.btn:hover:not(:disabled) { background: var(--bg-row-hover); border-color: var(--text-dim); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-on { background: var(--pastel-cyan); color: var(--bg-page); border-color: var(--pastel-cyan); font-weight: 600; }
.btn-on:hover:not(:disabled) { background: var(--pastel-lilac); border-color: var(--pastel-lilac); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* =============================================================================
   TÁBLÁZAT — az lxbrain „szoros” táblázata: minden oszlop a tartalmára zsugorodik, a maradékot a
   szándékosan üres `.spacer` záróoszlop nyeli el (a számok így nem szakadnak el a nevüktől).
============================================================================= */
.table-scroll { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    background: var(--bg-header); color: var(--text-muted);
    text-align: left; font-weight: 600; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: 0.4px;
    padding: 8px 11px; border-bottom: 1px solid var(--border);
}
tbody td { padding: 7px 11px; border-bottom: 1px solid var(--border-light); }
tbody tr:nth-child(even) { background: var(--bg-row-alt); }
tbody tr:hover { background: var(--bg-row-hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-tight th, .table-tight td { width: 1%; white-space: nowrap; }
.table-tight th.spacer, .table-tight td.spacer { width: auto; }
/* Az Árak lap modell-cellája: a forrás a név alatt, tördelhetően — nem a táblázat szélességét adja. */
.table-tight td.model-cell { white-space: normal; min-width: 240px; max-width: 460px; }
/* 0.3.2: a számla Állapot-cellája — hibánál a jelvény és a „lekérve …” két sorba törhet (egyiken belül nem), így a
   tábla a diagram mellett sem szélesedik (egy sorban ~110 px-szel szélesebb lett volna). */
.table-tight td.status-cell { white-space: normal; }
.table-tight td.status-cell > span { white-space: nowrap; }
.model-cell .source { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
td .badge { margin-left: 6px; }

/* =============================================================================
   ÁLLAPOT-JELZŐK
============================================================================= */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
    border: 1px solid transparent; white-space: nowrap;
}
.badge-ok    { background: rgba(158, 206, 106, 0.15); color: var(--pastel-mint);  border-color: rgba(158, 206, 106, 0.35); }
.badge-info  { background: rgba(125, 207, 255, 0.13); color: var(--pastel-cyan);  border-color: rgba(125, 207, 255, 0.30); }
.badge-warn  { background: rgba(224, 175, 104, 0.15); color: var(--pastel-peach); border-color: rgba(224, 175, 104, 0.35); }
.badge-bad   { background: rgba(247, 118, 142, 0.15); color: var(--pastel-red);   border-color: rgba(247, 118, 142, 0.35); }
.badge-muted { background: rgba(107, 115, 148, 0.15); color: var(--text-dim);     border-color: rgba(107, 115, 148, 0.35); }

.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.accent-peach { color: var(--pastel-peach); }
.accent-red   { color: var(--pastel-red); }

/* =============================================================================
   DIAGRAM (inline SVG — BarChart.razor)
============================================================================= */
.chart { container-type: inline-size; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border-light); stroke-width: 1; }
/* Az SVG-n belüli font-size a viewBox (760) EGYSÉGEIBEN értendő, és a diagrammal együtt kicsinyedik — ezért a felirat
   a diagram SAJÁT szélességéhez igazodik (container query), ~10–13 px látszó méretre (a 390 px-es mobilon 319 px → 24). */
.chart-axis { fill: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
@container (max-width: 680px) { .chart-axis { font-size: 15px; } }
@container (max-width: 520px) { .chart-axis { font-size: 18px; } }
@container (max-width: 420px) { .chart-axis { font-size: 24px; } }
/* 0.3.3: mobilon a belső keretben a diagram 289 px (mérve: 24 egységgel 9,1 px-es felirat). */
@container (max-width: 300px) { .chart-axis { font-size: 27px; } }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* =============================================================================
   MOBIL — a navigáció vízszintes sáv a fejléc alatt (három pontnál nem kell fiók)
============================================================================= */
@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: auto; flex: none; height: auto; position: static; flex-direction: row; align-items: center;
               border-right: 0; border-bottom: 1px solid var(--border-light); overflow-x: auto; }
    .sidebar-brand { padding: 10px 14px; border-bottom: 0; }
    .sidebar-brand .tagline, .sidebar-footer { display: none; }
    .nav-section { display: flex; padding: 0; }
    .nav-link { padding: 12px 12px; border-left: 0; border-bottom: 2px solid transparent; }
    .nav-link.active { border-bottom-color: var(--pastel-cyan); }
    .topbar { position: static; padding: 9px 14px; }
    .topbar .subtitle { display: none; }
    .content { padding: 14px 12px 32px; }
    .stat-value { font-size: 19px; }
    /* Mérve 390 px-en: a négy összegkártya egymás alatt az egész első képernyőt elvitte — 2 × 2. */
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .stat { padding: 10px 11px; }
}

/* =============================================================================
   SAJÁT KIEGÉSZÍTÉSEK (personal-kb-web) — űrlap, belépés, válasz, források
============================================================================= */

/* Űrlap-mezők: MINDIG az .input osztály (nem elemtípus-szelektor — a Blazor @bind nem ír `type`-ot, workspace-lecke). */
.input {
    width: 100%;
    background: var(--bg-deep); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px; font-size: 14px; font-family: inherit; line-height: 1.4;
}
.input:focus { outline: none; border-color: var(--pastel-cyan); box-shadow: 0 0 0 2px rgba(125, 207, 255, 0.18); }
.input::placeholder { color: var(--text-dim); }
select.input { width: auto; min-width: 150px; }
textarea.input { resize: vertical; }
.ask-input { min-height: 72px; }
.field-label { display: block; font-size: 12px; color: var(--text-muted); margin: 10px 0 5px; }
.field-label:first-child { margin-top: 0; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-row > .grow { flex: 1 1 260px; width: auto; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.btn-block { display: block; width: 100%; margin-top: 16px; padding: 9px 14px; }
.btn-danger { background: rgba(247, 118, 142, 0.15); color: var(--pastel-red); border-color: rgba(247, 118, 142, 0.45); }
.btn-danger:hover:not(:disabled) { background: rgba(247, 118, 142, 0.28); border-color: var(--pastel-red); }
.alert-ok { background: rgba(158, 206, 106, 0.12); border-color: rgba(158, 206, 106, 0.35); color: var(--pastel-mint); }
.alert-gap { margin-top: 10px; margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }

/* Belépés / kilépés / hibalapok (EmptyLayout) */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 14px; }
.login-card {
    width: 100%; max-width: 380px;
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius);
    padding: 22px 22px 24px; box-shadow: var(--shadow);
}
.login-brand { padding: 0 0 14px; margin-bottom: 16px; }
.login-form { margin-top: 4px; }

/* A válasz és a forrásai */
.answer p { margin: 0 0 10px; line-height: 1.6; }
.answer ul { margin: 0 0 10px 20px; line-height: 1.6; }
.answer li { margin-bottom: 4px; }
.cite { font-size: 12px; font-weight: 600; padding: 0 1px; vertical-align: 1px; }
.citations { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.citation { border-left: 2px solid var(--border); padding: 2px 0 2px 12px; scroll-margin-top: 70px; }
.citation:target { border-left-color: var(--pastel-cyan); }
.citation-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.citation-n { color: var(--pastel-cyan); font-weight: 600; font-variant-numeric: tabular-nums; }
.snippet { color: var(--text-muted); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }

/* Források: a cím-oszlop tördelhető, a többi a tartalmára zsugorodik */
.sources-table td { vertical-align: top; }
.sources-table .title-cell { min-width: 220px; overflow-wrap: anywhere; }

/* Forrás részletei */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin-top: 14px; font-size: 13px; }
.facts dt { color: var(--text-muted); }
.facts dd { min-width: 0; }
.prose { line-height: 1.6; }
.timeline { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.timeline li { display: flex; gap: 10px; align-items: baseline; }
.timeline li > span { min-width: 0; overflow-wrap: anywhere; }
.time-link { flex: 0 0 52px; font-variant-numeric: tabular-nums; }
details > summary { cursor: pointer; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
details[open] > summary { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }

@media (max-width: 860px) {
    .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .facts dd { margin-bottom: 8px; }
    .login-card { padding: 18px 16px 20px; }
}
