/* ---------------------------------------------------------------------------
   Lotosi UI. No framework, no external fonts - everything is served from the
   app's own origin so the strict Content-Security-Policy holds.
   --------------------------------------------------------------------------- */

:root {
    --bg: #0f1115;
    --bg-soft: #161a21;
    --surface: #1b212b;
    --surface-2: #222a36;
    --border: #2b3543;
    --text: #e6ebf2;
    --text-dim: #9aa7b8;
    --text-faint: #6f7d90;
    --accent: #4c7dff;
    --accent-soft: rgba(76, 125, 255, 0.16);
    --ok: #35c489;
    --warn: #f0a92e;
    --danger: #f2585b;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.18);
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f4f6fa;
        --bg-soft: #eceff5;
        --surface: #ffffff;
        --surface-2: #f7f9fc;
        --border: #dde3ec;
        --text: #17202e;
        --text-dim: #5a6779;
        --text-faint: #8492a5;
        --accent: #3b5bdb;
        --accent-soft: rgba(59, 91, 219, 0.1);
        --ok: #1a9c68;
        --warn: #b8760c;
        --danger: #c8393c;
        --shadow: 0 1px 2px rgba(23, 32, 46, 0.06), 0 8px 24px rgba(23, 32, 46, 0.06);
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
}

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 640; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.92em; }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--accent); color: #fff; padding: 0.6rem 1rem; z-index: 100;
    border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* --- Top bar --------------------------------------------------------------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 1.25rem;
    display: flex; align-items: center; gap: 1.5rem; min-height: 58px; flex-wrap: wrap;
}
.brand {
    display: inline-flex; align-items: center; gap: 0.55rem;
    font-weight: 700; color: var(--text); letter-spacing: -0.02em; font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.brand-dot {
    width: 11px; height: 11px; border-radius: 50%;
    background: linear-gradient(140deg, var(--accent), #8b5cf6);
}
.nav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.nav-link {
    padding: 0.4rem 0.75rem; border-radius: var(--radius-sm);
    color: var(--text-dim); font-size: 0.9rem; font-weight: 520;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent); }
.topbar-user { display: flex; align-items: center; gap: 0.6rem; }
.user-chip { display: flex; align-items: center; gap: 0.5rem; color: var(--text); font-size: 0.88rem; }
.user-chip:hover { text-decoration: none; }
.user-name { font-weight: 560; }

/* --- Layout ---------------------------------------------------------------- */

.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.lede { color: var(--text-dim); margin: 0.2rem 0 0; font-size: 0.92rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.card-narrow { max-width: 520px; }
.card-highlight { border-color: var(--accent); }
.card-verdict { background: var(--surface-2); }
.card-head {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 1rem; margin-bottom: 0.9rem; flex-wrap: wrap;
}
.card-actions { display: flex; gap: 0.4rem; }
.muted { color: var(--text-dim); font-size: 0.85rem; }
.small { font-size: 0.8rem; }
.nowrap { white-space: nowrap; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

.footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem; text-align: center;
    color: var(--text-faint); font-size: 0.82rem;
}
.footer p { max-width: 760px; margin: 0 auto; }

/* --- KPIs ------------------------------------------------------------------ */

.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.85rem; margin-bottom: 1rem;
}
.kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.15rem;
}
.kpi-label { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 1.7rem; font-weight: 660; letter-spacing: -0.02em; }
.kpi-value-sm { font-size: 1.05rem; }
.kpi-note { color: var(--text-faint); font-size: 0.8rem; }

/* --- Tables ---------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
    text-align: left; font-weight: 600; color: var(--text-dim);
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
    padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border);
}
.table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table-compact td, .table-compact th { padding: 0.38rem 0.5rem; }
.table-scroll { max-height: 620px; overflow: auto; border-radius: var(--radius-sm); }
.table-sticky thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.actions { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }

/* --- Balls ----------------------------------------------------------------- */

.balls { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.ball {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 0.3rem;
    border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
    font-family: var(--mono); font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ball-sm { min-width: 26px; height: 26px; font-size: 0.75rem; }
.balls-lg .ball { min-width: 38px; height: 38px; font-size: 0.95rem; }
.ball-bonus { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ball-hot { border-color: var(--warn); color: var(--warn); }
.ball-cold { border-color: var(--accent); color: var(--accent); }
.ball-link:hover { text-decoration: none; }
.ball-link:hover .ball { border-color: var(--accent); }

.latest-draw { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }

/* --- Forms ----------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field-label { font-size: 0.8rem; color: var(--text-dim); font-weight: 560; }
.field-inline { flex: 0 0 auto; }
.field-grow { flex: 1 1 220px; }
.field-check { flex-direction: row; align-items: center; gap: 0.45rem; padding-top: 1.2rem; }

input[type="text"], input[type="password"], input[type="email"], input[type="date"],
input[type="number"], input[type="file"], select, textarea {
    background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.48rem 0.6rem; font: inherit; font-size: 0.9rem; width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
textarea { font-family: var(--mono); font-size: 0.85rem; resize: vertical; }
.input-num { max-width: 110px; }
.input-date { max-width: 170px; }
.input-code { font-family: var(--mono); font-size: 1.3rem; letter-spacing: 0.35em; text-align: center; }
.select { min-width: 150px; }
.select-sm { min-width: 110px; padding: 0.28rem 0.4rem; font-size: 0.82rem; }

.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.form-row { display: flex; gap: 0.85rem; align-items: flex-end; flex-wrap: wrap; }
.form-row-end { justify-content: flex-end; margin-top: 0.9rem; }
.form-actions { display: flex; gap: 0.6rem; align-items: center; }
.inline-form { display: inline-flex; gap: 0.3rem; align-items: center; margin: 0; }
.toolbar { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 0.48rem 0.9rem; font: inherit; font-size: 0.88rem; font-weight: 560;
    cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-danger-ghost:hover { background: rgba(242, 88, 91, 0.1); }
.btn-sm { padding: 0.28rem 0.55rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* --- Feedback -------------------------------------------------------------- */

.alert {
    padding: 0.7rem 0.9rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); margin-bottom: 0.85rem; font-size: 0.9rem;
}
.alert-success { border-color: var(--ok); background: rgba(53, 196, 137, 0.1); }
.alert-error { border-color: var(--danger); background: rgba(242, 88, 91, 0.1); }
.alert-info { border-color: var(--accent); background: var(--accent-soft); }

.callout {
    background: var(--surface-2); border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm); padding: 0.85rem 1rem; margin-bottom: 1rem; font-size: 0.9rem;
}
.callout-warn { border-left-color: var(--warn); }

.badge {
    display: inline-block; padding: 0.12rem 0.45rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 620; text-transform: uppercase; letter-spacing: 0.03em;
    border: 1px solid var(--border); color: var(--text-dim);
}
.badge-ok { color: var(--ok); border-color: var(--ok); }
.badge-warn { color: var(--warn); border-color: var(--warn); }
.badge-neutral { color: var(--text-faint); }
.badge-role { color: var(--accent); border-color: var(--accent); }

.hint { color: var(--text-dim); font-size: 0.84rem; margin: 0.6rem 0 0; }
.bullets { margin: 0.4rem 0; padding-left: 1.1rem; }
.bullets li { margin-bottom: 0.25rem; }

.empty-state {
    text-align: center; padding: 3rem 1.5rem; background: var(--surface);
    border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty-state h2 { margin-bottom: 0.4rem; }
.empty-state p { color: var(--text-dim); margin-bottom: 1rem; }

/* --- Tabs ------------------------------------------------------------------ */

.tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab {
    padding: 0.4rem 0.8rem; border-radius: var(--radius-sm);
    color: var(--text-dim); font-size: 0.88rem; font-weight: 540;
    border: 1px solid transparent;
}
.tab:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.tab.is-active { background: var(--surface); border-color: var(--border); color: var(--text); }
.tab-action { margin-left: auto; color: var(--accent); }

/* --- Charts ---------------------------------------------------------------- */

.chart { width: 100%; height: 260px; }
.chart-sm { height: 190px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .bar { fill: var(--accent); }
.chart .bar-high { fill: var(--warn); }
.chart .bar-mark { fill: var(--ok); }
.chart .axis-line { stroke: var(--border); stroke-width: 1; }
.chart .baseline { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .expected-dot { fill: none; stroke: var(--warn); stroke-width: 1.5; }
.chart .tick { fill: var(--text-faint); font-size: 9px; font-family: var(--mono); }
.chart .chart-empty { fill: var(--text-faint); font-size: 12px; font-family: var(--sans); }

.meter {
    display: inline-block; width: 46px; height: 5px; border-radius: 3px;
    background: var(--border); vertical-align: middle; margin-right: 0.4rem; position: relative;
}
.meter::after {
    content: ""; position: absolute; inset: 0 auto 0 0;
    width: calc(var(--v, 0) * 1%); background: var(--accent); border-radius: 3px;
}

/* --- Details / misc -------------------------------------------------------- */

.inline-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 0.7rem 0 0; }
.inline-stats-wide { gap: 2.2rem; }
.inline-stats div { display: flex; flex-direction: column; }
.inline-stats dt { color: var(--text-dim); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
.inline-stats dd { margin: 0; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.detail-list { margin: 0 0 1rem; }
.detail-list div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.detail-list dt { color: var(--text-dim); font-size: 0.86rem; }
.detail-list dd { margin: 0; font-size: 0.9rem; }

.ticket-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.ticket {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.7rem 0.9rem;
}
.ticket-main { display: flex; align-items: center; gap: 0.8rem; }
.ticket-rank { color: var(--text-faint); font-family: var(--mono); font-size: 0.82rem; }
.ticket-meta { display: flex; gap: 1.1rem; margin: 0; flex-wrap: wrap; }
.ticket-meta div { display: flex; flex-direction: column; }
.ticket-meta dt { color: var(--text-faint); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.ticket-meta dd { margin: 0; font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.verdict { font-size: 0.95rem; margin-bottom: 0.9rem; }
.verdict-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.8rem; }
.verdict-item {
    display: flex; flex-direction: column; gap: 0.2rem; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.7rem 0.8rem;
}
.verdict-label { color: var(--text-dim); font-size: 0.78rem; }
.verdict-value { font-weight: 620; font-variant-numeric: tabular-nums; }

.code, pre.code {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.7rem 0.85rem;
    font-family: var(--mono); font-size: 0.82rem; overflow-x: auto; white-space: pre;
}
.codes { list-style: none; margin: 0.8rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem; }
.codes code {
    display: block; background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; text-align: center; letter-spacing: 0.08em;
}
.secret code { font-size: 1.1rem; letter-spacing: 0.12em; background: var(--bg-soft); padding: 0.5rem 0.7rem; border-radius: var(--radius-sm); display: inline-block; }
.secret-uri code { font-size: 0.75rem; word-break: break-all; display: block; background: var(--bg-soft); padding: 0.5rem; border-radius: var(--radius-sm); }

.steps { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 1.4rem; }
.steps h3 { margin-bottom: 0.35rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 0.9rem; }

.reset-details, .recovery-details { display: inline-block; }
.reset-details summary, .recovery-details summary {
    cursor: pointer; font-size: 0.8rem; color: var(--text-dim); padding: 0.28rem 0;
}
.recovery-details { display: block; margin-top: 1.2rem; }
details[open] summary { margin-bottom: 0.5rem; }

.strength { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: var(--text-dim); }
.strength-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--border); position: relative; overflow: hidden; }
.strength-bar::after {
    content: ""; position: absolute; inset: 0 auto 0 0;
    width: calc(var(--s, 0) * 1%); background: var(--warn); transition: width 0.15s linear;
}
.strength[data-level="strong"] .strength-bar::after { background: var(--ok); }
.strength[data-level="weak"] .strength-bar::after { background: var(--danger); }

/* --- Guest screens --------------------------------------------------------- */

.guest-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1.5rem; }
.guest-shell { width: 100%; max-width: 400px; }
.guest-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow);
}
.guest-brand {
    display: flex; align-items: center; gap: 0.55rem;
    font-weight: 700; font-size: 1.1rem; margin-bottom: 1.4rem; letter-spacing: -0.02em;
}
.guest-title { font-size: 1.3rem; margin-bottom: 0.3rem; }
.guest-sub { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 1.3rem; }
.guest-help { color: var(--text-faint); font-size: 0.8rem; margin: 1.2rem 0 0; }
.guest-note { color: var(--text-faint); font-size: 0.78rem; text-align: center; margin-top: 1.2rem; }

@media (max-width: 700px) {
    .page-head { flex-direction: column; align-items: stretch; }
    .topbar-inner { gap: 0.75rem; }
    .nav { order: 3; width: 100%; }
    .ticket { flex-direction: column; align-items: flex-start; }
}

/* --- Slovenian game model additions ---------------------------------------- */

/* Screen-reader-only label (the language picker's <label>). */
.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;
}

.locale-switch { margin-right: 0.25rem; }
.locale-switch .select { min-width: 104px; }

/*
 * The supplementary ball ("dodatna številka") comes out of the same drum as the
 * main numbers, so it is shown as a main ball with an outline rather than as a
 * different kind of ball - which is what a separate-drum extra gets.
 */
.ball-separator {
    align-self: center; color: var(--text-faint);
    font-weight: 600; padding: 0 0.1rem; user-select: none;
}
.ball-supplementary {
    background: transparent; border-color: var(--warn); color: var(--warn);
    border-style: dashed;
}

.callout-note { border-left-color: var(--warn); }

.tier-jackpot td { font-weight: 620; }
.tier-total td { border-top: 1px solid var(--border); color: var(--text-dim); }
.tier-total td:first-child { border-top-color: transparent; }

.footer-fine { color: var(--text-faint); font-size: 0.76rem; margin-top: 0.5rem; }

/* Slovenian labels run longer than the English ones, so table headers wrap. */
.table th { white-space: normal; }

/* --- Installer -------------------------------------------------------------- */

.setup-body { display: flex; min-height: 100vh; justify-content: center; padding: 2rem 1rem; }
.setup-shell { width: 100%; max-width: 620px; }
.setup-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.25rem;
}
.setup-locale { margin: 0; }
.setup-card { padding: 1.5rem; }
.setup-card h1 { font-size: 1.35rem; margin-bottom: 0.3rem; }
.setup-card .lede { margin-bottom: 1.1rem; }
.setup-card .table { margin-bottom: 1rem; }
.setup-card .hint-row td { padding-top: 0; border-bottom: none; }

.setup-steps {
    list-style: none; display: flex; gap: 0.4rem; margin: 0 0 1rem; padding: 0; flex-wrap: wrap;
}
.setup-steps li {
    display: flex; align-items: center; gap: 0.4rem; flex: 1 1 auto;
    padding: 0.45rem 0.7rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-faint); font-size: 0.82rem;
}
.setup-steps .step-number {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--surface-2); border: 1px solid var(--border);
    font-family: var(--mono); font-size: 0.72rem;
}
.setup-steps li.is-active { border-color: var(--accent); color: var(--text); }
.setup-steps li.is-active .step-number { background: var(--accent); border-color: var(--accent); color: #fff; }
.setup-steps li.is-done { color: var(--ok); }
.setup-steps li.is-done .step-number { border-color: var(--ok); color: var(--ok); }

.setup-card pre.code { max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* The dashboard nag shown while public/install.php is still reachable. */
.install-warning {
    border-left-color: var(--danger);
    background: rgba(242, 88, 91, 0.08);
}
.install-warning code {
    background: var(--bg-soft); padding: 0.1rem 0.3rem; border-radius: 3px;
}

@media (max-width: 560px) {
    .setup-steps .step-label { display: none; }
    .setup-steps li { flex: 0 0 auto; }
}
