/* Dolgozatfigyelő – mobil-first stíluslap */
:root {
    --paper: #f6f3ec;
    --surface: #ffffff;
    --ink: #1f2a2e;
    --ink-soft: #4a5458;
    --muted: #6b7478;
    --line: #e4dfd3;
    --primary: #2f6f62;
    --primary-ink: #ffffff;
    --primary-dark: #245a4f;
    --focus: #f0a63a;

    --pending-bg: #fdf3c8;
    --pending-ink: #6b5200;
    --pending-edge: #e8c440;
    --confirmed-bg: #dcf1e2;
    --confirmed-ink: #1d5b33;
    --confirmed-edge: #3f9d62;
    --disputed-bg: #fbe0dc;
    --disputed-ink: #8a2418;
    --disputed-edge: #d4543f;
    --cancelled-bg: #ecebe8;
    --cancelled-ink: #5d5f60;
    --cancelled-edge: #a9aaa8;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(31, 42, 46, .06), 0 4px 14px rgba(31, 42, 46, .06);
    --nav-h: 64px;
    font-size: 16px;
}

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

body.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }

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

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

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: rgba(0,0,0,.05); padding: .05em .3em; border-radius: 4px; }

/* ---------------------------------------------------------------- fejléc és navigáció */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar__inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.08rem;
}
.brand__mark {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--primary);
    color: var(--primary-ink);
    font-size: 1.1rem;
}

/* Mobilon alsó tab-sáv */
.nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(31, 42, 46, .06);
}
.nav__item {
    flex: 1;
    min-height: var(--nav-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 600;
}
.nav__icon { font-size: 1.35rem; line-height: 1; }
.nav__item.is-active { color: var(--primary); }
.nav__item--primary .nav__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 30px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-ink);
    font-size: 1.2rem;
    font-weight: 700;
}

@media (min-width: 720px) {
    body.has-nav { padding-bottom: 24px; }
    .nav {
        position: static;
        border: 0;
        box-shadow: none;
        gap: 4px;
        padding: 0;
    }
    .nav__item {
        flex: none;
        flex-direction: row;
        min-height: 42px;
        padding: 0 14px;
        border-radius: 999px;
        font-size: .95rem;
        gap: 6px;
    }
    .nav__icon { font-size: 1rem; }
    .nav__item.is-active { background: #e7f0ed; }
    .nav__item--primary { background: var(--primary); color: var(--primary-ink); }
    .nav__item--primary.is-active { background: var(--primary-dark); color: var(--primary-ink); }
    .nav__item--primary .nav__icon { width: auto; height: auto; background: none; }
}

/* ---------------------------------------------------------------- oldal */
.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 16px 16px 24px;
}
.page__title { font-size: 1.6rem; line-height: 1.25; margin: 8px 0 12px; }
.lead { font-size: 1.05rem; color: var(--ink-soft); margin: 0 0 18px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.back { margin: 0 0 8px; font-size: .95rem; }
.back a { text-decoration: none; }
.empty {
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 18px;
    color: var(--muted);
    text-align: center;
    margin: 0;
}
.more-link { text-align: center; margin: 24px 0 8px; }

.hero { margin: 4px 0 20px; }
.hero__hello { font-size: 1.35rem; font-weight: 700; margin: 0 0 12px; }

.section { margin: 0 0 26px; }
.section__title {
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-soft);
    margin: 0 0 10px;
}

/* ---------------------------------------------------------------- gombok */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    text-align: center;
    line-height: 1.25;
    transition: background-color .15s, border-color .15s, transform .05s;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn--block { display: flex; width: 100%; }
.btn--large { min-height: 58px; font-size: 1.08rem; }
.btn--small { min-height: 38px; padding: 6px 12px; font-size: .88rem; }

.btn--primary { background: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { background: var(--primary-dark); color: var(--primary-ink); }
.btn--secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn--secondary:hover { background: #eef5f3; }
.btn--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface); color: var(--ink); }
.btn--danger { background: var(--surface); color: var(--disputed-ink); border-color: var(--disputed-edge); }
.btn--danger:hover { background: var(--disputed-bg); }

.btn--yes { background: var(--surface); color: var(--confirmed-ink); border-color: var(--confirmed-edge); }
.btn--yes:hover, .btn--yes.is-selected { background: var(--confirmed-edge); color: #fff; }
.btn--no { background: var(--surface); color: var(--disputed-ink); border-color: var(--disputed-edge); }
.btn--no:hover, .btn--no.is-selected { background: var(--disputed-edge); color: #fff; }
.btn.is-selected::after { content: "✓"; font-weight: 800; }

.btn--google { background: var(--surface); color: var(--ink); border-color: #c9c4b8; }
.btn--google:hover { background: #fafafa; color: var(--ink); border-color: #9a968c; }

/* ---------------------------------------------------------------- státusz */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}
.status--pending { background: var(--pending-bg); color: var(--pending-ink); border-color: var(--pending-edge); }
.status--confirmed { background: var(--confirmed-bg); color: var(--confirmed-ink); border-color: var(--confirmed-edge); }
.status--disputed { background: var(--disputed-bg); color: var(--disputed-ink); border-color: var(--disputed-edge); }
.status--cancelled { background: var(--cancelled-bg); color: var(--cancelled-ink); border-color: var(--cancelled-edge); }

.counts { display: inline-flex; gap: 12px; font-weight: 700; font-size: .95rem; white-space: nowrap; }

/* ---------------------------------------------------------------- kártyák */
.cards { display: grid; gap: 12px; }
.card {
    display: flex;
    gap: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    border-left: 6px solid var(--pending-edge);
    color: inherit;
    text-decoration: none;
}
.card:hover { color: inherit; box-shadow: 0 2px 4px rgba(31,42,46,.08), 0 8px 22px rgba(31,42,46,.08); }
.card--confirmed { border-left-color: var(--confirmed-edge); }
.card--disputed { border-left-color: var(--disputed-edge); }
.card--cancelled { border-left-color: var(--cancelled-edge); opacity: .75; }
.card--cancelled .card__subject, .card--cancelled .card__topic { text-decoration: line-through; }
.cards--muted .card { opacity: .8; }

.card__date {
    flex: 0 0 74px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-right: 1px solid var(--line);
    padding-right: 12px;
}
.card__daynum { font-weight: 800; font-size: 1.9rem; line-height: 1; }
.card__month { font-weight: 700; font-size: .9rem; line-height: 1.3; }
.card__weekday { color: var(--muted); font-size: .78rem; line-height: 1.3; margin-top: 4px; }
.card__body { flex: 1; min-width: 0; }
.card__subject { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.card__topic { margin: 2px 0 8px; color: var(--ink-soft); overflow-wrap: anywhere; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.card__hint { margin: 8px 0 0; font-size: .85rem; color: var(--primary); font-weight: 600; }
.card__mine { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }

@media (max-width: 380px) {
    .card { flex-direction: column; gap: 8px; }
    .card__date { flex-direction: row; flex-wrap: wrap; gap: 6px; align-items: baseline; border-right: 0; padding-right: 0; text-align: left; }
    .card__daynum { font-size: 1.2rem; }
    .card__weekday { margin-top: 0; }
}

/* ---------------------------------------------------------------- részletek */
.detail {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px 18px;
    box-shadow: var(--shadow);
    border-top: 8px solid var(--pending-edge);
    margin-bottom: 18px;
}
.detail--confirmed { border-top-color: var(--confirmed-edge); }
.detail--disputed { border-top-color: var(--disputed-edge); }
.detail--cancelled { border-top-color: var(--cancelled-edge); }
.detail__date { margin: 0; color: var(--ink-soft); font-weight: 600; }
.detail__subject { margin: 4px 0 2px; font-size: 1.9rem; line-height: 1.15; }
.detail__topic { margin: 0 0 8px; font-size: 1.2rem; overflow-wrap: anywhere; }
.detail__description { margin: 0 0 12px; padding: 10px 12px; background: var(--paper); border-radius: var(--radius-sm); color: var(--ink-soft); overflow-wrap: anywhere; }
.detail__status { margin: 12px 0; }
.detail__footer { margin-top: 18px; }

.tally { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tally__item { background: var(--paper); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .95rem; }
.tally__item strong { font-size: 1.3rem; }

.vote { margin: 0 0 12px; }
.vote__title { font-size: 1.15rem; margin: 0 0 8px; }
.vote__current { margin: 0 0 12px; color: var(--ink-soft); }
.vote__buttons { display: grid; gap: 12px; }
@media (min-width: 560px) { .vote__buttons { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- duplikáció */
.duplicate {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    border-top: 8px solid var(--focus);
}
.duplicate__title { font-size: 1.35rem; margin: 0 0 8px; line-height: 1.25; }
.duplicate__item {
    display: grid;
    gap: 12px;
    padding: 14px;
    margin: 12px 0;
    background: var(--paper);
    border-radius: var(--radius-sm);
}
.duplicate__item p { margin: 2px 0 8px; }
.duplicate__other { margin-top: 16px; }

/* ---------------------------------------------------------------- űrlapok */
.form { display: grid; gap: 16px; }
.form--compact { gap: 12px; }
.field { display: grid; gap: 6px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-weight: 700; }
.field legend { margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=date], .field select, .field textarea {
    width: 100%;
    min-height: 50px;
    padding: 10px 12px;
    font: inherit;
    font-size: 1.05rem;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    appearance: none;
    -webkit-appearance: none;
}
.field select {
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
    background-size: 6px 6px;
    background-repeat: no-repeat;
    padding-right: 36px;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(47, 111, 98, .18); }
.field input[disabled] { background: #f0ede6; color: var(--ink-soft); }
.field__help { margin: 0; font-size: .85rem; color: var(--muted); }
.field__error { margin: 0; font-size: .9rem; color: var(--disputed-ink); font-weight: 600; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--disputed-edge); }

.check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 400;
    margin-bottom: 8px;
}
.check input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }

.quick-dates { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    min-height: 40px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 2px solid var(--line);
    background: var(--surface);
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
}
.chip.is-active { border-color: var(--primary); background: #e7f0ed; color: var(--primary-dark); }

.logout { margin-top: 28px; }

/* ---------------------------------------------------------------- értesítések */
.flashes { display: grid; gap: 8px; margin-bottom: 14px; }
.flash {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: #e7f0ed;
    border: 1px solid #b9d6cd;
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 12px;
}
.flashes .flash { margin-bottom: 0; }
.flash--success { background: var(--confirmed-bg); border-color: #a9d8b8; color: var(--confirmed-ink); }
.flash--error { background: var(--disputed-bg); border-color: #efb3a8; color: var(--disputed-ink); }
.flash--info { background: #eaf1f7; border-color: #bfd3e6; color: #24476a; font-weight: 400; }

/* ---------------------------------------------------------------- belépés */
.login { max-width: 440px; margin: 20px auto 0; text-align: center; }
.login .form, .login .flash { text-align: left; }
.login__badge {
    width: 72px; height: 72px; margin: 0 auto 12px;
    display: grid; place-items: center;
    border-radius: 20px;
    background: var(--primary); color: #fff; font-size: 2.2rem;
}
.login__title { font-size: 1.8rem; margin: 0 0 6px; }
.devnote { margin-top: 26px; }
.dev-users { display: grid; gap: 8px; margin: 0 0 18px; }
.dev-user { flex-direction: column; gap: 0; align-items: flex-start; text-align: left; }

/* ---------------------------------------------------------------- admin */
.subnav { display: flex; gap: 6px; margin: 0 0 16px; overflow-x: auto; }
.subnav a {
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    text-decoration: none;
    font-weight: 600;
    color: var(--ink-soft);
    white-space: nowrap;
}
.subnav a.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.panel__title { font-size: 1.1rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.panel .empty { border: 0; padding: 6px 0; text-align: left; }
.panel form + form { margin-top: 8px; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--paper); font-size: .78rem; font-weight: 700; color: var(--ink-soft); vertical-align: middle; }
.pill--admin { background: var(--ink); color: #fff; }

.userlist, .admintests, .plainlist { list-style: none; margin: 0; padding: 0; }
.userlist__item { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.userlist__item:first-child { border-top: 0; }
.userlist__info { overflow-wrap: anywhere; }
.userlist__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.panel .userlist__actions form { margin: 0; }

.admintests__item { border-top: 1px solid var(--line); }
.admintests__item:first-child { border-top: 0; }
.admintests__item a { display: grid; gap: 4px; padding: 12px 0; color: inherit; text-decoration: none; }
.admintests__item.is-past { opacity: .65; }
.admintests__date { font-weight: 700; font-variant-numeric: tabular-nums; }
.admintests__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }

.plainlist li { padding: 8px 0; border-top: 1px solid var(--line); }
.plainlist li:first-child { border-top: 0; }
.details { display: inline-block; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table th { border-top: 0; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr.is-disabled td { opacity: .55; }

/* ---------------------------------------------------------------- hiba */
.error-page { text-align: center; padding: 30px 0; }
.error-page__code { font-size: 3.5rem; font-weight: 800; color: var(--line); margin: 0; }
.debug { text-align: left; white-space: pre-wrap; background: #1f2a2e; color: #f6f3ec; padding: 14px; border-radius: var(--radius-sm); font-size: .8rem; overflow-x: auto; }

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

.backup-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel .backup-row form { margin: 0; }
.panel > form + .plainlist, .panel > form + .empty { margin-top: 12px; }
.cron-table th { width: 40%; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--ink-soft); border-top: 1px solid var(--line); }
.cron-table tr:first-child th { border-top: 0; }
.copyable { user-select: all; display: block; padding: 8px 10px; }
