:root {
    --bg: #f5f1ea;
    --bg-panel: #fffdf8;
    --ink: #16202a;
    --ink-muted: #5f6b78;
    --line: #d8d1c7;
    --accent: #8a5d24;
    --accent-2: #0d4f63;
    --danger: #b42318;
    --ok: #0d7a4a;
    --warning: #a15c07;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top right, #efe5d7 0%, #f5f1ea 45%, #ebe4d8 100%);
}

a {
    color: var(--accent-2);
    text-decoration: none;
}

.layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.brand {
    font-family: "Bitter", Georgia, serif;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.05);
}

.grid {
    display: grid;
    gap: 14px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 4px;
}

input,
select,
textarea,
button {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 14px;
    font-family: inherit;
}

textarea {
    min-height: 78px;
    resize: vertical;
}

button {
    cursor: pointer;
    background: #fff;
}

button.primary {
    background: linear-gradient(130deg, #97682a 0%, #764a17 100%);
    color: #fff;
    border: 0;
}

button.secondary {
    border-color: #bdd2da;
    background: #edf5f8;
    color: #123b4a;
}

button.danger {
    border-color: #f2c7c1;
    background: #fef4f2;
    color: var(--danger);
}

.inline-actions {
    display: flex;
    gap: 8px;
}

.inline-actions button {
    width: auto;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 9px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    white-space: nowrap;
}

th {
    font-size: 12px;
    color: var(--ink-muted);
}

.tag {
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
}

.tag.ok {
    background: #ecfdf3;
    color: var(--ok);
}

.tag.warning {
    background: #fff8eb;
    color: var(--warning);
}

.tag.danger {
    background: #fef3f2;
    color: var(--danger);
}

.metrics {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
}

.metric .k {
    font-size: 12px;
    color: var(--ink-muted);
}

.metric .v {
    font-size: 20px;
    font-weight: 700;
    margin-top: 6px;
}

.notice {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-top: 10px;
}

.notice.error {
    background: #fef3f2;
    color: var(--danger);
}

.notice.success {
    background: #ecfdf3;
    color: var(--ok);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

/* ---- Raboš tab navigation ---- */
.rabos-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--line);
}

.rabos-tabs .tab {
    padding: 8px 18px;
    border-radius: 8px 8px 0 0;
    color: var(--ink-muted);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
}

.rabos-tabs .tab:hover {
    background: #ece5da;
    color: var(--ink);
}

.rabos-tabs .tab.active {
    background: var(--bg-panel);
    color: var(--accent);
    border-color: var(--line);
    border-bottom-color: var(--bg-panel);
}

/* ---- Panel header ---- */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.panel-header h3 {
    margin: 0;
}

/* ---- Filter bar ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar select {
    width: auto;
    flex: 1 1 150px;
    max-width: 260px;
}

.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filter-bar .filter-group label {
    margin: 0;
}

.filter-bar button {
    width: auto;
}

.filter-count {
    font-size: 12px;
    color: var(--ink-muted);
    margin-bottom: 6px;
    min-height: 16px;
}

/* ---- Clusterize scroll area ---- */
.clusterize-scroll {
    max-height: 520px;
    overflow-y: auto;
}

.clusterize-extra-row {
    display: none;
}

.clusterize-keep-parity .clusterize-extra-row.clusterize-extra-bottom {
    display: table-row;
}

/* ---- Interactive table rows ---- */
tbody tr.data-row {
    cursor: pointer;
    transition: background 0.1s;
}

tbody tr.data-row:hover {
    background: #f0ebe3;
}

tbody tr.data-row.row-selected {
    background: #e8ddd0;
}

tbody tr.data-row.row-selected td {
    border-bottom-color: #c9b99e;
}

@media (max-width: 900px) {
    .grid.two,
    .grid.three,
    .metrics {
        grid-template-columns: 1fr;
    }

    th,
    td {
        font-size: 12px;
    }

    .rabos-tabs .tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .filter-bar input[type="text"],
    .filter-bar input[type="date"],
    .filter-bar select {
        max-width: 100%;
    }
}
