/* ══════════════════════════════════════════════
   CorSuite — main.css  (light theme + mobile)
   ══════════════════════════════════════════════ */

/* ── 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: #0f172a;
    background: #f1f5f9;
    line-height: 1.6;
}

a { color: #16a34a; text-decoration: none; }
a:hover { text-decoration: underline; color: #15803d; }

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

/* ── 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: #f1f5f9; isolation: isolate; }

/* ── GLOBAL TOPBAR ───────────────────────────── */
.global-topbar {
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    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 3px rgba(0,0,0,.06);
}
.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, #22c55e, #16a34a);
    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: #0f172a; letter-spacing: -0.3px; }
.gtb-tenant-name {
    font-size: 12px; color: #475569;
    border-left: 1px solid #e2e8f0; 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: #475569; cursor: pointer;
    padding: 5px 10px; border-radius: 7px; border: 1px solid #e2e8f0;
    transition: all .15s; background: #f8fafc;
}
.gtb-company-current:hover { border-color: #cbd5e1; color: #0f172a; background: #f1f5f9; }
.gtb-right { display: flex; align-items: center; gap: 10px; }
.gtb-time { font-size: 13px; color: #64748b; 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(239,68,68,.06); border: 1px solid rgba(239,68,68,.25);
    color: #dc2626; font-size: 13px; font-weight: 600;
    text-decoration: none; transition: all .15s;
}
.btn-support:hover { background: rgba(239,68,68,.12); color: #dc2626; text-decoration: none; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    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: #ffffff;
    border-right: 1px solid #e2e8f0;
    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 #e2e8f0; padding-top: 4px; }

.rail-item-wrap { position: relative; }
.rail-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 68px; height: 62px;
    color: #94a3b8; text-decoration: none;
    transition: color .15s;
    cursor: pointer; gap: 5px;
    border: none; background: none;
}
.rail-item:hover { background: none; color: #1e293b; text-decoration: none; }
.rail-item span { font-size: 10px; font-weight: 600; text-align: center; line-height: 1.2; white-space: nowrap; letter-spacing: .01em; }

.rail-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: #f1f5f9;
    transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.rail-icon svg { width: 20px; height: 20px; }

/* Barvy ikon — výrazné */
.rail-item[data-color="green"]  { color: #15803d; }
.rail-item[data-color="green"]  .rail-icon { background: #dcfce7; color: #16a34a; }
.rail-item[data-color="blue"]   { color: #1d4ed8; }
.rail-item[data-color="blue"]   .rail-icon { background: #dbeafe; color: #2563eb; }
.rail-item[data-color="amber"]  { color: #b45309; }
.rail-item[data-color="amber"]  .rail-icon { background: #fef3c7; color: #d97706; }
.rail-item[data-color="violet"] { color: #6d28d9; }
.rail-item[data-color="violet"] .rail-icon { background: #ede9fe; color: #7c3aed; }
.rail-item[data-color="pink"]   { color: #be185d; }
.rail-item[data-color="pink"]   .rail-icon { background: #fce7f3; color: #db2777; }
.rail-item[data-color="slate"]  { color: #475569; }
.rail-item[data-color="slate"]  .rail-icon { background: #f1f5f9; color: #64748b; }

/* Hover — zvednutí ikony */
.rail-item:hover .rail-icon {
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.rail-item[data-color="green"]:hover  .rail-icon { box-shadow: 0 4px 12px rgba(22,163,74,.25); }
.rail-item[data-color="blue"]:hover   .rail-icon { box-shadow: 0 4px 12px rgba(37,99,235,.25); }
.rail-item[data-color="amber"]:hover  .rail-icon { box-shadow: 0 4px 12px rgba(217,119,6,.25); }
.rail-item[data-color="violet"]:hover .rail-icon { box-shadow: 0 4px 12px rgba(124,58,237,.25); }
.rail-item[data-color="pink"]:hover   .rail-icon { box-shadow: 0 4px 12px rgba(219,39,119,.25); }

/* Aktivní položka — barevný podtrhávací pruž */
.rail-active .rail-icon {
    transform: scale(1.05);
}
.rail-active[data-color="green"]  { color: #15803d; }
.rail-active[data-color="green"]  .rail-icon { background: #bbf7d0; box-shadow: 0 2px 8px rgba(22,163,74,.3); }
.rail-active[data-color="blue"]   { color: #1d4ed8; }
.rail-active[data-color="blue"]   .rail-icon { background: #bfdbfe; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.rail-active[data-color="amber"]  { color: #b45309; }
.rail-active[data-color="amber"]  .rail-icon { background: #fde68a; box-shadow: 0 2px 8px rgba(217,119,6,.3); }
.rail-active[data-color="violet"] { color: #6d28d9; }
.rail-active[data-color="violet"] .rail-icon { background: #ddd6fe; box-shadow: 0 2px 8px rgba(124,58,237,.3); }
.rail-active[data-color="slate"]  { color: #334155; }
.rail-active[data-color="slate"]  .rail-icon { background: #e2e8f0; }
.rail-active span { font-weight: 700; }

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

/* Submenu flyout */
.rail-submenu {
    display: none;
    position: absolute; left: 68px; top: 0;
    background: #ffffff; border: 1px solid #e2e8f0;
    border-radius: 11px; min-width: 215px;
    padding: 6px 0; z-index: 200;
    box-shadow: 0 8px 28px rgba(0,0,0,.1);
}
.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: #94a3b8;
    letter-spacing: .8px; padding: 6px 16px 8px;
    text-transform: uppercase;
}
.rail-submenu a {
    display: block; padding: 9px 16px;
    color: #334155; font-size: 14px;
    text-decoration: none; transition: background .1s, color .1s;
}
.rail-submenu a:hover { background: #f8fafc; color: #0f172a; text-decoration: none; }
.rail-submenu a.active { color: #16a34a; font-weight: 600; }
.rail-submenu a.disabled { color: #cbd5e1; 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: #0f172a; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.muted { color: #64748b; font-size: 13px; }

/* ── CARDS ─────────────────────────────────── */
.card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 16px;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card-title {
    font-size: 13px; font-weight: 700; color: #64748b;
    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: #0f172a; }
.link-sm { font-size: 13px; color: #16a34a; }

/* ── STATS ─────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
    text-align: center; padding: 20px 12px;
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stat-label { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 700; color: #0f172a; }
.stat-danger .stat-value { color: #dc2626; }
.stat-danger { border-color: rgba(220,38,38,.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: #475569; text-transform: uppercase; letter-spacing: .4px;
    padding: 11px 12px; border-bottom: 2px solid #e2e8f0;
    white-space: nowrap; background: #f8fafc;
}
td {
    padding: 12px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #0f172a;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
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(22,163,74,.1);  color: #16a34a; border: 1px solid rgba(22,163,74,.3); }
.badge-warn   { background: rgba(217,119,6,.1);  color: #b45309; border: 1px solid rgba(217,119,6,.3); }
.badge-danger { background: rgba(220,38,38,.1);  color: #dc2626; border: 1px solid rgba(220,38,38,.3); }
.badge-neutral{ background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.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); }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: 1px solid #d1d5db; border-radius: 8px;
    background: #ffffff; color: #374151; font-size: 14px;
    cursor: pointer; transition: all .15s; white-space: nowrap;
    text-decoration: none; font-weight: 500;
}
.btn:hover { background: #f9fafb; border-color: #9ca3af; text-decoration: none; color: #111827; }
.btn-primary { background: #16a34a; border-color: #16a34a; color: #ffffff; font-weight: 700; }
.btn-primary:hover { background: #15803d; border-color: #15803d; color: #ffffff; }
.btn-danger { background: transparent; border-color: rgba(220,38,38,.35); color: #dc2626; }
.btn-danger:hover { background: rgba(220,38,38,.06); color: #b91c1c; }
.btn-red { background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.25); color: #dc2626; padding: 4px 9px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-red:hover { background: rgba(220,38,38,.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: #9ca3af; cursor: pointer; font-size: 14px; padding: 2px 6px; }
.btn-remove:hover { color: #dc2626; }

/* ── 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: #64748b; margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: .3px;
}
.field input, .field select, .field textarea {
    width: 100%; padding: 10px 13px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 14px; color: #0f172a;
    background: #ffffff; outline: none;
    transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,.1);
}
.field input::placeholder { color: #94a3b8; }
.field-hint { font-size: 12px; color: #64748b; 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: #0f172a; }
hr { border: none; border-top: 1px solid #e2e8f0; 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: #475569; padding: 8px 6px; border-bottom: 2px solid #e2e8f0; background: #f8fafc; }
.items-editor td { padding: 5px 4px; border-bottom: 1px solid #f1f5f9; }
.items-editor input, .items-editor select {
    border: 1px solid #d1d5db; border-radius: 5px;
    padding: 5px 7px; font-size: 13px; width: 100%;
    background: #ffffff; color: #0f172a;
}
.totals-box { margin-top: 14px; border-top: 1px solid #e2e8f0; padding-top: 10px; }
.total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; color: #374151; }
.total-row-final { font-size: 17px; font-weight: 700; color: #16a34a; border-top: 1px solid #e2e8f0; margin-top: 6px; padding-top: 8px; }

/* ── TERMS ─────────────────────────────────── */
.term-row { padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.term-row:last-child { border-bottom: none; }
.term-name { font-size: 14px; color: #0f172a; font-weight: 500; }
.term-date { font-size: 12px; color: #64748b; }
.term-urgent .term-name { color: #dc2626; font-weight: 700; }
.term-urgent .term-date { color: #dc2626; }

/* ── MESSAGES ─────────────────────────────── */
.messages { margin-bottom: 16px; }
.msg { padding: 11px 15px; border-radius: 8px; font-size: 14px; margin-bottom: 8px; }
.msg-error, .msg-warning { background: rgba(220,38,38,.07); color: #b91c1c; border: 1px solid rgba(220,38,38,.2); }
.msg-success, .msg-info { background: rgba(22,163,74,.07); color: #15803d; border: 1px solid rgba(22,163,74,.2); }

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

/* ── PORTAL ─────────────────────────────────── */
.portal-layout { min-height: 100vh; display: flex; flex-direction: column; background: #f1f5f9; }
.portal-header { background: #ffffff; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.portal-brand { font-size: 18px; font-weight: 700; color: #16a34a; }
.portal-user { font-size: 14px; color: #374151; }
.portal-user a { color: #374151; }
.portal-user a:hover { color: #16a34a; }
.portal-main { flex: 1; padding: 28px; max-width: 960px; margin: 0 auto; width: 100%; }

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

/* ── FOOTER ─────────────────────────────────── */
.footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid #e2e8f0; font-size: 12px; color: #94a3b8; }
.footer a { color: #94a3b8; }
.footer a:hover { color: #64748b; }

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

/* ── COMPANY SWITCHER (v topbaru) ────────────── */
.company-arrow { font-size: 10px; color: #64748b; flex-shrink: 0; }
.company-menu {
    display: none; position: absolute; left: 0; top: calc(100% + 6px);
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 9px;
    box-shadow: 0 8px 24px rgba(0,0,0,.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: #374151;
    background: none; border: none; cursor: pointer;
    text-align: left; text-decoration: none; transition: background .12s;
}
.company-item:hover { background: #f8fafc; color: #0f172a; text-decoration: none; }
.company-item-active { color: #16a34a; font-weight: 700; }
.company-item-add { color: #16a34a; font-size: 13px; border-top: 1px solid #f1f5f9; }

/* ── LANDING PAGE ────────────────────────────── */
.landing { background: #f8fafc; min-height: 100vh; color: #0f172a; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; padding: 18px 48px; border-bottom: 1px solid #e2e8f0; background: #fff; }
.landing-nav-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: #0f172a; 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: #0f172a; line-height: 1.1; margin-bottom: 20px; }
.landing-hero h1 span { color: #16a34a; }
.landing-hero p { font-size: 18px; color: #475569; margin-bottom: 36px; line-height: 1.6; }
.hero-buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-hero-primary { background: #16a34a; 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: #15803d; text-decoration: none; color: #ffffff; }
.btn-hero-secondary { background: transparent; color: #374151; font-weight: 600; font-size: 15px; padding: 12px 28px; border-radius: 10px; border: 1px solid #d1d5db; cursor: pointer; transition: all .15s; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn-hero-secondary:hover { border-color: #16a34a; color: #16a34a; 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 #e2e8f0; border-radius: 14px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.feature-icon { font-size: 28px; margin-bottom: 14px; }
.feature-title { font-size: 15px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.feature-desc { font-size: 14px; color: #475569; line-height: 1.6; }
.landing-cta { text-align: center; padding: 60px 24px; background: linear-gradient(135deg, rgba(22,163,74,.05), rgba(16,185,129,.03)); border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; margin-bottom: 60px; }
.landing-cta h2 { font-size: 32px; font-weight: 700; color: #0f172a; margin-bottom: 12px; }
.landing-cta p { color: #475569; margin-bottom: 28px; font-size: 15px; }

/* ── 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 #e2e8f0;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
}
.mobile-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: #94a3b8; 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: #475569; text-decoration: none; }
.mobile-nav-active { color: #16a34a !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 #e2e8f0;
  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(0,0,0,.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 #f1f5f9;
}
.mobile-menu-header span { font-size: 15px; font-weight: 700; color: #0f172a; }
.mobile-menu-close {
  background: #f1f5f9; border: none; color: #64748b; 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: #374151; font-size: 15px;
  text-decoration: none; border-bottom: 1px solid #f8fafc;
  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: #f8fafc; color: #0f172a; text-decoration: none; }
.mobile-menu-item .mmi-icon { width: 36px; height: 36px; border-radius: 10px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.mobile-menu-logout { color: #dc2626; }
.mobile-menu-logout .mmi-icon { background: rgba(220,38,38,.08); }
.mobile-menu-item-active { color: #16a34a !important; }
.mobile-menu-item-active .mmi-icon { background: rgba(22,163,74,.1); }
.mobile-menu-section { font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .6px; padding: 12px 20px 4px; }

/* ── RESPONSIVE: ≤ 768px ─────────────────────── */
@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-x: auto; }
  table { min-width: 520px; }
  th, td { padding: 9px 8px; font-size: 13px; }

  /* 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; }

  /* 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; }

  /* 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 { font-size: 12px; }
  .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; }

  /* Tlačítka */
  .actions { gap: 6px; }
  .btn-sm { font-size: 12px; padding: 5px 9px; }
  .card-title { font-size: 12px; }
  .section-header h2 { font-size: 15px; }
}

/* ── 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; }
  .auth-box { padding: 20px 14px; margin: 0 8px; }
}

/* ══════════════════════════════════════════════
   PAYROLL (CorMzdy) — doplňkové CSS třídy
   ══════════════════════════════════════════════ */

/* Topbar layout */
.topbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-back {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 13px; color: #16a34a; font-weight: 600;
    text-decoration: none; padding: 4px 0;
    transition: color .15s;
}
.btn-back:hover { color: #15803d; text-decoration: none; }

/* Card header (nadpis sekce uvnitř karty) */
.card-header {
    font-size: 12px; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: .5px;
    padding-bottom: 12px; margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* Formuláře */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 4px;
}
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group-check { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-top: 4px; }
.form-label {
    display: block; font-size: 12px; font-weight: 700;
    color: #64748b; text-transform: uppercase; letter-spacing: .3px;
    margin-bottom: 2px;
}
.form-input {
    width: 100%; padding: 9px 12px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 14px; color: #0f172a; background: #ffffff;
    outline: none; transition: border-color .15s;
}
.form-input:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,.1);
}
select.form-input { appearance: auto; cursor: pointer; }
.form-help { font-size: 12px; color: #64748b; margin-top: 3px; }
.form-error { font-size: 12px; color: #dc2626; margin-top: 3px; font-weight: 600; }
.checkbox { width: auto !important; cursor: pointer; }

/* Badge aliasy pro payroll */
.badge-green  { background: rgba(22,163,74,.1);   color: #16a34a; border: 1px solid rgba(22,163,74,.3); }
.badge-amber  { background: rgba(217,119,6,.1);   color: #b45309; border: 1px solid rgba(217,119,6,.3); }
.badge-red    { background: rgba(220,38,38,.1);   color: #dc2626; border: 1px solid rgba(220,38,38,.3); }
.badge-muted  { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-violet { background: rgba(124,58,237,.1);  color: #7c3aed; border: 1px solid rgba(124,58,237,.3); }

/* Detail view (employee_detail) */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 4px; }
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .4px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(220,38,38,.06); border: 1px solid rgba(220,38,38,.25); color: #dc2626; }

/* Info / warn / error boxy */
.info-box {
    background: #f0fdf4; border: 1px solid rgba(22,163,74,.3);
    border-radius: 10px; padding: 14px 16px;
    font-size: 13px; color: #166534; line-height: 1.7;
    margin-bottom: 16px;
}
.info-box a { color: #16a34a; font-weight: 700; }
.warn-box {
    background: #fffbeb; border: 1px solid rgba(217,119,6,.3);
    border-radius: 10px; padding: 14px 16px;
    font-size: 13px; color: #92400e; line-height: 1.7;
    margin-bottom: 16px;
}
.warn-box a { color: #b45309; font-weight: 700; }
.error-box {
    background: rgba(220,38,38,.05); border: 1px solid rgba(220,38,38,.25);
    border-radius: 10px; padding: 14px 16px;
    font-size: 13px; color: #991b1b; line-height: 1.7;
    margin-bottom: 16px;
}

/* ── Payroll sub-navigation ────────────────── */
.payroll-subnav {
    display: flex; gap: 4px; flex-wrap: wrap;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 6px; margin-bottom: 16px;
}
.payroll-subnav-item {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 8px;
    font-size: 13px; font-weight: 600; color: #475569;
    text-decoration: none; transition: background .15s, color .15s;
    white-space: nowrap;
}
.payroll-subnav-item:hover { background: #f1f5f9; color: #0f172a; text-decoration: none; }
.payroll-subnav-item.active { background: #dcfce7; color: #15803d; }

/* ── Payroll tabs (employee detail) ─────────── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; }
.tab-link {
    padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
    color: #475569; background: #f1f5f9; text-decoration: none;
    border: 1px solid transparent; transition: all .15s;
}
.tab-link:hover { background: #e2e8f0; color: #0f172a; text-decoration: none; }
.tab-link.active { background: #fff; color: #15803d; border-color: #e2e8f0; }

/* ── Print styles (smlouva) ─────────────────── */
@media print {
    .rail, .topbar, .payroll-subnav, .btn, .btn-back,
    .print-hide, .no-print { display: none !important; }
    body { background: #fff; font-size: 12px; }
    .card { box-shadow: none; border: none; }
    .print-page { padding: 0; }
}
.contract-print-header {
    display: flex; justify-content: space-between;
    border-bottom: 2px solid #0f172a; padding-bottom: 12px; margin-bottom: 20px;
}
.contract-section { margin-bottom: 20px; }
.contract-section h3 { font-size: 13px; text-transform: uppercase;
    letter-spacing: .5px; color: #64748b; margin-bottom: 8px; }
.contract-field { display: flex; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.contract-field label { min-width: 220px; color: #64748b; }
.contract-field span { font-weight: 600; }
.signature-line {
    border-top: 1px solid #0f172a; width: 220px; padding-top: 4px;
    font-size: 11px; color: #64748b; margin-top: 40px;
}

/* ── Stat badge ──────────────────────────────── */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-box {
    flex: 1; min-width: 120px; background: #fff;
    border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px;
}
.stat-box .stat-value { font-size: 22px; font-weight: 700; color: #0f172a; }
.stat-box .stat-label { font-size: 12px; color: #64748b; margin-top: 2px; }
.stat-box.green .stat-value { color: #16a34a; }
.stat-box.amber .stat-value { color: #d97706; }
.stat-box.red .stat-value { color: #dc2626; }
