/* ══════════════════════════════════════════════
   CorSuite — main.css  (green brand identity)
   ══════════════════════════════════════════════ */

/* ── CSS VARIABLES ──────────────────────────── */
:root {
  --color-primary:       #0B2F1D;
  --color-primary-600:   #1F6B3A;
  --color-primary-500:   #4F8F3A;
  --color-primary-light: #EEF6EA;
  --color-primary-panel: #DDEDD5;
  --color-bg:            #F8FBF7;
  --color-surface:       #FFFFFF;
  --color-text:          #102018;
  --color-muted:         #5F6F63;
  --color-border:        #D7E5D2;
  --color-success:       #2E7D32;
  --color-warning:       #B7791F;
  --color-danger:        #B42318;
}

/* ── RESET ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #102018;
    background: #F8FBF7;
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: #1F6B3A; text-decoration: none; }
a:hover { text-decoration: underline; color: #145C2F; }

p, span, div, li { color: inherit; }
h1, h2, h3, h4, h5 { color: #102018; }

/* ── LAYOUT ─────────────────────────────────── */
.layout { display: flex; flex-direction: column; min-height: 100vh; }
.layout-body { display: flex; flex: 1; min-height: 0; }
.main { flex: 1; padding: 24px 28px; min-width: 0; background: #F8FBF7; isolation: isolate; }

img, svg, video, canvas, iframe { max-width: 100%; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; max-width: 100%; }
textarea { resize: vertical; }

/* ── GLOBAL TOPBAR ───────────────────────────── */
.global-topbar {
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid #D7E5D2;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px;
    position: sticky; top: 0; z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(11,47,29,.07);
}
.gtb-left { display: flex; align-items: center; gap: 14px; }
.gtb-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.gtb-brand:hover { text-decoration: none; }
.brand-logo {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #4F8F3A, #1F6B3A);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 15px; color: #fff; flex-shrink: 0;
}
.brand-name { font-size: 16px; font-weight: 700; color: #102018; letter-spacing: -0.3px; }
.gtb-tenant-name {
    font-size: 12px; color: #4A5E4E;
    border-left: 1px solid #D7E5D2; padding-left: 14px; margin-left: 2px;
}
.gtb-company-wrap { position: relative; }
.gtb-company-current {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #4A5E4E; cursor: pointer;
    padding: 5px 10px; border-radius: 7px; border: 1px solid #D7E5D2;
    transition: all .15s; background: #EEF6EA;
}
.gtb-company-current:hover { border-color: #B8CEB3; color: #102018; background: #F8FBF7; }
.gtb-right { display: flex; align-items: center; gap: 10px; }
.gtb-time { font-size: 13px; color: #5F6F63; font-variant-numeric: tabular-nums; letter-spacing: .5px; min-width: 56px; text-align: center; }
.btn-support {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 13px; border-radius: 20px;
    background: rgba(180,35,24,.06); border: 1px solid rgba(180,35,24,.25);
    color: #B42318; font-size: 13px; font-weight: 600;
    text-decoration: none; transition: all .15s;
}
.btn-support:hover { background: rgba(180,35,24,.12); color: #B42318; text-decoration: none; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #4F8F3A, #1F6B3A);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    flex-shrink: 0; cursor: default; user-select: none;
}

/* ── RAIL ────────────────────────────────────── */
.rail {
    width: 68px;
    background: #0B2F1D;
    border-right: none;
    display: flex; flex-direction: column;
    position: sticky; top: 52px;
    height: calc(100vh - 52px);
    overflow: visible;
    z-index: 50; flex-shrink: 0;
    isolation: isolate;
}
.rail-nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; overflow: visible; }
.rail-footer { padding-bottom: 8px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 4px; }

.rail-item-wrap { position: relative; }
.rail-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 68px; height: 58px;
    color: rgba(255,255,255,0.65); text-decoration: none;
    transition: background .15s, color .15s;
    cursor: pointer; gap: 4px;
    border: none; background: none;
}
.rail-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.95); text-decoration: none; }
.rail-item span { font-size: 10px; font-weight: 500; text-align: center; line-height: 1.2; white-space: nowrap; }

.rail-icon {
    width: 36px; height: 36px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.1);
    transition: background .15s, filter .15s, transform .15s, box-shadow .15s;
}
.rail-icon svg { width: 18px; height: 18px; }

/* Barvy ikon — per-module gradient system */
.rail-item[data-color="green"]  .rail-icon { background:linear-gradient(135deg,#dcfce7,#bbf7d0); color:#1F6B3A; box-shadow:0 1px 3px rgba(31,107,58,.22); }
.rail-item[data-color="blue"]   .rail-icon { background:linear-gradient(135deg,#dbeafe,#bfdbfe); color:#2563eb; box-shadow:0 1px 3px rgba(37,99,235,.18); }
.rail-item[data-color="amber"]  .rail-icon { background:linear-gradient(135deg,#fef3c7,#fde68a); color:#d97706; box-shadow:0 1px 3px rgba(217,119,6,.18); }
.rail-item[data-color="violet"] .rail-icon { background:linear-gradient(135deg,#ede9fe,#ddd6fe); color:#7c3aed; box-shadow:0 1px 3px rgba(124,58,237,.18); }
.rail-item[data-color="slate"]  .rail-icon { background:linear-gradient(135deg,rgba(255,255,255,.15),rgba(255,255,255,.08)); color:rgba(255,255,255,0.7); }
.rail-item[data-color="indigo"] .rail-icon { background:linear-gradient(135deg,#e0e7ff,#c7d2fe); color:#4f46e5; box-shadow:0 1px 3px rgba(79,70,229,.18); }
.rail-item[data-color="orange"] .rail-icon { background:linear-gradient(135deg,#ffedd5,#fed7aa); color:#ea580c; box-shadow:0 1px 3px rgba(234,88,12,.18); }
.rail-item[data-color="sky"]    .rail-icon { background:linear-gradient(135deg,#e0f2fe,#bae6fd); color:#0284c7; box-shadow:0 1px 3px rgba(2,132,199,.18); }
.rail-item[data-color="pink"]   .rail-icon { background:linear-gradient(135deg,#fce7f3,#fbcfe8); color:#db2777; box-shadow:0 1px 3px rgba(219,39,119,.18); }
.rail-item[data-color="rose"]   .rail-icon { background:linear-gradient(135deg,#ffe4e6,#fecdd3); color:#e11d48; box-shadow:0 1px 3px rgba(225,29,72,.18); }
.rail-item[data-color="cyan"]   .rail-icon { background:linear-gradient(135deg,#cffafe,#a5f3fc); color:#0891b2; box-shadow:0 1px 3px rgba(8,145,178,.18); }
.rail-item[data-color="teal"]   .rail-icon { background:linear-gradient(135deg,#ccfbf1,#99f6e4); color:#0d9488; box-shadow:0 1px 3px rgba(13,148,136,.18); }

/* Hover — subtle scale + brightness */
.rail-item:hover .rail-icon { filter: brightness(.91); transform: scale(1.06); }

/* Aktivní položka */
.rail-active { background: rgba(255,255,255,0.1) !important; }
.rail-active .rail-item-label { font-weight: 700 !important; }
.rail-active[data-color="green"]  { color:#4F8F3A; }
.rail-active[data-color="green"]  .rail-icon { background:linear-gradient(135deg,#bbf7d0,#86efac); box-shadow:0 2px 8px rgba(31,107,58,.32); }
.rail-active[data-color="blue"]   { color:#2563eb; }
.rail-active[data-color="blue"]   .rail-icon { background:linear-gradient(135deg,#bfdbfe,#93c5fd); box-shadow:0 2px 8px rgba(37,99,235,.28); }
.rail-active[data-color="amber"]  { color:#d97706; }
.rail-active[data-color="amber"]  .rail-icon { background:linear-gradient(135deg,#fde68a,#fcd34d); box-shadow:0 2px 8px rgba(217,119,6,.28); }
.rail-active[data-color="violet"] { color:#7c3aed; }
.rail-active[data-color="violet"] .rail-icon { background:linear-gradient(135deg,#ddd6fe,#c4b5fd); box-shadow:0 2px 8px rgba(124,58,237,.28); }
.rail-active[data-color="indigo"] { color:#4f46e5; }
.rail-active[data-color="indigo"] .rail-icon { background:linear-gradient(135deg,#c7d2fe,#a5b4fc); box-shadow:0 2px 8px rgba(79,70,229,.28); }
.rail-active[data-color="rose"]   { color:#e11d48; }
.rail-active[data-color="rose"]   .rail-icon { background:linear-gradient(135deg,#fecdd3,#fda4af); box-shadow:0 2px 8px rgba(225,29,72,.28); }
.rail-active[data-color="cyan"]   { color:#0891b2; }
.rail-active[data-color="cyan"]   .rail-icon { background:linear-gradient(135deg,#a5f3fc,#67e8f9); box-shadow:0 2px 8px rgba(8,145,178,.28); }
.rail-active[data-color="sky"]    { color:#0284c7; }
.rail-active[data-color="sky"]    .rail-icon { background:linear-gradient(135deg,#bae6fd,#7dd3fc); box-shadow:0 2px 8px rgba(2,132,199,.28); }
.rail-active[data-color="orange"] { color:#ea580c; }
.rail-active[data-color="orange"] .rail-icon { background:linear-gradient(135deg,#fed7aa,#fdba74); box-shadow:0 2px 8px rgba(234,88,12,.28); }
.rail-active[data-color="slate"]  { color:rgba(255,255,255,0.85); }

/* Disabled (coming soon) */
.rail-disabled { opacity: 0.35; cursor: not-allowed; }
.rail-disabled:hover { background: none !important; }
.rail-disabled:hover .rail-icon { filter: none !important; }

/* Submenu flyout */
.rail-submenu {
    display: none;
    position: absolute; left: 68px; top: 0;
    background: #ffffff; border: 1px solid #D7E5D2;
    border-radius: 11px; min-width: 215px;
    padding: 6px 0; z-index: 200;
    box-shadow: 0 8px 28px rgba(0,0,0,.1);
    max-height: 90vh; overflow-y: auto;
}
.rail-item-wrap.has-submenu::after {
    content: ''; position: absolute; right: -8px; top: 0;
    width: 8px; height: 100%; pointer-events: none;
}
.rail-item-wrap.has-submenu:hover .rail-submenu,
.rail-submenu:hover { display: block; }
.rail-submenu { pointer-events: none; }
.rail-item-wrap.has-submenu:hover .rail-submenu { pointer-events: auto; }

.rail-submenu-header {
    font-size: 10px; font-weight: 700; color: #8FA494;
    letter-spacing: .8px; padding: 6px 16px 8px;
    text-transform: uppercase;
}
.rail-submenu a {
    display: block; padding: 9px 16px;
    color: #3A4D3E; font-size: 14px;
    text-decoration: none; transition: background .1s, color .1s;
}
.rail-submenu a:hover { background: #EEF6EA; color: #102018; text-decoration: none; }
.rail-submenu a.active { color: #1F6B3A; font-weight: 600; }
.rail-submenu a.disabled { color: #B8CEB3; pointer-events: none; font-style: italic; font-size: 13px; }

/* ── TOPBAR (stránkový) ──────────────────────── */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.topbar h1 { font-size: 24px; font-weight: 700; color: #102018; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.muted { color: #5F6F63; font-size: 13px; }

/* ── CARDS ─────────────────────────────────── */
.card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #D7E5D2;
    padding: 20px;
    margin-bottom: 16px;
    color: #102018;
    box-shadow: 0 1px 4px rgba(11,47,29,.05);
}
.card-title {
    font-size: 13px; font-weight: 700; color: #5F6F63;
    margin-bottom: 14px; text-transform: uppercase; letter-spacing: .5px;
}
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-header h2 { font-size: 16px; font-weight: 700; color: #102018; }
.link-sm { font-size: 13px; color: #1F6B3A; }

/* ── STATS ─────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-box { background: #fff; border: 1px solid #D7E5D2; border-radius: 12px; padding: 14px; text-align: center; }
.stat-box .stat-value { font-size: 22px; font-weight: 700; color: #102018; }
.stat-box .stat-label { font-size: 11px; color: #5F6F63; font-weight: 600; text-transform: uppercase; }
.stat-card {
    text-align: center; padding: 20px 12px;
    background: #ffffff; border: 1px solid #D7E5D2; border-radius: 16px;
    box-shadow: 0 1px 4px rgba(11,47,29,.05);
}
.stat-label { font-size: 12px; color: #5F6F63; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 700; color: #102018; }
.stat-danger .stat-value { color: #B42318; }
.stat-danger { border-color: rgba(180,35,24,.25); }

/* ── CONTENT GRID ─────────────────────────── */
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .content-grid { grid-template-columns: 1fr; } }

/* ── TABLE ─────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; font-size: 12px; font-weight: 700;
    color: #4A5E4E; text-transform: uppercase; letter-spacing: .4px;
    padding: 11px 12px; border-bottom: 2px solid #D7E5D2;
    white-space: nowrap; background: #EEF6EA;
}
td {
    padding: 12px 12px;
    border-bottom: 1px solid #F8FBF7;
    font-size: 14px;
    color: #102018;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #EEF6EA; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── BADGES ─────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-ok     { background: rgba(31,107,58,.1);  color: #1F6B3A; border: 1px solid rgba(31,107,58,.3); }
.badge-green  { background: rgba(31,107,58,.1);  color: #1F6B3A; border: 1px solid rgba(31,107,58,.3); }
.badge-warn   { background: rgba(183,121,31,.1); color: #B7791F; border: 1px solid rgba(183,121,31,.3); }
.badge-danger { background: rgba(180,35,24,.1);  color: #B42318; border: 1px solid rgba(180,35,24,.3); }
.badge-neutral{ background: #F8FBF7; color: #4A5E4E; border: 1px solid #D7E5D2; }
.badge-muted  { background: #F8FBF7; color: #5F6F63; border: 1px solid #D7E5D2; }
.badge-purple { background: rgba(124,58,237,.1); color: #7c3aed; border: 1px solid rgba(124,58,237,.3); }
.badge-blue   { background: rgba(37,99,235,.1);  color: #1d4ed8; border: 1px solid rgba(37,99,235,.3); }

/* ── FILTER BAR ──────────────────────────────── */
.filter-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 12px;
}
.filter-input {
    padding: 8px 12px; border: 1px solid #C8DCC2; border-radius: 8px;
    font-size: 14px; color: #102018; background: #fff; outline: none;
    transition: border-color .15s; flex: 1; min-width: 180px; max-width: 360px;
}
.filter-input:focus { border-color: #1F6B3A; box-shadow: 0 0 0 3px rgba(31,107,58,.1); }
.filter-count { font-size: 12px; color: #5F6F63; white-space: nowrap; }
.btn-active { background: #1F6B3A !important; border-color: #1F6B3A !important; color: #fff !important; }

/* ── FORM INPUT (standalone, mimo .field) ─────── */
.form-input {
    padding: 8px 12px; border: 1px solid #C8DCC2; border-radius: 8px;
    font-size: 14px; color: #102018; background: #fff; outline: none;
    transition: border-color .15s;
}
.form-input:focus { border-color: #1F6B3A; box-shadow: 0 0 0 3px rgba(31,107,58,.1); }

/* ── BTN BACK ────────────────────────────────── */
.btn-back {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; color: #5F6F63; text-decoration: none;
    transition: color .15s;
}
.btn-back:hover { color: #102018; text-decoration: none; }

/* ── PAYROLL SUBNAV ──────────────────────────── */
.payroll-subnav {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid #D7E5D2;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.payroll-subnav-item {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px; border-radius: 8px; font-size: 13px;
    font-weight: 600; color: #4A5E4E; text-decoration: none;
    border: 1px solid transparent; transition: all .15s; white-space: nowrap;
}
.payroll-subnav-item:hover { background: #F8FBF7; color: #102018; text-decoration: none; }
.payroll-subnav-item.active { background: rgba(31,107,58,.08); color: #1F6B3A; border-color: rgba(31,107,58,.25); }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: 1px solid #C8DCC2; border-radius: 8px;
    background: #ffffff; color: #3D4F42; font-size: 14px;
    cursor: pointer; transition: all .15s; white-space: nowrap;
    text-decoration: none; font-weight: 500;
}
.btn:hover { background: #F8FBF7; border-color: #8FA494; text-decoration: none; color: #102018; }
.btn-primary { background: #1F6B3A; border-color: #1F6B3A; color: #ffffff; font-weight: 700; }
.btn-primary:hover { background: #145C2F; border-color: #145C2F; color: #ffffff; }
.btn-danger { background: transparent; border-color: rgba(180,35,24,.35); color: #B42318; }
.btn-danger:hover { background: rgba(180,35,24,.06); color: #9A1E14; }
.btn-red { background: rgba(180,35,24,.08); border: 1px solid rgba(180,35,24,.25); color: #B42318; padding: 4px 9px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-red:hover { background: rgba(180,35,24,.15); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; display: flex; }
.btn-remove { background: none; border: none; color: #8FA494; cursor: pointer; font-size: 14px; padding: 2px 6px; }
.btn-remove:hover { color: #B42318; }

/* ?? RESPONSIVE HELPERS ?? */
.page-actions,
.inline-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 18px;
    align-items: start;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.form-grid-wide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.two-col-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.responsive-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.token-box {
    display: block;
    width: 100%;
    min-height: 88px;
    border: 1px solid #C8DCC2;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px 12px;
    color: #102018;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-all;
}

.muted-box {
    padding: 12px 14px;
    border: 1px solid #D7E5D2;
    border-radius: 12px;
    background: #EEF6EA;
}

.notice-box {
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
}

.warning-box {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.success-box {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

/* ── ACTIONS ─────────────────────────────────── */
.actions { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

/* ── FORMS ─────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label {
    display: block; font-size: 12px; font-weight: 700;
    color: #5F6F63; margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: .3px;
}
.field input, .field select, .field textarea {
    width: 100%; padding: 10px 13px;
    border: 1px solid #C8DCC2; border-radius: 8px;
    font-size: 14px; color: #102018;
    background: #ffffff; outline: none;
    transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: #1F6B3A;
    box-shadow: 0 0 0 3px rgba(31,107,58,.1);
}
.field input::placeholder { color: #8FA494; }
.field-hint { font-size: 12px; color: #5F6F63; margin-top: 5px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
select option { background: #ffffff; color: #102018; }
hr { border: none; border-top: 1px solid #D7E5D2; margin: 16px 0; }

/* Kalendář ikony — světlé pozadí nepotřebuje invert */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: 0.6;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ── INVOICE EDITOR ─────────────────────────── */
.invoice-layout { display: grid; grid-template-columns: 1fr 290px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .invoice-layout { grid-template-columns: 1fr; } }
.items-editor { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-editor th { font-size: 12px; font-weight: 700; color: #4A5E4E; padding: 8px 6px; border-bottom: 2px solid #D7E5D2; background: #EEF6EA; }
.items-editor td { padding: 5px 4px; border-bottom: 1px solid #F8FBF7; }
.items-editor input, .items-editor select {
    border: 1px solid #C8DCC2; border-radius: 5px;
    padding: 5px 7px; font-size: 13px; width: 100%;
    background: #ffffff; color: #102018;
}
.totals-box { margin-top: 14px; border-top: 1px solid #D7E5D2; padding-top: 10px; }
.total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; color: #3D4F42; }
.total-row-final { font-size: 17px; font-weight: 700; color: #1F6B3A; border-top: 1px solid #D7E5D2; margin-top: 6px; padding-top: 8px; }

/* ── TERMS ─────────────────────────────────── */
.term-row { padding: 10px 0; border-bottom: 1px solid #F8FBF7; }
.term-row:last-child { border-bottom: none; }
.term-name { font-size: 14px; color: #102018; font-weight: 500; }
.term-date { font-size: 12px; color: #5F6F63; }
.term-urgent .term-name { color: #B42318; font-weight: 700; }
.term-urgent .term-date { color: #B42318; }

/* ── MESSAGES ─────────────────────────────── */
.messages { margin-bottom: 16px; }
.msg { padding: 11px 15px; border-radius: 8px; font-size: 14px; margin-bottom: 8px; }
.msg-error, .msg-warning { background: rgba(180,35,24,.07); color: #9A1E14; border: 1px solid rgba(180,35,24,.2); }
.msg-success, .msg-info { background: rgba(31,107,58,.07); color: #145C2F; border: 1px solid rgba(31,107,58,.2); }

/* ── AUTH ─────────────────────────────────── */
.auth-page { background: #F8FBF7; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-box { background: #ffffff; border-radius: 16px; border: 1px solid #D7E5D2; padding: 40px 36px; width: 100%; max-width: 400px; box-shadow: 0 4px 24px rgba(11,47,29,.08); }
.auth-box-wide { max-width: 500px; }
.auth-brand { font-size: 28px; font-weight: 800; color: #1F6B3A; text-align: center; margin-bottom: 4px; }
.auth-sub { font-size: 14px; color: #5F6F63; text-align: center; margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: #5F6F63; }
.auth-footer a { color: #1F6B3A; }

/* ── PORTAL ─────────────────────────────────── */
.portal-layout { min-height: 100vh; display: flex; flex-direction: column; background: #F8FBF7; }
.portal-header { background: #ffffff; border-bottom: 1px solid #D7E5D2; display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; box-shadow: 0 1px 3px rgba(11,47,29,.05); flex-wrap: wrap; gap: 8px; }
.portal-brand { font-size: 18px; font-weight: 700; color: #1F6B3A; }
.portal-user { font-size: 14px; color: #3D4F42; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.portal-user a { color: #3D4F42; }
.portal-user a:hover { color: #1F6B3A; }
.portal-main { flex: 1; padding: 28px; max-width: 960px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.portal-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) {
  .portal-2col { grid-template-columns: 1fr !important; }
  .portal-main { padding: 16px 14px; }
  .portal-header { padding: 10px 14px; }
}

/* ── PWA BANNER ─────────────────────────────── */
.pwa-banner {
    display: flex; align-items: center; gap: 12px;
    background: rgba(31,107,58,.06); border: 1px solid rgba(31,107,58,.2);
    border-radius: 10px; padding: 12px 16px; margin-bottom: 20px;
    font-size: 14px; color: #145C2F; flex-wrap: wrap;
}

/* ── FOOTER ─────────────────────────────────── */
.footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid #D7E5D2; font-size: 12px; color: #8FA494; }
.footer a { color: #8FA494; }
.footer a:hover { color: #5F6F63; }

/* ── EXPORT DROPDOWN ─────────────────────────── */
.export-item { display: block; padding: 10px 16px; font-size: 14px; color: #3D4F42; text-decoration: none; transition: background .12s; }
.export-item:hover { background: #EEF6EA; text-decoration: none; }

/* ── COMPANY SWITCHER (v topbaru) ────────────── */
.company-arrow { font-size: 10px; color: #5F6F63; flex-shrink: 0; }
.company-menu {
    display: none; position: absolute; left: 0; top: calc(100% + 6px);
    background: #ffffff; border: 1px solid #D7E5D2; border-radius: 9px;
    box-shadow: 0 8px 24px rgba(11,47,29,.1); z-index: 300; overflow: hidden;
    min-width: 200px;
}
.company-item {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; padding: 10px 14px; font-size: 13px; color: #3D4F42;
    background: none; border: none; cursor: pointer;
    text-align: left; text-decoration: none; transition: background .12s;
}
.company-item:hover { background: #EEF6EA; color: #102018; text-decoration: none; }
.company-item-active { color: #1F6B3A; font-weight: 700; }
.company-item-add { color: #1F6B3A; font-size: 13px; border-top: 1px solid #F8FBF7; }

/* ── LANDING PAGE ────────────────────────────── */
.landing { background: #EEF6EA; min-height: 100vh; color: #102018; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; padding: 18px 48px; border-bottom: 1px solid #D7E5D2; background: #fff; }
.landing-nav-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: #102018; text-decoration: none; }
.landing-nav-links { display: flex; gap: 12px; align-items: center; }
.landing-hero { text-align: center; padding: 80px 24px 60px; max-width: 800px; margin: 0 auto; }
.landing-hero h1 { font-size: 48px; font-weight: 800; color: #102018; line-height: 1.1; margin-bottom: 20px; }
.landing-hero h1 span { color: #1F6B3A; }
.landing-hero p { font-size: 18px; color: #4A5E4E; margin-bottom: 36px; line-height: 1.6; }
.hero-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-hero-primary { background: #1F6B3A; color: #ffffff; font-weight: 700; font-size: 15px; padding: 12px 28px; border-radius: 10px; border: none; cursor: pointer; transition: background .15s; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn-hero-primary:hover { background: #145C2F; text-decoration: none; color: #ffffff; }
.btn-hero-secondary { background: transparent; color: #3D4F42; font-weight: 600; font-size: 15px; padding: 12px 28px; border-radius: 10px; border: 1px solid #C8DCC2; cursor: pointer; transition: all .15s; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn-hero-secondary:hover { border-color: #1F6B3A; color: #1F6B3A; text-decoration: none; }
.landing-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; padding: 0 48px 80px; max-width: 1100px; margin: 0 auto; }
.feature-card { background: #ffffff; border: 1px solid #D7E5D2; border-radius: 16px; padding: 24px; box-shadow: 0 1px 4px rgba(11,47,29,.05); }
.feature-icon { font-size: 28px; margin-bottom: 14px; }
.feature-title { font-size: 15px; font-weight: 700; color: #102018; margin-bottom: 8px; }
.feature-desc { font-size: 14px; color: #4A5E4E; line-height: 1.6; }
.landing-cta { text-align: center; padding: 60px 24px; background: linear-gradient(135deg, rgba(31,107,58,.05), rgba(79,143,58,.03)); border-top: 1px solid #D7E5D2; border-bottom: 1px solid #D7E5D2; margin-bottom: 60px; }
.landing-cta h2 { font-size: 32px; font-weight: 700; color: #102018; margin-bottom: 12px; }
.landing-cta p { color: #4A5E4E; margin-bottom: 28px; font-size: 15px; }

/* ── SIDEBAR DETAIL LAYOUT (300px | content) ── */
.sidebar-detail-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

/* ── HELP SIDEBAR LAYOUT (200px | content) ──── */
.help-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  max-width: 960px;
}

/* ── CONTENT + SIDEBAR (1fr | 320px) ─────────── */
.content-sidebar-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

/* ── FORM ROW / COL (IMAP, Datovka, …) ───────── */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.form-row:last-child {
  margin-bottom: 0;
}
.form-col {
  flex: 1 1 200px;
  min-width: 0;
}
.form-col label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #5F6F63;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.form-col input,
.form-col select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #C8DCC2;
  border-radius: 8px;
  font-size: 14px;
  color: #102018;
  background: #ffffff;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}
.form-col input:focus,
.form-col select:focus {
  border-color: #1F6B3A;
  box-shadow: 0 0 0 3px rgba(31,107,58,.1);
}

/* ── MODAL RESPONSIVE ────────────────────────── */
.modal-wrap {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-wrap.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box-dark {
  background: #0B2F1D;
  border: 1px solid #1F6B3A;
  color: #EEF6EA;
}

/* ── CALENDAR RESPONSIVE ─────────────────────── */
.calendar-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.calendar-wrap table,
.calendar-wrap .cal-grid {
  min-width: 560px;
}

@media (max-width: 860px) {
  .sidebar-detail-layout { grid-template-columns: 1fr; }
  .content-sidebar-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .help-layout { grid-template-columns: 1fr; }
}

/* ── PRINT ─────────────────────────────────── */
@media print {
  .rail, .global-topbar, .actions, .form-actions,
  .btn, button, .messages,
  .export-item, #export-menu, .pwa-banner,
  .footer, .rail-footer, .mobile-nav, .mobile-menu,
  .logout-link { display: none !important; }
  .no-print { display: none !important; }
  .layout { display: block !important; }
  .layout-body { display: block !important; }
  .main { padding: 0 !important; background: white !important; }
  .card { border: none !important; box-shadow: none !important; }
  body { background: white !important; color: black !important; }
}

/* ── MOBILE BOTTOM NAV ───────────────────────── */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px; z-index: 200;
  background: #ffffff;
  border-top: 1px solid #D7E5D2;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 12px rgba(11,47,29,.07);
}
.mobile-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: #8FA494; text-decoration: none; font-size: 10px; font-weight: 500;
  background: none; border: none; cursor: pointer; padding: 4px 0;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.mobile-nav-item:hover, .mobile-nav-item:active { color: #4A5E4E; text-decoration: none; }
.mobile-nav-active { color: #1F6B3A !important; }

/* ── MOBILE MENU OVERLAY ─────────────────────── */
.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 500;
}
.mobile-menu.open { display: block; }
.mobile-menu-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
}
.mobile-menu-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #ffffff; border-top: 1px solid #D7E5D2;
  border-radius: 20px 20px 0 0;
  padding: 0 0 calc(16px + env(safe-area-inset-bottom, 0));
  max-height: 82vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -8px 30px rgba(11,47,29,.12);
}
.mobile-menu.open .mobile-menu-panel { transform: translateY(0); }
.mobile-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 10px;
  border-bottom: 1px solid #F8FBF7;
}
.mobile-menu-header span { font-size: 15px; font-weight: 700; color: #102018; }
.mobile-menu-close {
  background: #EEF6EA; border: none; color: #5F6F63; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.mobile-menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px; color: #3D4F42; font-size: 15px;
  text-decoration: none; border-bottom: 1px solid #F8FBF7;
  transition: background .12s; background: none;
  border-left: none; border-right: none; border-top: none;
  width: 100%; cursor: pointer;
}
.mobile-menu-item:last-child { border-bottom: none; }
.mobile-menu-item:hover, .mobile-menu-item:active { background: #EEF6EA; color: #102018; text-decoration: none; }
.mobile-menu-item .mmi-icon { width: 36px; height: 36px; border-radius: 10px; background: #EEF6EA; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.mobile-menu-logout { color: #B42318; }
.mobile-menu-logout .mmi-icon { background: rgba(180,35,24,.08); }
.mobile-menu-item-active { color: #1F6B3A !important; }
.mobile-menu-item-active .mmi-icon { background: rgba(31,107,58,.1); }
.mobile-menu-section { font-size: 11px; font-weight: 700; color: #8FA494; text-transform: uppercase; letter-spacing: .6px; padding: 12px 20px 4px; }

/* ── RESPONSIVE: ≤ 768px ─────────────────────── */
/* Sidebar groups */
.rail {
    width: 248px;
    overflow-x: hidden;
}
.rail-nav {
    padding: 14px 10px 18px;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
}
.rail-footer { display: none; }

.rail-group {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    transition: border-color .2s, box-shadow .2s;
}
.rail-group:hover {
    border-color: rgba(255,255,255,0.14);
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.rail-group-active {
    border-color: rgba(255,255,255,0.22);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.rail-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s, color .15s;
    border-radius: 10px;
}
.rail-group-toggle:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.75);
}
.rail-group-open .rail-group-toggle {
    background: rgba(255,255,255,0.09);
    border-bottom-color: rgba(255,255,255,0.06);
    border-radius: 10px 10px 0 0;
    color: rgba(255,255,255,0.9);
}
.rail-group-label { flex: 1; text-align: left; }
.rail-group-heading { display: flex; align-items: center; gap: 8px; }
.rail-group-glyph {
    width: 22px; height: 22px;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0;
    background: rgba(255,255,255,0.1);
    transition: background .15s;
}
.rail-group-open .rail-group-glyph { background: rgba(255,255,255,0.16); }
.rail-group-title { font-size: 11px; font-weight: 700; letter-spacing: .07em; }
.rail-group-arrow {
    font-size: 11px;
    color: rgba(255,255,255,0.28);
    transition: transform .18s ease, color .15s;
}
.rail-group-toggle:hover .rail-group-arrow { color: rgba(255,255,255,0.5); }
.rail-group-open .rail-group-arrow {
    transform: rotate(180deg);
    color: rgba(255,255,255,0.5);
}
.rail-group-items {
    display: none;
    padding: 6px;
}
.rail-group-open .rail-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rail-group-open {
    overflow: visible;
}

/* Wide sidebar: submenu se zobrazí inline, ne jako flyout vpravo */
.rail-group .rail-item-wrap .rail-submenu {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 2px 0 4px 0;
    background: transparent;
    max-height: none;
    min-width: 0;
    pointer-events: auto;
    overflow: visible;
}
/* Submenu se zobrazuje kliknutím (JS accordion) — hover jen na desktop jako bonus */
@media (hover: hover) {
  .rail-group .rail-item-wrap:hover .rail-submenu { display: block; }
}
.rail-group .rail-submenu-header { display: none; }
.rail-group .rail-submenu a {
    padding: 6px 8px 6px 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.62);
    border-radius: 7px;
    background: transparent;
}
.rail-group .rail-submenu a:hover {
    background: rgba(255,255,255,0.09);
    color: rgba(255,255,255,0.92);
    text-decoration: none;
}
.rail-group .rail-submenu a.active {
    color: #86efac;
    font-weight: 600;
    background: rgba(134,239,172,0.12);
}
.rail-group .rail-submenu a.disabled {
    color: rgba(255,255,255,0.28);
    pointer-events: none;
    font-style: italic;
}

.rail-item-wrap {
    position: relative;
    border-radius: 10px;
}
.rail-item {
    width: 100%;
    min-height: 50px;
    height: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    padding: 7px 10px;
    border-radius: 10px;
    transition: background .13s;
}
.rail-item:hover {
    background: rgba(255,255,255,0.07);
}
.rail-item span {
    white-space: normal;
    text-align: left;
    line-height: 1.35;
}
.rail-item-label {
    flex: 1;
    min-width: 0;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: inherit;
}
.rail-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    flex-shrink: 0;
    transition: filter .15s, transform .15s, box-shadow .15s;
}
.rail-icon svg {
    width: 18px;
    height: 18px;
}
.rail-icon-badge {
    position: relative;
}
/* Icon container when holding a counter badge */
.rail-icon.rail-icon-counter {
    position: relative;
}
/* The actual counter badge span */
.rail-counter {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 2px #0B2F1D;
}
/* Inline badge in label text */
.rail-inline-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    height: 17px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    margin-left: 5px;
    flex-shrink: 0;
    vertical-align: middle;
}
.rail-item-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.65);
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.1;
    flex-shrink: 0;
}
.rail-item-badge-alert {
    background: rgba(239,68,68,.18);
    color: #fca5a5;
}

.rail-submenu {
    left: calc(100% - 8px);
    top: 6px;
}

@media (max-width: 1366px) and (min-width: 769px) {
    .rail {
        width: 220px;
    }
    .main {
        padding: 22px 22px;
    }
}

@media (max-width: 768px) {
  /* Skrýt desktop rail */
  .rail { display: none !important; }

  /* Zobrazit mobilní spodní nav */
  .mobile-nav { display: flex; }

  /* Přizpůsobit hlavní obsah */
  .main { padding: 14px 12px 76px; }

  /* Topbar: skrýt hodiny, tlačítko podpory */
  .gtb-time { display: none; }
  .btn-support { display: none; }
  .global-topbar { padding: 0 10px; height: 48px; }
  .gtb-left { gap: 6px; min-width: 0; flex: 1; }
  .brand-name { font-size: 14px; }
  .gtb-tenant-name {
    max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 11px; padding-left: 8px;
  }
  .gtb-company-current { font-size: 11px; padding: 3px 6px; max-width: 120px; }
  .gtb-company-current span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }
  .gtb-right { gap: 6px; flex-shrink: 0; }
  .rail { top: 48px; height: calc(100vh - 48px); }

  /* Tabulky — horizontální scroll */
  .card { padding: 12px 10px; overflow: hidden; }
  table { min-width: auto; }
  th, td { padding: 9px 8px; font-size: 13px; }
  .table-scroll { -webkit-overflow-scrolling: touch; }

  /* Stats mřížka */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 14px 8px; }
  .stat-value { font-size: 24px; }

  /* Topbar nadpisy */
  .topbar h1 { font-size: 20px; }
  .topbar { margin-bottom: 12px; gap: 8px; }
  .topbar-right { width: 100%; justify-content: flex-start; }
  .topbar-right .btn { flex: 1 1 calc(50% - 6px); justify-content: center; }

  /* Formuláře */
  .field-row { flex-direction: column; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; min-width: 120px; }
  .split-layout,
  .two-col-grid { grid-template-columns: 1fr; }
  .page-actions,
  .inline-actions { width: 100%; }
  .page-actions .btn,
  .inline-actions .btn { flex: 1 1 calc(50% - 6px); justify-content: center; }
  .responsive-card-grid,
  .form-grid,
  .form-grid-wide { grid-template-columns: 1fr; }

  /* Touch targets — min 44px výška */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .btn-remove { min-height: 36px; min-width: 36px; }
  .token-box { min-height: 110px; font-size: 12px; }
  .muted-box, .notice-box, .warning-box, .success-box { padding: 12px; }

  /* Auth stránka */
  .auth-box { padding: 24px 18px; margin: 0 12px; }
  .auth-brand { font-size: 24px; }

  /* Invoice layout */
  .invoice-layout { grid-template-columns: 1fr; }
  .items-editor-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .items-editor { font-size: 12px; min-width: 560px; }
  .items-editor th, .items-editor td { padding: 4px 3px; }

  /* Content grid */
  .content-grid { grid-template-columns: 1fr; gap: 10px; }

  /* Landing page */
  .landing-nav { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
  .landing-hero h1 { font-size: 30px; }
  .landing-hero p { font-size: 15px; }
  .landing-features { padding: 0 16px 40px; }
  .hero-buttons { flex-direction: column; align-items: stretch; }
  .btn-hero-primary, .btn-hero-secondary { justify-content: center; }

  /* Tlačítka */
  .actions { gap: 6px; }
  .actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
  .btn-sm { font-size: 12px; padding: 5px 9px; }
  .card-title { font-size: 12px; }
  .section-header h2 { font-size: 15px; }

  /* Formuláře na mobilu */
  .filter-bar { gap: 6px; }
  .filter-input { max-width: 100%; min-width: auto; flex: 1 1 100%; }
  .field-row { flex-direction: column; gap: 0; }
  .field-row .field { margin-bottom: 12px; }
  .field-row .field:last-child { margin-bottom: 16px; }
  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-col { flex: 1 1 100%; margin-bottom: 12px; }
  .form-row .form-col:last-child { margin-bottom: 0; }
  .form-actions[style*="position:sticky"] { position: relative !important; padding: 12px 0 !important; background: transparent !important; backdrop-filter: none !important; border-top: none !important; }

  /* Modaly na mobilu */
  .modal-box, .modal-box-dark { padding: 20px 16px !important; max-width: 95vw !important; }

  /* Kalendář na mobilu */
  .calendar-wrap .cal-grid,
  .calendar-wrap table { min-width: auto; }
  .calendar-wrap .cal-grid > div,
  .calendar-wrap .cal-grid > a { font-size: 10px; padding: 2px; }

  /* Help layout */
  .help-layout { grid-template-columns: 1fr; gap: 16px; }

  /* Sidebar detail layout na tabletu/mobilu */
  .sidebar-detail-layout { grid-template-columns: 1fr; }
  .content-sidebar-layout { grid-template-columns: 1fr; }

  /* Rail submenu na mobilu nezobrazovat */
  .rail-submenu { display: none !important; }

  /* Touch targets */
  .rail-item { min-height: 48px; }
  .rail-group-toggle { min-height: 44px; }
  .mobile-nav-item { min-height: 56px; }

  /* Global topbar na mobilu */
  .global-topbar { height: 48px; padding: 0 10px; }
  .gtb-brand { gap: 6px; }
  .brand-logo { width: 26px; height: 26px; font-size: 13px; }
  .gtb-company-current { max-width: 140px; padding: 4px 8px; font-size: 11px; }
  .gtb-company-current span:first-child { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .company-menu { max-width: calc(100vw - 20px); left: auto; right: 0; }
}

/* ── RESPONSIVE: ≤ 480px (malé telefony) ────── */
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand-name { display: none; }
  .main { padding: 12px 10px 76px; }
  .card { padding: 10px 8px; }
  th, td { padding: 7px 6px; font-size: 12px; }
  .topbar h1 { font-size: 18px; }
  .topbar-right .btn,
  .page-actions .btn,
  .inline-actions .btn { flex-basis: 100%; }
  .auth-box { padding: 20px 14px; margin: 0 8px; }
  .portal-main { padding: 14px 12px; }
  .portal-header { padding: 10px 14px; }
  .btn { min-height: 44px; }
}

/* ── GLOBAL LIGHT THEME OVERRIDE (admin area) ────────────────
   Opravuje inline dark styles v šablonách — přebíjí !important.
   Netýká se .rail (sidebar), invoice šablon a portálu.
   ──────────────────────────────────────────────────────────── */
.main input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
.main select,
.main textarea {
  background: #ffffff !important;
  color: #102018 !important;
  border-color: #C8DCC2 !important;
}
.main input::placeholder,
.main textarea::placeholder {
  color: #8FA494 !important;
}
/* Kalendářová ikonka — bez invertu na světlém pozadí */
.main input[type="date"]::-webkit-calendar-picker-indicator,
.main input[type="time"]::-webkit-calendar-picker-indicator,
.main input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: none !important;
  opacity: 0.6;
}
/* Export dropdown menu — světlé */
#export-menu a,
.export-menu a {
  color: #3D4F42 !important;
  background: transparent !important;
}
#export-menu,
.export-menu {
  background: #ffffff !important;
  border-color: #D7E5D2 !important;
  box-shadow: 0 4px 16px rgba(11,47,29,.1) !important;
}
#export-menu a:hover,
.export-menu a:hover {
  background: #EEF6EA !important;
  color: #102018 !important;
}
