/*
 * Látogatószámláló – admin felület stíluskészlet.
 *
 * Egyetlen forrás az admin oldalak megjelenéséhez: design tokenek, elrendezés
 * és újrahasznosítható komponensek. A nézetek csak ezeket az osztályokat
 * használják, saját inline stílust nem definiálnak.
 */

/* ------------------------------------------------------------------ tokenek */

:root {
    --bg: #fbfbfa;
    --surface: #ffffff;
    --surface-2: #f4f4f2;
    --surface-3: #ebeae6;
    --line: #e4e3de;
    --line-strong: #d3d2cc;
    --ink: #1a1a19;
    --ink-2: #6c6b66;
    --ink-3: #97968f;
    --accent: #2f56c8;
    --accent-soft: #eef2fd;
    --ok: #1d7a4f;
    --ok-soft: #e8f4ed;
    --warn: #a06a12;
    --warn-soft: #fbf1de;
    --danger: #b4362b;
    --danger-soft: #fbeceb;
    --focus: #2f56c8;
    --btn-primary-bg: #1f1f1d;
    --btn-primary-ink: #ffffff;
    --overlay: rgba(26, 26, 25, .38);

    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 14px;
    --sidebar: 236px;

    --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    color-scheme: light;
}

/* -------------------------------------------------------------------- alapok */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -.011em;
}

h1 { font-size: 19px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }

p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

code, kbd, pre {
    font-family: var(--mono);
    font-size: 12.5px;
}

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

::selection {
    background: var(--accent-soft);
}

.num {
    font-variant-numeric: tabular-nums;
}

.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.hidden,
[hidden] { display: none !important; }

.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 8px; }
.stack-lg { display: grid; gap: 22px; }

/*
 * Rácselemek alapértelmezetten a saját min-content méretüknél nem zsugorodnak
 * kisebbre, ezért egy széles táblázat kitolná az egész oldalt. A táblázatok
 * saját vízszintes görgetést kapnak, itt csak engedjük a zsugorodást.
 */
.stack > *,
.stack-sm > *,
.stack-lg > *,
.grid > * { min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ----------------------------------------------------------------- elrendezés */

.shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 12px 12px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 8px 14px;
    color: var(--ink);
}

.brand:hover { text-decoration: none; }

.brand__logo {
    display: block;
    width: 196px;
    height: auto;
    max-height: 40px;
    object-fit: contain;
    object-position: left center;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-ink);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -.02em;
    flex: none;
}

.brand__name {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1.2;
}

.brand__sub {
    display: block;
    font-size: 11.5px;
    font-weight: 400;
    color: var(--ink-3);
}

.nav {
    display: grid;
    gap: 1px;
}

.nav__label {
    padding: 12px 8px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
}

.nav__item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: 13.5px;
    line-height: 1.3;
}

.nav__item:hover {
    background: var(--surface-2);
    color: var(--ink);
    text-decoration: none;
}

.nav__item[aria-current="page"] {
    background: var(--surface-2);
    color: var(--ink);
    font-weight: 550;
}

.nav__item svg {
    flex: none;
    width: 16px;
    height: 16px;
    stroke: currentColor;
    opacity: .8;
}

.sidebar__foot {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 8px;
}

.who {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    min-width: 0;
}

.who__avatar {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: none;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--ink-2);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.who__text {
    min-width: 0;
    display: grid;
    line-height: 1.25;
}

.who__mail {
    font-size: 12.5px;
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.who__mail:hover { color: var(--ink); }

.who__role {
    font-size: 11px;
    color: var(--ink-3);
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.topbar__titles {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.topbar__titles h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-3);
    margin-bottom: 1px;
}

.crumb a { color: var(--ink-2); }

.page {
    width: 100%;
    max-width: 1180px;
    padding: 22px 28px 64px;
}

.section__head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
}

.section__head h2 { flex: none; }

.section__hint {
    font-size: 12.5px;
    color: var(--ink-3);
}

/* mobil */

.sidebar__close {
    display: none;
}

@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        z-index: 60;
        inset: 0 auto 0 0;
        width: 264px;
        transform: translateX(-100%);
        transition: transform .18s ease;
    }

    body[data-nav="open"] .sidebar { transform: none; }

    body[data-nav="open"]::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 50;
        background: var(--overlay);
    }

    .sidebar__close { display: inline-flex; }
    .topbar { padding: 12px 16px; }
    .page { padding: 18px 16px 56px; }
}

/* Szűk kijelzőn a másodlagos állapotszövegek helyet adnak a műveleteknek. */
@media (max-width: 700px) {
    .hide-sm { display: none !important; }
    .topbar { gap: 8px; }
}

/* ------------------------------------------------------------------ felületek */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.card__head h2,
.card__head h3 { flex: none; }

.card__body { padding: 16px; }
.card__body--tight { padding: 12px 16px; }

.card__foot {
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* A min() védi a szűk kijelzőt: egy oszlop soha nem lóghat ki a képernyőről. */
.grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
}

.grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }

/* A zónakártyák minden sorban azonos magasságúak, a tartalmuk alulról épül fel. */
.zone-cards { grid-auto-rows: minmax(156px, auto); }

.zone-card {
    display: flex;
    height: 100%;
}

.zone-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.zone-card__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    min-height: calc(2 * 1.35em);
}

.zone-card__name {
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.zone-card__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
}

.zone-card__badges:empty { display: none; }

.zone-card__value { margin-top: auto; }

.zone-card__meter { height: 4px; }
.zone-card__meter--empty { visibility: hidden; }

.zone-card__meta { min-height: 1.55em; }

/* mérőszámok */

.stat {
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.stat__label {
    font-size: 12.5px;
    color: var(--ink-2);
}

.stat__value {
    margin-top: 2px;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.stat__meta {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.stat--warn .stat__value { color: var(--warn); }
.stat--danger .stat__value { color: var(--danger); }
.stat__value.is-negative { color: var(--danger); }

/* mérce */

.meter {
    height: 4px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

.meter__fill {
    height: 100%;
    border-radius: inherit;
    background: var(--ink);
    transition: width .3s ease;
}

.meter__fill--warn { background: var(--warn); }
.meter__fill--danger { background: var(--danger); }

/* --------------------------------------------------------------------- jelzők */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.badge--plain::before { display: none; }

.badge--ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge--warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge--danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge--info { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge--mute { color: var(--ink-3); }

.tag {
    display: inline-block;
    overflow-wrap: anywhere;
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 11.5px;
}

/* --------------------------------------------------------------------- gombok */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13.5px;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}

.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { background: var(--surface-3); }

.btn[disabled],
.btn[aria-busy="true"] {
    opacity: .55;
    pointer-events: none;
}

.btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    flex: none;
}

.btn--primary {
    background: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: var(--btn-primary-ink);
}

.btn--primary:hover {
    background: color-mix(in srgb, var(--btn-primary-bg) 86%, var(--bg));
    border-color: color-mix(in srgb, var(--btn-primary-bg) 86%, var(--bg));
}

.btn--danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}

.btn--danger:hover { background: var(--danger-soft); }

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ink-2);
}

.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn--sm {
    padding: 4px 9px;
    font-size: 12.5px;
    border-radius: 6px;
}

.btn--sm svg { width: 14px; height: 14px; }

.btn--icon {
    padding: 6px;
    border-radius: 6px;
}

.btn--block { width: 100%; }

.event-reset-button {
    align-items: flex-start;
    flex-direction: column;
    text-align: left;
    white-space: normal;
}

.event-reset-button small {
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 400;
}

.btn-group {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------- űrlapok */

.field {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.field__label {
    font-size: 12.5px;
    font-weight: 550;
    color: var(--ink-2);
}

.field__hint {
    font-size: 12px;
    color: var(--ink-3);
}

.field__error {
    font-size: 12px;
    color: var(--danger);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="datetime-local"],
input[type="date"],
input[type="color"],
select,
textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13.5px;
    transition: border-color .12s ease, box-shadow .12s ease;
}

input[type="color"] {
    padding: 2px;
    height: 32px;
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 64px;
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: right 13px center, right 8px center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 28px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--danger);
}

input::placeholder,
textarea::placeholder { color: var(--ink-3); }

.check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
}

.check input {
    margin: 2px 0 0;
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    flex: none;
}

.check__text { font-size: 13px; }
.check__text small { display: block; color: var(--ink-3); font-size: 12px; }

.form-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    align-items: start;
}

.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }

@media (max-width: 620px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2 { grid-column: auto; }
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.toolbar input[type="search"],
.toolbar select {
    width: auto;
    min-width: 150px;
}

.segmented {
    display: inline-flex;
    padding: 2px;
    gap: 2px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.segmented::-webkit-scrollbar { display: none; }

.segmented button {
    padding: 4px 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ink-2);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}

/*
 * Letiltott váltó. Enélkül a gomb kattinthatónak látszott, kattintásra pedig
 * nem történt semmi – például telítettség nézet kapacitás nélkül.
 */
.segmented button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.segmented button:disabled:hover { background: transparent; }

.segmented button[aria-pressed="true"] {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

/* -------------------------------------------------------------------- táblázat */

.table-wrap {
    overflow-x: auto;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    background: var(--surface-2);
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.is-open td { background: var(--surface-2); }

.table td.num,
.table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table .cell-actions {
    text-align: right;
    white-space: nowrap;
}

.table .cell-main {
    font-weight: 550;
}

.table .cell-sub {
    display: block;
    font-weight: 400;
    font-size: 12.5px;
    color: var(--ink-3);
}

.table--fixed { table-layout: fixed; }

.detail-row td {
    background: var(--surface-2);
    padding: 0 14px 14px;
}

/* -------------------------------------------------------------- lista / állapot */

.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
}

.list > li {
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
}

.list > li:last-child { border-bottom: 0; }

.empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13.5px;
}

.empty__title {
    color: var(--ink-2);
    font-weight: 550;
    margin-bottom: 2px;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--surface-2);
    border-radius: 5px;
    height: 11px;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 7%, transparent), transparent);
    animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton::after { animation: none; }
    * { transition: none !important; }
}

.notice {
    display: flex;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 13.5px;
}

.notice--warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.notice--info { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.notice a { color: inherit; text-decoration: underline; }
.notice__body { flex: 1 1 auto; min-width: 0; color: inherit; }

/* ------------------------------------------------------------- varázsló */

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    list-style: none;
    margin: 0 0 20px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--line);
}

.steps li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-3);
    font-size: 13.5px;
}

.steps__num {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.steps li.is-current { color: var(--ink); font-weight: 550; }

.steps li.is-current .steps__num {
    background: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: var(--btn-primary-ink);
}

.steps li.is-done { color: var(--ink-2); }

.steps li.is-done .steps__num {
    background: var(--ok-soft);
    border-color: transparent;
    color: var(--ok);
}

/* --------------------------------------------------------------------- fülek */

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    overflow-x: auto;
    overflow-y: hidden;
}

.tabs button {
    padding: 8px 12px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--ink-2);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
}

.tabs button:hover { color: var(--ink); }

.tabs button[aria-selected="true"] {
    color: var(--ink);
    font-weight: 550;
    border-bottom-color: var(--ink);
}

.tabs button .count {
    margin-left: 5px;
    font-size: 11.5px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ diagram */

.chart {
    position: relative;
    width: 100%;
    overflow-x: auto;
    color: var(--ink);
}

.chart__hit { cursor: crosshair; }

/*
 * Diagram kiolvasó buborék. Egérrel rámutatva, érintőképernyőn koppintva
 * jelenik meg; a pozicionálást a charts.js számolja a diagram doboza fölé.
 */
.chart__tip {
    position: absolute;
    z-index: 3;
    display: grid;
    gap: 1px;
    padding: 7px 10px;
    max-width: 70%;
    border-radius: 8px;
    background: var(--ink);
    color: var(--surface);
    font-size: 12.5px;
    line-height: 1.35;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s ease;
}

.chart__tip.is-visible { opacity: 1; }

.chart__tip-label { opacity: .7; }

.chart__tip-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}


.chart svg { display: block; width: 100%; height: auto; }

.chart__empty {
    padding: 26px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
}

.chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--ink-3);
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
}

.chart-legend span::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 3px;
    margin-right: 6px;
    background: var(--accent);
}

.chart-legend .corrections::before { background: var(--warn); }

/* ------------------------------------------------------- márkázás előnézet */

.brand-preview {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 22px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-align: center;
}

.brand-preview__brand {
    font-size: 12.5px;
    opacity: .7;
}

.brand-preview__value {
    font-size: 46px;
    font-weight: 640;
    line-height: 1;
    letter-spacing: -.035em;
    font-variant-numeric: tabular-nums;
}

.brand-preview__label {
    font-size: 12.5px;
    opacity: .7;
}

.brand-preview__meter {
    width: min(260px, 100%);
    height: 6px;
    border-radius: 999px;
    background: rgba(128, 128, 128, .28);
    overflow: hidden;
}

.brand-preview__meter span {
    display: block;
    height: 100%;
    width: 62%;
    border-radius: inherit;
}

/* ---------------------------------------------------------------- token / copy */

.copy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.copy code {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-all;
    color: var(--ink);
}

/* ------------------------------------------------------------------ párbeszéd */

dialog.modal {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .18);
}

dialog.modal--wide { width: min(760px, calc(100vw - 32px)); }

dialog.modal::backdrop {
    background: var(--overlay);
    backdrop-filter: blur(2px);
}

.modal__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.modal__head h2 { flex: 1 1 auto; font-size: 15px; }

.modal__body {
    padding: 18px;
    overflow-y: auto;
    max-height: calc(100vh - 210px);
}

.modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal__error {
    margin-bottom: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 13px;
}

/* -------------------------------------------------------------------- toastok */

.toasts {
    position: fixed;
    z-index: 200;
    right: 16px;
    bottom: 16px;
    display: grid;
    gap: 8px;
    width: min(360px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    font-size: 13.5px;
    animation: toast-in .16s ease-out;
}

.toast__dot {
    margin-top: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-3);
    flex: none;
}

.toast--ok .toast__dot { background: var(--ok); }
.toast--error .toast__dot { background: var(--danger); }
.toast--warn .toast__dot { background: var(--warn); }

.toast__body { flex: 1 1 auto; min-width: 0; }
.toast__body code { word-break: break-all; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- bejelentkezés */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth__card {
    width: min(100%, 380px);
}

.auth__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.auth__logo {
    display: block;
    width: min(100%, 280px);
    height: auto;
    max-height: 52px;
    object-fit: contain;
    object-position: left center;
}

.auth__title {
    font-size: 20px;
    letter-spacing: -.02em;
    margin-bottom: 2px;
}

.auth__foot {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: var(--ink-3);
}

pre.payload {
    max-height: 320px;
    overflow: auto;
    margin: 10px 0 0;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--ink-2);
}

/* --------------------------------------------------------- live payload panel */

body.has-drawer { overflow: hidden; }

.payload-drawer__scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: var(--overlay);
    animation: payload-scrim-in .18s ease;
}

.payload-drawer {
    position: fixed;
    z-index: 80;
    inset: 0 0 0 auto;
    width: min(720px, calc(100vw - 24px));
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -18px 0 40px rgba(0, 0, 0, .15);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .18s ease, visibility 0s linear .18s;
}

.payload-drawer.is-open {
    transform: none;
    visibility: visible;
    transition: transform .18s ease;
}

.payload-drawer__head {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.payload-drawer__title {
    min-width: 0;
    flex: 1 1 auto;
}

.payload-drawer__title h2,
.payload-drawer__title span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payload-drawer__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    background: var(--bg);
}

.payload-live {
    display: grid;
    gap: 7px;
}

.payload-live__entry {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}

.payload-live__summary {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) repeat(3, 44px) auto 16px;
    align-items: center;
    gap: 9px;
    min-height: 51px;
    padding: 7px 11px;
    cursor: pointer;
    list-style: none;
}

.payload-live__summary::-webkit-details-marker { display: none; }
.payload-live__summary:hover { background: var(--surface-2); }

.payload-live__camera {
    display: grid;
    min-width: 0;
}

.payload-live__camera strong,
.payload-live__camera small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payload-live__camera strong { font-size: 12.5px; }
.payload-live__camera small { color: var(--ink-3); font-size: 11.5px; }

.payload-live__metric {
    display: grid;
    justify-items: center;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.payload-live__metric small {
    color: var(--ink-3);
    font-size: 10.5px;
    text-transform: uppercase;
}

.payload-live__metric strong { font-size: 13px; }

.payload-live__chevron {
    color: var(--ink-3);
    font-size: 16px;
    transition: transform .15s ease;
}

.payload-live__entry[open] .payload-live__chevron { transform: rotate(180deg); }

.payload-live__details {
    padding: 11px;
    border-top: 1px solid var(--line);
    background: var(--bg);
}

.payload-live__message {
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 13px;
    font-weight: 550;
}

.payload-live__errors {
    margin: 0 0 8px;
    padding: 8px 10px;
    overflow: auto;
    border-radius: var(--radius-sm);
    background: var(--warn-soft);
    color: var(--warn);
}

.payload-live__request-meta {
    margin-bottom: 7px;
    overflow-wrap: anywhere;
}

.payload-live__body {
    max-height: none;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.payload-live__entry .notice { margin-bottom: 8px; }

@keyframes payload-scrim-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 620px) {
    .payload-drawer { width: 100vw; }
    .payload-drawer__head { padding: 10px 12px; }
    .payload-drawer__body { padding: 10px; }
    .payload-live__summary {
        grid-template-columns: minmax(100px, 1fr) repeat(3, 34px) 16px;
        gap: 5px;
    }
    .payload-live__summary .badge {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: start;
    }
    .payload-live__chevron { grid-column: 5; grid-row: 1; }
}

/* ------------------------------------------------------------------ diff nézet */

.kv {
    display: grid;
    grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
    gap: 1px 12px;
    font-size: 12.5px;
}

.kv dt {
    color: var(--ink-3);
    font-family: var(--mono);
    font-size: 11.5px;
    padding-top: 1px;
}

.kv dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.kv dd.changed { color: var(--warn); }

.diff {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.diff__col h4 {
    font-size: 11.5px;
    color: var(--ink-3);
    margin-bottom: 6px;
    font-weight: 600;
}

/*
 * Dinamikus jelmagyarázat. A sorozatszínek a diagramból jönnek (zónánként
 * más), ezért a mintát nem CSS-ből festjük, hanem a Charts.legend() adja.
 */
.chart-legend .legend__item::before,
.chart-legend .legend__swatch::before { content: none; }

.legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend__swatch {
    display: inline-block;
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 3px;
}

/* Táblázatsorba illő mini idősor. */
.spark-cell {
    width: 116px;
    min-width: 116px;
}

.spark {
    display: block;
    width: 100%;
    height: 30px;
    color: var(--accent);
}

.spark-empty {
    display: block;
    height: 30px;
    line-height: 30px;
    color: var(--ink-3);
    font-size: 12px;
}
