:root {
    --primary:   #2563eb;
    --primary-h: #1d4ed8;
    --bg:        #f8fafc;
    --surface:   #ffffff;
    --border:    #e2e8f0;
    --text:      #1e293b;
    --muted:     #64748b;
    --success:   #16a34a;
    --success-bg:#dcfce7;
    --danger:    #dc2626;
    --danger-bg: #fee2e2;
    --warn-bg:   #fef9c3;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* Nav */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.nav-brand {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
    text-decoration: none;
    margin-right: 16px;
}
.nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav a:hover, .nav a.active {
    background: #eff6ff;
    color: var(--primary);
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Page header */
.page-header {
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.page-header p {
    color: var(--muted);
    margin-top: 4px;
    font-size: 13px;
}

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafa;
}
.card-header h2 {
    font-size: 15px;
    font-weight: 600;
}
.card-body {
    padding: 24px;
}

/* Table */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
thead th {
    background: #f1f5f9;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-warn    { background: var(--warn-bg);     color: #854d0e; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

/* Form */
.form-group { margin-bottom: 20px; }
label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text);
}
.hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    font-family: inherit;
    resize: vertical;
}
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
input[type=text], input[type=email], input[type=password], input[type=url] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #fecaca; }

/* Stats row */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}
.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.stat-card .label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 500;
}

/* Link */
a.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
a.link:hover { text-decoration: underline; }

/* Refresh badge */
.last-update {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Loader */
.spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 12px; }
    .nav { padding: 0 12px; gap: 4px; }
    .nav-brand { font-size: 14px; margin-right: 8px; }
    .nav a { padding: 5px 8px; font-size: 13px; }
    .last-update { display: none; }

    .stats { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
    .stat-card { padding: 14px; }
    .stat-card .value { font-size: 22px; }

    /* Tabulka → card list na mobilu */
    .table-wrap { overflow-x: unset; }

    table thead { display: none; }

    table, tbody, tr, td { display: block; width: 100%; }

    tbody tr {
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 4px 0;
        background: var(--surface);
        box-shadow: 0 1px 3px rgba(0,0,0,.04);
    }
    tbody tr:hover { background: var(--surface); }

    tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 14px;
        border-bottom: 1px solid var(--border);
        font-size: 13px;
        gap: 12px;
    }
    tbody td:last-child { border-bottom: none; }

    tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 11px;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: .4px;
        flex-shrink: 0;
        min-width: 110px;
    }

    .card-header { flex-direction: column; align-items: flex-start; gap: 10px; }

    /* Nastavení – 1 sloupec na mobilu */
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* Code block */
.code {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    word-break: break-all;
    color: #334155;
}
