/* Duban — interný nástroj. Jedna šablóna štýlu pre celú appku, mobile-first. */

:root {
    --bg: #f6f5f2;
    --panel: #ffffff;
    --ink: #1c1b19;
    --muted: #6d6a64;
    --line: #e3e0d9;
    --accent: #b4472a;
    --accent-ink: #ffffff;
    --ok: #1f7a4d;
    --err: #b32020;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .04);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17161a;
        --panel: #201f24;
        --ink: #eceae6;
        --muted: #9b968e;
        --line: #33313a;
        --accent: #e0704e;
        --accent-ink: #1a1013;
        --ok: #4cc38a;
        --err: #ef6a6a;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* ── Hlavička ─────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--ink);
    font-size: 1.05rem;
}
.topnav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.who {
    color: var(--muted);
    font-size: .85rem;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.footer { padding: 16px; text-align: center; color: var(--muted); font-size: .8rem; }

/* ── Karty a dlaždice ─────────────────────────────────────────────────── */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.tile-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.tile-value.small { font-size: 1.1rem; }
.tile-link { display: inline-block; margin-top: 8px; font-weight: 600; text-decoration: none; }
.tile-link:hover { text-decoration: underline; }

.stav-list { list-style: none; margin: 8px 0 0; padding: 0; }
.stav-list li { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.stav-list li:last-child { border-bottom: 0; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .inline { margin-left: auto; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }

/* ── Tlačidlá a formuláre ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    min-height: 44px; /* pohodlný cieľ na dotyk */
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-google .g-icon {
    display: inline-grid;
    place-items: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #fff;
    color: #4285f4;
    font-weight: 800;
}

.form { display: grid; gap: 12px; margin-top: 12px; }
.form label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
input[type=email], input[type=password], input[type=search] {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    min-height: 44px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.search { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.search input { flex: 1 1 240px; }

.alert { border-radius: 10px; padding: 10px 12px; margin: 12px 0; }
.alert-error { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }

/* ── Prihlásenie ──────────────────────────────────────────────────────── */
.login-wrap { min-height: 80vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-logo { font-size: 2.4rem; }
.login-card h1 { margin: 4px 0 2px; }
.klasicke { margin-top: 18px; text-align: left; }
.klasicke summary { cursor: pointer; color: var(--muted); font-size: .9rem; }

/* ── Tabuľka leadov ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.leads { width: 100%; border-collapse: collapse; background: var(--panel); }
table.leads th, table.leads td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table.leads th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); position: sticky; top: 0; }
.meno { font-weight: 600; }
.odpoved { font-size: .88rem; padding: 1px 0; }
.otazka { color: var(--muted); }
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-size: .75rem;
    font-weight: 700;
}
.tag-done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

.behy { margin-top: 24px; }
.behy summary { cursor: pointer; color: var(--muted); }
table.runs { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .85rem; }
table.runs td { padding: 6px 10px; border-bottom: 1px solid var(--line); }

/* Na mobile sa z každého riadku stane karta — vodorovné skrolovanie tabuľky
   s piatimi stĺpcami sa na telefóne nedá použiť. */
@media (max-width: 820px) {
    table.leads thead { display: none; }
    table.leads, table.leads tbody, table.leads tr, table.leads td { display: block; width: 100%; }
    table.leads tr {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        margin-bottom: 12px;
        padding: 4px 0;
    }
    table.leads td { border-bottom: 1px solid var(--line); padding: 8px 14px; }
    table.leads tr td:last-child { border-bottom: 0; }
    table.leads td::before {
        content: attr(data-label);
        display: block;
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--muted);
        margin-bottom: 2px;
    }
    .table-wrap { overflow-x: visible; }
    table.runs, table.runs tbody, table.runs tr, table.runs td { display: block; width: 100%; }
    table.runs tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
    table.runs td { border: 0; padding: 1px 0; }
}

/* ── Grafy (SVG počítané na serveri, src/graf.rs) ─────────────────────── */
.grafy {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.graf { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }
.graf-hlavicka { font-size: .95rem; color: var(--muted); margin-top: 2px; }
.graf-hlavicka strong { color: var(--ink); font-size: 1.3rem; }
.graf-mriezka { stroke: var(--line); stroke-width: 1; }
.graf-os { fill: var(--muted); font-size: 11px; }
.graf-ciara { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.graf-plocha { stroke: none; opacity: .16; }
/* Body sú kvôli tooltipu (<title>) veľké, ale neviditeľné — na 200 dní by
   z grafu bola šnúra guľôčok. */
.graf-bod { fill: transparent; }
.graf-bod:hover { fill: var(--accent); }
.graf-ciara.c-lead, .graf-bod.c-lead:hover { stroke: var(--accent); }
.graf-plocha.c-lead { fill: var(--accent); }
.graf-ciara.c-mail { stroke: var(--ok); }
.graf-plocha.c-mail { fill: var(--ok); }
.graf-stlpec.c-mail { fill: var(--ok); }
.graf-stlpec.c-lead { fill: var(--accent); }
.graf-stlpec.nula { fill: var(--line); }
.graf-stlpec:hover { opacity: .7; }

/* ── Fronta rozposielania ─────────────────────────────────────────────── */
h2 { font-size: 1.1rem; margin: 26px 0 10px; }
.fronta-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.fronta-predmet { flex: 1 1 100%; }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }
.fronta-stav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 14px 0;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.fronta-akcie { display: flex; gap: 8px; flex-wrap: wrap; }
.fronta-akcie .inline { display: inline; }
.fronta-zoznam { margin-top: 14px; }
.fronta-zoznam summary { cursor: pointer; color: var(--muted); }
tr.stav-pending td { opacity: .65; }

.rezim { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.rezim legend { padding: 0 6px; }
.radio { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; cursor: pointer; color: var(--ink); }
.radio input { margin-top: 4px; }

textarea, select {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    min-height: 44px;
}
textarea { resize: vertical; line-height: 1.5; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.alert-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.tag-fake, .tag-paused { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.tag-real, .tag-error, .tag-cancelled { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.tag-running { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
code { background: color-mix(in srgb, var(--muted) 14%, transparent); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.kampan-vyber { display: block; margin-top: 10px; font-size: .9rem; color: var(--muted); }
.kampan-vyber select { margin-top: 4px; }
