/* LacoBot web - moderní vzhled (bez závislostí). Světlý i tmavý režim přes data-theme na <html>. */
:root {
    --bg: #f4f5f9;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --text: #1c2333;
    --muted: #667085;
    --border: #e3e6ee;
    --primary: #4f46e5;
    --primary-soft: #eef0ff;
    --primary-text: #ffffff;
    --ok: #12805c;      --ok-soft: #e4f6ee;
    --warn: #b45309;    --warn-soft: #fdf1dc;
    --danger: #c42b2b;  --danger-soft: #fde8e8;
    --off: #c2410c;     --off-soft: #ffedd5;
    --def: #1d4ed8;     --def-soft: #dbeafe;
    --hyb: #6d28d9;     --hyb-soft: #ede9fe;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --radius: 12px;
    --sidebar: 252px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
    --bg: #0e1320;
    --surface: #171e2f;
    --surface-2: #1c2438;
    --text: #e6e9f2;
    --muted: #98a2b8;
    --border: #2a3350;
    --primary: #8b87ff;
    --primary-soft: #232a52;
    --primary-text: #0e1320;
    --ok: #4ade9a;     --ok-soft: #12302a;
    --warn: #fbbf64;   --warn-soft: #35290f;
    --danger: #ff7b7b; --danger-soft: #3a1a1c;
    --off: #fb923c;    --off-soft: #3a2312;
    --def: #7aa8ff;    --def-soft: #16264a;
    --hyb: #b79cff;    --hyb-soft: #2a2050;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
small, .muted { color: var(--muted); }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 30; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.brand small { display: block; font-weight: 500; font-size: 11px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-group { margin: 14px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.nav a.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text); font-weight: 500; margin: 1px 0; }
.nav a.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav a.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav a.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-sub { margin: 2px 0 6px 28px; border-left: 2px solid var(--border); padding-left: 8px; }
.nav-sub a { display: block; padding: 5px 8px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.nav-sub a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav-sub a.active { color: var(--primary); font-weight: 600; }
.side-foot { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex: none; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { margin-left: var(--sidebar); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 10px 24px; }
.topbar .crumbs { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumbs b { color: var(--text); }
.topbar form { display: flex; gap: 6px; }
.content { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 9px; width: 36px; height: 36px; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.burger { display: none; }
.scrim { display: none; }

/* ---------- komponenty ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.tabs a { padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--primary-soft); color: var(--primary); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 15px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.up { color: var(--ok); } .down { color: var(--danger); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary, .btn-primary, input[type=submit].btn, input.submit { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover, .btn-primary:hover, input[type=submit].btn:hover, input.submit:hover { filter: brightness(1.08); background: var(--primary); }
.btn.danger, .btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 7px; }
.btn svg { width: 16px; height: 16px; }
input[type=submit].btn, input.submit { padding: 8px 18px; border-radius: 9px; font-weight: 600; cursor: pointer; border: 1px solid var(--primary); font: inherit; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.off { background: var(--off-soft); color: var(--off); border-color: transparent; }
.badge.def { background: var(--def-soft); color: var(--def); border-color: transparent; }
.badge.hybrid { background: var(--hyb-soft); color: var(--hyb); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.alert.ok, .succes { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.alert.danger, .fail { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.succes, .fail { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }

/* tabulky */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.table .dim { color: var(--muted); opacity: .55; }
table[data-sortable] th { cursor: pointer; user-select: none; }
table[data-sortable] th.sorted-asc::after { content: " ▲"; font-size: 9px; }
table[data-sortable] th.sorted-desc::after { content: " ▼"; font-size: 9px; }
.row-off { box-shadow: inset 3px 0 0 var(--off); }
.row-def { box-shadow: inset 3px 0 0 var(--def); }
.row-hybrid { box-shadow: inset 3px 0 0 var(--hyb); }

/* formuláře */
label.field { display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=number], input[type=search], input[type=password], select, textarea, .input {
    width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
input.ts { width: 74px; text-align: center; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
.inline-form { display: inline; }
/* starší Form.php */
.form_line { margin-bottom: 12px; }
.form_text, .form_text_long { font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.txtpole { min-height: 120px; }
.form small { color: var(--muted); }

/* off/def pruh */
.bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); min-width: 90px; }
.bar i { display: block; height: 100%; }
.bar .o { background: var(--off); } .bar .d { background: var(--def); }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; background: var(--muted); }
.legend .o::before { background: var(--off); } .legend .d::before { background: var(--def); }

/* vkládací zóna (CTRL+V) */
.paste-zone { border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); min-height: 150px; padding: 14px; overflow: auto; outline: none; }
.paste-zone:focus { border-color: var(--primary); background: var(--primary-soft); }
.paste-zone:empty::before { content: attr(data-placeholder); color: var(--muted); }
.paste-result { margin-top: 12px; }

/* grafy */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--border); } .chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .12; }
.chart .tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 4px 8px; border-radius: 7px; font-size: 12px; transform: translate(-50%, -120%); white-space: nowrap; display: none; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { max-width: 420px; width: 100%; }
.login img { width: 64px; height: 64px; border-radius: 16px; }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }

@media (max-width: 1000px) {
    .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0, 0, 0, .2); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 25; }
    .main { margin-left: 0; }
    .burger { display: inline-grid; }
    .content { padding: 16px; }
    .topbar { padding: 10px 16px; }
    .topbar form { display: none; }
}
@media (max-width: 640px) {
    .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
    .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 12px 14px; } .stat .value { font-size: 20px; }
    .page-head h1 { font-size: 20px; }
}
@media print { .sidebar, .topbar { display: none; } .main { margin: 0; } }

/* přepínací "čipy" (role vesnic u artefaktů) */
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip { position: relative; display: inline-block; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.chip span { display: inline-block; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 12px; user-select: none; }
.chip input:focus-visible + span { outline: 2px solid var(--primary); }
.chip.off input:checked + span { background: var(--off-soft); color: var(--off); border-color: var(--off); }
.chip.cata input:checked + span { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.chip.hero input:checked + span { background: var(--hyb-soft); color: var(--hyb); border-color: var(--hyb); }
.chip.auto input:checked + span { border-style: dashed; }
.timeline { display: grid; gap: 8px; }
.heat { width: 100%; max-width: 760px; height: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.legend-scale { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend-scale i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -3px; margin-right: 4px; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; min-height: 140px; }
