/*
 * Rebootcode Support – stíluslap. Nincs build lépés, ez a fájl megy ki.
 *
 * Elvek:
 *  - A CSP (style-src 'self') miatt NINCS inline style: minden szín és
 *    állapot osztályból jön (a típusszín swatch-a data: SVG kép, l. swatch()).
 *  - Mobil-első: a rácsok és a táblák 720 px alatt kártyává esnek szét, a
 *    menü 900 px alatt gombra csukódik (CSS-only, checkbox-kapcsolóval).
 *  - Sötét mód a rendszerbeállításból (prefers-color-scheme), külön kapcsoló
 *    nélkül – ehhez minden szín token.
 */

:root {
    color-scheme: light dark;

    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --border: #e1e6ee;
    --border-strong: #c9d1de;
    --text: #1a2333;
    --muted: #61708a;
    --primary: #c2410c;
    --primary-dark: #9a3412;
    --primary-tint: #fdeee4;
    --info: #2456d6;
    --info-tint: #e8effd;
    --danger: #cf3a2d;
    --danger-tint: #fdecea;
    --success: #1b8a5a;
    --success-tint: #e3f6ec;
    --warning: #a16207;
    --warning-tint: #fdf6dc;
    --purple: #5b4bc4;
    --purple-tint: #ece9fb;
    --neutral-tint: #edf0f5;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px -8px rgba(20, 30, 50, .12);
    --focus: 0 0 0 3px rgba(194, 65, 12, .28);
    --topbar-h: 56px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f141d;
        --surface: #171e2b;
        --surface-2: #1d2634;
        --border: #2a3444;
        --border-strong: #3a465a;
        --text: #e7ecf4;
        --muted: #97a4ba;
        --primary: #fb923c;
        --primary-dark: #fdba74;
        --primary-tint: #3b2314;
        --info: #7ea4ff;
        --info-tint: #1d2c4d;
        --danger: #ff7b6e;
        --danger-tint: #3d1f1c;
        --success: #4fcf8f;
        --success-tint: #16362a;
        --warning: #f5c542;
        --warning-tint: #3a3112;
        --purple: #a99bff;
        --purple-tint: #2a2650;
        --neutral-tint: #232d3d;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px -8px rgba(0, 0, 0, .5);
        --focus: 0 0 0 3px rgba(251, 146, 60, .35);
    }
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

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

/* ---------- Fejléc és menü ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 0 20px;
    min-height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -.01em;
}
.brand strong { color: var(--primary); font-weight: 700; }
.brand-mark {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
}

.navpanel { display: contents; }

.mainnav { display: flex; gap: 4px; }
.mainnav a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.mainnav a:hover { color: var(--text); background: var(--surface-2); }
.mainnav a[aria-current="page"] { color: var(--primary); background: var(--primary-tint); }
.mainnav a.nav-cta { color: var(--primary); }

.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.username { font-weight: 600; }
.userlink { color: var(--muted); font-size: 14px; text-decoration: none; padding: 6px 8px; border-radius: var(--radius-sm); }
.userlink:hover { color: var(--text); background: var(--surface-2); }

.role, .status, .badge {
    display: inline-block;
    font-size: 12px;
    line-height: 1.4;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--neutral-tint);
    color: var(--muted);
    white-space: nowrap;
    font-weight: 500;
}
.role-admin { background: var(--danger-tint); color: var(--danger); }
.role-developer { background: var(--info-tint); color: var(--info); }
.badge-warn { background: var(--warning-tint); color: var(--warning); }
.badge-ok { background: var(--success-tint); color: var(--success); }

/* Időzóna a fejlécben – csak akkor látszik, ha a useré eltér a rendszerétől */
.tz { font-size: 12px; color: var(--muted); }

/* Menügomb – csak mobilon. A checkbox a panel testvére, hogy ~ kijelölővel nyisson. */
.navburger {
    display: none;
    margin-left: auto;
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    place-items: center;
    color: var(--text);
}
.navburger:hover { background: var(--surface-2); }
.navburger span, .navburger span::before, .navburger span::after {
    display: block;
    width: 20px; height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform .2s;
}
.navburger span { position: relative; }
.navburger span::before, .navburger span::after { content: ""; position: absolute; left: 0; }
.navburger span::before { top: -6px; }
.navburger span::after { top: 6px; }
.navtoggle:checked ~ .navburger span { background: transparent; }
.navtoggle:checked ~ .navburger span::before { transform: translateY(6px) rotate(45deg); }
.navtoggle:checked ~ .navburger span::after { transform: translateY(-6px) rotate(-45deg); }
.navtoggle:focus-visible ~ .navburger { box-shadow: var(--focus); }

@media (max-width: 900px) {
    .navburger { display: grid; }
    .navpanel {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 4px 0 12px;
        border-top: 1px solid var(--border);
    }
    .navtoggle:checked ~ .navpanel { display: flex; }
    .mainnav { flex-direction: column; gap: 2px; }
    .mainnav a { padding: 12px 10px; font-size: 16px; }
    .userbox {
        margin: 8px 0 0;
        padding: 12px 10px 0;
        border-top: 1px solid var(--border);
        flex-wrap: wrap;
    }
    .userbox .userlink, .userbox .linkbutton { font-size: 15px; padding: 8px 0; }
    .userbox form.inline { margin-left: auto; }
}

/* ---------- Elrendezés ---------- */

.container { max-width: 1120px; margin: 24px auto; padding: 0 20px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.card.narrow + .card.narrow { margin-top: 16px; }
.card h1 { margin: 0 0 12px; font-size: 22px; letter-spacing: -.01em; }
.card h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: -.01em; }
.card h2 .muted { font-weight: 400; font-size: 14px; }
.card h2 + .muted { margin-top: 0; }
.card h2.subhead { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.card > p:last-child { margin-bottom: 0; }

.authpage { max-width: 440px; margin: 8vh auto 0; padding: 0 20px; }
.authpage .brand { justify-content: center; display: flex; margin-bottom: 20px; font-size: 20px; }
.authpage .card { padding: 28px; }

.cardfooter {
    display: flex;
    align-items: center;
    gap: 12px 20px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagehead {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 16px;
}
.pagehead h1 { margin: 0; font-size: 24px; letter-spacing: -.015em; line-height: 1.25; }
.pagehead h1 code { font-size: 15px; vertical-align: middle; }
.pagehead h1 .muted { font-weight: 400; font-size: 15px; }
.pagehead .headactions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pagehead .backlink { flex-basis: 100%; order: -1; }
.backlink {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}
.backlink:hover { color: var(--primary); }
.backlink::before { content: "←"; }

.muted { color: var(--muted); font-size: 14px; }
.lead { font-size: 16px; margin: 0 0 16px; }
.status-code { font-size: 44px; font-weight: 800; color: var(--border-strong); margin: 0; line-height: 1; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

.debug { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.debug summary { cursor: pointer; color: var(--danger); font-weight: 600; }
.debug pre { overflow-x: auto; font-size: 12px; color: var(--muted); }

code {
    background: var(--neutral-tint);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Gombok ---------- */

.button, .linkbutton { font: inherit; cursor: pointer; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.button:hover { background: var(--primary-dark); color: #fff; }
.button.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.button.secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--surface); }
.button.danger { background: var(--danger); }
.button.danger:hover { background: #b12e22; }
.button.small { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.button:disabled { opacity: .55; cursor: default; }

.linkbutton {
    background: none;
    border: 0;
    color: var(--muted);
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.linkbutton:hover { color: var(--primary); }
.linkbutton.danger { color: var(--danger); }
.linkbutton.danger:hover { color: #b12e22; }
.linkbutton:disabled { color: var(--muted); opacity: .6; text-decoration: none; cursor: default; }
form.inline { display: inline; }

@media (prefers-color-scheme: dark) {
    .button { color: #0f141d; }
    .button:hover { color: #0f141d; }
    .button.secondary, .button.secondary:hover { color: var(--text); }
    .button.danger, .button.danger:hover { color: #fff; }
}

.actions { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-top: 20px; }

/* ---------- Üzenetek ---------- */

.flash {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--muted);
    background: var(--surface);
}
.flash-success { border-left-color: var(--success); background: var(--success-tint); }
.flash-error { border-left-color: var(--danger); background: var(--danger-tint); }
.flash-info { border-left-color: var(--info); background: var(--info-tint); }
.flash-warning { border-left-color: var(--warning); background: var(--warning-tint); }

.empty { color: var(--muted); padding: 12px 0; margin: 0; }
.empty a { color: var(--primary); }

/* Kihajtható magyarázat: rövid kérdés, alatta a részletek */
details.help { margin: 8px 0 0; }
details.help summary { cursor: pointer; color: var(--muted); font-size: 14px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.help summary::-webkit-details-marker { display: none; }
details.help summary::before { content: "▸"; font-size: 12px; transition: transform .15s; }
details.help[open] summary::before { transform: rotate(90deg); }
details.help summary:hover { color: var(--primary); }
details.help .muted { margin: 8px 0 0; }

/* ---------- Formok ---------- */

.form { margin-top: 4px; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea, .inlineform select {
    width: 100%;
    font: inherit;
    color: var(--text);
    padding: 9px 11px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    min-height: 40px;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inlineform select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus);
}
.field input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 0 6px 0 0; vertical-align: -3px; accent-color: var(--primary); }
.field input[type="color"] { padding: 3px; width: 56px; }
.field input[type="file"] { padding: 7px; }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field ::placeholder { color: var(--muted); opacity: .8; }
.hint { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.field-error { margin: 5px 0 0; color: var(--danger); font-size: 13px; font-weight: 500; }
.field:has(.field-error) input, .field:has(.field-error) select, .field:has(.field-error) textarea { border-color: var(--danger); }

.checkfield label { font-weight: 500; font-size: 14px; display: flex; align-items: flex-start; gap: 4px; cursor: pointer; }
.checkfield input { flex: 0 0 auto; margin-top: 2px !important; }

.fieldrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }

/* Nagy, betűs kódmező (2FA) */
.codeinput { font-size: 26px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

/* Egy sorba szedett form (tag- és jegytípus-felvétel) */
.rowform {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.rowform .field { margin-bottom: 0; flex: 1 1 180px; }
.rowform .narrowfield { flex: 0 0 120px; }
.rowform .actions, .filterform .actions { margin-top: 24px; }
.rowform .checkfield, .filterform .checkfield { flex: 0 0 auto; }
.rowform .checkfield label, .filterform .checkfield label { margin-top: 30px; }

/* Szűrők: kihajtható doboz, a fejlécében az aktív szűrők száma */
.filters { }
.filters summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    padding: 2px 0;
}
.filters summary::-webkit-details-marker { display: none; }
.filters summary::after { content: "▾"; color: var(--muted); margin-left: auto; transition: transform .15s; }
.filters[open] summary::after { transform: rotate(180deg); }
.filters .count { background: var(--primary); color: #fff; font-size: 12px; border-radius: 999px; padding: 1px 8px; }
.filters summary > .muted { font-weight: 400; }
@media (max-width: 720px) { .filters summary > .muted { display: none; } }
.filters .filterform { margin-top: 16px; }
.filterform {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px 14px;
    align-items: start;
}
.filterform .field { margin-bottom: 0; }
.filterform .field.wide { grid-column: 1 / -1; }
.filterform .actions { grid-column: 1 / -1; margin-top: 4px; }
.filterform .checkfield label { margin-top: 0; }

/* ---------- Táblák ---------- */

.tablewrap { overflow-x: auto; margin: 12px -8px 0; padding: 0 8px; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; margin: 12px 0 0; }
.tablewrap .table { margin-top: 0; }
.table th, .table td {
    text-align: left;
    padding: 10px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot th { text-transform: none; font-size: 14px; color: var(--text); letter-spacing: 0; border-top: 2px solid var(--border-strong); border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.inactive td { color: var(--muted); }
.table a { color: var(--primary); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table td.primary a { font-weight: 600; color: var(--text); }
.table td.primary a:hover { color: var(--primary); }
.table tbody tr:hover td { background: var(--surface-2); }
.rowactions { text-align: right; white-space: nowrap; }
.rowactions a, .rowactions form { margin-left: 14px; }
.rowactions a:first-child, .rowactions form:first-child { margin-left: 0; }
.table .sub { display: block; font-size: 13px; color: var(--muted); }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
/* Tömör számtábla (riport): a fejléc tördelhető, a cellák keskenyebbek, így 10 oszlop is kifér görgetés nélkül */
.table.dense th, .table.dense td { padding: 8px 6px; }
.table.dense th { white-space: normal; font-size: 11px; line-height: 1.3; vertical-align: bottom; }
.table.dense td { font-size: 14px; }
.table.dense tfoot th { font-size: 14px; white-space: nowrap; }
.table.dense td.nowrap { white-space: normal; overflow-wrap: anywhere; }

/* Mobilon a táblasor kártya lesz; a fejléc a cellák data-label-jéből jön.
   A címke abszolút pozíciójú, így a cella tartalma (kép + szöveg + .sub) egyben marad. */
@media (max-width: 720px) {
    .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; }
    .table.responsive thead, .table.responsive tfoot { display: none; }
    .table.responsive tr {
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
    }
    .table.responsive tbody tr:last-child { border-bottom: 0; }
    .table.responsive td {
        position: relative;
        padding: 3px 0 3px 40%;
        border: 0;
        text-align: left;
        min-height: 1.6em;
    }
    .table.responsive tbody tr:hover td { background: transparent; }
    .table.responsive td.num { text-align: left; }
    .table.responsive td[data-label]::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 3px;
        width: 38%;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.6;
    }
    .table.responsive td .sub { display: block; }
    .table.responsive td.primary { padding-left: 0; font-size: 16px; padding-bottom: 6px; }
    .table.responsive td.primary a { font-weight: 600; }
    .table.responsive td.rowactions {
        padding: 8px 0 0;
        text-align: left;
        white-space: normal;
        display: flex;
        flex-wrap: wrap;
        gap: 6px 16px;
    }
    .table.responsive td.rowactions a, .table.responsive td.rowactions form { margin-left: 0; }
    .table.responsive td.empty-row { padding-left: 0; }
}

/* Jegytípus színe: data: SVG kép, mert inline style-t a CSP nem enged */
.swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: baseline;
    border: 0;
}

.plainlist { margin: 8px 0 0; padding-left: 18px; }
.plainlist li { margin-bottom: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.chips a, .chips span {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 13px;
    text-decoration: none;
}
.chips a:hover { border-color: var(--primary); color: var(--primary); }
.chips a.active, .chips span.active { background: var(--primary-tint); border-color: transparent; color: var(--primary); font-weight: 600; }
.chips .chiplabel { border: 0; padding-left: 0; color: var(--muted); }

/* ---------- Hibajegyek ---------- */

.status::before {
    content: "";
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 6px;
    vertical-align: 1px;
}
.status-new { background: var(--info-tint); color: var(--info); }
.status-accepted { background: var(--success-tint); color: var(--success); }
.status-in_progress { background: var(--warning-tint); color: var(--warning); }
.status-waiting_for_reply { background: var(--purple-tint); color: var(--purple); }
.status-resolved { background: var(--success-tint); color: var(--success); }
.status-closed { background: var(--neutral-tint); color: var(--muted); }
.status-rejected { background: var(--danger-tint); color: var(--danger); }

.breached { color: var(--danger); font-weight: 600; }
.breached .muted { color: var(--danger); }
.soon { color: var(--warning); font-weight: 600; }
.soon .muted { color: var(--warning); }

/* Riport: teljesítés-százalék három állapota */
.delivered { color: var(--success); font-weight: 600; }
.slipping { color: var(--warning); font-weight: 600; }

.pager { display: flex; gap: 16px; align-items: center; justify-content: center; padding-top: 12px; }
.pager a { color: var(--primary); text-decoration: none; padding: 6px 10px; border-radius: var(--radius-sm); }
.pager a:hover { background: var(--primary-tint); }

.factlist {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px 24px;
    margin: 0;
}
.factlist dt { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
.factlist dd { margin: 0; }
.factlist dd .muted { display: block; font-size: 13px; }
.factlist dd.big { font-size: 17px; font-weight: 600; }

.pagehead .tickethead { flex-basis: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }

/* Rich text: a mentett tartalom és a szerkesztő ugyanúgy néz ki */
.richtext { line-height: 1.6; overflow-wrap: anywhere; }
.richtext p { margin: 0 0 10px; }
.richtext p:last-child { margin-bottom: 0; }
.richtext ul, .richtext ol { margin: 0 0 10px; padding-left: 22px; }
.richtext pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    overflow-x: auto;
}
.richtext code { background: var(--surface-2); }
.richtext img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.richtext a { color: var(--primary); }

.richtext.editable {
    min-height: 160px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.richtext.editable:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.richtext.editable:empty::before { content: attr(data-placeholder); color: var(--muted); }

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-bottom: 0;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-toolbar button {
    font: inherit;
    min-width: 36px;
    min-height: 32px;
    padding: 2px 8px;
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text);
}
.editor-toolbar button:hover { background: var(--surface); border-color: var(--border-strong); }

.attachments { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.attachments li {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    max-width: 100%;
}
.attachments a { text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.attachments a::before { content: "📎 "; }
.attachments .muted { font-size: 12px; }

/* Előzmény: függőleges idővonal */
.timeline { list-style: none; margin: 4px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; margin-bottom: 12px; padding-left: 8px; }
.timeline li:last-child { margin-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -24px; top: 7px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border-strong);
}
.timeline li:last-child::before { border-color: var(--primary); background: var(--primary); }
.timeline li.ev-comment::before { border-color: var(--info); }
.timeline li.ev-comment a { text-decoration: none; }
.timeline li.ev-comment a:hover { text-decoration: underline; }
.timeline .muted { font-size: 13px; display: block; }
.timeline .note {
    margin-top: 4px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 14px;
}

/* Jegy: műveletek és hozzászólások */
.statusactions { display: flex; flex-wrap: wrap; gap: 8px; }
.rejectbox { margin-top: 16px; }
.rejectbox summary { cursor: pointer; color: var(--danger); font-weight: 500; }
.rejectbox .form { margin-top: 12px; max-width: 520px; }

.inlineform { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inlineform select { width: auto; min-height: 34px; padding: 4px 8px; font-size: 14px; }

.comments { list-style: none; margin: 0; padding: 0; }
.comment { padding: 14px 0; border-top: 1px solid var(--border); }
.comment:first-child { border-top: 0; }
.comment.internal {
    background: var(--warning-tint);
    border-left: 3px solid var(--warning);
    border-top: 0;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 8px 0;
}
.comment.internal + .comment { border-top: 0; }
.commenthead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.commenthead .muted { font-size: 13px; }
.internalbadge {
    font-size: 12px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--warning);
    color: #fff;
    font-weight: 600;
}
.commentform { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ---------- Áttekintő ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
    display: block;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--primary); color: var(--text); transform: translateY(-1px); }
.tilevalue { display: block; font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tilelabel { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.tile.warn { border-left: 4px solid var(--warning); }
.tile.warn .tilevalue { color: var(--warning); }
.tile.danger { border-left: 4px solid var(--danger); }
.tile.danger .tilevalue { color: var(--danger); }
.tile.zero .tilevalue { color: var(--muted); }

.ticketlist { list-style: none; margin: 8px 0 0; padding: 0; }
.ticketlist li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px 12px;
    padding: 9px 0;
    border-top: 1px solid var(--border);
}
.ticketlist li:first-child { border-top: 0; }
.ticketlist a { color: var(--text); text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticketlist a:hover { color: var(--primary); }
.ticketlist a code { font-weight: 500; }
.ticketlist .muted, .ticketlist .breached, .ticketlist .soon { font-size: 13px; text-align: right; white-space: nowrap; }
.ticketlist .project { font-size: 13px; color: var(--muted); }

@media (max-width: 720px) {
    .ticketlist li { grid-template-columns: auto minmax(0, 1fr) auto; }
    .ticketlist li a:nth-child(2) { grid-column: 1 / -1; white-space: normal; order: -1; }
    .ticketlist li .status, .ticketlist li .project { justify-self: start; }
    .ticketlist .muted, .ticketlist .breached, .ticketlist .soon { text-align: right; white-space: normal; }
}

/* ---------- Mobil finomítások ---------- */

@media (max-width: 720px) {
    body { font-size: 16px; }
    .container { margin: 14px auto; padding: 0 12px; }
    .card { padding: 16px; border-radius: var(--radius); }
    .card.narrow { margin-top: 0; }
    .authpage { margin-top: 4vh; padding: 0 12px; }
    .authpage .card { padding: 22px 18px; }
    .pagehead { margin-bottom: 12px; }
    .pagehead h1 { font-size: 21px; }
    .pagehead .headactions { margin-left: 0; flex-basis: 100%; order: 2; }
    .pagehead .headactions .button { flex: 1 1 auto; }
    .actions { gap: 10px; }
    .actions .button { flex: 1 1 auto; }
    .rowform .field, .rowform .narrowfield { flex: 1 1 100%; }
    .rowform .checkfield label { margin-top: 0; }
    .rowform .actions, .filterform .actions { margin-top: 8px; width: 100%; }
    .field input, .field select, .field textarea { font-size: 16px; } /* iOS ne zoomoljon */
    .statusactions .button { flex: 1 1 45%; }
    .cardfooter { gap: 10px; }
    .factlist { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
    .factlist > .wide { grid-column: 1 / -1; }
    .footer { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

@media print {
    .topbar, .footer, .actions, .statusactions, .commentform, .rejectbox, .filters, .pager { display: none !important; }
    .card { box-shadow: none; break-inside: avoid; }
    body { background: #fff; }
}
