/* ─── CHYTKA.CZ ADMIN (PHP) ──────────────────────────────────────────────
   Barvy a tvar layoutu navazují na původní Python administraci,
   ať appka po přepisu vizuálně nepůsobí jako jiný systém. */

:root {
    --c-blue:      #2563eb;
    --c-blue-dark: #1d4ed8;
    --c-cyan:      #06b6d4;
    --c-dark:      #0b0f14;
    --c-dark2:     #0f1923;
    --c-surface:   #f5f6fa;
    --c-border:    #e2e4ec;
    --c-text:      #0f1923;
    --c-muted:     #6b7280;
    --c-danger:    #dc2626;
    --c-success:   #16a34a;

    --sidebar-w: 220px;
    --font-body: 'Source Sans 3', system-ui, -apple-system, sans-serif;
}

* , *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--c-text);
    background: var(--c-surface);
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
input, select, textarea, button { font: inherit; }

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--c-dark2);
    color: #fff;
    padding: 6px 16px;
}

.brand { display: flex; align-items: center; gap: 9px; color: inherit; }
.brand-mark {
    width: 28px; height: 28px; border-radius: 7px;
    background: linear-gradient(135deg, var(--c-blue), var(--c-cyan));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; color: #fff;
}
.brand-title { font-size: 15px; font-weight: 700; }
.brand-sec { font-weight: 500; color: #9fb0c3; }


.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 13px; color: #e2e8f0; }
.power-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
    border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #e2e8f0; cursor: pointer;
}
.power-btn:hover { background: rgba(220,38,38,.85); border-color: transparent; color: #fff; }

/* ── Layout grid ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: calc(100vh - 42px);
}

.sidebar-card {
    background: #fff;
    border-right: 1px solid var(--c-border);
    padding: 20px 14px;
}

.sidebar-section-title {
    font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--c-muted); font-weight: 700; margin-bottom: 10px; padding: 0 10px;
}
.sidebar-list { display: flex; flex-direction: column; gap: 2px; }
.sidebar-item { padding: 9px 10px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--c-text); }
.sidebar-item:hover { background: var(--c-surface); }
.sidebar-item.active { background: #eaf1ff; color: var(--c-blue-dark); }
.sidebar-label { font-size: 12px; color: var(--c-muted); padding: 0 10px; }
.sidebar-label.muted { display: block; padding: 10px; }

.content-stack { padding: 32px; max-width: 1100px; margin: 0 auto; width: 100%; }

/* ── Cards / tables ── */
.card {
    background: #fff; border: 1px solid var(--c-border); border-radius: 12px;
    padding: 24px; margin-bottom: 20px;
}
.card h2 { font-size: 18px; margin-bottom: 16px; }

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-tile {
    flex: 1; min-width: 140px; background: #fff; border: 1px solid var(--c-border);
    border-radius: 12px; padding: 18px;
}
.stat-tile .num { font-size: 28px; font-weight: 700; color: var(--c-blue-dark); }
.stat-tile .label { font-size: 13px; color: var(--c-muted); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--c-border); text-align: left; }
table.data th { font-size: 12px; text-transform: uppercase; color: var(--c-muted); font-weight: 700; }
table.data tr:hover td { background: #fafbfe; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-gray  { background: #f1f2f6; color: var(--c-muted); }
.badge-blue  { background: #dbeafe; color: var(--c-blue-dark); }

/* ── Forms / buttons ── */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=password],
.form-row input[type=date], .form-row input[type=number], .form-row select, .form-row textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--c-border); border-radius: 8px; font-size: 14px;
}
.form-row .error { color: var(--c-danger); font-size: 13px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row label { margin: 0; font-weight: 600; }

.btn {
    display: inline-block; padding: 9px 16px; border-radius: 8px; border: none;
    font-weight: 700; font-size: 14px; cursor: pointer; background: var(--c-blue); color: #fff;
}
.btn:hover { background: var(--c-blue-dark); }
.btn-ghost { background: transparent; color: #e2e8f0; border: 1px solid rgba(255,255,255,.25); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-danger { background: var(--c-danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #fff; color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { background: var(--c-surface); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.actions-row { display: flex; gap: 10px; margin-top: 18px; }

/* ── Toast ── */
.toast { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 600; font-size: 14px; }
.toast-success { background: #dcfce7; color: #15803d; }
.toast-error   { background: #fee2e2; color: #b91c1c; }

/* ── Login page ── */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: var(--c-dark2); }
.login-box { background: #fff; border-radius: 14px; padding: 36px; width: 360px; }
.login-box h1 { font-size: 20px; margin-bottom: 4px; }
.login-box .sub { color: var(--c-muted); font-size: 13px; margin-bottom: 22px; }
.login-box .btn { width: 100%; margin-top: 8px; }

footer#AppFooter { text-align: center; padding: 14px; font-size: 12px; color: var(--c-muted); }

/* ── Layout bez postranního menu (Finance) + základní mobil ── */
.dashboard-grid.finance-full { grid-template-columns: minmax(0,1fr); }
.finance-full .content-stack { max-width: none; }

@media (max-width: 800px) {
    .topbar { padding: 3px 10px; gap: 8px; }
    .brand-mark { width: 24px; height: 24px; font-size: 11px; border-radius: 6px; }
    .brand-title { font-size: 14px; }
    .user-chip { display: none; }
    .power-btn { width: 28px; height: 28px; }
    .dashboard-grid { grid-template-columns: minmax(0,1fr); }
    .sidebar-card { border-right: none; border-bottom: 1px solid var(--c-border); padding: 10px 12px; }
    .content-stack { padding: 12px; }
    .form-grid { grid-template-columns: 1fr; }
    table.data { display: block; overflow-x: auto; }
}

/* ── Dashboard: dlaždice sekcí (navigace je jen přes Dashboard) ── */
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 0 0 24px; }
.section-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 22px 12px; background: #fff; border: 1px solid var(--c-border); border-radius: 14px;
    font-weight: 700; font-size: 15px;
}
.section-card .ico { font-size: 28px; line-height: 1; }
.section-card:hover { border-color: var(--c-blue); background: #eaf1ff; }
@media (max-width: 800px) { .section-grid { grid-template-columns: repeat(2, 1fr); } .section-card { padding: 18px 8px; } }

/* ── Ikona nápovědy v horní liště ── */
.help-btn { text-decoration: none; }
.help-btn:hover { background: rgba(37,99,235,.9); border-color: transparent; color: #fff; }

/* ── Stránky nápovědy ── */
.help { max-width: 860px; margin: 0 auto; line-height: 1.6; }
.help h1 { font-size: 24px; margin: 0 0 6px; }
.help .lead { color: var(--c-muted); font-size: 16px; margin: 0 0 22px; }
.help h2 { font-size: 19px; margin: 34px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--c-border); }
.help h3 { font-size: 16px; margin: 22px 0 6px; }
.help ul, .help ol { padding-left: 22px; margin: 8px 0 12px; }
.help li { margin: 4px 0; }
.help figure { margin: 16px 0 22px; }
.help figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--c-border); border-radius: 10px; box-shadow: 0 2px 10px rgba(15,25,35,.08); }
.help figure.narrow img { max-width: 380px; }
.help figcaption { font-size: 13px; color: var(--c-muted); margin-top: 6px; }
.help .tip { background: #eaf1ff; border-left: 4px solid var(--c-blue); border-radius: 8px; padding: 10px 14px; margin: 14px 0; }
.help .warn { background: #fff4e5; border-left: 4px solid #f59e0b; border-radius: 8px; padding: 10px 14px; margin: 14px 0; }
.help .toc { background: #fff; border: 1px solid var(--c-border); border-radius: 12px; padding: 12px 18px; margin: 0 0 8px; }
.help .toc a { color: var(--c-blue-dark); }
.help kbd, .help code { background: #eef0f6; border-radius: 5px; padding: 1px 6px; font-size: .92em; }
.help .back { display: inline-block; margin-bottom: 14px; color: var(--c-blue-dark); font-weight: 600; }
.help table.kv { border-collapse: collapse; width: 100%; margin: 10px 0 16px; font-size: 14px; }
.help table.kv th, .help table.kv td { border: 1px solid var(--c-border); padding: 7px 10px; text-align: left; vertical-align: top; }
.help table.kv th { background: #f5f6fa; width: 32%; }
@media (max-width: 800px) { .help h1 { font-size: 21px; } .help figure.narrow img { max-width: 100%; } }

/* Stránky bez postranního menu, ale s běžnou šířkou obsahu (Dashboard, nápověda) */
.finance-full.narrow-main .content-stack { max-width: 1100px; margin: 0 auto; }

/* Mobil: postranní menu jako úzký vodorovný pruh */
@media (max-width: 800px) {
    .sidebar-card .sidebar-section-title, .sidebar-card .sidebar-label, .sidebar-card hr { display: none; }
    .sidebar-list { flex-direction: row; overflow-x: auto; gap: 6px; }
    .sidebar-item { white-space: nowrap; padding: 7px 12px; border: 1px solid var(--c-border); }
    .sidebar-item.active { border-color: var(--c-blue); }
}
