/* =========================================================
   KOM7 – jednotný vzhled aplikace
   Primárně pro telefon, na desktopu se rozšíří.
   Barvy a rozměry se mění na jednom místě – v :root.
   ========================================================= */

:root {
    /* Barvy */
    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-2: #f7f8fb;
    --surface-3: #eef1f6;
    --text: #101828;
    --text-2: #344054;
    --muted: #667085;
    --faint: #98a2b3;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;

    --brand: #3056d3;
    --brand-hover: #2445b4;
    --brand-soft: #eef2ff;
    --brand-text: #2b4bb8;

    --success: #067647;
    --success-soft: #ecfdf3;
    --success-border: #abefc6;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --warning-border: #fedf89;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --danger-border: #fecdca;

    /* Rozměry */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --control-h: 44px;
    --gap: 12px;
    --page-max: 1200px;
    --gutter: 16px;
    --appbar-h: 56px;
    --tabbar-h: 64px;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.16);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* =========================================================
   Základ
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    /* místo pro spodní lištu na telefonu */
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}

h1, h2, h3 {
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h1 {
    margin: 0 0 16px;
    font-size: 24px;
    font-weight: 700;
}

h2 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 650;
}

h3 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 650;
}

p {
    margin: 0 0 12px;
}

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

a:hover {
    text-decoration: underline;
}

strong {
    font-weight: 650;
}

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

/* =========================================================
   Rozvržení stránky
   ========================================================= */

.page,
.container,
.wrap,
.dashboard {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 20px var(--gutter) 24px;
}

/* .page může obalovat vnořený .container (import, účty, byty) */
.page > .container,
.page > main.container {
    padding: 0;
}

/* Hlavička stránky: nadpis + akce */
.top,
.head,
.page-header,
.topbar,
.table-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 18px;
}

.top h1,
.head h1,
.page-header h1,
.topbar h1 {
    margin: 0;
}

.topbar {
    position: static;
    padding: 0;
    background: none;
    border: 0;
}

.eyebrow {
    margin-bottom: 2px;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* „KOM7“ nad nadpisem je díky horní liště zbytečné */
.topbar .eyebrow {
    display: none;
}

.page-title,
.title,
.dashboard-title {
    margin: 0 0 16px;
}

.sub,
.subnote,
.detail-subtitle,
.contract-subtitle {
    color: var(--muted);
}

.sub {
    margin: -8px 0 18px;
}

.back-row {
    margin-bottom: 12px;
}

/* =========================================================
   Horní lišta + navigace
   ========================================================= */

.appbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.appbar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: var(--page-max);
    height: var(--appbar-h);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    color: var(--text);
    text-decoration: none !important;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f74f0, var(--brand));
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-text {
    display: flex;
    flex-direction: column;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.15;
}

.brand-text small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.appnav {
    display: none;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.appnav a {
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
}

.appnav a:hover {
    background: var(--surface-3);
}

.appnav a.active {
    background: var(--brand-soft);
    color: var(--brand-text);
    font-weight: 600;
}

/* Spodní lišta (telefon) */
.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--border);
}

.tabbar > a,
.tabbar-more > summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: var(--tabbar-h);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    list-style: none;
}

.tabbar-more > summary::-webkit-details-marker {
    display: none;
}

.tabbar > a.active,
.tabbar-more.active > summary,
.tabbar-more[open] > summary {
    color: var(--brand);
}

.nav-icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tabbar-more {
    position: relative;
}

.tabbar-sheet {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 10px);
    display: grid;
    gap: 2px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.tabbar-sheet a {
    padding: 13px 14px;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
}

.tabbar-sheet a:hover {
    background: var(--surface-2);
}

.tabbar-sheet a.active {
    background: var(--brand-soft);
    color: var(--brand-text);
}

@media (min-width: 900px) {
    body {
        padding-bottom: 32px;
    }

    .appnav {
        display: flex;
    }

    .tabbar {
        display: none;
    }
}

/* =========================================================
   Karty / sekce
   ========================================================= */

.card,
.section,
.form,
.result-card,
.table-card,
.detail-card,
.section-card,
.contract-card,
.byt-card,
.group {
    margin: 0 0 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.card > h2:first-child,
.section > h2:first-child,
.form > h2:first-child,
.section-card > h2:first-child {
    margin-top: 0;
}

@media (min-width: 700px) {
    .card,
    .section,
    .form,
    .result-card,
    .table-card,
    .detail-card,
    .section-card,
    .contract-card,
    .byt-card {
        padding: 20px;
    }
}

/* Rozbalovací sekce (detail subjektu) */
details.section {
    padding: 0;
    overflow: hidden;
}

details.section > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
}

details.section > summary::-webkit-details-marker {
    display: none;
}

details.section > summary::after {
    content: "";
    width: 9px;
    height: 9px;
    margin-left: 12px;
    border-right: 2px solid var(--faint);
    border-bottom: 2px solid var(--faint);
    transform: rotate(45deg);
    transition: transform 0.15s;
}

details.section[open] > summary::after {
    transform: rotate(-135deg);
}

.section-content {
    padding: 0 16px 16px;
}

/* =========================================================
   Tlačítka
   ========================================================= */

/* Holé <button> bez třídy = hlavní akce */
:where(button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--control-h);
    padding: 0 18px;
    border: 1px solid var(--brand);
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

:where(button):hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
}

/* .btn / .button = sekundární (světlé) tlačítko */
.btn,
.button,
.filter,
.filters a:not(.btn),
.month-nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--control-h);
    padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover,
.button:hover,
.filter:hover,
.filters a:not(.btn):hover,
.month-nav-button:hover {
    background: var(--surface-2);
}

.btn.primary,
.button.primary,
button.primary,
.primary.btn,
a.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.btn.primary:hover,
.button.primary:hover,
button.primary:hover,
a.primary:hover {
    border-color: var(--brand-hover);
    background: var(--brand-hover);
}

.button.secondary,
.btn.secondary {
    border-color: var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
}

.danger,
.btn.danger,
.button.danger,
button.danger {
    border-color: var(--danger-border);
    background: var(--danger-soft);
    color: var(--danger);
}

.danger:hover,
.btn.danger:hover,
.button.danger:hover,
button.danger:hover {
    border-color: #fda29b;
    background: #fee4e2;
}

.btn.small,
.button.small,
button.small {
    min-height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

button:disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Skupiny tlačítek */
.actions,
.buttons,
.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.button-row,
.form .actions,
form > .actions,
.buttons {
    margin-top: 16px;
}

.top .actions,
.top .buttons,
.head .actions {
    margin-top: 0;
}

/* Na telefonu jsou hlavní akce formulářů přes celou šířku */
@media (max-width: 600px) {
    .form .actions > *,
    form > .actions > *,
    .buttons > *,
    .button-row > * {
        flex: 1 1 auto;
    }
}

/* Filtry / segmenty */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
}

.filters a:not(.btn),
.filter {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 14px;
}

.filters a.active,
.filter.active {
    border-color: var(--text);
    background: var(--text);
    color: #fff;
}

.filters select {
    flex: 1 1 160px;
    width: auto;
}

/* =========================================================
   Formuláře
   ========================================================= */

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea) {
    width: 100%;
    min-height: var(--control-h);
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px; /* 16px zabrání zoomu na iOS */
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}

:where(select) {
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}

:where(textarea) {
    min-height: 90px;
    resize: vertical;
}

:where(input, select, textarea):focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(48, 86, 211, 0.15);
}

:where(input, select, textarea):disabled {
    background: var(--surface-2);
    color: var(--muted);
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    vertical-align: middle;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

.field label,
.edit-amount label,
.filter-form label {
    display: block;
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}

.grid,
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 640px) {
    .grid,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.full {
    grid-column: 1 / -1;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

form {
    margin: 0;
}

/* =========================================================
   Tabulky
   ========================================================= */

.table-wrap,
.wrap > div[style*="overflow"],
.invoice-list,
.subtable-wrap,
.history-table-wrap,
.prehled-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

:where(table) {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

:where(th, td) {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

:where(th) {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    background: var(--surface-2);
}

:where(tbody tr:last-child td) {
    border-bottom: 0;
}

:where(tbody tr:hover td) {
    background: #fafbfd;
}

/* Samostatně stojící tabulka bez karty dostane rámeček */
.table-wrap:not(.card *):not(.section *):not(.group *):not(.table-card *),
.wrap > div[style*="overflow"],
.prehled-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.num,
.number {
    text-align: right !important;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   Hlášky
   ========================================================= */

.msg,
.message,
.success,
.err,
.error,
.errors,
.alert {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: 14px;
}

.msg,
.message,
.success {
    border-color: var(--success-border);
    background: var(--success-soft);
    color: #05603a;
}

.err,
.error,
.errors {
    border-color: var(--danger-border);
    background: var(--danger-soft);
    color: #912018;
}

.errors ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.errors li {
    margin-bottom: 4px;
}

/* =========================================================
   Štítky
   ========================================================= */

.status,
.badge,
.locked-badge,
.history-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.status.off,
.badge,
.history-count {
    background: var(--surface-3);
    color: var(--muted);
}

.badge-meter {
    background: #eaf2ff;
    color: #1849a9;
}

.badge-person {
    background: #fdf2e3;
    color: #93370d;
}

/* =========================================================
   Barvy textu
   ========================================================= */

.ok,
.balance-minus,
.remaining-paid,
.prescription-remaining.paid {
    color: var(--success);
}

.warn,
.balance-plus,
.remaining-unpaid,
.prescription-remaining.unpaid {
    color: var(--warning);
}

.missing,
.error-number {
    color: var(--danger);
    font-weight: 600;
}

.muted,
.no-meter,
.prazdna {
    color: var(--muted);
}

.small:not(.btn):not(.button):not(button),
.hint,
.note,
.group-note {
    color: var(--muted);
    font-size: 13px;
}

.label {
    color: var(--muted);
    font-size: 12px;
}

.empty,
.section-empty,
.payment-empty {
    padding: 14px;
    background: var(--surface-2);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

/* =========================================================
   Metriky (souhrnné dlaždice)
   ========================================================= */

.summary-item,
.metric,
.detail-item,
.result-grid > div,
.group-metric {
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 0;
}

.summary-label,
.metric .l,
.detail-label,
.result-grid span,
.group-metric .label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.summary-value,
.metric .v,
.detail-value,
.result-grid strong,
.group-metric .value {
    display: block;
    margin-top: 2px;
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

/* =========================================================
   Import výpisu / Bankovní účty
   ========================================================= */

.card > .label,
.table-header .label,
.byt-label {
    margin-bottom: 4px;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.count {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.file-box {
    display: block;
    margin-top: 14px;
    padding: 18px;
    background: var(--surface-2);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
}

.file-title {
    display: block;
    font-weight: 650;
}

.file-description {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

input[type="file"] {
    display: block;
    width: 100%;
    margin-top: 14px;
    font-size: 14px;
}

.file-box + button {
    width: 100%;
    margin-top: 14px;
}

@media (max-width: 600px) {
    .card form > button[type="submit"],
    .table-card form > button[type="submit"] {
        width: 100%;
        margin-top: 14px;
    }
}

.result-title {
    font-size: 16px;
    font-weight: 700;
}

.filename {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

/* =========================================================
   Přehled bytů (byty.php)
   ========================================================= */

.byt-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.byt-card .current {
    margin-top: 14px;
    padding: 14px;
    background: var(--surface-2);
    border-radius: var(--radius);
}

.byt-card .tenant span,
.byt-card .values span,
.byt-card .detail-grid span {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 12px;
}

.byt-card .tenant strong {
    font-size: 17px;
}

.byt-card .values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.byt-card .values strong {
    font-size: 15px;
}

.byt-card details {
    margin-top: 14px;
    border-top: 1px solid var(--border);
}

.byt-card summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 2px 2px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.byt-card summary::-webkit-details-marker {
    display: none;
}

.byt-card summary::before {
    content: "›";
    font-size: 20px;
    line-height: 1;
    transition: transform 0.15s;
}

.byt-card details[open] summary::before {
    transform: rotate(90deg);
}

.byt-card summary span:first-of-type {
    margin-right: auto;
}

.byt-card .history {
    padding-top: 8px;
}

.byt-card .contract {
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.byt-card .contract:first-child {
    border-top: 0;
}

.byt-card .contract-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.byt-card .contract-head span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.byt-card .detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 16px;
}

.byt-card .detail-grid strong {
    display: block;
    font-size: 14px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

@media (min-width: 700px) {
    .byt-card .detail-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* =========================================================
   Telefon
   ========================================================= */

@media (max-width: 600px) {
    :root {
        --gutter: 12px;
    }

    .page,
    .container,
    .wrap,
    .dashboard {
        padding-top: 16px;
    }

    h1 {
        font-size: 22px;
    }

    .result-grid {
        gap: 6px;
    }

    .result-grid > div {
        padding: 10px;
    }

    .result-grid strong {
        font-size: 17px;
    }

    .byt-card .contract-head {
        display: block;
    }

    .byt-card .contract-head span {
        display: block;
        margin-top: 2px;
    }
}

/* =========================================================
   Přihlášení a uživatel
   ========================================================= */

/* Přihlašovací stránky: bez spodní lišty, formulář uprostřed */
body.verejna {
    padding-bottom: 32px;
}

.auth-page {
    max-width: 440px;
    padding-top: 32px;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form button {
    width: 100%;
}

.auth-odkaz {
    margin: 16px 0 0;
    text-align: center;
    font-size: 14px;
}

/* Uživatel v horní liště (desktop) */
.appuser {
    display: none;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
}

.appuser form {
    margin: 0;
}

.appuser-name {
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.appuser-name.active {
    color: var(--brand-text);
}

@media (min-width: 900px) {
    .appuser {
        display: flex;
    }
}

/* Uživatel v menu „Více“ (telefon) */
.tabbar-sheet-user {
    display: grid;
    gap: 8px;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.tabbar-sheet-user small {
    display: block;
    font-size: 13px;
}

.tabbar-sheet-user form {
    margin: 0;
}

.tabbar-sheet-user .btn {
    width: 100%;
}

/* =========================================================
   Horní lišta na počítači: 1. řádek značka + uživatel,
   2. řádek menu (vejde se i při mnoha položkách)
   ========================================================= */
@media (min-width: 900px) {
    :root {
        --appbar-h: 100px;
    }

    .appbar-inner {
        flex-wrap: wrap;
        height: auto;
        row-gap: 0;
        padding-top: 10px;
    }

    .appuser {
        margin-left: auto;
    }

    .appnav {
        order: 3;
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 2px 4px;
        margin: 6px -10px 0;
        padding-bottom: 8px;
        overflow: visible;
    }
}

/* Horní lišta na počítači přes celou šířku okna (značka vlevo, uživatel vpravo, menu pod nimi). */
@media (min-width: 900px) {
    .appbar-inner {
        max-width: none;
        padding-left: 24px;
        padding-right: 24px;
    }

    .appnav {
        margin-left: -10px;
        margin-right: 0;
    }
}

/* =========================================================
   Odečty: stav potvrzení a fotky
   ========================================================= */
.stav-odectu {
    display: inline-flex;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.stav-odectu.CEKA { background: var(--warning-soft); color: var(--warning); }
.stav-odectu.POTVRZENO { background: var(--success-soft); color: var(--success); }
.stav-odectu.ZAMITNUTO { background: var(--danger-soft); color: var(--danger); }
.odecet-stav { margin-top: 4px; }
tr.odecet-zamitnuto td { color: var(--muted); }
tr.odecet-zamitnuto td:nth-child(3) { text-decoration: line-through; }
tr.odecet-ceka td { background: #fffdf5; }

.foto-miniatury { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.foto-miniatury img {
    width: 64px; height: 64px; object-fit: cover;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.foto-pole input[type=file] {
    margin-top: 0; padding: 10px;
    border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
}
.foto-nahled {
    max-width: 100%; max-height: 240px; margin-top: 6px;
    border-radius: var(--radius); border: 1px solid var(--border); object-fit: contain; background: var(--surface-2);
}

/* Menu „Více“: na nízkém displeji se posouvá, nic se neschová pod horní okraj. */
.tabbar-sheet {
    max-height: calc(100vh - var(--tabbar-h) - env(safe-area-inset-bottom, 0px) - 24px);
    max-height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom, 0px) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.tabbar-sheet a {
    padding: 11px 14px;
}

/* Evidence autora: „Vytvořil … · Naposledy upravil …“ */
.autor-info {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}
.protokol-json {
    margin: 0; white-space: pre-wrap; word-break: break-word;
    font-size: 12px; color: var(--muted);
}

/* Stav vyúčtování: řada štítků (potvrzeno → předpis → uhrazeno). */
.stav-kroky { display: inline-flex; flex-wrap: nowrap; gap: 4px; white-space: nowrap; }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
a.badge { text-decoration: none !important; }
a.badge:hover { box-shadow: inset 0 0 0 1px currentColor; }

/* Předpis zálohy na vodu: ve kterém vyúčtování je započten. */
.vv-zahrnuti { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.vv-zahrnuti .badge { white-space: normal; text-align: left; }
