/* ==================== Reset & Base ==================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #ccfbf1;
    --success: #2d7a4f;
    --success-light: #d6f0e2;
    --danger: #c0392b;
    --danger-light: #fde8e6;
    --warning: #c87941;
    --warning-light: #fdf0e3;
    --secondary: #5a7a8a;
    --bg: #f0fdf9;
    --surface: #ffffff;
    --border: #99f6e4;
    --text: #0d2030;
    --text-muted: #5a7a8a;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.10);
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.75rem; }
h3 { font-size: 0.8rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Navbar */
.navbar { background: var(--surface); border-bottom: 2px solid var(--primary-light); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(13,148,136,0.10); }
.nav-container { max-width: 100%; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; gap: 1.5rem; height: 56px; }
.nav-brand { color: var(--primary); font-weight: 800; font-size: 1.1rem; text-decoration: none; letter-spacing: 0.04em; text-transform: uppercase; }
.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-links a { color: var(--text-muted); text-decoration: none; padding: 0.35rem 0.55rem; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 500; transition: all 0.15s; white-space: nowrap; }
.nav-links a:hover { background: #f1f5f9; color: var(--text); text-decoration: none; }
.nav-user { display: flex; gap: 0.5rem; align-items: center; color: var(--text-muted); font-size: 0.82rem; white-space: nowrap; flex-shrink: 0; }
.nav-user .btn-link { color: var(--text-muted); font-size: 0.875rem; }

/* Container */
.container { max-width: 1200px; margin: 2rem auto; padding: 0 1.5rem; }

/* Page Header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.doc-number { background: var(--primary-light); color: var(--primary-dark); padding: 0.4rem 1rem; border-radius: 20px; font-size: 0.875rem; font-weight: 600; }

/* Cards */
.card { background: var(--surface); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; border: 1px solid var(--border); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.875rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.15s; font-family: inherit; white-space: nowrap; }
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-secondary { background: var(--secondary); color: white; border-color: var(--secondary); }
.btn-secondary:hover { background: #475569; color: white; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #059669; color: white; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; color: white; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Forms */
label { display: block; margin-bottom: 0.75rem; font-size: 0.75rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; flex: 1; }
label.checkbox { display: flex; align-items: center; gap: 0.5rem; font-weight: normal; cursor: pointer; text-transform: none; letter-spacing: 0; }
input, select, textarea { width: 100%; padding: 0.6rem 0.875rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; margin-top: 0.35rem; font-family: inherit; background: var(--surface); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
input[type="checkbox"] { width: auto; margin: 0; }
.form-row { display: flex; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 180px; }
.form-row label.col-2 { flex: 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.help-text { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.75rem; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--bg); font-weight: 700; color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; }
.data-table tbody tr:hover { background: var(--bg); }
.patient-row:hover td { background: var(--primary-light); }
.data-table .right, .right { text-align: right; }
.data-table tfoot td { padding: 0.75rem 1rem; border-top: 2px solid var(--border); }
.data-table tfoot tr.total-row td { background: var(--primary); color: white; font-weight: 600; }
.kv-table { width: 100%; }
.kv-table th { font-weight: 500; color: var(--text-muted); padding: 0.4rem 0; text-align: left; width: 45%; font-size: 0.875rem; }
.kv-table td { padding: 0.4rem 0; font-weight: 500; }

/* Totals */
.totals-preview { margin-top: 1rem; padding: 1rem 1.25rem; background: var(--bg); border-radius: var(--radius-sm); text-align: right; border: 1px solid var(--border); }
.totals-preview > div { margin-bottom: 0.25rem; font-size: 0.9rem; color: var(--text-muted); }
.totals-preview .total { font-size: 1.15rem; font-weight: 700; padding-top: 0.5rem; margin-top: 0.5rem; border-top: 1px solid var(--border); color: var(--text); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }

/* Filter bar */
.filter-bar { display: flex; gap: 0.25rem; margin-bottom: 1rem; background: var(--surface); padding: 0.3rem; border-radius: var(--radius-sm); width: fit-content; border: 1px solid var(--border); box-shadow: var(--shadow); }
.filter { padding: 0.4rem 1rem; border-radius: 6px; color: var(--text-muted); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: all 0.15s; }
.filter:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.filter.active { background: var(--primary); color: white; }

/* Flash */
.flash { padding: 0.875rem 1.25rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.flash-error { background: var(--danger-light); color: #991b1b; border-color: #fca5a5; }
.flash-warning { background: var(--warning-light); color: #92400e; border-color: #fcd34d; }

/* Auth */
.auth-box { max-width: 420px; margin: 5rem auto; background: var(--surface); padding: 2.5rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.auth-box h1 { text-align: center; margin-bottom: 0.5rem; }
.auth-box button { width: 100%; padding: 0.75rem; margin-top: 0.5rem; font-size: 1rem; }
.auth-box p { text-align: center; margin-top: 1rem; font-size: 0.9rem; }

/* Detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
@media (max-width: 700px) { .detail-grid { grid-template-columns: 1fr; } }
.empty { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 0.95rem; }

/* Choice screen */
.choice-screen { max-width: 960px; margin: 3rem auto; text-align: center; }
.choice-title { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; color: var(--text); letter-spacing: -0.03em; }
.choice-subtitle { color: var(--text-muted); font-size: 1rem; margin-bottom: 2.5rem; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.choice-tile { background: var(--surface); padding: 2.5rem 2rem; border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: all 0.2s; border: 2px solid var(--border); display: block; }
.choice-tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.choice-icon { font-size: 3rem; margin-bottom: 1rem; line-height: 1; }
.choice-label { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.4rem; letter-spacing: -0.02em; }
.choice-desc { color: var(--text-muted); font-size: 0.9rem; }
.choice-recent { margin-top: 2rem; color: var(--text-muted); }
.choice-recent a { font-size: 0.9rem; color: var(--text-muted); }

/* Favorite tiles */
.favorite-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.fav-tile { background: var(--surface); border: 2px solid var(--primary-light); border-radius: var(--radius-sm); padding: 1rem; cursor: pointer; text-align: center; transition: all 0.15s; font-family: inherit; color: var(--text); }
.fav-tile:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.fav-tile-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
.fav-tile-price { font-size: 0.8rem; opacity: 0.75; }
.pricelist-picker { display: flex; gap: 1rem; align-items: flex-end; margin-bottom: 1.25rem; padding: 1rem; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.pricelist-picker label { flex: 1; margin-bottom: 0; }

/* Selected items */
#selected-items { margin-bottom: 1rem; }
.selected-item { display: grid; grid-template-columns: 2fr 1fr 1fr 0.8fr 1fr auto; gap: 0.75rem; align-items: end; padding: 1rem; background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 0.5rem; border: 1px solid var(--border); border-left: 3px solid var(--primary); }
.selected-item label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; display: block; }
.selected-item > div { min-width: 0; }
.selected-item input, .selected-item select { margin: 0; padding: 0.4rem 0.6rem; font-size: 0.875rem; }
.selected-item-name strong { display: block; padding: 0.4rem 0; font-size: 0.95rem; font-weight: 600; }
.selected-item-qty { display: flex; flex-direction: column; }
.selected-item-qty .unit-label { display: inline-block; margin-top: 0.25rem; font-size: 0.8rem; color: var(--text-muted); }
.item-row-total { display: block; padding: 0.4rem 0; font-size: 0.95rem; font-weight: 600; }
.btn-remove-row { background: var(--danger-light); color: var(--danger); border: none; width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; font-size: 1.1rem; line-height: 1; align-self: center; transition: all 0.15s; font-weight: 700; }
.btn-remove-row:hover { background: var(--danger); color: white; }

/* Company banner */
.company-banner { color: white; padding: 0.875rem 1.5rem; border-radius: var(--radius); font-size: 0.85rem; font-weight: 700; margin-bottom: 1.5rem; letter-spacing: 0.05em; text-transform: uppercase; }
.company-tag { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: 20px; color: white; font-size: 0.72rem; font-weight: 700; }

/* Category tabs */
.category-tabs { display: flex; gap: 0.3rem; margin-bottom: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--border); padding-bottom: 0.75rem; }
.cat-tab { background: transparent; border: 1.5px solid var(--border); padding: 0.4rem 1rem; border-radius: 20px; cursor: pointer; font-family: inherit; font-size: 0.875rem; color: var(--text-muted); font-weight: 500; transition: all 0.15s; }
.cat-tab:hover { background: var(--bg); color: var(--text); }
.cat-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Category pills */
.category-list { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.category-pill { background: var(--primary-light); color: var(--primary-dark); padding: 0.3rem 0.6rem 0.3rem 0.9rem; border-radius: 20px; font-size: 0.875rem; display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.pill-remove { background: transparent; border: none; color: var(--primary); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.2rem; border-radius: 50%; transition: all 0.15s; }
.pill-remove:hover { background: var(--danger); color: white; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.inline-form input { margin: 0; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-label { color: var(--text-muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.stat-value.warning { color: var(--warning); }

/* Responsive */
@media (max-width: 700px) {
    .nav-container { flex-wrap: wrap; gap: 0.75rem; height: auto; padding: 0.75rem 1rem; }
    .nav-links { order: 3; width: 100%; flex-wrap: wrap; }
    .form-row { flex-direction: column; }
    .selected-item { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .selected-item-name { grid-column: 1 / -1; }
    .pricelist-picker { flex-direction: column; align-items: stretch; }
    .choice-grid { grid-template-columns: 1fr; gap: 1rem; }
    .choice-tile { padding: 1.75rem 1.5rem; }
    .choice-icon { font-size: 2.5rem; }
    .choice-label { font-size: 1.3rem; }
}

/* ==================== Home screen ==================== */
.home-screen { max-width: 860px; margin: 3rem auto; }
.home-header { margin-bottom: 2.5rem; }
.home-header h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.home-subtitle { color: var(--text-muted); font-size: 1rem; margin-top: 0.25rem; }
.home-section-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 0.75rem; }

.company-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.company-card {
    display: flex;
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 0 0 2px var(--primary), 0 0 12px rgba(27,191,214,0.25);
    border: 2px solid var(--primary);
    transition: all 0.25s;
    background: var(--surface);
}
.company-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--primary), 0 0 28px rgba(27,191,214,0.55), 0 0 60px rgba(27,191,214,0.2); text-decoration: none; border-color: var(--primary); }
.company-card-accent { display: none; }
.company-card-body { padding: 1.5rem 1.75rem; flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.company-card-name { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.company-card-full { font-size: 0.875rem; color: var(--text-muted); }
.company-card-arrow { font-size: 1.25rem; color: var(--company-color); margin-top: 0.75rem; transition: transform 0.2s; }
.company-card:hover .company-card-arrow { transform: translateX(4px); }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.quick-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; background: var(--primary-light); border-color: var(--primary); }
.quick-card-icon { font-size: 1.75rem; flex-shrink: 0; }
.quick-card-title { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.quick-card-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.1rem; }

@media (max-width: 600px) {
    .company-grid, .quick-grid { grid-template-columns: 1fr; }
    .home-header h1 { font-size: 1.6rem; }
}

/* ==================== Quick pricelist ==================== */
.quick-pricelist {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.qpl-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.qpl-row:last-child { border-bottom: none; }
.qpl-row:hover { background: var(--bg); }
.qpl-favorite { background: #fffbeb; }
.qpl-favorite:hover { background: #fef3c7; }
.qpl-star { color: #f59e0b; margin-right: 0.3rem; }
.qpl-name { flex: 1; font-size: 0.9rem; font-weight: 500; color: var(--text); }
.qpl-price { width: 110px; text-align: right; font-size: 0.875rem; color: var(--text-muted); font-weight: 600; }
.qpl-controls { display: flex; align-items: center; gap: 0.5rem; }
.qpl-btn {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.qpl-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.qpl-qty {
    width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}
.qpl-qty.active { color: var(--primary); }
.qpl-custom-row { background: var(--bg); }

/* ==================== Payment badges ==================== */
.payment-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.payment-hotove { background: #d1fae5; color: #065f46; }
.payment-karta  { background: #dbeafe; color: #1e40af; }
.payment-prevod { background: #ffedd5; color: #9a3412; }
.payment-bd     { background: #f1f5f9; color: #64748b; }

/* Řádky tabulky podle platby */
.row-payment-hotove td { border-left: 3px solid #10b981; }
.row-payment-karta  td:first-child { border-left: 3px solid #3b82f6; }
.row-payment-prevod td:first-child { border-left: 3px solid #f97316; }

/* ==================== Billing qty buttons ==================== */
.billing-qty-btn {
    width: 32px; height: 32px;
    border-radius: 6px;
    font-size: 1.1rem; font-weight: 700;
    cursor: pointer; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: inherit;
}
.billing-qty-minus {
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
}
.billing-qty-plus {
    border: 1.5px solid var(--primary);
    background: var(--primary);
    color: white;
}
.billing-qty-display {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    font-size: .9rem;
    display: inline-block;
}

/* ==================== TABLET / iPad (641-1024 px) ==================== */
/*
 * Optimalizace pro iPad portrait (820px) a landscape (1180px), iPad Pro (1024/1366).
 * Cílem je pohodlné ovládání prsty (min. 44x44 px tap targets podle Apple HIG)
 * a lepší využití prostoru než na telefonu.
 */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Větší základ písma pro čitelnost na ruce */
    body { font-size: 16px; }

    /* Navigace: větší tap areas */
    .nav-container { padding: 0 1.25rem; }
    .nav-links a {
        padding: 0.6rem 0.85rem;
        font-size: 0.95rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .nav-brand { font-size: 1.15rem; }

    /* Tlačítka: splnit 44x44 px tap target */
    .btn, button.btn, input[type="submit"], input[type="button"] {
        min-height: 44px;
        padding: 0.7rem 1.25rem;
        font-size: 1rem;
    }
    .btn-small { min-height: 38px; padding: 0.5rem 0.9rem; font-size: 0.92rem; }

    /* Form inputy: větší a pohodlnější na psaní prsty */
    input[type="text"], input[type="email"], input[type="number"], input[type="date"],
    input[type="password"], select, textarea {
        min-height: 44px;
        font-size: 16px;   /* zabrání auto-zoomu v iOS Safari */
        padding: 0.6rem 0.85rem;
    }

    /* Karty - trochu víc vzduchu */
    .card { padding: 1.5rem; }

    /* Quick pricelist - větší řádky pro přesné ťukání */
    .qpl-row { padding: 0.85rem 1.1rem; gap: 1.1rem; }
    .qpl-name { font-size: 1rem; }
    .qpl-price { font-size: 0.95rem; width: 120px; }
    .qpl-btn {
        width: 44px; height: 44px;
        font-size: 1.35rem;
        border-width: 2px;
    }
    .qpl-qty { width: 40px; font-size: 1.05rem; }

    /* Favorite tiles - větší pro snadné tapnutí */
    .fav-tile { padding: 0.9rem 1.1rem; min-height: 60px; }
    .fav-tile-name { font-size: 0.95rem; }
    .fav-tile-price { font-size: 0.85rem; }

    /* Category tabs */
    .cat-tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-height: 42px;
    }

    /* Vybrané položky - přeskládat tak, aby byly čitelné */
    .selected-item {
        gap: 0.9rem;
        padding: 0.9rem;
    }

    /* Home screen - dvouřadé plakety */
    .company-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
    .quick-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }

    /* Odstranit hover efekty (na iPadu překáží sticky hover po tapu) */
    .company-card:hover, .quick-card:hover, .choice-tile:hover { transform: none; }

    /* Kartotéka: skrýt vedlejší sloupce na tablet portrait */
    .col-tablet-hide { display: none; }

    /* Billing +/- tlačítka: 44×44 px pro ovládání v rukavicích */
    .billing-qty-btn { width: 44px; height: 44px; font-size: 1.4rem; border-width: 2px; }
    .billing-qty-display { min-width: 32px; font-size: 1.1rem; }

    /* Tabulky: víc místa mezi sloupci */
    table td, table th { padding: 0.85rem 0.75rem; }

    /* Odstrani zbytečný "remove" křížek zvětšit */
    .btn-remove-row {
        width: 38px; height: 38px;
        font-size: 1.25rem;
    }
}

/* ==================== iPad Portrait (820px) - specifická úprava ==================== */
/* Když je iPad na výšku, form-row přeskládej do jednoho sloupce pro lepší čitelnost */
@media (min-width: 641px) and (max-width: 900px) {
    .form-row { flex-wrap: wrap; }
    .form-row label { flex: 1 1 calc(50% - 0.5rem); min-width: 200px; }
    .form-row label.col-2 { flex: 1 1 100%; }

    /* Selected item: dvojsloupec */
    .selected-item {
        grid-template-columns: 1fr 1fr;
        row-gap: 0.75rem;
    }
    .selected-item-name { grid-column: 1 / -1; }
}


/* ==================== DOKUMENTACE ZZ ==================== */
/* DOKUMENTACE ZZ */

/* Stav revize - barevné kódování */
.stav-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.stav-ok        { background: #d1fae5; color: #065f46; }
.stav-bliz      { background: #fef3c7; color: #92400e; }
.stav-nal       { background: #ffedd5; color: #9a3412; }
.stav-po        { background: #fee2e2; color: #991b1b; }
.stav-neurceno  { background: #e2e8f0; color: #475569; }

/* Dashboard statistiky */
.dok-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.dok-stat-card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.dok-stat-card .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 700;
}
.dok-stat-card .value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}
.dok-stat-card.ok   .value { color: #10b981; }
.dok-stat-card.bliz .value { color: #f59e0b; }
.dok-stat-card.nal  .value { color: #f97316; }
.dok-stat-card.po   .value { color: #ef4444; }

/* Firma switcher v dokumentaci */
.dok-firma-switcher {
    display: inline-flex;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}
.dok-firma-switcher a {
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.15s;
}
.dok-firma-switcher a:hover { color: var(--text); text-decoration: none; }
.dok-firma-switcher a.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* Tabulka přístrojů - datum */
.dok-datum-nal  { color: #9a3412; font-weight: 600; }
.dok-datum-po   { color: #991b1b; font-weight: 700; }

/* Seznam revizí */
.revize-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.revize-row:last-child { border-bottom: none; }
.revize-row .typ { font-weight: 600; }
.revize-row .datum { font-size: 0.85rem; color: var(--text-muted); }

/* Tablet / iPad optimalizace */
@media (max-width: 1024px) and (min-width: 641px) {
    .dok-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dok-stat-card .value { font-size: 1.75rem; }
    .revize-row { grid-template-columns: 1fr; }
    .revize-row .datum { font-size: 0.8rem; }
}

/* Mobile */
@media (max-width: 640px) {
    .dok-stats-grid { grid-template-columns: 1fr 1fr; }
    .dok-stat-card { padding: 1rem; }
    .dok-stat-card .value { font-size: 1.5rem; }
    .dok-firma-switcher { width: 100%; }
    .dok-firma-switcher a { flex: 1; text-align: center; }
}

.ano-ne-btns button.selected-ano-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.ano-ne-btns button.selected-ne-safe   { background: #198754; color: #fff; border-color: #198754; }

/* ===== HAMBURGER MOBILNÍ MENU ===== */
.nav-hamburger { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--primary); padding: 0.25rem 0.5rem; margin-left: auto; }
.nav-user-mobile { display: none; }

@media (max-width: 1024px) {
    .nav-hamburger { display: block; }
    .nav-user-desktop { display: none; }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 56px; right: 0; left: 0;
        background: var(--surface);
        border-bottom: 2px solid var(--primary-light);
        box-shadow: 0 4px 16px rgba(0,0,0,0.10);
        z-index: 200;
        padding: 0.5rem 0;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 0.75rem 1.5rem; font-size: 1rem; min-height: 44px; display: flex; align-items: center; border-bottom: 1px solid var(--border); white-space: normal; }
    .nav-user-mobile { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem 1.5rem; border-top: 2px solid var(--primary-light); color: var(--text-muted); font-size: 0.9rem; }
    .nav-container { position: relative; flex-wrap: nowrap; }
}

.btn-xs { padding: 0.15rem 0.6rem; font-size: 0.75rem; line-height: 1.4; }
