/* Klienti — minimal, modern, readable */
:root {
    --bg: #f5f6f8;
    --bg-card: #ffffff;
    --border: #e2e5ea;
    --text: #1f2937;
    --text-muted: #6b7280;
    --primary: #305496;
    --primary-hover: #244379;
    --danger: #c0392b;
    --green-bg: #dcfce7; --green-text: #166534;
    --red-bg:   #fee2e2; --red-text: #991b1b;
    --gray-bg:  #f3f4f6; --gray-text: #374151;
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0; background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
}

/* --- topbar --- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { font-size: 16px; }
.brand .subtitle { color: var(--text-muted); font-size: 13px; padding: 2px 8px; background: var(--gray-bg); border-radius: 4px; }
.logo-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); }

/* --- toolbar --- */
.toolbar {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 24px; background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.toolbar input[type="search"] {
    flex: 0 1 320px;
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px;
}
.toolbar select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    background: white;
}
.toolbar .count { color: var(--text-muted); font-size: 13px; padding-left: 8px; }
.toolbar .spacer { flex: 1; }

/* --- buttons --- */
.btn {
    display: inline-flex; align-items: center;
    padding: 8px 14px; border-radius: 6px; border: 1px solid transparent;
    font-size: 14px; cursor: pointer; text-decoration: none;
    background: var(--bg-card); color: var(--text);
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-card); border-color: var(--border); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }

/* --- table --- */
main { padding: 0; overflow-x: auto; }
table#grid {
    width: 100%; border-collapse: collapse; background: var(--bg-card);
    font-size: 13px;
}
table#grid thead { position: sticky; top: 0; z-index: 5; background: var(--bg-card); }
table#grid th {
    text-align: left; padding: 10px 12px; font-weight: 600;
    color: var(--text); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table#grid th.sortable { cursor: pointer; user-select: none; }
table#grid th.sortable:hover { background: #f9fafb; }
table#grid td {
    padding: 8px 12px; border-bottom: 1px solid #f1f2f5; vertical-align: top;
    max-width: 280px; overflow: hidden; text-overflow: ellipsis;
}
table#grid tbody tr:hover { background: #fafbfc; cursor: pointer; }
table#grid tbody tr:hover td.col-actions { background: inherit; }

.col-int, .col-money, .col-date { white-space: nowrap; }
.col-money, .col-int { text-align: right; }
.col-longtext { max-width: 360px; white-space: pre-wrap; }

.col-actions { width: 80px; text-align: right; white-space: nowrap; }
.col-actions button {
    background: transparent; border: none; cursor: pointer; padding: 4px 6px;
    font-size: 16px; color: var(--text-muted); border-radius: 4px;
}
.col-actions button:hover { background: var(--gray-bg); color: var(--text); }
.col-actions .row-del:hover { color: var(--danger); }

/* --- chips (stav schvaľovania) --- */
td.chip {
    display: table-cell; /* keep table layout */
}
td.chip::before {
    content: attr(data-chip);
}
td.chip-yes { color: var(--green-text); }
td.chip-yes::before, td.chip-no::before { display: none; }
td.col-choice {
    text-align: center;
}
td.chip-yes {
    background: var(--green-bg); color: var(--green-text); font-weight: 600;
}
td.chip-no {
    background: var(--red-bg); color: var(--red-text); font-weight: 600;
}

.loading, .empty {
    padding: 40px; text-align: center; color: var(--text-muted);
}

/* --- dialog --- */
dialog {
    border: 1px solid var(--border); border-radius: 10px; padding: 0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    max-width: 720px; width: 90%;
}
dialog::backdrop {
    background: rgba(0,0,0,0.4);
}
dialog form { padding: 20px 24px; }
dialog h2 { margin: 0 0 16px 0; font-size: 18px; }
.form-grid {
    display: grid; gap: 12px;
    grid-template-columns: 1fr 1fr;
}
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field span { color: var(--text-muted); }
.field input, .field textarea, .field select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px; font-family: inherit;
}
.field-longtext { grid-column: 1 / -1; }
.dialog-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}

/* --- login --- */
.login-wrap {
    min-height: 100vh; display: grid; place-items: center;
    background: linear-gradient(135deg, #f5f6f8 0%, #e8ecf3 100%);
}
.login-card {
    width: 360px; padding: 32px;
    background: white; border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}
.login-card h1 { margin: 0 0 4px 0; }
.login-card .muted { color: var(--text-muted); margin: 0 0 20px 0; font-size: 13px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-bottom: 12px; }
.login-card input {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px;
}
.login-card button {
    width: 100%; margin-top: 8px;
    padding: 12px; background: var(--primary); color: white;
    border: none; border-radius: 6px; font-size: 14px; font-weight: 600;
    cursor: pointer;
}
.login-card button:hover { background: var(--primary-hover); }
.login-card .error {
    padding: 8px 12px; background: var(--red-bg); color: var(--red-text);
    border-radius: 6px; margin-bottom: 12px; font-size: 13px;
}
