/* =====================================================================
   CRM DiMaR — štýl aplikácie
   Dimar Group s. r. o. · MARKETING | SINCE 1998
   Tmavý bočný panel, červený akcent, moderný minimalizmus
   ===================================================================== */

:root {
    --red:        #C8102E;
    --red-btn:    #C8102E;
    --red-dark:   #9B0B23;
    --red-btn-dark: #9B0B23;
    --red-soft:   #FDECEF;
    --red-line:   #F3C6CE;

    --ink:        #111827;
    --ink-2:      #374151;
    --muted:      #6B7280;

    --surface:    #FFFFFF;
    --canvas:     #F3F4F6;
    --line:       #E5E7EB;

    --surface-2:  #F9FAFB;
    --surface-3:  #F3F4F6;
    --surface-4:  #E5E7EB;
    --line-strong:#D1D5DB;
    --on-accent:  #FFFFFF;

    /* Svetlý bočný panel (svetlý režim) */
    --sidebar-bg:       #ECEEF2;
    --sidebar-text:     #374151;
    --sidebar-text-dim: #6B7280;
    --sidebar-hover:    rgba(0, 0, 0, .05);
    --sidebar-active-bg: rgba(200, 16, 46, .09);
    --sidebar-active-text: #9B0B23;
    --sidebar-border:   #D5D8DF;
    --sidebar-label:    #9CA3AF;

    --danger:     #991B1B;
    --danger-dark:#7F1D1D;
    --danger-row: #FEF2F2;

    --ok:         #065F46;
    --ok-soft:    #ECFDF5;
    --ok-line:    #A7F3D0;
    --warn:       #92400E;
    --warn-soft:  #FFFBEB;
    --warn-line:  #FDE68A;
    --info:       #1E40AF;
    --info-soft:  #EFF6FF;
    --info-line:  #BFDBFE;

    --win:        #065F46;
    --win-soft:   #ECFDF5;
    --win-line:   #A7F3D0;

    --purple:     #5B21B6;
    --purple-soft:#F5F3FF;
    --purple-line:#DDD6FE;

    --gap: 1.2rem;
    --stack: 1.4rem;
    --radius:     10px;
    --radius-sm:  6px;
    --shadow:     0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
    --topbar-h:   60px;
    --sidebar-w:  240px;

    --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0 0 .6rem;
    line-height: 1.25;
    letter-spacing: -.02em;
    font-weight: 700;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }

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

p { margin: 0 0 .8rem; }

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    background: var(--red);
    color: var(--on-accent);
    padding: .6rem 1rem;
    z-index: 100;
}
.skip-link:focus { left: .5rem; top: .5rem; }

/* ---------------------------------------------------------------------
   Horná lišta
   --------------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem 0 0;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0;
    color: var(--on-accent);
    text-decoration: none;
    width: var(--sidebar-w);
    flex-shrink: 0;
    padding: 0 1.1rem;
    border-right: 1px solid var(--sidebar-border);
    height: 100%;
}
.brand:hover { text-decoration: none; opacity: .9; }

.brand__logo {
    height: 28px;
    width: auto;
    display: block;
}

.topbar__right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.user-chip { display: flex; align-items: center; gap: .55rem; }

.user-chip__avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(200, 16, 46, .15);
    color: var(--red);
    border: 1px solid rgba(200, 16, 46, .25);
    font-weight: 700;
    font-size: .85rem;
}

.user-chip__info { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip__name { font-size: .85rem; font-weight: 600; color: var(--sidebar-text); }
.user-chip__role { font-size: .72rem; color: var(--sidebar-text-dim); }

.topbar__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 34px;
    padding: 0 8px;
    background: none;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-left: .75rem;
}
.topbar__burger span {
    display: block;
    height: 2px;
    background: #D1D5DB;
    border-radius: 2px;
}

/* ---------------------------------------------------------------------
   Rozloženie
   --------------------------------------------------------------------- */
.shell {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - var(--topbar-h) - 46px);
}

.sidebar {
    position: sticky;
    top: var(--topbar-h);
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    height: calc(100vh - var(--topbar-h));
    padding: 1rem .65rem;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    gap: .1rem;
    overflow-y: auto;
}

.sidebar__label {
    margin: 1rem .6rem .3rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--sidebar-label);
}
.sidebar__label:first-child { margin-top: 0; }

.navlink {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .6rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: .88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .12s ease, color .12s ease;
}
.navlink:hover { background: var(--sidebar-hover); color: var(--sidebar-text); text-decoration: none; }
.navlink.is-active {
    background: var(--sidebar-active-bg);
    border-left-color: var(--red);
    color: var(--sidebar-active-text);
    font-weight: 650;
}
.navlink__icon { font-size: .9rem; opacity: .75; width: 1.1rem; text-align: center; flex-shrink: 0; }
.navlink.is-active .navlink__icon { opacity: 1; }

.sidebar__foot {
    margin-top: auto;
    padding: .6rem .6rem .2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
    padding-top: .8rem;
}

.version-pill {
    display: inline-block;
    padding: .16rem .5rem;
    border: 1px solid var(--sidebar-border);
    border-radius: 99px;
    font-size: .7rem;
    color: var(--sidebar-label);
}
.version-pill--warn {
    background: rgba(251, 191, 36, .12);
    border-color: rgba(251, 191, 36, .3);
    color: #FCD34D;
    font-weight: 600;
    cursor: help;
}

.content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.5rem 1.75rem 2.5rem;
}

/* ---------------------------------------------------------------------
   Hlavička stránky
   --------------------------------------------------------------------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}
.page-head__sub { margin: 0; color: var(--muted); font-size: .88rem; }
.page-head__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.eyebrow {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: .12rem;
}

/* ---------------------------------------------------------------------
   Karty
   --------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.1rem;
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .9rem 1.15rem;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
}
.card__head h2, .card__head h3 { margin: 0; }
.card__body { padding: 1.15rem; }
.card__body--flush { padding: 0; }

.content > * + *,
.content > form > * + * { margin-top: var(--stack); }
.content > .page-head { margin-bottom: 0; }
.content > .alert { margin-bottom: 0; }

.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--red);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
}
.stat__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .15rem; }
.stat__value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__note { font-size: .76rem; color: var(--muted); }

/* ---------------------------------------------------------------------
   Tlačidlá
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--red);
    color: var(--on-accent);
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
    text-decoration: none;
    letter-spacing: -.01em;
}
.btn:hover { background: var(--red-btn-dark); color: var(--on-accent); text-decoration: none; box-shadow: 0 2px 6px rgba(200,16,46,.25); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--outline { background: transparent; border-color: var(--red); color: var(--red-dark); }
.btn--outline:hover { background: var(--red-soft); color: var(--red-dark); box-shadow: none; }

.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink); box-shadow: none; }

/* Ghost + danger = outlined danger (transparent bg, red text/border) */
.btn--ghost.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--ghost.btn--danger:hover { background: var(--danger); color: #fff; box-shadow: none; }

/* Topbar – tlačidlá musia byť čitateľné na tmavom pozadí #111827 */
.topbar .btn--ghost { border-color: rgba(0,0,0,.18); color: var(--sidebar-text); }
.topbar .btn--ghost:hover { background: rgba(0,0,0,.06); color: var(--ink); border-color: rgba(0,0,0,.28); }
.topbar .btn--outline { border-color: var(--red); color: var(--red-dark); }
.topbar .btn--outline:hover { background: var(--red-soft); color: var(--red-dark); border-color: var(--red); }

.btn--danger { background: var(--danger); }
.btn--danger:hover { background: var(--danger-dark); }

.btn--sm { padding: .32rem .7rem; font-size: .82rem; }
.btn--block { width: 100%; }

.btn-row { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------------
   Formuláre
   --------------------------------------------------------------------- */
.field { margin-bottom: .9rem; }

.field label,
.label {
    display: block;
    margin-bottom: .28rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
}

.req { color: var(--red); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="tel"], select, textarea {
    width: 100%;
    padding: .5rem .7rem;
    font: inherit;
    font-size: .92rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--red);
    outline: none;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, .1);
}
textarea { min-height: 110px; resize: vertical; }
select { appearance: auto; }

.hint { display: block; margin-top: .22rem; font-size: .78rem; color: var(--muted); }

.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid--3 .span-3 { grid-column: span 3; }

.fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.4rem;
}
.fieldset legend {
    padding: 0;
    margin-bottom: .7rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--red);
    border-bottom: 1px solid var(--red-line);
    width: 100%;
    padding-bottom: .3rem;
}

.filters {
    display: flex;
    gap: .6rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.filters .field { margin-bottom: 0; min-width: 150px; }
.filters .field--wide { flex: 1 1 240px; }

.check {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .9rem;
}
.check input { width: auto; }

/* ---------------------------------------------------------------------
   Tabuľky
   --------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
table.data th, table.data td {
    padding: .62rem .85rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
table.data thead th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
    z-index: 1;
}
table.data tbody tr:hover { background: var(--surface-3); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .row-link { font-weight: 600; }
table.data tr.is-danger td { background: var(--danger-row); }

.notify-row {
    padding: .7rem 0;
    border-bottom: 1px solid var(--line);
}
.notify-row:first-child { padding-top: 0; }
.notify-row:last-of-type { border-bottom: 0; }
.notify-row .hint { margin-bottom: .35rem; }
.notify-row input[type="text"] { font-size: .86rem; }

.city-suggest {
    margin-top: .4rem;
    padding: .5rem .6rem;
    background: var(--info-soft);
    border: 1px solid var(--info-line);
    border-radius: var(--radius-sm);
}
.city-suggest__label {
    display: block;
    margin-bottom: .35rem;
    font-size: .78rem;
    color: var(--ink-2);
}
.city-suggest__item {
    margin: 0 .3rem .3rem 0;
    padding: .25rem .55rem;
    background: var(--surface);
    border: 1px solid var(--info-line);
    border-radius: 999px;
    font: inherit;
    font-size: .8rem;
    color: var(--info);
    cursor: pointer;
}
.city-suggest__item:hover { background: var(--info); color: var(--on-accent); }

.sort-header {
    display: inline-flex;
    align-items: center;
    gap: .1rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.sort-header:hover { color: var(--ink); text-decoration: none; }
.sort-header.is-active { color: var(--ink); font-weight: 800; }
.sort-header__arrow { font-size: .9em; opacity: .8; }

/* Rozbaľovacia karta */
details.card > summary.card__head {
    cursor: pointer;
    list-style: none;
    user-select: none;
}
details.card > summary.card__head::-webkit-details-marker { display: none; }
details.card > summary.card__head:hover { background: var(--surface-3); }

.card__toggle {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--muted);
}
.card__toggle::after {
    content: "▾";
    display: inline-block;
    font-size: .9rem;
    transition: transform .15s ease;
}
details[open] > summary .card__toggle::after { transform: rotate(180deg); }
details[open] > summary .card__toggle { color: var(--red); }

/* ---------------------------------------------------------------------
   Modálne potvrdenie
   --------------------------------------------------------------------- */
dialog.modal {
    width: min(30rem, calc(100vw - 2rem));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
    color: var(--ink);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .5); }

.modal__head {
    padding: .9rem 1.2rem;
    border-bottom: 1px solid var(--line);
    border-top: 3px solid var(--red);
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal__head h2 { margin: 0; font-size: 1.05rem; }
.modal__body { padding: 1.1rem 1.2rem; font-size: .92rem; }
.modal__body p { margin: 0 0 .6rem; }
.modal__body p:last-child { margin-bottom: 0; }
.modal__target {
    display: block;
    margin: .7rem 0;
    padding: .6rem .75rem;
    background: var(--red-soft);
    border: 1px solid var(--red-line);
    border-left: 3px solid var(--red);
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .85rem 1.2rem;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------------------------------------------------------------------
   Faktúry a súbory
   --------------------------------------------------------------------- */
.filetag {
    display: inline-block;
    margin-right: .4rem;
    padding: .05rem .35rem;
    border: 1px solid var(--red-line);
    border-radius: 4px;
    background: var(--red-soft);
    color: var(--red-dark);
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    vertical-align: 1px;
}

input[type="file"] {
    width: 100%;
    padding: .45rem .5rem;
    font: inherit;
    font-size: .88rem;
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
}
input[type="file"]:focus { border-color: var(--red); outline: none; }
input[type="file"]:disabled { background: var(--surface-4); color: var(--muted); }

.req-item {
    padding: .85rem 0;
    border-bottom: 1px solid var(--line);
}
.req-item:first-child { padding-top: 0; }
.req-item:last-child { border-bottom: 0; padding-bottom: 0; }

.req-item__head {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
    margin-bottom: .4rem;
}
.req-item__text {
    margin: 0 0 .4rem;
    font-size: .9rem;
    white-space: pre-line;
}
.req-item__actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}
.inline-form input[type="text"] { width: auto; min-width: 170px; }

.ta-right { text-align: right; }
table.data td.ta-right .btn { margin-left: .25rem; }

.login-links {
    margin: .9rem 0 0;
    text-align: center;
    font-size: .86rem;
}
.login-links a { color: var(--red); font-weight: 600; }

.login-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0 .75rem;
    color: var(--muted);
    font-size: .82rem;
}
.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.code-block {
    margin: 0;
    padding: .7rem .8rem;
    max-height: 260px;
    overflow: auto;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: .78rem;
    line-height: 1.5;
    color: var(--ink-2);
    white-space: pre-wrap;
    word-break: break-word;
}

.empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--muted);
}
.empty strong { display: block; color: var(--ink); margin-bottom: .3rem; }

/* ---------------------------------------------------------------------
   Štítky a stavy
   --------------------------------------------------------------------- */
.chip {
    display: inline-block;
    padding: .14rem .52rem;
    border-radius: 99px;
    font-size: .73rem;
    font-weight: 650;
    letter-spacing: .01em;
    white-space: nowrap;
    border: 1px solid transparent;
}
.chip--novy        { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.chip--vyhrata     { background: var(--win-soft); color: var(--win); border-color: var(--win-line); }
.chip--win         { background: var(--win-soft); color: var(--win); border-color: var(--win-line); }
.chip--purple      { background: var(--purple-soft); color: var(--purple); border-color: var(--purple-line); }
.chip--info        { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.chip--warn        { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.chip--doc-projektova_dokumentacia { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.chip--doc-zmluva                  { background: var(--purple-soft); color: var(--purple); border-color: var(--purple-line); }
.chip--doc-mailova_komunikacia     { background: var(--win-soft); color: var(--win); border-color: var(--win-line); }
.chip--doc-iny                     { background: var(--surface-4); color: var(--muted); border-color: var(--line); }
.chip--prebieha    { background: var(--red-soft); color: var(--red-dark); border-color: var(--red-line); }
.chip--pozastavena { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.chip--dokoncena   { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.chip--zrusena     { background: var(--surface-4); color: var(--muted); border-color: var(--line); }
.chip--admin       { background: var(--red-soft); color: var(--red-dark); border-color: var(--red-line); }
.chip--user        { background: var(--surface-4); color: var(--ink-2); border-color: var(--line); }
.chip--ok          { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.chip--fail        { background: var(--red-soft); color: var(--red-dark); border-color: var(--red-line); }
.chip--muted       { background: var(--surface-4); color: var(--muted); border-color: var(--line); }

.is-late { color: var(--red-dark); font-weight: 650; }
.value-badge.is-late { color: var(--red-dark); }
tr.is-muted-row td { opacity: .6; }
tr.is-muted-row:hover td { opacity: 1; }

.prio { font-size: .8rem; font-weight: 600; }
.prio--vysoka  { color: var(--red-dark); }
.prio--stredna { color: var(--ink-2); }
.prio--nizka   { color: var(--muted); }

.deadline-late { color: var(--red-dark); font-weight: 650; }
.deadline-soon { color: var(--warn); font-weight: 600; }

/* ---------------------------------------------------------------------
   Hlásenia
   --------------------------------------------------------------------- */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert--success { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.alert--error   { background: var(--red-soft); border-color: var(--red-line); color: var(--red-dark); }
.alert--info    { background: var(--info-soft); border-color: var(--info-line); color: var(--info); }
.alert--warning { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

/* ---------------------------------------------------------------------
   Detail zákazky
   --------------------------------------------------------------------- */
.deflist { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: .1rem 1rem; }
.deflist dt {
    padding: .45rem 0;
    font-size: .8rem;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}
.deflist dd {
    margin: 0;
    padding: .45rem 0;
    font-size: .92rem;
    border-bottom: 1px solid var(--line);
}
.deflist dd:last-of-type, .deflist dt:last-of-type { border-bottom: 0; }

.value-badge {
    display: inline-block;
    padding: .3rem .85rem;
    background: var(--red-soft);
    border: 1px solid var(--red-line);
    border-radius: var(--radius-sm);
    color: var(--red-dark);
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.prose { white-space: pre-wrap; }

.audit-strip {
    margin-top: 1.2rem;
    padding: .85rem 1.15rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-top: 3px solid var(--red);
    border-radius: var(--radius);
    font-size: .82rem;
    color: var(--muted);
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
}
.audit-strip strong { display: block; color: var(--ink); font-weight: 600; font-size: .88rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    position: relative;
    padding: .55rem 0 .55rem 1.1rem;
    border-bottom: 1px solid var(--line);
    font-size: .86rem;
}
.timeline li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .95rem;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--red);
}
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-size: .78rem; }

.diff { margin: .3rem 0 0; font-size: .82rem; }
.diff__old { color: var(--muted); text-decoration: line-through; }
.diff__new { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------------
   Prihlásenie - centrovaná forma
   --------------------------------------------------------------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(200, 16, 46, .08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(200, 16, 46, .05) 0%, transparent 50%);
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .2);
    overflow: hidden;
}

.login-card__head {
    background: var(--canvas);
    border-bottom: 1px solid var(--line);
    padding: 2rem 2rem 1.5rem;
    text-align: center;
}

.login-card__logo {
    height: 36px;
    width: auto;
    margin-bottom: 1.2rem;
}

.login-card__domain {
    display: inline-block;
    margin-top: .5rem;
    padding: .22rem .65rem;
    background: var(--red-soft);
    border: 1px solid var(--red-line);
    border-radius: 99px;
    font-size: .76rem;
    font-weight: 600;
    color: var(--red-dark);
}

.login-card__body {
    padding: 1.75rem 2rem 2rem;
}

.login-card h2 {
    font-size: 1.2rem;
    margin-bottom: .3rem;
    text-align: center;
}
.login-card__sub {
    color: var(--muted);
    font-size: .86rem;
    text-align: center;
    margin-bottom: 1.4rem;
}

.captcha {
    display: flex;
    gap: .6rem;
    align-items: stretch;
}
.captcha__task {
    display: grid;
    place-items: center;
    min-width: 108px;
    padding: 0 .8rem;
    background: var(--red-soft);
    border: 1px solid var(--red-line);
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--red-dark);
    font-variant-numeric: tabular-nums;
    user-select: none;
}
.captcha input { flex: 1; }

.login-links {
    margin: .9rem 0 0;
    text-align: center;
    font-size: .86rem;
}
.login-links a { color: var(--red); font-weight: 600; }

.login-foot {
    margin-top: 1.5rem;
    padding-top: .9rem;
    border-top: 1px solid var(--line);
    font-size: .76rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.6;
}

/* ---------------------------------------------------------------------
   Inštalátor
   --------------------------------------------------------------------- */
.installer {
    max-width: 720px;
    margin: 2.5rem auto;
    padding: 0 1.2rem 3rem;
}
.steps { display: flex; gap: .4rem; margin-bottom: 1.6rem; list-style: none; padding: 0; }
.steps li {
    flex: 1;
    padding: .5rem .7rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-bottom: 3px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: .82rem;
    color: var(--muted);
}
.steps li.is-active { border-bottom-color: var(--red); color: var(--ink); font-weight: 650; }
.steps li.is-done { border-bottom-color: var(--ok); color: var(--ok); }
.steps li span { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--line);
    font-size: .9rem;
}
.check-list li:last-child { border-bottom: 0; }

.pw-box {
    background: var(--canvas);
    border: 1px dashed var(--red-line);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    font-family: var(--mono);
    font-size: 1rem;
    word-break: break-all;
}

/* ---------------------------------------------------------------------
   Pätička
   --------------------------------------------------------------------- */
.appfoot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    flex-wrap: wrap;
    padding: .9rem 1.2rem;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--sidebar-border);
    font-size: .78rem;
    color: var(--sidebar-label);
}
.appfoot a { color: var(--sidebar-label); }
.appfoot a:hover { color: #D1D5DB; }
.appfoot__dot { opacity: .4; }

/* ---------------------------------------------------------------------
   Pomocné triedy
   --------------------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: var(--mono); font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .6rem; }
.mt-2 { margin-top: 1.2rem; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.pager { display: flex; gap: .35rem; align-items: center; padding: .8rem 1.1rem; flex-wrap: wrap; }
.pager a, .pager span {
    padding: .3rem .6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: .84rem;
    color: var(--ink-2);
}
.pager .is-current { background: var(--red); border-color: var(--red); color: var(--on-accent); font-weight: 650; }

/* ---------------------------------------------------------------------
   Responzivita
   --------------------------------------------------------------------- */
@media (max-width: 1180px) {
    .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--main { grid-template-columns: minmax(0, 1fr); }
}

/* Sidebar logout – viditeľný len na mobile */
.sidebar__logout-mobile { display: none; }

@media (max-width: 860px) {
    .topbar { padding: 0; gap: 0; }
    .topbar__burger { display: flex; }
    .user-chip__info { display: none; }
    .topbar__right { padding-right: 8px; }
    .topbar__right .btn--ghost { display: none; }
    .topbar__right .btn--outline { display: none; }
    .brand { width: auto; border-right: 0; padding: 0 1rem; }
    .sidebar__logout-mobile { display: inline-flex; width: 100%; justify-content: center; margin-top: .3rem; }

    .sidebar {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        z-index: 35;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,.4);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: calc(100dvh - var(--topbar-h));
        height: calc(100vh - var(--topbar-h)); /* fallback pre staršie browsery */
        padding-bottom: calc(.65rem + env(safe-area-inset-bottom, 0px));
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar__foot { position: sticky; bottom: 0; background: var(--sidebar-bg); margin-top: .5rem; }

    .content { padding: 1rem .9rem 2rem; }
    .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
    .form-grid, .form-grid--3 { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2, .form-grid--3 .span-3 { grid-column: span 1; }
    .deflist { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .deflist dt { padding-bottom: 0; border-bottom: 0; }
    .deflist dd { padding-top: .1rem; }
    .audit-strip { gap: 1rem; }
    .steps { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

@media print {
    .topbar, .sidebar, .page-head__actions, .appfoot { display: none; }
    .content { padding: 0; }
    .card { box-shadow: none; }
}

/* ---------------------------------------------------------------------
   Moduly 0.0.2 – Klienti, Poštovné, Kniha jázd, Pokladňa
   --------------------------------------------------------------------- */
.module-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .22rem .65rem;
    border-radius: 99px;
    font-size: .73rem;
    font-weight: 650;
}
.module-badge--in  { background: var(--ok-soft);   color: var(--ok);   border: 1px solid var(--ok-line); }
.module-badge--out { background: var(--red-soft);  color: var(--red-dark); border: 1px solid var(--red-line); }

.cash-amount--in  { color: var(--ok);       font-weight: 700; font-variant-numeric: tabular-nums; }
.cash-amount--out { color: var(--red-dark); font-weight: 700; font-variant-numeric: tabular-nums; }

.trip-km { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Aktuálne zákazky – dashboard karta */
.active-orders-list { list-style: none; margin: 0; padding: 0; }
.active-orders-list li {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--line);
    font-size: .88rem;
}
.active-orders-list li:last-child { border-bottom: 0; }
.active-orders-list .ao-code { font-family: var(--mono); font-size: .8rem; color: var(--muted); flex-shrink: 0; }
.active-orders-list .ao-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-orders-list .ao-chip { flex-shrink: 0; }

/* Klientska karta v zákazke */
.client-ref {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .22rem .6rem;
    background: var(--info-soft);
    border: 1px solid var(--info-line);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    color: var(--info);
    text-decoration: none;
}
.client-ref:hover { background: var(--info); color: var(--on-accent); }

/* ---------------------------------------------------------------------
   Tmavý režim
   --------------------------------------------------------------------- */
[data-theme="dark"] {
    --red:        #F06070;
    --red-dark:   #F5808F;
    --red-btn:      #C31533;
    --red-btn-dark: #A5102A;
    --red-soft:   #2D1318;
    --red-line:   #5A1E28;

    --ink:        #F1F5F9;
    --ink-2:      #CBD5E1;
    --muted:      #94A3B8;

    --surface:    #1E2330;
    --surface-2:  #252B3B;
    --surface-3:  #2B3245;
    --surface-4:  #323B50;
    --canvas:     #161B27;
    --line:       #2E3650;
    --line-strong:#3D4A65;

    --danger:     #B91C1C;
    --danger-dark:#991B1B;
    --danger-row: #2A1515;

    --ok:         #10B981;
    --ok-soft:    #0F2A1E;
    --ok-line:    #1A4A35;
    --warn:       #F59E0B;
    --warn-soft:  #2A200A;
    --warn-line:  #4A3810;
    --info:       #60A5FA;
    --info-soft:  #0F1E35;
    --info-line:  #1E3560;

    --win:        #34D399;
    --win-soft:   #0A2A1E;
    --win-line:   #124730;

    --purple:     #A78BFA;
    --purple-soft:#1A1030;
    --purple-line:#3A2560;

    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .4);

    /* Tmavý bočný panel v dark mode */
    --sidebar-bg:       #111827;
    --sidebar-text:     #D1D5DB;
    --sidebar-text-dim: #9CA3AF;
    --sidebar-hover:    rgba(255, 255, 255, .07);
    --sidebar-active-bg: rgba(200, 16, 46, .18);
    --sidebar-active-text: #FF8090;
    --sidebar-border:   #1F2937;
    --sidebar-label:    #6B7280;

    color-scheme: dark;
}

[data-theme="dark"] .btn { color: #FFFFFF; }

[data-theme="dark"] .navlink:hover { color: #F9FAFB; }

[data-theme="dark"] .topbar .btn--ghost { border-color: rgba(255,255,255,.25); color: #E5E7EB; }
[data-theme="dark"] .topbar .btn--ghost:hover { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.45); }
[data-theme="dark"] .topbar .btn--outline { border-color: rgba(255,140,155,.5); color: #FF8090; }
[data-theme="dark"] .topbar .btn--outline:hover { background: rgba(200,16,46,.15); color: #FFA0B0; border-color: rgba(255,140,155,.75); }

[data-theme="dark"] .theme-toggle { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .theme-toggle:hover { background: rgba(255,255,255,.12); }

/* Prepínač témy */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .35rem;
    padding: .3rem .6rem;
    background: rgba(0,0,0,.05);
    border: 1px solid var(--sidebar-border);
    border-radius: 999px;
    font: inherit;
    font-size: .74rem;
    font-weight: 600;
    color: var(--sidebar-text-dim);
    cursor: pointer;
    transition: background .12s ease;
}
.theme-toggle:hover { background: rgba(0,0,0,.09); color: var(--sidebar-text); }
.theme-toggle__icon { font-size: .85rem; line-height: 1; }

/* Odkaz na zákazku v logoch */
.timeline__order {
    display: inline-block;
    margin-top: .15rem;
    font-size: .82rem;
    font-weight: 600;
}
.log-order__title { display: block; font-size: .82rem; }

/* Upozornenia v Knihe jázd – karta s výraznejším orámovaním */
.card--alert { border-left: 3px solid var(--warn); }
[data-theme="dark"] .card--alert { border-left-color: var(--warn); }

/* Pomocný text pod poľom formulára */
.field__hint {
    display: block;
    margin-top: .25rem;
    font-size: .78rem;
    color: var(--muted);
}

/* Deaktivovaný riadok tabuľky */
tr.is-muted td { opacity: .55; }
tr.is-muted:hover td { opacity: 1; }

/* Taby (Kniha jázd) */
.tab-bar {
    display: flex;
    gap: .25rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}
.tab-bar__item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem .9rem;
    font-size: .88rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: color .15s, border-color .15s;
}
.tab-bar__item:hover { color: var(--ink); }
.tab-bar__item.is-active {
    color: var(--red);
    border-bottom-color: var(--red);
    font-weight: 600;
}
[data-theme="dark"] .tab-bar__item:hover { color: var(--ink); }
[data-theme="dark"] .tab-bar__item.is-active { color: var(--red); }

/* =====================================================================
   Moduly 0.1.1
   ===================================================================== */

/* Filter bar – horizontálne položky na desktope */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: flex-end;
}
.filter-bar .field { margin: 0; flex: 1 1 130px; min-width: 120px; }
.filter-bar--nowrap { flex-wrap: nowrap; overflow-x: auto; }
.filter-bar--nowrap .field { flex: 1 1 0; min-width: 90px; }
@media (max-width: 860px) {
    .filter-bar { flex-direction: column; }
    .filter-bar .field { flex: none; width: 100%; }
    .filter-bar--nowrap { flex-wrap: wrap; overflow-x: visible; }
    .filter-bar--nowrap .field { flex: none; width: 100%; }
}
.receipt-btn-acc { color: var(--success, #16a34a); border-color: var(--success, #16a34a); }
.receipt-btn-acc:hover { background: var(--success, #16a34a); color: #fff; }

/* Settings – Bločky a Kategórie dokumentov vedľa seba */
.settings-duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap, 1rem);
    align-items: start;
}
@media (max-width: 1180px) {
    .settings-duo { grid-template-columns: minmax(0, 1fr); }
}

/* PWA inštalačný banner */
.pwa-banner {
    display: none;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,.35);
    padding: .9rem 1.1rem;
    max-width: min(480px, calc(100vw - 2rem));
    width: 100%;
}
.pwa-banner.is-visible { display: flex; gap: .8rem; align-items: flex-start; }
.pwa-banner__text { flex: 1; font-size: .9rem; line-height: 1.4; }
.pwa-banner__title { font-weight: 700; font-size: .95rem; margin-bottom: .2rem; }
.pwa-banner__actions { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.pwa-banner__close { flex-shrink: 0; background: none; border: none; color: rgba(255,255,255,.6); font-size: 1.2rem; cursor: pointer; line-height: 1; padding: 0; }
.pwa-banner__close:hover { color: #fff; }
.pwa-banner .btn { background: #fff; color: #111; border-color: #fff; }
.pwa-banner .btn:hover { background: #e5e7eb; border-color: #e5e7eb; color: #111; box-shadow: none; }
.pwa-banner .btn--ghost { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; }
.pwa-banner .btn--ghost:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.8); color: #fff; box-shadow: none; }
[data-theme="dark"] .pwa-banner { background: #1F2937; }

/* Push notifikácie – riadok v nastaveniach */
.notify-row__push { margin-top: .3rem; }
.push-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; padding: .15rem .5rem; border-radius: 99px; background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-line); font-weight: 600; }
