:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #697386;
    --line: #dbe2ea;
    --paper: #ffffff;
    --page: #f4f7fb;
    --nav: #172033;
    --nav-soft: #24324b;
    --blue: #246bfe;
    --green: #177245;
    --amber: #9a5b00;
    --soft-blue: #eaf1ff;
    --soft-green: #eaf7f0;
    --soft-amber: #fff5df;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--page);
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

button,
input,
select {
    font: inherit;
}

.sidebar {
    min-height: 100vh;
    background: var(--nav);
    color: #fff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #f6c74f;
    color: #172033;
    font-weight: 800;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    color: #aab6c8;
    font-size: 12px;
    margin-top: 3px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav-item {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
    color: #d8e0ec;
    background: transparent;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.is-active {
    background: var(--nav-soft);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px;
    border-radius: 8px;
    background: var(--nav-soft);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.status-ok {
    color: #75e6a1;
}

.shell {
    padding: 28px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 20px;
}

p {
    color: var(--muted);
}

.topbar-actions,
.panel-head,
.filters,
.segmented {
    display: flex;
    align-items: center;
    gap: 10px;
}

.primary-button,
.secondary-button,
.row-button,
.icon-button,
.segmented button {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 38px;
    padding: 0 14px;
    cursor: pointer;
}

.primary-button {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.secondary-button,
.row-button,
.icon-button,
.segmented button {
    background: #fff;
    color: var(--ink);
}

.icon-button {
    width: 38px;
    padding: 0;
}

.view {
    display: none;
}

.view.is-visible {
    display: block;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric,
.panel,
.domain-card,
.customer-header {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric {
    padding: 18px;
}

.metric span,
.metric em {
    display: block;
    color: var(--muted);
    font-style: normal;
}

.metric strong {
    display: block;
    margin: 8px 0;
    font-size: 26px;
}

.panel {
    overflow: hidden;
}

.panel-head {
    justify-content: space-between;
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.panel-head p {
    margin: 6px 0 0;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

td span {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.pill.success {
    color: var(--green);
    background: var(--soft-green);
}

.pill.warning {
    color: var(--amber);
    background: var(--soft-amber);
}

.pill.muted {
    color: var(--muted);
    background: #eef2f6;
}

.customer-header {
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.customer-header p {
    margin: 8px 0 0;
}

.domain-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.domain-card {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.domain-card span,
.mail-list span {
    color: var(--muted);
}

.mail-list {
    display: grid;
}

.mail-list article {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.mail-list article:last-child {
    border-bottom: 0;
}

.billing-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border-bottom: 1px solid var(--line);
}

.billing-summary div {
    background: #fff;
    padding: 18px;
}

.billing-summary span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.billing-summary strong {
    font-size: 22px;
}

.segmented {
    padding: 3px;
    background: #eef2f6;
    border-radius: 8px;
}

.segmented button {
    border: 0;
    min-height: 32px;
    background: transparent;
}

.segmented .is-selected {
    background: #fff;
}

.filters {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.filters input,
.filters select {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
}

.filters input {
    flex: 1;
    min-width: 220px;
}

/* ---------- Doplňkové styly aplikace ---------- */

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

.primary-button, .secondary-button, .row-button {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.row-button { min-height: 32px; font-size: 13px; }
.row-button.danger { color: #b3261e; border-color: #f1c4c0; }
.row-button.danger:hover { background: #fdeceb; }

/* Flash zprávy */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); }
.flash.success { background: var(--soft-green); color: var(--green); border-color: #bfe6cf; }
.flash.error   { background: #fdeceb; color: #b3261e; border-color: #f1c4c0; }
.flash.info    { background: var(--soft-blue); color: var(--blue); border-color: #c8dcff; }

/* Formuláře */
.form-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 22px; max-width: 720px; }
.form-row { display: grid; gap: 6px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { font-size: 14px; font-weight: 600; }
label .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
    width: 100%; min-height: 40px; border: 1px solid var(--line);
    border-radius: 8px; padding: 8px 12px; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; min-height: auto; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--page); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 32px; width: 360px; }
.login-card .brand-mark { margin-bottom: 18px; }

/* Impersonace banner */
.impersonate-bar {
    background: var(--soft-amber); color: var(--amber); border: 1px solid #f0d59a;
    border-radius: 8px; padding: 10px 16px; margin-bottom: 16px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
}

/* Pilulky stavů fakturace */
.pill.to_invoice { color: var(--amber); background: var(--soft-amber); }
.pill.invoiced   { color: var(--blue);  background: var(--soft-blue); }
.pill.paid       { color: var(--green); background: var(--soft-green); }
.pill.skipped    { color: var(--muted); background: #eef2f6; }

/* Kalendář / měsíční navigace */
.month-nav { display: flex; align-items: center; gap: 12px; }
.month-nav strong { font-size: 18px; min-width: 170px; text-align: center; }
.text-right { text-align: right; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Pro stránky bez sidebaru (login) přepneme grid na jeden sloupec */
body.single { grid-template-columns: 1fr; }

@media (max-width: 940px) {
    .form-grid { grid-template-columns: 1fr; }

    body {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
    }

    .metrics,
    .domain-grid,
    .billing-summary {
        grid-template-columns: 1fr;
    }

    .topbar,
    .customer-header,
    .panel-head,
    .filters {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
    }

    .topbar-actions button,
    .customer-header button,
    .filters input,
    .filters select {
        width: 100%;
    }
}

