/* =====================================================================
   Cartel OS – design systém
   Tmavý charcoal, teplá bílá typografie, acid-lime akcent.
   ===================================================================== */

:root {
    /* Plochy – tmavě šedá, ne černá, aby se v tom dalo pracovat celý den */
    --bg:            #1b1c1f;
    --bg-sidebar:    #17181b;
    --surface:       #212226;
    --surface-2:     #282a2e;
    --surface-3:     #303237;

    /* Okraje */
    --line:          #34363b;
    --line-strong:   #44464c;

    /* Text */
    --text:          #f0efe9;
    --text-muted:    #9a9aa2;
    --text-dim:      #74747c;

    /* Akcenty – zelená podle loga cartel.monster */
    --lime:          #3ED92B;
    --lime-hover:    #55E842;
    --lime-dim:      #2BA81E;
    --lime-bg:       rgba(62, 217, 43, 0.12);
    --warn:          #f5a623;
    --warn-bg:       rgba(245, 166, 35, 0.12);
    --crit:          #f2545b;
    --crit-bg:       rgba(242, 84, 91, 0.12);
    --info:          #6cb2fa;
    --info-bg:       rgba(108, 178, 250, 0.12);

    /* Rozměry */
    --sidebar-w:     236px;
    --radius:        10px;
    --radius-sm:     6px;

    /* Typografie */
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--lime); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

:focus-visible {
    outline: 2px solid var(--lime);
    outline-offset: 2px;
    border-radius: 3px;
}

::selection { background: var(--lime); color: #10120f; }

/* ---------------------------------------------------------------------
   Rozvržení aplikace
   --------------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    padding: 18px 18px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 11px;
}
.brand-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: block;
    overflow: visible;
}
.brand-text { min-width: 0; }
.brand-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.brand-sub {
    color: var(--lime);
    font-size: 12.5px;
    font-weight: 600;
    margin-top: 1px;
    letter-spacing: 0.01em;
}

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
    background: var(--lime);
    color: #10120f;
    font-weight: 600;
}
.nav-item.active:hover { color: #10120f; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }

.nav-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-dim);
    padding: 16px 12px 6px;
    font-weight: 600;
}

.sidebar-foot {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--text-dim);
}
.sidebar-foot strong { color: var(--text-muted); font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 62px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    gap: 20px;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { font-size: 19px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 18px;
    border-left: 1px solid var(--line);
}
.user-chip .meta { line-height: 1.25; }
.user-chip .meta strong { display: block; font-size: 13px; font-weight: 600; }
.user-chip .meta span { font-size: 11.5px; color: var(--text-muted); }

.avatar {
    width: 34px; height: 34px;
    flex: 0 0 34px;
    border-radius: 8px;
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}
.avatar.sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 10px; border-radius: 6px; }
.avatar.lime { background: var(--lime); color: #10120f; border-color: var(--lime); }

.content { padding: 24px 26px 60px; flex: 1; }

/* ---------------------------------------------------------------------
   Karty
   --------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

.stack { display: flex; flex-direction: column; gap: 16px; }

/* KPI dlaždice */
.kpi { padding: 17px 18px; }
.kpi-label {
    display: flex; align-items: center; gap: 9px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
}
.kpi-label svg { width: 16px; height: 16px; color: var(--lime); }
.kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-value.sm { font-size: 22px; }
.kpi-note { margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.kpi-note.crit { color: var(--crit); }
.kpi-note.warn { color: var(--warn); }
.kpi-note.ok   { color: var(--lime); }

/* Ukazatel průběhu */
.bar {
    height: 5px;
    background: var(--surface-3);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 10px;
}
.bar > span { display: block; height: 100%; background: var(--lime); border-radius: 99px; }
.bar.warn > span { background: var(--warn); }
.bar.crit > span { background: var(--crit); }
.bar.thin { height: 4px; margin-top: 6px; }

/* ---------------------------------------------------------------------
   Tabulky
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.data th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    font-weight: 600;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: var(--surface);
}
table.data td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.shrink { width: 1%; white-space: nowrap; }

.row-title { display: flex; align-items: center; gap: 11px; }
.row-title .code {
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 700;
    background: var(--lime);
    color: #10120f;
    padding: 5px 7px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.row-title .code.muted { background: var(--surface-3); color: var(--text-muted); }
.row-title strong { font-weight: 600; display: block; }
.row-title small { color: var(--text-muted); font-size: 12px; display: block; }

/* ---------------------------------------------------------------------
   Odznaky a stavy
   --------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 99px;
    background: currentColor;
    flex: 0 0 6px;
}
.badge.is-ok    { color: var(--lime); }
.badge.is-warn  { color: var(--warn); }
.badge.is-crit  { color: var(--crit); }
.badge.is-info  { color: var(--info); }
.badge.is-muted { color: var(--text-muted); }

.tag {
    display: inline-block;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
    background: var(--surface-3);
    color: var(--text-muted);
    border: 1px solid var(--line-strong);
    white-space: nowrap;
}
.tag.lime { background: var(--lime-bg); color: var(--lime); border-color: rgba(62,217,43,.32); }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(245,166,35,.32); }
.tag.crit { background: var(--crit-bg); color: var(--crit); border-color: rgba(242,84,91,.32); }
.tag.info { background: var(--info-bg); color: var(--info); border-color: rgba(108,178,250,.32); }

.overdue { color: var(--crit); font-weight: 600; }

/* ---------------------------------------------------------------------
   Tlačítka
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-dim); color: var(--text); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--lime);
    border-color: var(--lime);
    color: #10120f;
}
.btn-primary:hover { background: var(--lime-hover); border-color: var(--lime-hover); color: #10120f; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { color: var(--crit); border-color: rgba(242,84,91,.38); background: var(--crit-bg); }
.btn-danger:hover { background: rgba(242,84,91,.2); border-color: var(--crit); color: var(--crit); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------------
   Formuláře
   --------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.field label,
.label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 5px; }
.req { color: var(--lime); }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="url"], input[type="tel"],
input[type="search"], select, textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color .12s, background .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--text-dim); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--lime);
    background: var(--surface-3);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }

textarea { resize: vertical; min-height: 88px; line-height: 1.6; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239a9aa2' stroke-width='1.6'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px;
    padding-right: 32px;
}
select option { background: var(--surface-2); color: var(--text); }

input[type="file"] {
    width: 100%;
    padding: 10px;
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}
input[type="file"]:hover { border-color: var(--lime); }
input[type="file"]::file-selector-button {
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 6px 12px;
    margin-right: 12px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    cursor: pointer;
    color: var(--text);
}
.check input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--lime);
    cursor: pointer;
}

.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; }

fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin: 0 0 18px;
}
fieldset legend {
    padding: 0 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--lime);
}

/* Filtry */
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filters .f { min-width: 150px; }
.filters .f.grow { flex: 1; min-width: 220px; }
.filters label { font-size: 11.5px; margin-bottom: 5px; }

/* ---------------------------------------------------------------------
   Záložky
   --------------------------------------------------------------------- */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab {
    padding: 10px 15px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--lime); border-bottom-color: var(--lime); }
.tab .count {
    font-size: 11px;
    background: var(--surface-3);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 99px;
    font-weight: 700;
}
.tab.active .count { background: var(--lime-bg); color: var(--lime); }

/* ---------------------------------------------------------------------
   Definiční seznam
   --------------------------------------------------------------------- */
.dl { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 0; }
.dl dt, .dl dd {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    margin: 0;
    min-width: 0;
}
.dl dt { color: var(--text-muted); font-size: 13px; }
.dl dd { font-weight: 500; overflow-wrap: anywhere; }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: none; }

/* ---------------------------------------------------------------------
   Seznam souborů
   --------------------------------------------------------------------- */
.file-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--surface-2); }

.file-ext {
    width: 38px; height: 38px;
    flex: 0 0 38px;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    display: grid;
    place-items: center;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--lime);
    letter-spacing: 0.02em;
}
.file-meta { flex: 1; min-width: 0; }
.file-meta strong {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-meta small { color: var(--text-muted); font-size: 12px; }

/* ---------------------------------------------------------------------
   Poznámky a časová osa
   --------------------------------------------------------------------- */
.note {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}
.note:last-child { border-bottom: none; }
.note-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.note-head strong { font-size: 13.5px; font-weight: 600; }
.note-head time { color: var(--text-dim); font-size: 12px; }
.note-body { color: var(--text); white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; }
.note-title { font-weight: 600; margin-bottom: 4px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
    content: "";
    position: absolute;
    left: 5px; top: 6px; bottom: 6px;
    width: 1px;
    background: var(--line-strong);
}
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
    content: "";
    position: absolute;
    left: -21px; top: 6px;
    width: 9px; height: 9px;
    border-radius: 99px;
    background: var(--surface-3);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 1px var(--line-strong);
}
.tl-item.lime::before { background: var(--lime); box-shadow: 0 0 0 1px var(--lime); }
.tl-text { font-size: 13px; }
.tl-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

/* ---------------------------------------------------------------------
   Hlášky
   --------------------------------------------------------------------- */
.flash {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid;
}
.flash svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.flash-success { background: var(--lime-bg); border-color: rgba(62,217,43,.32); color: var(--lime); }
.flash-error   { background: var(--crit-bg); border-color: rgba(242,84,91,.32); color: var(--crit); }
.flash-info    { background: var(--info-bg); border-color: rgba(108,178,250,.32); color: var(--info); }

.callout {
    padding: 13px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    font-size: 13px;
    color: var(--text-muted);
}
.callout strong { color: var(--text); }
.callout.warn { border-color: rgba(245,166,35,.32); background: var(--warn-bg); color: var(--warn); }

/* Prázdný stav */
.empty {
    padding: 44px 24px;
    text-align: center;
    color: var(--text-muted);
}
.empty svg { width: 34px; height: 34px; color: var(--text-dim); margin-bottom: 12px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 380px; margin: 0 auto 16px; }

/* ---------------------------------------------------------------------
   Přihlašovací obrazovka
   --------------------------------------------------------------------- */
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 0%, rgba(62,217,43,.06), transparent 55%),
        var(--bg);
}
.login-card { width: 100%; max-width: 372px; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .logo {
    width: 66px;
    height: 66px;
    display: block;
    margin: 0 auto 14px;
}
.login-brand .name { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; }
.login-brand .sub { color: var(--lime); font-size: 15px; font-weight: 600; margin-top: 2px; }
.login-foot {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-dim);
}

/* ---------------------------------------------------------------------
   Chybová stránka
   --------------------------------------------------------------------- */
.error-page { max-width: 480px; margin: 60px auto; text-align: center; }
.error-code {
    font-size: 60px;
    font-weight: 800;
    color: var(--lime);
    line-height: 1;
    letter-spacing: -0.03em;
}
.error-page h1 { margin: 14px 0 8px; }
.error-page p { color: var(--text-muted); margin-bottom: 22px; }

/* ---------------------------------------------------------------------
   Pomocné třídy
   --------------------------------------------------------------------- */
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.lime { color: var(--lime); }
.crit { color: var(--crit); }
.warn { color: var(--warn); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.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;
}
.inline-form { display: inline; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-head .sub { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }

.breadcrumb {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.breadcrumb a:hover { color: var(--lime); }

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

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex: none;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
    .nav { display: flex; gap: 4px; overflow-x: auto; padding: 10px; }
    .nav-item { margin-bottom: 0; white-space: nowrap; }
    .nav-group-label { display: none; }
    .sidebar-foot { display: none; }
    .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; }
    .content { padding: 16px 16px 40px; }
    .grid-3, .grid-2, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .dl { grid-template-columns: minmax(0, 1fr); }
    .dl dt { padding-bottom: 0; border-bottom: none; color: var(--text-dim); font-size: 12px; }
    .dl dd { padding-top: 3px; }
}

@media (max-width: 560px) {
    .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .user-chip .meta { display: none; }
    .page-head { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

@media print {
    .sidebar, .topbar, .btn, .filters { display: none !important; }
    body { background: #fff; color: #000; }
    .card { border-color: #ccc; }
}

/* ---------------------------------------------------------------------
   Nebezpečná zóna – destruktivní akce oddělené od zbytku formuláře
   --------------------------------------------------------------------- */
.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding: 18px;
    border: 1px solid rgba(242, 84, 91, .3);
    border-radius: var(--radius);
    background: var(--crit-bg);
}
.danger-zone strong { display: block; font-size: 14px; color: var(--crit); margin-bottom: 4px; }
.danger-zone p { font-size: 12.5px; margin: 0; max-width: 520px; }

/* ---------------------------------------------------------------------
   Kanban nástěnka
   --------------------------------------------------------------------- */
.kanban {
    display: grid;
    grid-template-columns: repeat(5, minmax(210px, 1fr));
    gap: 12px;
    align-items: start;
    overflow-x: auto;
    padding-bottom: 6px;
}

.kanban-col {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-width: 210px;
}

.kanban-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
}
.kanban-count {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface-3);
    padding: 1px 7px;
    border-radius: 99px;
}

.kanban-body {
    padding: 10px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    transition: background .12s;
}
.kanban-body.over {
    background: var(--lime-bg);
    outline: 1px dashed var(--lime);
    outline-offset: -6px;
    border-radius: var(--radius);
}

.kanban-empty {
    margin: 0;
    padding: 18px 6px;
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
}

/* Karta úkolu */
.task {
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    cursor: grab;
    transition: border-color .12s, transform .08s, opacity .12s;
}
.task:hover { border-color: var(--text-dim); }
.task:active { cursor: grabbing; }
.task.dragging { opacity: .45; transform: rotate(1deg); }
.task.saving { opacity: .6; pointer-events: none; }

.task-title {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}
.task-title:hover { color: var(--lime); }

.task-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.task-meta:empty { display: none; }
.task-meta .tag { font-size: 10.5px; padding: 2px 7px; }

.task-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.task-facts {
    display: flex;
    gap: 9px;
    font-size: 11.5px;
    white-space: nowrap;
}
.avatar.sm.dim { color: var(--text-dim); background: var(--surface-3); }

/* ---------------------------------------------------------------------
   Milníky
   --------------------------------------------------------------------- */
.milestone {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}
.milestone:last-child { border-bottom: none; }
.milestone-main { flex: 1; min-width: 0; }
.milestone-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.milestone-actions select { width: auto; min-width: 130px; font-size: 12.5px; padding: 6px 28px 6px 10px; }

@media (max-width: 1100px) {
    .kanban { grid-template-columns: repeat(5, 210px); }
}
@media (max-width: 900px) {
    .milestone { flex-direction: column; }
    .milestone-actions { width: 100%; }
}

/* ---------------------------------------------------------------------
   Rozpad výpočtu odměny
   Musí být na první pohled jasné, z čeho se částka počítá.
   --------------------------------------------------------------------- */
.calc {
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.calc-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 12.5px;
}
.calc-rows { display: flex; flex-direction: column; }
.calc-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
.calc-row:last-child { border-bottom: none; }
.calc-label { color: var(--text-muted); }
.calc-value { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.calc-total {
    border-top: 1px solid var(--line-strong);
    border-bottom: none;
    margin-top: 4px;
    padding-top: 12px;
}
.calc-total .calc-label { color: var(--text); font-weight: 600; }
.calc-total .calc-value { font-size: 19px; font-weight: 700; color: var(--lime); }
.calc-formula {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line-strong);
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------
   Životní cyklus odměny
   --------------------------------------------------------------------- */
.lifecycle {
    list-style: none;
    margin: 10px 0 0;
    padding: 0 0 0 20px;
    position: relative;
}
.lifecycle::before {
    content: "";
    position: absolute;
    left: 4px; top: 8px; bottom: 8px;
    width: 1px;
    background: var(--line-strong);
}
.lifecycle li {
    position: relative;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}
.lifecycle li::before {
    content: "";
    position: absolute;
    left: -20px; top: 12px;
    width: 9px; height: 9px;
    border-radius: 99px;
    background: var(--surface-3);
    box-shadow: 0 0 0 1px var(--line-strong);
}
.lifecycle li.done::before { background: var(--lime); box-shadow: 0 0 0 1px var(--lime); }
.lifecycle li.done .lc-name { color: var(--text); font-weight: 600; }
.lc-name { color: var(--text-dim); }
.lc-detail { color: var(--text-muted); font-size: 12px; text-align: right; white-space: nowrap; }

/* ---------------------------------------------------------------------
   Faktury
   --------------------------------------------------------------------- */
.invoice {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}
.invoice:last-child { border-bottom: none; }
.invoice-main { flex: 1; min-width: 0; }
.invoice-side { flex-shrink: 0; text-align: right; min-width: 170px; }
.invoice-amount { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary.btn { display: inline-flex; }

@media (max-width: 900px) {
    .invoice { flex-direction: column; }
    .invoice-side { text-align: left; width: 100%; }
    .calc-row { flex-direction: column; gap: 2px; }
}
