/* ════════════════════════════════════════════
   Fakturář — design system
   Newsreader (display) + IBM Plex Sans (UI)
═══════════════════════════════════════════════ */

:root {
    --paper: #F4EFE3;
    --paper-2: #FAF6EC;
    --surface: #FFFFFF;
    --ink: #1A1815;
    --ink-soft: #4A463F;
    --muted: #8A857C;
    --line: #E5DDC9;
    --line-soft: #EDE7D6;
    --accent: #2D4A3E;
    --accent-soft: #E5EDE8;
    --accent-ink: #173028;
    --warn: #B0431D;
    --warn-soft: #F6E4D9;
    --ok: #2D6A4F;
    --ok-soft: #DCEAE0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: 0;
    background: transparent;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

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

.boot {
    display: grid;
    place-items: center;
    min-height: 100vh;
    color: var(--muted);
    font-size: 14px;
}

/* ── Typography ───────────────────── */
.display {
    font-family: 'Newsreader', Georgia, serif;
    font-optical-sizing: auto;
    letter-spacing: -0.015em;
    font-weight: 500;
}
.mono { font-family: 'IBM Plex Mono', monospace; }
.tabular { font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); }
.ink-soft { color: var(--ink-soft); }
.ink { color: var(--ink); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }
.text-accent { color: var(--accent); }

.uppercase {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--ink-soft);
}

.ornament::before {
    content: '';
    display: inline-block;
    width: 28px; height: 1px;
    background: var(--ink-soft);
    vertical-align: middle;
    margin-right: 0.625rem;
    opacity: 0.5;
}

h1.display, h2.display, h3.display { margin: 0; line-height: 1.1; }

/* ── Buttons ──────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.05rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.3;
    letter-spacing: -0.005em;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: var(--paper);
    border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-ink);
    border-color: var(--accent-ink);
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-soft); }

.btn-ghost {
    color: var(--ink-soft);
    padding: 0.5rem;
    border-radius: 6px;
    background: transparent;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.15s ease;
}
.btn-ghost:hover:not(:disabled) { background: var(--line-soft); color: var(--ink); }
.btn-ghost.btn-danger:hover { background: var(--warn-soft); color: var(--warn); }

.btn-warn { background: var(--warn); color: white; border-color: var(--warn); }
.btn-warn:hover:not(:disabled) { background: #8A3417; }

.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; }

/* ── Forms ────────────────────────── */
.input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.numeric {
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.input.mono { font-family: 'IBM Plex Mono', monospace; }

textarea.input { min-height: 38px; resize: vertical; }

.label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 0.375rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.field { display: block; }
.field + .field { margin-top: 1rem; }
.grid > .field + .field { margin-top: 0; }
.grid > .field { margin-top: 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    font-size: 0.875rem;
}
.checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ── Card ─────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}
.card-pad { padding: 1.5rem; }

/* ── Layout ───────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    border-right: 1px solid var(--line);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}
.sidebar-brand {
    margin-bottom: 1.5rem;
}
.sidebar-brand h1 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.85rem;
    font-weight: 500;
    margin: 0;
    letter-spacing: -0.02em;
    font-variation-settings: "opsz" 56;
}
.sidebar-stats {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line-soft);
}
.sidebar-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 0.2rem 0;
}
.sidebar-stat .v { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.78rem; }
.sidebar-user {
    margin-top: 1rem;
    padding: 0.625rem;
    border-radius: 8px;
    background: var(--paper-2);
    font-size: 0.78rem;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.sidebar-user .email {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; min-width: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    color: var(--ink-soft);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    width: 100%;
    text-align: left;
    cursor: pointer;
    background: transparent;
    border: 0;
    font-family: inherit;
}
.nav-item:hover { background: var(--line-soft); color: var(--ink); }
.nav-item.active {
    background: var(--ink);
    color: var(--paper-2);
}
.nav-item .ic {
    width: 17px; height: 17px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.main {
    flex: 1;
    padding: 2.5rem;
    max-width: 1100px;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 30;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0.625rem 1rem;
    align-items: center;
    justify-content: space-between;
}
.mobile-nav h1 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 500;
    margin: 0;
}

@media (max-width: 800px) {
    .sidebar { display: none; }
    .mobile-nav { display: flex; }
    .main { padding: 5rem 1.25rem 2rem; max-width: 100%; }
}

/* ── Hero ─────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.page-title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 2.75rem;
    font-weight: 500;
    margin: 0.25rem 0 0;
    letter-spacing: -0.025em;
    font-variation-settings: "opsz" 72;
    line-height: 1.05;
}
@media (max-width: 600px) {
    .page-title { font-size: 2rem; }
}

/* ── Stat cards ───────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}
@media (max-width: 800px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.stat-card .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stat-card .label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--muted);
    margin: 0;
}
.stat-card .value {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.55rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.stat-card .hint {
    font-size: 0.78rem;
    color: var(--muted);
}

/* ── Badges ───────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.badge-paid { background: var(--ok-soft); color: var(--ok); }
.badge-unpaid { background: var(--line-soft); color: var(--ink-soft); }
.badge-overdue { background: var(--warn-soft); color: var(--warn); }

/* ── Tables ───────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
    text-align: left;
    padding: 0.85rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.tbl td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.9rem;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.row-clickable { cursor: pointer; }
.tbl tr.row-clickable:hover td { background: var(--paper-2); }
.tbl .actions { text-align: right; opacity: 0.75; }
.tbl tr:hover .actions { opacity: 1; }
.tbl .right { text-align: right; }

/* ── Filter pills ────────────────── */
.pills {
    display: inline-flex;
    gap: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.25rem;
}
.pill {
    padding: 0.4rem 0.85rem;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-soft);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: all 0.15s ease;
}
.pill:hover { color: var(--ink); }
.pill.active { background: var(--ink); color: var(--paper-2); }

/* ── Search ────────────────────────── */
.search {
    position: relative;
    max-width: 360px;
    width: 100%;
}
.search input { padding-left: 2.25rem; }
.search .ic {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

/* ── Empty state ──────────────────── */
.empty {
    text-align: center;
    padding: 3.5rem 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}
.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 1rem;
}
.empty h3 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.5rem;
    margin: 0.25rem 0 0.5rem;
    font-weight: 500;
}
.empty p {
    color: var(--ink-soft);
    margin: 0 0 1.5rem;
    max-width: 28em;
    margin-left: auto;
    margin-right: auto;
}

/* ── Customer cards grid ─────────── */
.customer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (max-width: 800px) { .customer-grid { grid-template-columns: 1fr; } }
.customer-card {
    padding: 1.25rem;
    transition: border-color 0.15s ease;
}
.customer-card .top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}
.customer-card h3 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 500;
    margin: 0;
    letter-spacing: -0.01em;
}
.customer-card .actions {
    display: flex;
    gap: 0.125rem;
    opacity: 0.6;
}
.customer-card:hover .actions { opacity: 1; }
.customer-card .meta {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line-soft);
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.78rem;
}

/* ── Modal ────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 21, 0.45);
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-lg { max-width: 980px; }
.modal-head {
    padding: 1.5rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-head h2 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0;
    letter-spacing: -0.015em;
}
.modal-body { padding: 1.5rem; }
.modal-foot {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Full screen modal for invoice editor */
.fullscreen {
    position: fixed; inset: 0; z-index: 40;
    background: var(--paper);
    overflow-y: auto;
}
.fullscreen-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem;
}
@media (max-width: 800px) { .fullscreen-inner { padding: 1.25rem; } }

/* ── Section box ─────────────────── */
.section-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.section-title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0 0 1.25rem;
    letter-spacing: -0.01em;
}

/* ── Item rows in invoice editor ──── */
.items-table {
    width: 100%;
    border-collapse: collapse;
}
.items-table th {
    text-align: left;
    padding: 0.5rem 0.5rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--ink-soft);
}
.items-table td { padding: 0.25rem 0.5rem; vertical-align: top; }
.items-table .right { text-align: right; }

.totals {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line-soft);
    display: flex;
    justify-content: flex-end;
}
.totals-box {
    width: 320px;
    max-width: 100%;
}
.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.875rem;
}
.totals-row .v { font-variant-numeric: tabular-nums; font-weight: 500; }
.totals-final {
    margin-top: 0.5rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.totals-final .l {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 500;
}
.totals-final .v {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.55rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* ── Auth screen ─────────────────── */
.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 2.5rem 2rem;
}
.auth-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}
.auth-brand h1 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 500;
    margin: 0.5rem 0 0;
    letter-spacing: -0.025em;
    font-variation-settings: "opsz" 60;
}
.auth-brand p {
    color: var(--muted);
    font-size: 0.875rem;
    margin: 0.5rem 0 0;
}
.auth-tabs {
    display: flex;
    background: var(--paper-2);
    border-radius: 10px;
    padding: 0.25rem;
    margin-bottom: 1.5rem;
}
.auth-tabs button {
    flex: 1;
    padding: 0.55rem;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-soft);
}
.auth-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }

.alert {
    padding: 0.75rem 0.875rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.alert-error { background: var(--warn-soft); color: var(--warn); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line); }

/* ── Dashboard ───────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 1000px) { .dashboard-grid { grid-template-columns: 1fr; } }

.recent-row {
    display: grid;
    grid-template-columns: 90px 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
    text-align: left;
    background: transparent;
    border-left: 0; border-right: 0; border-top: 0;
    font: inherit; color: inherit;
}
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover { background: var(--paper-2); }

/* Monthly chart */
.chart {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    height: 160px;
}
.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    height: 100%;
    justify-content: flex-end;
}
.chart-bar {
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    background: var(--line);
    min-height: 2px;
}
.chart-bar-paid { background: var(--accent); }
.chart-month {
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.chart-tooltip {
    font-size: 0.65rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transition: opacity 0.15s;
}
.chart-col:hover .chart-tooltip { opacity: 1; }
.chart-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--ink-soft);
}
.legend-dot {
    display: inline-block;
    width: 11px; height: 11px;
    border-radius: 3px;
    margin-right: 0.4rem;
    vertical-align: middle;
}

/* ── ARES lookup ─────────────────── */
.ares-box {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.ares-results {
    margin-top: 0.75rem;
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.ares-result {
    display: block;
    text-align: left;
    width: 100%;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.ares-result:hover { border-color: var(--ink-soft); }
.ares-result .nm { font-size: 0.875rem; font-weight: 500; }
.ares-result .ad { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }

/* ── Actions row ──────────────────── */
.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.125rem;
}

/* ── Print page ──────────────────── */
.print-shell {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(26, 24, 21, 0.55);
    overflow-y: auto;
    padding: 2rem 1rem;
}
.print-toolbar {
    max-width: 920px;
    margin: 0 auto 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.print-page {
    background: white;
    color: #1A1815;
    width: 210mm;
    min-height: 297mm;
    padding: 18mm 16mm;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 10pt;
    line-height: 1.4;
}
.print-page table { width: 100%; border-collapse: collapse; }
.print-page .item-row td {
    padding: 10px 8px;
    border-bottom: 1px solid #E5DDC9;
    font-variant-numeric: tabular-nums;
    vertical-align: top;
}
.print-page .item-head th {
    padding: 10px 8px;
    border-bottom: 1.5px solid #1A1815;
    font-size: 9pt;
    font-weight: 600;
    text-align: left;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

@media print {
    @page { size: A4; margin: 0; }
    body { background: white !important; }
    .no-print { display: none !important; }
    .print-shell {
        position: static !important;
        background: white !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    .print-page {
        box-shadow: none !important;
        margin: 0 !important;
        width: 100% !important;
        min-height: auto !important;
    }
}

/* ── Misc ─────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.25s ease; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 0.8s linear infinite; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.78rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.italic { font-style: italic; }
.hidden { display: none; }
@media (min-width: 800px) { .md-hidden { display: none; } }
@media (max-width: 799px) { .desktop-only { display: none; } }

/* ── Custom dialog (alert/confirm replacement) ─────── */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 21, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
}
.dialog {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: dialogIn 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}
@keyframes dialogIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.dialog-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin-bottom: 0.85rem;
}
.dialog-icon-warn  { background: var(--warn-soft); color: var(--warn); }
.dialog-icon-info  { background: var(--accent-soft); color: var(--accent); }
.dialog-icon-danger { background: var(--warn-soft); color: var(--warn); }
.dialog-icon-ok    { background: var(--ok-soft); color: var(--ok); }

.dialog-body {
    padding: 1.5rem 1.5rem 1.25rem;
}

.dialog-title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 500;
    margin: 0 0 0.35rem;
    letter-spacing: -0.015em;
    line-height: 1.25;
    color: var(--ink);
}

.dialog-msg {
    color: var(--ink-soft);
    font-size: 0.92rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.dialog-detail {
    margin-top: 0.85rem;
    padding: 0.75rem 0.85rem;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.dialog-detail-label {
    color: var(--ink-soft);
    font-size: 0.78rem;
}
.dialog-detail-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
}

.dialog-foot {
    padding: 0.85rem 1.5rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

