/* Kameleon Naturalny — Panel v2 */
:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --line: #e3e7ee;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #0f766e;
    --primary-d: #115e59;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #0f766e;
    --warn: #b45309;
    --danger: #b91c1c;
    --ok: #15803d;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: #fff;
}
.brand > div { display: flex; flex-direction: column; }
.brand strong { font-size: 17px; }
.brand small { color: var(--sidebar-text); opacity: .7; }

.brand-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34d399, #0f766e);
    display: inline-block;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, .15);
}

.nav {
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 4px;
    flex: 1;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    padding: 10px 12px;
    border-radius: 8px;
    transition: background .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.nav a.on { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-ico { width: 18px; text-align: center; opacity: .85; }

.sidebar-foot {
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
}
.sidebar-foot .user { color: var(--sidebar-text); }

.content {
    flex: 1;
    padding: 26px 30px 60px;
    max-width: 1200px;
}

/* ---------- Komponenty ---------- */
.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0 0 4px; font-size: 22px; }
.muted { color: var(--muted); }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}
.card-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
}
.card .mt { margin-top: 14px; }

.stat { position: relative; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 800; margin: 4px 0; font-variant-numeric: tabular-nums; }
.stat-value.warn { color: var(--warn); }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.link-stat .stat-sub a { font-weight: 600; }

/* ---------- Toolbar / formularze ---------- */
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.toolbar.wrap { flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 180px; }

.inline { display: inline-flex; }

.form-group { margin-bottom: 14px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }

input[type="text"], input[type="search"], input[type="password"],
input[type="number"], input[type="email"], select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(15, 118, 110, .35);
    border-color: var(--primary);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack input[type="number"] { max-width: 240px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(0,0,0,.04); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--sidebar-text);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

/* ---------- Flash / alerty ---------- */
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 600;
}
.flash-success,
.flash-info { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

.alert {
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: var(--warn);
    border-radius: 8px;
    margin-bottom: 14px;
}
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Tabele ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tbody tr:hover { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-dense th, .table-dense td { padding: 6px 8px; font-size: 13px; }
.table-scroll { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* ---------- Badge ---------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    background: #eef2f7;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-ok { background: #ecfdf5; color: var(--ok); }
.badge-error { background: #fef2f2; color: var(--danger); }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* ---------- Paginacja ---------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 14px;
    flex-wrap: wrap;
}
.pagination .gap { flex: 1; }

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    width: 360px;
    max-width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 28px;
}
.card-head { text-align: center; margin-bottom: 18px; }
.card-head h1 { margin: 10px 0 2px; font-size: 20px; }
.card-head p { margin: 0; color: var(--muted); }

/* ---------- Grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}
.grid .card { margin-bottom: 0; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef2f7; padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* ---------- Responsywne ---------- */
@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .nav a { flex: 1 1 auto; justify-content: center; }
    .sidebar-foot { flex-direction: row; justify-content: space-between; align-items: center; }
    .content { padding: 18px 16px 40px; }
    .cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .cards { grid-template-columns: 1fr; }
}