/* =====================================================================
   Fluent 2 design systém pro interní CRM
   Vychází z oficiální Fluent 2 (Web) sady tokenů — brand/neutral ramp,
   elevace (shadow2..shadow64), pohyb (duration/curve), zaoblení,
   typografická škála a skutečné Fluent UI System Icons (Microsoft),
   self-hosted jako podmnožina webfontu (jen použitých 21 glyfů, ~3 kB
   místo stahování celého Material Symbols z Google Fonts).
   ===================================================================== */

@font-face {
    font-family: "Fluent System Icons";
    src: url("fonts/fluent-icons.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

/* Skutečné Fluent UI System Icons (microsoft/fluentui-system-icons,
   MIT licence) — každá třída odpovídá jednomu glyfu z podmnožiny
   webfontu. Použití: <span class="ic ic-add" aria-hidden="true"></span> */
.ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: "Fluent System Icons";
    font-size: 20px;
    line-height: 1;
    font-style: normal;
    font-weight: normal;
    speak: none;
    -webkit-font-smoothing: antialiased;
}

.ic-add::before             { content: "\f10a"; }
.ic-call::before             { content: "\e271"; }
.ic-close::before            { content: "\f36a"; }
.ic-cloud_download::before   { content: "\e38e"; }
.ic-domain::before           { content: "\f205"; }
.ic-edit::before             { content: "\f3de"; }
.ic-mail::before              { content: "\f507"; }
.ic-more_horiz::before       { content: "\e825"; }
.ic-person::before            { content: "\f5be"; }
.ic-search::before            { content: "\f690"; }
.ic-sell::before               { content: "\f2f6"; }
.ic-settings::before          { content: "\f6aa"; }
.ic-tag::before                { content: "\f77d"; }
.ic-upload_file::before      { content: "\f1a5"; }
.ic-view_column::before      { content: "\f2fd"; }
.ic-visibility::before        { content: "\e5f3"; }
.ic-apps::before               { content: "\f134"; }
.ic-bar_chart::before         { content: "\f340"; }
.ic-dashboard::before         { content: "\f1e3"; }
.ic-payments::before          { content: "\f5a5"; }
.ic-task_alt::before          { content: "\f299"; }
.ic-fire::before               { content: "\ef6a"; }
.ic-arrow_trending::before    { content: "\f198"; }
.ic-calendar::before           { content: "\e24f"; }
.ic-receipt::before             { content: "\e9ff"; }

:root {
    /* ---- Brand ramp (Fluent 2 default "Brand Web" modrá) ---- */
    --brand-10: #001433;
    --brand-20: #001d4e;
    --brand-40: #003666;
    --brand-60: #0f548c;
    --brand-70: #115ea3;
    --brand-80: #0f6cbd;
    --brand-90: #2886de;
    --brand-100: #479ef5;
    --brand-110: #62abf5;
    --brand-120: #77b7f7;
    --brand-130: #96c6fa;
    --brand-160: #eaf3fb;

    --color-primary: var(--brand-80);
    --color-primary-hover: var(--brand-70);
    --color-primary-pressed: var(--brand-60);
    --color-primary-bg: var(--brand-160);

    /* ---- Neutral ramp (Fluent 2 Web Light) ---- */
    --grey-2: #050505;
    --grey-8: #141414;
    --grey-14: #242424;
    --grey-24: #3d3d3d;
    --grey-32: #525252;
    --grey-38: #616161;
    --grey-44: #707070;
    --grey-52: #858585;
    --grey-62: #9e9e9e;
    --grey-84: #d6d6d6;
    --grey-88: #e0e0e0;
    --grey-90: #e6e6e6;
    --grey-92: #ebebeb;
    --grey-94: #f0f0f0;
    --grey-96: #f5f5f5;
    --grey-98: #fafafa;
    --grey-100: #ffffff;

    --color-bg: var(--grey-96);
    --color-surface: var(--grey-100);
    --color-surface-alt: var(--grey-98);
    --color-border: var(--grey-90);
    --color-border-strong: var(--grey-84);

    --color-text: var(--grey-14);
    --color-text-secondary: var(--grey-38);
    --color-text-tertiary: var(--grey-52);
    --color-text-disabled: var(--grey-62);
    --color-text-on-primary: #ffffff;

    --color-success-bg: #dff6dd;
    --color-success-text: #0e6b0e;
    --color-success-border: #9fd89d;
    --color-warning-bg: #fff4ce;
    --color-warning-text: #8a6d00;
    --color-warning-border: #f0d98c;
    --color-info-bg: var(--brand-160);
    --color-info-text: var(--brand-80);
    --color-neutral-bg: var(--grey-94);
    --color-neutral-text: var(--grey-38);
    --color-danger: #c4314b;
    --color-danger-bg: #fdecef;
    --color-danger-border: #f3b6c1;
    --color-lead-bg: #f0ebfa;
    --color-lead-text: #5b3ea6;

    /* ---- Zaoblení (Fluent 2 corner radius scale) ---- */
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-circular: 999px;

    /* ---- Elevace (Fluent 2 shadow ramp) — dvouvrstvý stín:
       těsný ambient + směrový. Vyšší číslo = prvek "výš" nad plochou. ---- */
    --shadow-2:  0 0 2px rgba(0,0,0,0.12),  0 1px 2px rgba(0,0,0,0.14);
    --shadow-4:  0 0 2px rgba(0,0,0,0.12),  0 2px 4px rgba(0,0,0,0.14);
    --shadow-8:  0 0 2px rgba(0,0,0,0.12),  0 4px 8px rgba(0,0,0,0.14);
    --shadow-16: 0 0 2px rgba(0,0,0,0.14),  0 8px 16px rgba(0,0,0,0.14);
    --shadow-28: 0 0 8px rgba(0,0,0,0.12),  0 14px 28px rgba(0,0,0,0.16);
    --shadow-64: 0 0 8px rgba(0,0,0,0.12),  0 32px 64px rgba(0,0,0,0.18);

    /* zachováno pro zpětnou kompatibilitu s dřívějšími pojmenováními */
    --shadow-sm: var(--shadow-2);
    --shadow-md: var(--shadow-8);

    /* ---- Pohyb (Fluent 2 motion tokens) ---- */
    --duration-ultra-fast: 50ms;
    --duration-faster: 100ms;
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    --curve-easy-ease: cubic-bezier(0.33, 0, 0.67, 1);
    --curve-decelerate: cubic-bezier(0.1, 0.9, 0.2, 1);
    --curve-accelerate: cubic-bezier(0.7, 0, 1, 0.5);

    /* ---- Typografická škála (Fluent 2 type ramp) ---- */
    --font-size-caption: 12px;
    --line-height-caption: 16px;
    --font-size-body: 14px;
    --line-height-body: 20px;
    --font-size-body-lg: 16px;
    --line-height-body-lg: 22px;
    --font-size-subtitle2: 16px;
    --font-size-subtitle1: 18px;
    --font-size-title3: 20px;
    --font-size-title2: 24px;
    --font-size-title1: 28px;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* ---- Focus ring (Fluent 2 dvoubarevný fokusový obrys) ---- */
    --focus-ring: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-primary);

    --nav-width: 64px;
    --topbar-height: 48px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: "Segoe UI", "Segoe UI Web", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--font-size-body);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--duration-faster) var(--curve-easy-ease); }
a:hover { text-decoration: underline; }

/* Jednotný klávesnicový fokus (Fluent 2 focus indicator) — nenahrazuje
   focus na prvcích, které si vlastní outline definují jinak (input/select). */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
.nav-item:focus-visible,
.view-toggle a:focus-visible,
.tabs a:focus-visible,
[tabindex]:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* ---------- App shell ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-nav {
    width: var(--nav-width);
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.app-nav .brand {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(155deg, var(--brand-90) 0%, var(--brand-80) 55%, var(--brand-60) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-bold);
    font-size: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-4);
}

.app-nav .nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    align-items: center;
}

.app-nav .nav-spacer { flex: 1; }

.nav-item {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    position: relative;
    font-size: 18px;
    transition: background var(--duration-faster) var(--curve-easy-ease),
                color var(--duration-faster) var(--curve-easy-ease);
}

.nav-item:hover {
    background: var(--color-neutral-bg);
    text-decoration: none;
    color: var(--color-text);
}

.nav-item.active {
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 2px;
    background: var(--color-primary);
}

.nav-item .ic {
    font-size: 22px;
}

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

/* ---------- Top bar ---------- */

.topbar {
    height: var(--topbar-height);
    background: color-mix(in srgb, var(--color-surface) 86%, transparent);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar .search {
    flex: 1;
    max-width: 460px;
    position: relative;
}

.topbar .search input {
    width: 100%;
    height: 32px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    padding: 0 12px 0 34px;
    font-size: 13px;
    font-family: inherit;
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color var(--duration-faster) var(--curve-easy-ease),
                background var(--duration-faster) var(--curve-easy-ease),
                box-shadow var(--duration-faster) var(--curve-easy-ease);
}

.topbar .search input:hover { border-color: var(--grey-62); }

.topbar .search input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
    background: var(--color-surface);
}

.topbar .search .ic {
    position: absolute;
    left: 9px;
    top: 6px;
    font-size: 18px;
    color: var(--color-text-tertiary);
}

.topbar .spacer { flex: 1; }

.user-chip {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(155deg, var(--brand-90) 0%, var(--brand-70) 100%);
    color: #fff;
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.user-menu .who { color: var(--color-text); font-weight: var(--font-weight-semibold); }
.user-menu .role { color: var(--color-text-tertiary); font-size: var(--font-size-caption); }

/* ---------- Content ---------- */

.content {
    padding: 24px 28px 40px;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* Stránky, které se mají vejít celé na obrazovku bez svislého skrolování
   (např. Kanban) — hlavička a lišta filtrů mají pevnou výšku, obsah pod
   nimi (.kanban-board) dostane zbylý prostor a skroluje se jen uvnitř
   jednotlivých sloupců. Nezávisí na konkrétní výšce topbaru/hlavičky —
   ta se odečte automaticky díky flexboxu. */
.content-fitscreen {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height));
    max-width: none;
    padding-bottom: 16px;
    overflow: hidden;
}
.content-fitscreen .page-header,
.content-fitscreen .toolbar-row {
    flex-shrink: 0;
}

.page-header h1 {
    font-size: var(--font-size-title2);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.01em;
    margin: 0 0 4px;
}

.page-header .subtitle {
    color: var(--color-text-secondary);
    font-size: 13px;
    margin: 0;
}

.page-header .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
    font-family: inherit;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
    transition: background var(--duration-faster) var(--curve-easy-ease),
                border-color var(--duration-faster) var(--curve-easy-ease),
                box-shadow var(--duration-faster) var(--curve-easy-ease),
                transform var(--duration-ultra-fast) var(--curve-easy-ease);
}

.btn:hover { background: var(--color-neutral-bg); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-on-primary);
    box-shadow: var(--shadow-2);
}

.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); box-shadow: var(--shadow-4); }
.btn-primary:active { background: var(--color-primary-pressed); border-color: var(--color-primary-pressed); box-shadow: none; }

.btn-danger {
    color: var(--color-danger);
    border-color: var(--color-danger);
    background: var(--color-surface);
}

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

.btn-disabled,
.btn[aria-disabled="true"] {
    background: var(--color-neutral-bg);
    color: var(--color-text-disabled);
    border-color: var(--color-border);
    cursor: default;
    pointer-events: none;
    box-shadow: none;
}

.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }

.btn-ghost { border-style: dashed; color: var(--color-text-secondary); background: transparent; }
.btn-ghost:hover { background: var(--color-neutral-bg); }

/* ---------- Sjednocená nástrojová lišta seznamu (filtry + zobrazení) ---------- */

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-2);
}

.toolbar-group { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.toolbar-divider { width: 1px; height: 22px; background: var(--color-border); flex-shrink: 0; }

/* Přepínač typu on/off (např. "Moji klienti") — odlišný od segmentovaného
   výběru stavu (.view-toggle), protože jde o binární volbu, ne kategorii. */
.toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    padding: 0 12px 0 6px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-circular);
    font-size: 12.5px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    white-space: nowrap;
    transition: background var(--duration-faster) var(--curve-easy-ease),
                border-color var(--duration-faster) var(--curve-easy-ease),
                color var(--duration-faster) var(--curve-easy-ease);
}
.toggle-pill:hover { background: var(--color-neutral-bg); text-decoration: none; }
.toggle-pill .toggle-knob {
    width: 28px;
    height: 16px;
    border-radius: var(--radius-circular);
    background: var(--color-neutral-bg);
    border: 1px solid var(--color-border-strong);
    position: relative;
    flex-shrink: 0;
    transition: background var(--duration-fast) var(--curve-easy-ease),
                border-color var(--duration-fast) var(--curve-easy-ease);
}
.toggle-pill .toggle-knob::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-circular);
    background: #fff;
    box-shadow: var(--shadow-2);
    transition: left var(--duration-fast) var(--curve-decelerate);
}
.toggle-pill.active { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-bg); }
.toggle-pill.active .toggle-knob { background: var(--color-primary); border-color: var(--color-primary); }
.toggle-pill.active .toggle-knob::after { left: 13px; }

/* Rozbalovací nabídka pro budoucí filtry (nahrazuje natrvalo šedé čipy).
   Panel zůstává v DOM, přepínání .open animuje fade+slide (Fluent motion). */
.filter-menu { position: relative; }
.filter-menu-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 230px;
    background: color-mix(in srgb, var(--color-surface) 92%, transparent);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-16);
    padding: 6px;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top left;
    transition: opacity var(--duration-fast) var(--curve-decelerate),
                transform var(--duration-fast) var(--curve-decelerate),
                visibility var(--duration-fast);
}
.filter-menu-panel.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.filter-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    color: var(--color-text-tertiary);
    cursor: default;
}
.filter-menu-item .hint {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    background: var(--color-neutral-bg);
    padding: 2px 6px;
    border-radius: var(--radius-circular);
}

/* ---------- Filter / view chips ---------- */

.chip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    border-radius: var(--radius-circular);
    font-size: 12.5px;
    font-weight: var(--font-weight-semibold);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration-faster) var(--curve-easy-ease),
                border-color var(--duration-faster) var(--curve-easy-ease),
                color var(--duration-faster) var(--curve-easy-ease);
}

.chip:hover { background: var(--color-neutral-bg); text-decoration: none; }

.chip.active {
    background: var(--color-primary-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.chip.disabled {
    color: var(--color-text-tertiary);
    cursor: default;
    opacity: 0.6;
    pointer-events: none;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.view-toggle a, .view-toggle span {
    padding: 0 12px;
    height: 28px;
    display: flex;
    align-items: center;
    font-size: 12.5px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    border-right: 1px solid var(--color-border-strong);
    text-decoration: none;
    transition: background var(--duration-faster) var(--curve-easy-ease),
                color var(--duration-faster) var(--curve-easy-ease);
}

.view-toggle a:last-child, .view-toggle span:last-child { border-right: none; }
.view-toggle a:hover { background: var(--color-neutral-bg); text-decoration: none; }
.view-toggle .active { background: var(--color-primary-bg); color: var(--color-primary); }
.view-toggle .disabled { color: var(--color-text-tertiary); opacity: 0.55; pointer-events: none; }

/* ---------- Card / surface ---------- */

.surface {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
}

/* ---------- Table ---------- */

table.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    font-size: 11.5px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-tertiary);
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13.5px;
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--duration-faster) var(--curve-easy-ease); }
.data-table tbody tr:hover { background: var(--color-surface-alt); }

.cell-primary { font-weight: var(--font-weight-semibold); color: var(--color-text); }
.cell-muted { color: var(--color-text-tertiary); }

.entity-cell { display: flex; align-items: center; gap: 10px; }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-weight: var(--font-weight-bold);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar.round { border-radius: 50%; }

/* ---------- Badges / status ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: var(--radius-circular);
    font-size: 11.5px;
    font-weight: var(--font-weight-bold);
}

.badge-company { background: var(--color-info-bg); color: var(--color-info-text); }
.badge-person  { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-neutral { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-lead    { background: var(--color-lead-bg); color: var(--color-lead-text); }

/* ---------- Empty / placeholder states ---------- */

.empty-state { padding: 40px; text-align: center; color: var(--color-text-tertiary); }

.placeholder-note {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: var(--color-text-tertiary);
    font-weight: var(--font-weight-medium);
}

/* ---------- Pagination ---------- */

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-top: 1px solid var(--color-border);
    font-size: 12.5px;
    color: var(--color-text-secondary);
}

.pagination-bar .buttons { display: flex; gap: 8px; }

/* ---------- Detail header (company / person) ---------- */

.detail-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.detail-header .avatar { width: 56px; height: 56px; font-size: 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-4); }
.detail-header .avatar.round { border-radius: 50%; }

.detail-header h1 { font-size: var(--font-size-title2); font-weight: var(--font-weight-bold); letter-spacing: -0.01em; margin: 0 0 6px; }

.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }

.tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: var(--color-neutral-bg);
    color: var(--color-neutral-text);
    font-size: 11.5px;
    font-weight: var(--font-weight-semibold);
}

.detail-header .breadcrumb {
    font-size: 12.5px;
    color: var(--color-text-tertiary);
    margin-bottom: 6px;
}

.detail-header .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Metric strip ---------- */

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--color-border);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow-2);
}

.metric-cell {
    background: var(--color-surface);
    padding: 12px 16px;
    transition: background var(--duration-faster) var(--curve-easy-ease);
}

.metric-cell:hover { background: var(--color-surface-alt); }

.metric-cell .label {
    font-size: 11.5px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 4px;
}

.metric-cell .value {
    font-size: var(--font-size-subtitle1);
    font-weight: var(--font-weight-bold);
}

/* ---------- Tabs (Fluent Pivot) ---------- */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 18px;
}

.tabs a {
    position: relative;
    padding: 10px 6px;
    margin-right: 18px;
    font-size: 13.5px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color var(--duration-faster) var(--curve-easy-ease);
}

.tabs a:hover { color: var(--color-text); text-decoration: none; }
.tabs a.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tabs a.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 2px 2px 0 0;
    animation: fluentPivotIndicator var(--duration-normal) var(--curve-decelerate);
}

@keyframes fluentPivotIndicator {
    from { transform: scaleX(0.4); opacity: 0.4; }
    to { transform: scaleX(1); opacity: 1; }
}

/* ---------- Detail layout: main + side panel ---------- */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    margin-bottom: 20px;
    transition: box-shadow var(--duration-normal) var(--curve-easy-ease);
}

.panel .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
}

.panel .panel-head h2 {
    font-size: var(--font-size-subtitle2);
    margin: 0;
    font-weight: var(--font-weight-semibold);
}

.panel .panel-body { padding: 4px 16px 12px; }

.person-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--duration-faster) var(--curve-easy-ease);
}

.person-row:last-child { border-bottom: none; }
.person-row:hover { background: var(--color-surface-alt); margin: 0 -8px; padding: 12px 8px; border-radius: var(--radius-sm); }

.person-row .info { flex: 1; min-width: 0; }
.person-row .name { font-weight: var(--font-weight-semibold); font-size: 13.5px; }
.person-row .meta { font-size: 12px; color: var(--color-text-tertiary); }

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    margin-top: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.timeline-item .title { font-weight: var(--font-weight-semibold); font-size: 13px; }
.timeline-item .meta { font-size: 12px; color: var(--color-text-tertiary); }

.side-card-field {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.side-card-field:last-child { border-bottom: none; }

.side-card-field .label {
    font-size: 11.5px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}

.side-card-field .value { font-size: 13.5px; }

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 16px;
}

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
}

.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field.full { grid-column: 1 / -1; }

.form-field label {
    font-size: 12.5px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
}

.form-field input[type=text],
.form-field input[type=email],
.form-field input[type=tel],
.form-field input[type=password],
.form-field select {
    height: 32px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    padding: 0 10px;
    font-size: 13.5px;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--duration-faster) var(--curve-easy-ease),
                box-shadow var(--duration-faster) var(--curve-easy-ease);
}

.form-field input[type=text]:hover,
.form-field input[type=email]:hover,
.form-field input[type=tel]:hover,
.form-field input[type=password]:hover,
.form-field select:hover { border-color: var(--grey-62); }

.form-field textarea {
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    font-size: 13.5px;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
    resize: vertical;
    min-height: 72px;
    transition: border-color var(--duration-faster) var(--curve-easy-ease);
}

.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

/* ---------- Autocomplete (firma u osoby) ---------- */

.autocomplete { position: relative; }

.autocomplete-results {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-16);
    max-height: 240px;
    overflow-y: auto;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity var(--duration-fast) var(--curve-decelerate),
                transform var(--duration-fast) var(--curve-decelerate),
                visibility var(--duration-fast);
}

.autocomplete-results.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }

.autocomplete-results .ac-item {
    padding: 8px 10px;
    font-size: 13.5px;
    cursor: pointer;
    transition: background var(--duration-ultra-fast) linear;
}

.autocomplete-results .ac-item:hover,
.autocomplete-results .ac-item.highlighted {
    background: var(--color-primary-bg);
}

.autocomplete-results .ac-empty {
    padding: 8px 10px;
    font-size: 12.5px;
    color: var(--color-text-tertiary);
}

.selected-company-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 6px 0 10px;
    border-radius: var(--radius-md);
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
    margin-top: 6px;
}

.selected-company-chip button {
    border: none;
    background: transparent;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 4px;
    border-radius: 50%;
    transition: background var(--duration-faster) var(--curve-easy-ease);
}
.selected-company-chip button:hover { background: rgba(15, 108, 189, 0.14); }

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
}

.checkbox-field .hint { color: var(--color-text-tertiary); font-size: 12px; display: block; margin-top: 2px; }

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-error { background: var(--color-danger-bg); color: var(--color-danger); border-color: var(--color-danger-border); }
.alert-success { background: var(--color-success-bg); color: var(--color-success-text); border-color: var(--color-success-border); }

/* ---------- Input + inline button (např. IČO + Načíst z ARES) ---------- */

.input-with-button {
    display: flex;
    gap: 6px;
}

.input-with-button input { flex: 1; min-width: 0; }
.input-with-button .btn { flex-shrink: 0; white-space: nowrap; }
.input-with-button .btn .ic { font-size: 16px; }

.field-hint {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin: 4px 0 0;
    min-height: 15px;
}

.field-hint-ok { color: var(--color-success-text); }
.field-hint-error { color: var(--color-danger); }

/* ---------- Row actions (kebab menu) ---------- */

.row-actions {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.row-actions-trigger {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--duration-faster) var(--curve-easy-ease),
                color var(--duration-faster) var(--curve-easy-ease);
}

.row-actions-trigger:hover,
.row-actions-trigger[aria-expanded="true"] {
    background: var(--color-neutral-bg);
    color: var(--color-text);
}

.row-actions-trigger .ic { font-size: 18px; }

.row-actions-menu {
    position: absolute;
    top: calc(100% + 2px);
    right: 0;
    min-width: 160px;
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-16);
    z-index: 30;
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top right;
    transition: opacity var(--duration-fast) var(--curve-decelerate),
                transform var(--duration-fast) var(--curve-decelerate),
                visibility var(--duration-fast);
}

.row-actions-menu.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); }

.row-actions-menu a,
.row-actions-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--color-text);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: background var(--duration-ultra-fast) linear;
}

.row-actions-menu a:hover,
.row-actions-menu button:hover {
    background: var(--color-neutral-bg);
    text-decoration: none;
}

.row-actions-menu .ic { font-size: 17px; color: var(--color-text-tertiary); }

.row-actions-menu .danger { color: var(--color-danger); }
.row-actions-menu .danger .ic { color: var(--color-danger); }

/* ---------- Table cell truncation ---------- */

.data-table { table-layout: fixed; }

/* Každý sloupec MUSÍ mít explicitní šířku — u fixed layoutu bere prohlížeč
   šířky z první řádky (thead); sloupec bez šířky se zhroutí na 0 a jeho
   obsah pak vizuálně přetéká přes sousední buňky (bez šířky nemá smysl
   spoléhat na automatické dopočítání zbytku). */
.data-table .col-entity { width: 20%; }
.data-table .col-status { width: 9%; white-space: nowrap; }
/* Stav dealu má i po zkrácení popisku (viz dealStatusShortLabel())
   o něco delší text než u Contacts ("Vyjednávání", "Analýza"…), proto
   vlastní o něco širší sloupec jen pro tabulky s dealy. */
.data-table .col-status-deal { width: 13%; white-space: nowrap; }
.data-table .col-ico { width: 9%; white-space: nowrap; }
.data-table .col-count { width: 9%; white-space: nowrap; }
.data-table .col-phone { width: 13%; }
.data-table .col-email { width: 16%; }
.data-table .col-address { width: 12%; }
.data-table .col-owner { width: 12%; }
.data-table .col-actions { width: 56px; }

.cell-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-cell .info { min-width: 0; flex: 1; }
.entity-cell .info .cell-primary { display: block; }

.avatar.avatar-generic {
    background: var(--color-neutral-bg);
    color: var(--color-text-tertiary);
}

.avatar .ic { font-size: 16px; }

/* ---------- Login page ---------- */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1100px 520px at 12% -10%, rgba(15,108,189,0.14), transparent 60%),
        radial-gradient(900px 480px at 100% 110%, rgba(15,108,189,0.10), transparent 55%),
        linear-gradient(150deg, var(--brand-160) 0%, var(--color-bg) 55%);
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: color-mix(in srgb, var(--color-surface) 96%, transparent);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-28);
    padding: 32px;
    animation: fluentCardIn var(--duration-slow) var(--curve-decelerate);
}

@keyframes fluentCardIn {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card .brand {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(155deg, var(--brand-90) 0%, var(--brand-80) 55%, var(--brand-60) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-bold);
    margin-bottom: 16px;
    box-shadow: var(--shadow-4);
}

.login-card h1 { font-size: var(--font-size-subtitle1); font-weight: var(--font-weight-bold); margin: 0 0 4px; }
.login-card p.subtitle { color: var(--color-text-secondary); font-size: 13px; margin: 0 0 20px; }
.login-card .form-field { margin-bottom: 14px; }
.login-card button { width: 100%; justify-content: center; height: 36px; }

/* ---------- Hashtagy (skupiny firem) a Segmenty (kategorie firem) ---------- */

.badge-segment { font-weight: var(--font-weight-bold); }
.badge-tag { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
a.badge-link { text-decoration: none; }
a.badge-link:hover .badge { filter: brightness(0.95); }

/* Chip-input pro hashtagy (contacts/company_edit.php) — psaní + našeptávač
   z existujících hashtagů + klik na chip pro smazání. */
.tag-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 5px 8px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    position: relative;
    transition: border-color var(--duration-faster) var(--curve-easy-ease),
                box-shadow var(--duration-faster) var(--curve-easy-ease);
}
.tag-input:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }

.tag-input-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 4px 0 10px;
    border-radius: var(--radius-circular);
    background: var(--color-neutral-bg);
    color: var(--color-neutral-text);
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    animation: fluentChipIn var(--duration-fast) var(--curve-decelerate);
}

@keyframes fluentChipIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.tag-input-chip::before { content: "#"; opacity: 0.6; }
.tag-input-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 50%;
    opacity: 0.7;
    transition: background var(--duration-faster) var(--curve-easy-ease), opacity var(--duration-faster) var(--curve-easy-ease);
}
.tag-input-chip button:hover { opacity: 1; background: rgba(0, 0, 0, 0.08); }

.tag-input input[type=text] {
    flex: 1;
    min-width: 120px;
    border: none;
    outline: none;
    height: 26px;
    font-size: 13px;
    background: transparent;
}

.tag-input-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-16);
    z-index: 20;
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity var(--duration-fast) var(--curve-decelerate),
                transform var(--duration-fast) var(--curve-decelerate),
                visibility var(--duration-fast);
}
.tag-input-suggestions.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
.tag-input-suggestion-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--duration-ultra-fast) linear;
}
.tag-input-suggestion-item:hover,
.tag-input-suggestion-item.active { background: var(--color-neutral-bg); }
.tag-input-suggestion-item .hint { margin-left: auto; font-size: 11px; color: var(--color-text-tertiary); }

/* Výběr segmentů (contacts/company_edit.php) — vícevýběr barevných pilulek. */
.segment-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.segment-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 12px;
    border-radius: var(--radius-circular);
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 12.5px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    user-select: none;
    transition: background var(--duration-faster) var(--curve-easy-ease),
                border-color var(--duration-faster) var(--curve-easy-ease),
                color var(--duration-faster) var(--curve-easy-ease),
                box-shadow var(--duration-faster) var(--curve-easy-ease);
}
.segment-chip:hover { box-shadow: var(--shadow-2); }
.segment-chip input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.segment-chip input[type=checkbox]:focus-visible ~ .segment-chip-dot { box-shadow: var(--focus-ring); border-radius: 50%; }
.segment-chip .segment-chip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--segment-color, var(--color-primary));
    flex-shrink: 0;
    transition: background var(--duration-faster) var(--curve-easy-ease);
}
.segment-chip.checked {
    background: var(--segment-color, var(--color-primary));
    border-color: var(--segment-color, var(--color-primary));
    color: #fff;
}
.segment-chip.checked .segment-chip-dot { background: #fff; }
.segment-picker .empty-hint { font-size: 12.5px; color: var(--color-text-tertiary); }

/* Aktivní filtr dle hashtagu/segmentu nad přehledem firem (contacts/index.php). */
.active-filter-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: var(--color-primary-bg);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--color-primary);
    animation: fluentCardIn var(--duration-normal) var(--curve-decelerate);
}
.active-filter-banner a { color: inherit; font-weight: var(--font-weight-bold); text-decoration: underline; }

/* ---------- Segmenty (Nastavení) — barevný vzorník ---------- */
.color-swatch-input { display: flex; align-items: center; gap: 10px; }
.color-swatch-input input[type=color] {
    width: 40px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
}
.color-swatch-input input[type=text] { width: 110px; }

/* ---------- Skeleton loading (volitelná utilita — .skeleton na prázdný blok) ---------- */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--color-neutral-bg);
    border-radius: var(--radius-sm);
    color: transparent !important;
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
    animation: fluentSkeletonSweep 1.4s var(--curve-easy-ease) infinite;
}
@keyframes fluentSkeletonSweep {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* Respektuje nastavení systému "méně pohybu" — vypne dekorativní animace. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* =====================================================================
   Deals (Obchodní případy) — barvy stavů, kanban board, mini-forecast
   ===================================================================== */

.badge-deal-lead        { background: var(--color-lead-bg); color: var(--color-lead-text); }
.badge-deal-analysis    { background: var(--brand-160); color: var(--brand-80); }
.badge-deal-proposal    { background: #fdf0e6; color: #b25a00; }
.badge-deal-negotiation { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-deal-hold        { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.badge-deal-won         { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-deal-lost        { background: var(--color-danger-bg); color: var(--color-danger); }

.hot-deal-flag { color: #d0742a; display: inline-flex; align-items: center; }
.hot-deal-flag .ic { font-size: 15px; }

.moved-flag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10.5px;
    font-weight: var(--font-weight-bold);
    color: var(--color-warning-text);
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    padding: 1px 7px;
    border-radius: var(--radius-circular);
    white-space: nowrap;
}

/* ---------- Kanban board ---------- */

.kanban-board {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    align-items: stretch;
}

.content-fitscreen .kanban-board {
    flex: 1;
    min-height: 0;
}

.kanban-column {
    /* Přesně 7 pevných sloupců (stavy dealu) — rozdělí se rovnoměrně přes
       celou dostupnou šířku obrazovky (viz .content-fitscreen), místo
       pevné šířky 260px, která na běžný monitor nevešla bez skrolování. */
    flex: 1 1 0;
    min-width: 168px;
    max-width: 320px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
    transition: background var(--duration-faster) var(--curve-easy-ease),
                box-shadow var(--duration-faster) var(--curve-easy-ease);
}

.content-fitscreen .kanban-column {
    max-height: none;
    height: 100%;
}

.kanban-column.drag-over {
    background: var(--color-primary-bg);
    box-shadow: 0 0 0 2px var(--color-primary) inset;
}

.kanban-column-head {
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.kanban-column-head .title { font-size: 12.5px; font-weight: var(--font-weight-bold); color: var(--color-text); }
.kanban-column-head .count {
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-tertiary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 1px 8px;
    border-radius: var(--radius-circular);
}
.kanban-column-head .sum { font-size: 11px; color: var(--color-text-tertiary); margin-top: 2px; }

.kanban-column-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 60px;
}

.content-fitscreen .kanban-column-body {
    flex: 1;
    min-height: 0;
}

.kanban-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: var(--shadow-2);
    cursor: grab;
    transition: box-shadow var(--duration-faster) var(--curve-easy-ease),
                transform var(--duration-faster) var(--curve-easy-ease),
                opacity var(--duration-faster) var(--curve-easy-ease);
    text-decoration: none;
    color: inherit;
    display: block;
}
.kanban-card:hover { box-shadow: var(--shadow-8); transform: translateY(-1px); text-decoration: none; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.45; }

.kanban-card .name {
    font-weight: var(--font-weight-semibold);
    font-size: 13px;
    color: var(--color-text);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kanban-card .company {
    font-size: 11.5px;
    color: var(--color-text-tertiary);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kanban-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kanban-card .amount { font-size: 12.5px; font-weight: var(--font-weight-bold); color: var(--color-text); }
.kanban-card .owner {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--color-primary-bg); color: var(--color-primary);
    font-size: 9.5px; font-weight: var(--font-weight-bold);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---------- Mini forecast bar chart (Reporty -> Ekonomický pohled) ---------- */

.forecast-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 160px;
    padding: 12px 6px 0;
    border-bottom: 1px solid var(--color-border);
}

.forecast-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.forecast-bar-stack { width: 100%; max-width: 48px; display: flex; flex-direction: column-reverse; border-radius: var(--radius-xs) var(--radius-xs) 0 0; overflow: hidden; }
.forecast-bar-seg-weighted { background: var(--color-primary); }
.forecast-bar-seg-won { background: var(--color-success-text); }
.forecast-bar-label { font-size: 11px; color: var(--color-text-tertiary); text-align: center; }
.forecast-bar-value { font-size: 10.5px; font-weight: var(--font-weight-semibold); color: var(--color-text-secondary); }

.forecast-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--color-text-secondary); }
.forecast-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* ---------- Mini bar chart pro Reporty -> Finanční bilance (Prodej/Nákup) ---------- */

.finance-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 160px;
    padding: 12px 6px 0;
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
}

.finance-bar-col { flex: 1; min-width: 28px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.finance-bar-group { display: flex; align-items: flex-end; gap: 3px; width: 100%; max-width: 40px; }
.finance-bar { flex: 1; border-radius: var(--radius-xs) var(--radius-xs) 0 0; min-height: 2px; }
.finance-bar-prodej { background: var(--color-success-text); }
.finance-bar-nakup { background: #d0742a; }
.finance-bar-label { font-size: 11px; color: var(--color-text-tertiary); text-align: center; }

/* =====================================================================
   Fakturace (Invoicing) — doklady, badge typů, formulář položek
   ===================================================================== */

.data-table .col-doctype { width: 15%; white-space: nowrap; }
.data-table .col-docnumber { width: 14%; white-space: nowrap; }

.badge-doc-invoice-issued   { background: var(--color-info-bg); color: var(--color-info-text); }
.badge-doc-credit-issued    { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-doc-invoice-received { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.badge-doc-credit-received  { background: var(--color-danger-bg); color: var(--color-danger); }

.invoice-items-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.invoice-items-table th { text-align: left; font-size: 12px; color: var(--color-text-tertiary); font-weight: var(--font-weight-semibold); padding: 6px 6px; border-bottom: 1px solid var(--color-border); }
.invoice-items-table td { padding: 6px 6px; border-bottom: 1px solid var(--color-border-subtle, var(--color-border)); vertical-align: top; }
.invoice-items-table input, .invoice-items-table select { width: 100%; }
.invoice-items-table .col-item-name { width: 32%; }
.invoice-items-table .col-item-qty { width: 10%; }
.invoice-items-table .col-item-unit { width: 12%; }
.invoice-items-table .col-item-price { width: 14%; }
.invoice-items-table .col-item-vat { width: 12%; }
.invoice-items-table .col-item-total { width: 14%; text-align: right; white-space: nowrap; }
.invoice-items-table .col-item-remove { width: 32px; }
.invoice-items-table .row-remove-btn { background: none; border: none; cursor: pointer; color: var(--color-text-tertiary); font-size: 16px; line-height: 1; padding: 4px; }
.invoice-items-table .row-remove-btn:hover { color: var(--color-danger); }
.invoice-totals { display: flex; justify-content: flex-end; gap: 24px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.invoice-totals .total-item { text-align: right; }
.invoice-totals .total-label { font-size: 12px; color: var(--color-text-tertiary); }
.invoice-totals .total-value { font-size: 15px; font-weight: var(--font-weight-semibold); }
.invoice-totals .total-value.grand { font-size: 18px; color: var(--color-primary); }

.doc-type-tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.doc-type-tile { flex: 1 1 180px; padding: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); text-decoration: none; color: inherit; }
.doc-type-tile:hover { border-color: var(--color-primary); background: var(--color-info-bg); }
.doc-type-tile .tile-code { font-size: 11px; font-weight: var(--font-weight-bold); color: var(--color-text-tertiary); letter-spacing: 0.04em; }
.doc-type-tile .tile-title { font-size: 14px; font-weight: var(--font-weight-semibold); margin-top: 2px; }
