/**
 * app-shell.css — Stage A+B redizajnu: tmavý bočný panel (sidebar) + svetlé
 * pracovné plátno + tenký horný bar. Načítava sa PO style.css/topbar.css a
 * cielene prepisuje len prvky globálneho rámca (chrome). Obsah stránok
 * (.tb-content, .tb-tickets-layout, karty, tabuľky) ostáva nedotknutý.
 */

:root {
    /* Tmavý technický sidebar */
    --app-sidebar-bg: #0B1F36;
    --app-sidebar-bg-2: #0F2942;
    --app-sidebar-border: rgba(255, 255, 255, 0.07);
    --app-sidebar-text: #aebfd4;
    --app-sidebar-text-strong: #ffffff;
    --app-sidebar-muted: #6b819d;
    --app-accent: #2563eb;
    --app-topbar-h: 60px;
    --app-canvas: #f6f8fb;
}

/* Plátno appky */
body.app-body { background: var(--app-canvas); }

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

/* ---------------------------------------------------------------
   Sidebar
--------------------------------------------------------------- */
.app-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--app-sidebar-bg);
    background-image: linear-gradient(180deg, var(--app-sidebar-bg-2) 0%, var(--app-sidebar-bg) 220px);
    color: var(--app-sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 120;
    border-right: 1px solid var(--app-sidebar-border);
}

.app-sidebar-brand {
    padding: 16px 16px 15px;
    border-bottom: 1px solid var(--app-sidebar-border);
    flex-shrink: 0;
}
.app-sidebar-brand a {
    display: flex; flex-direction: row; align-items: center; gap: 11px;
    color: var(--app-sidebar-text-strong); text-decoration: none; min-width: 0;
}
.app-brand-name {
    font-weight: 700; font-size: 1.12rem; letter-spacing: 0.01em;
    color: var(--app-sidebar-text-strong); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    padding-left: 11px;
    border-left: 1px solid var(--app-sidebar-border);
}
.app-sidebar-brand img { height: 80px; width: auto; max-width: 140px; display: block; flex-shrink: 0; }
.app-sidebar-brand .app-brand-mark {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, #2563eb, #1565c0);
    display: flex; align-items: center; justify-content: center; color: #fff;
}

/* Klikateľná karta používateľa (vľavo dole) + dropdown nahor */
.app-user-menu { position: relative; }
.app-user-card {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px; border-radius: 10px; cursor: pointer;
    background: rgba(255, 255, 255, 0.04); border: none; text-align: left;
    font-family: inherit; transition: background var(--transition-fast);
}
.app-user-card:hover { background: rgba(255, 255, 255, 0.09); }
.app-user-card .app-user-meta { min-width: 0; line-height: 1.25; flex: 1; }
.app-user-card .app-user-name {
    color: var(--app-sidebar-text-strong); font-weight: 600; font-size: 0.86rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-user-card .app-user-role { color: var(--app-sidebar-muted); font-size: 0.74rem; }
.app-user-caret { color: var(--app-sidebar-muted); display: flex; transition: transform 0.15s ease; }
.app-user-menu.open .app-user-caret { transform: rotate(90deg); }

.app-user-dropdown {
    position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; top: auto;
    background: #0F2942; border: 1px solid var(--app-sidebar-border);
    border-radius: 10px; padding: 6px; z-index: 60;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    opacity: 0; visibility: hidden; transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.app-user-menu.open .app-user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.app-user-dropdown a {
    display: block; padding: 9px 12px; border-radius: 8px;
    color: var(--app-sidebar-text); font-size: 0.86rem; font-weight: 500; text-decoration: none;
}
.app-user-dropdown a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.app-nav {
    flex: 1; overflow-y: auto;
    padding: 12px 12px 16px;
    display: flex; flex-direction: column; gap: 2px;
}
.app-nav-group {
    font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--app-sidebar-muted);
    padding: 14px 12px 6px;
}
.app-nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 9px;
    color: var(--app-sidebar-text); text-decoration: none;
    font-size: 0.9rem; font-weight: 500; white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.app-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.app-nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--app-sidebar-text-strong); }
.app-nav-item.active {
    background: var(--app-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.app-nav-item.active svg { opacity: 1; }
.app-nav-badge {
    margin-left: auto; background: #ef4444; color: #fff;
    font-size: 0.68rem; font-weight: 700; line-height: 1;
    padding: 3px 7px; border-radius: 999px;
}

/* Spodná karta používateľa */
.app-sidebar-user {
    border-top: 1px solid var(--app-sidebar-border);
    padding: 12px;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------
   Avatar (reusable) — Stage C doplní upload, teraz iniciály
--------------------------------------------------------------- */
.avatar {
    --av-size: 32px;
    width: var(--av-size); height: var(--av-size);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: calc(var(--av-size) * 0.4);
    color: #fff; flex-shrink: 0;
    background: #475569; object-fit: cover; overflow: hidden;
    position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--sm { --av-size: 26px; }
.avatar--lg { --av-size: 44px; }
.avatar--online::after {
    content: ''; position: absolute; right: -1px; bottom: -1px;
    width: 10px; height: 10px; border-radius: 50%;
    background: #22c55e; border: 2px solid var(--app-sidebar-bg);
}

/* ---------------------------------------------------------------
   Main + tenký topbar
--------------------------------------------------------------- */
.app-main {
    margin-left: var(--sidebar-w);
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    min-height: 100vh;
}
.app-topbar {
    position: sticky; top: 0; z-index: 50;
    height: var(--app-topbar-h);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    padding: 0 24px;
}
.app-topbar-title { font-size: 1.02rem; font-weight: 700; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.app-burger {
    display: none;
    width: 38px; height: 38px; border: none; background: transparent;
    border-radius: 8px; cursor: pointer; color: var(--text);
    align-items: center; justify-content: center;
}
.app-burger:hover { background: var(--bg); }

.app-sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45); z-index: 110;
}

/* Topbar varianty bell/user menu (znovapoužitie tb-notif/tb-user-menu, len
   farby na svetlom pozadí) */
.app-topbar .tb-notif-toggle,
.app-topbar .tb-user-menu-toggle { color: var(--text); }
.app-topbar .tb-notif-toggle:hover,
.app-topbar .tb-user-menu-toggle:hover { background: var(--bg); }
.app-topbar .tb-notif-badge { box-shadow: 0 0 0 2px #fff; }
.app-topbar .tb-avatar { background: var(--brand); color: #fff; box-shadow: none; }

/* ---------------------------------------------------------------
   Prepojenie so starým obsahom — zruš odsadenie pôvodného fixed topbaru
--------------------------------------------------------------- */
.tb-content { margin-top: 0 !important; padding: 24px; min-height: calc(100vh - var(--app-topbar-h)); }
.tb-tickets-layout { margin: -24px !important; min-height: calc(100vh - var(--app-topbar-h)) !important; }
.tb-settings-nav { top: calc(var(--app-topbar-h) + 16px) !important; }
.tb-footer { padding: 16px 0 24px; }

/* ---------------------------------------------------------------
   Responzivita — sidebar ako drawer
--------------------------------------------------------------- */
@media (max-width: 1024px) {
    .app-sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
    .app-sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
    .app-main { margin-left: 0; }
    .app-burger { display: inline-flex; }
    body.sidebar-open .app-sidebar-backdrop { display: block; }
}

/* ===============================================================
   Stage D — Dashboard command center
=============================================================== */
.dash-greeting { margin: 4px 0 20px; }
.dash-greeting h1 { font-size: 1.6rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.dash-greeting p { margin: 4px 0 0; color: var(--text-muted); font-size: 0.95rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card {
    background: #fff; border: 1px solid var(--border); border-radius: 16px;
    padding: 18px; display: flex; gap: 14px; align-items: flex-start;
    box-shadow: var(--shadow-card); text-decoration: none; color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-body { min-width: 0; }
.kpi-value { font-size: 30px; font-weight: 700; line-height: 1; color: var(--text); display: block; margin-bottom: 10px; }
.kpi-label { display: block; font-size: 0.84rem; font-weight: 600; color: var(--text); margin-top: 0; }
.kpi-sub { display: block; font-size: 0.74rem; color: var(--text-muted); margin-top: 3px; }
.kpi--red .kpi-icon { background: #fee2e2; color: #dc2626; }
.kpi--orange .kpi-icon { background: #ffedd5; color: #ea580c; }
.kpi--blue .kpi-icon { background: #dbeafe; color: #2563eb; }
.kpi--green .kpi-icon { background: #dcfce7; color: #16a34a; }
.kpi--purple .kpi-icon { background: #ede9fe; color: #7c3aed; }

.dash-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.dash-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-card); margin-bottom: 16px; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.dash-card-head h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.dash-card-head a { font-size: 0.82rem; color: var(--brand); text-decoration: none; }

.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 600; color: #16a34a; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; animation: livePulse 1.6s infinite; }
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Riadky tiketov */
.tline { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; border-left: 3px solid var(--slate); text-decoration: none; color: inherit; transition: background 0.1s ease; }
.tline:hover { background: var(--bg); }
.tline + .tline { margin-top: 6px; }
.tline--critical { border-left-color: #dc2626; }
.tline--high { border-left-color: #ea580c; }
.tline--medium { border-left-color: #f59e0b; }
.tline--low { border-left-color: #94a3b8; }
.tline-main { min-width: 0; flex: 1; }
.tline-subj { font-weight: 600; font-size: 0.88rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tline-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.tline-sla { font-size: 0.76rem; font-weight: 600; white-space: nowrap; text-align: right; }
.tline-sla.is-over { color: #dc2626; }
.tline-sla.is-soon { color: #ea580c; }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border-subtle); }
.feed-item:last-child { border-bottom: none; }
.feed-ico { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.feed-ico svg { width: 15px; height: 15px; }
.feed-txt { min-width: 0; font-size: 0.84rem; color: var(--text); line-height: 1.35; }
.feed-time { font-size: 0.72rem; color: var(--text-faint); margin-top: 1px; }

/* Donut (CSS conic) */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 132px; height: 132px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut::after { content: ''; position: absolute; inset: 20px; background: #fff; border-radius: 50%; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.donut-center b { font-size: 22px; font-weight: 700; }
.donut-center span { font-size: 0.68rem; color: var(--text-muted); }
.legend { list-style: none; margin: 0; padding: 0; font-size: 0.84rem; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.legend .dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend .val { margin-left: auto; font-weight: 600; }

/* SLA ring */
.ring { width: 120px; height: 120px; border-radius: 50%; position: relative; flex-shrink: 0; }
.ring::after { content: ''; position: absolute; inset: 14px; background: #fff; border-radius: 50%; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.ring-center b { font-size: 26px; font-weight: 700; color: var(--text); }
.ring-center span { font-size: 0.68rem; color: var(--text-muted); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.86rem; }
.mini-list li:last-child { border-bottom: none; }
.mini-bar { flex: 1; height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

@media (max-width: 1024px) { .dash-cols { grid-template-columns: 1fr; } }

/* ===============================================================
   Stage E — zoznam tiketov: farebný priority akcent na riadku
=============================================================== */
.tb-table tbody tr.tb-row-prio-critical:not(.tb-row-overdue) { box-shadow: inset 3px 0 0 #dc2626; }
.tb-table tbody tr.tb-row-prio-high:not(.tb-row-overdue) { box-shadow: inset 3px 0 0 #ea580c; }
.tb-table tbody tr.tb-row-prio-medium:not(.tb-row-overdue) { box-shadow: inset 3px 0 0 #f59e0b; }
.tb-table tbody tr.tb-row-prio-low:not(.tb-row-overdue) { box-shadow: inset 3px 0 0 #cbd5e1; }

/* ===============================================================
   Globálne — appka sa prispôsobí oknu, žiadne zbytočné posuvače
=============================================================== */
html, body { max-width: 100%; overflow-x: hidden; }
.app-main, .tb-content, .ticket-main-col, .tb-main-col { min-width: 0; max-width: 100%; }
.table-wrap, .tb-table-area { max-width: 100%; }
img, canvas, video, pre { max-width: 100%; }

/* ===============================================================
   Stage F — detail tiketu (premium polish)
=============================================================== */
/* Sticky sidebar pod nový tenký topbar */
.ticket-sidebar { top: calc(var(--app-topbar-h) + 16px) !important; }

/* Zaoblenejšie karty + výraznejší farebný akcent konverzácie */
.ticket-detail-layout .sidebar-card,
.ticket-detail-layout .ticket-main-col > .card,
.thread-message { border-radius: 14px; }
.thread-message { border-left-width: 4px; transition: box-shadow 0.12s ease; }
.thread-message:hover { box-shadow: var(--shadow); }

/* Avatar v hlavičke správy zarovnaný k menu */
.thread-meta-left .avatar { box-shadow: 0 0 0 2px #fff; }
.thread-message.from-staff .thread-meta-left .avatar:not([style*="background:#"]),
.thread-message.from-staff .thread-meta-left .avatar { }

/* Reply editor — väčšie pohodlné pole + jemné odlíšenie internej poznámky */
.tb-reply-textarea { min-height: 130px; border-radius: 12px; line-height: 1.55; }
textarea.is-internal-note { background: var(--warning-bg); border-color: #fcd34d; }

@media (max-width: 1024px) {
    .ticket-detail-layout { grid-template-columns: 1fr; }
    .ticket-sidebar { position: static; }
}

/* ===============================================================
   Zoznam tiketov — široká tabuľka scrolluje LEN vo svojej oblasti,
   nie cez celú stránku (žiadny vodorovný posuvač na stránke)
=============================================================== */
/* Pozn.: NEpoužívame overflow:hidden na .tb-main-col/.tb-tickets-layout, lebo
   by orezalo rozbalené menu „Stĺpce". Stačí, že tabuľka scrolluje vo svojej
   oblasti (.tb-table-area) a reťazec má min-width:0. */
.tb-tickets-layout { overflow: visible; }
.tb-main-col { overflow: visible; min-width: 0; }
.tb-table-area { overflow-x: auto; min-width: 0; }

/* Štítok ako kompaktná ikona (zoznam tiketov) */
.tag-ico { display: inline-flex; vertical-align: middle; margin-left: 3px; }
.tag-ico svg { display: block; }

/* ===============================================================
   Zoznam tiketov — výber stĺpcov (col picker)
=============================================================== */
.col-picker { position: relative; }
.col-picker > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center;
    height: 30px; border: 1px solid var(--border); border-radius: 6px;
    background: #fff; color: var(--text); font-size: 0.82rem;
}
.col-picker > summary::-webkit-details-marker { display: none; }
.col-picker > summary:hover { background: var(--bg); }
.col-picker-menu {
    position: absolute; right: 0; left: auto; top: calc(100% + 6px);
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: 8px; z-index: 130; /* nad sidebar (120) */
    min-width: 190px; max-width: calc(100vw - 24px);
}
/* Na úzkom okne otvor menu v toku pod tlačidlom — nikdy sa neschová pod sidebar */
@media (max-width: 1100px) {
    .col-picker { width: 100%; }
    .col-picker-menu {
        position: static; margin-top: 8px; min-width: 0; max-width: 100%;
        box-shadow: var(--shadow-card);
        display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}
.col-picker-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 0.86rem; border-radius: 6px; cursor: pointer; }
.col-picker-menu label:hover { background: var(--bg); }

.tb-table.hide-category .col-category,
.tb-table.hide-status .col-status,
.tb-table.hide-priority .col-priority,
.tb-table.hide-type .col-type,
.tb-table.hide-customer .col-customer,
.tb-table.hide-assignee .col-assignee,
.tb-table.hide-replies .col-replies,
.tb-table.hide-created .col-created,
.tb-table.hide-updated .col-updated { display: none; }

/* Zoznam tiketov — kompaktnejšie bunky, aby sa zmestilo viac do okna */
.tb-table th, .tb-table td { padding-top: 10px; padding-bottom: 10px; }
.tb-subject-cell { max-width: 360px; }

/* Zoznam zariadení — skrývateľné stĺpce */
.tb-table.hide-company .col-company,
.tb-table.hide-owner .col-owner,
.tb-table.hide-type .col-type,
.tb-table.hide-hw .col-hw,
.tb-table.hide-serial .col-serial,
.tb-table.hide-ip .col-ip,
.tb-table.hide-os .col-os,
.tb-table.hide-anydesk .col-anydesk,
.tb-table.hide-disk .col-disk,
.tb-table.hide-agentver .col-agentver,
.tb-table.hide-lastseen .col-lastseen { display: none; }

/* ===============================================================
   Editovateľný dashboard — mriežka presúvateľných widgetov
=============================================================== */
.dash-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-widget { min-width: 0; }
.dash-widget .dash-card { margin-bottom: 0; }
.dash-handle { display: none; }

/* Režim úprav */
.dash-board.editing .dash-widget {
    position: relative; cursor: move;
    outline: 2px dashed var(--brand); outline-offset: 3px; border-radius: 16px;
}
.dash-board.editing .dash-handle {
    display: block; position: absolute; top: 8px; left: 12px; z-index: 5;
    font-size: 0.72rem; font-weight: 700; color: var(--brand);
    background: var(--brand-light); padding: 2px 8px; border-radius: 999px;
    letter-spacing: 0.04em; pointer-events: none;
}
.dash-board.editing .dash-card a,
.dash-board.editing .dash-card button { pointer-events: none; }
.dash-widget.dragging { opacity: 0.45; }

/* Šírka / skrytie widgetu */
.dash-widget.span-2 { grid-column: span 2; }
.dash-widget.w-hidden { display: none; }
@media (max-width: 1024px) { .dash-widget.span-2 { grid-column: span 1; } }

/* Ovládacie tlačidlá widgetu (šírka / odobrať) */
.dash-ctl { display: none; }
.dash-board.editing .dash-ctl { display: flex; gap: 4px; position: absolute; top: 6px; right: 8px; z-index: 6; }
.dash-board.editing .dash-ctl button {
    width: 26px; height: 26px; border-radius: 7px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: var(--text);
    font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; pointer-events: auto;
}
.dash-board.editing .dash-ctl button:hover { background: var(--bg); }

/* Položky v menu „Pridať widget" */
.dash-add-item { display: block; width: 100%; text-align: left; border: none; background: none; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 0.86rem; color: var(--text); }
.dash-add-item:hover { background: var(--bg); }

@media (max-width: 1024px) { .dash-board { grid-template-columns: 1fr; } }

/* Widget s nastavenou výškou — karta vyplní a obsah scrolluje */
.dash-widget[style*="height"] .dash-card { height: 100%; overflow: auto; }
/* Úchyt na zmenu výšky (len v režime úprav) */
.dash-resize { display: none; }
.dash-board.editing .dash-resize {
    display: block; position: absolute; left: 0; right: 0; bottom: -4px; height: 12px; cursor: ns-resize; z-index: 6;
}
.dash-board.editing .dash-resize::after {
    content: ''; position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%);
    width: 44px; height: 4px; border-radius: 999px; background: var(--brand); opacity: 0.7;
}

/* ===============================================================
   Knowledge Base
=============================================================== */
.kb-hero {
    background: linear-gradient(135deg, #0F2942, #1565c0);
    color: #fff; border-radius: 16px; padding: 32px 28px; margin-bottom: 20px; text-align: center;
}
.kb-hero h1 { margin: 0 0 6px; font-size: 1.6rem; }
.kb-hero p { margin: 0 0 18px; opacity: 0.85; }
.kb-search { display: flex; align-items: center; gap: 8px; max-width: 600px; margin: 0 auto; background: #fff; border-radius: 12px; padding: 6px 6px 6px 14px; }
.kb-search svg { color: var(--text-faint); flex-shrink: 0; }
.kb-search input { flex: 1; border: none; outline: none; font-size: 0.95rem; padding: 8px 4px; background: none; color: var(--text); }
.kb-search .btn { flex-shrink: 0; }

.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kb-article-card {
    display: flex; flex-direction: column; gap: 6px;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px;
    text-decoration: none; color: var(--text); background: #fff;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.kb-article-card:hover { border-color: var(--brand); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.kb-art-title { font-weight: 600; font-size: 0.92rem; }
.kb-art-cat { font-size: 0.72rem; color: var(--brand-dark); background: var(--brand-light); padding: 2px 8px; border-radius: 999px; align-self: flex-start; }

/* Editor */
.kb-editor { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.kb-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: var(--bg); border-bottom: 1px solid var(--border); }
.kb-toolbar button {
    min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid transparent; background: none;
    border-radius: 6px; cursor: pointer; font-size: 0.9rem; color: var(--text); line-height: 1;
}
.kb-toolbar button:hover { background: #fff; border-color: var(--border); }
.kb-sep { width: 1px; background: var(--border); margin: 4px 4px; }
.kb-editable { min-height: 320px; padding: 16px 18px; outline: none; font-size: 0.95rem; line-height: 1.6; }
.kb-editable:focus { background: #fff; }
.kb-editable img { max-width: 100%; height: auto; border-radius: 8px; }

/* Čítací pohľad článku */
.kb-content { font-size: 0.97rem; line-height: 1.7; color: var(--text); }
.kb-content h2 { font-size: 1.25rem; margin: 1.4em 0 0.5em; }
.kb-content h3 { font-size: 1.08rem; margin: 1.2em 0 0.4em; }
.kb-content p { margin: 0 0 1em; }
.kb-content ul, .kb-content ol { margin: 0 0 1em 1.4em; }
.kb-content li { margin: 0.2em 0; }
.kb-content img { max-width: 100%; height: auto; border-radius: 10px; margin: 0.6em 0; box-shadow: var(--shadow-card); }
.kb-content a { color: var(--brand); }
.kb-content blockquote { margin: 0 0 1em; padding: 8px 16px; border-left: 3px solid var(--brand); background: var(--brand-light); border-radius: 6px; }
.kb-content pre { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.kb-content code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.kb-content table { border-collapse: collapse; width: 100%; margin: 0 0 1em; }
.kb-content th, .kb-content td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }

/* Oprava: code vnútri pre nesmie prebrať svetlé pozadie inline-kódu */
.kb-content pre code { background: none; color: inherit; padding: 0; border-radius: 0; }
.kb-content pre { color: #e2e8f0; }

/* KB — filtračné štítky + kompaktný zoznam (jednoduchší vzhľad) */
.kb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.kb-chip {
    padding: 6px 14px; border-radius: 999px; font-size: 0.84rem; font-weight: 500;
    text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--border);
    transition: all 0.12s ease;
}
.kb-chip:hover { border-color: var(--brand); color: var(--brand); }
.kb-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.kb-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 20px; }
.kb-list-item {
    display: flex; align-items: center; gap: 10px; padding: 11px 10px;
    border-radius: 8px; text-decoration: none; color: var(--text);
    border-bottom: 1px solid var(--border-subtle); transition: background 0.1s ease;
}
.kb-list-item:hover { background: var(--bg); }
.kb-li-ico { color: var(--text-faint); flex-shrink: 0; }
.kb-li-title { flex: 1; min-width: 0; font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-li-cat { font-size: 0.7rem; color: var(--brand-dark); background: var(--brand-light); padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.kb-li-arrow { color: var(--text-faint); flex-shrink: 0; }
@media (max-width: 720px) { .kb-list { grid-template-columns: 1fr; } }

/* ===============================================================
   Responzívny pas — tablet a mobil
=============================================================== */

/* Tablet a menej (sidebar je už drawer od 1024px) */
@media (max-width: 1024px) {
    .tb-content { padding: 16px; }
    .app-topbar { padding: 0 14px; gap: 10px; }

    /* Zoznam tiketov: strom kategórií nad tabuľku (nie bočný drawer) */
    .tb-tickets-layout { flex-direction: column; margin: -16px !important; }
    .tb-tree {
        position: static !important; width: 100% !important; transform: none !important;
        border-right: none; border-bottom: 1px solid var(--border-subtle); max-height: 220px; overflow-y: auto;
    }
    .tb-tree.collapsed { width: 100% !important; }
    .tb-tree-inner { width: 100% !important; }

    .kb-hero { padding: 22px 16px; }
    .kb-hero h1 { font-size: 1.3rem; }
}

/* Mobil */
@media (max-width: 640px) {
    .tb-content { padding: 12px; }
    h1 { font-size: 1.4rem; }
    .card, .dash-card { padding: 16px; border-radius: 14px; }
    .app-topbar-title { font-size: 0.95rem; }

    /* KPI karty 2 v rade, kompaktnejšie */
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-card { padding: 14px; gap: 10px; }
    .kpi-icon { width: 36px; height: 36px; }
    .kpi-value { font-size: 24px; margin-bottom: 6px; }

    /* Vyhľadávanie KB nech sa zmestí */
    .kb-search { flex-wrap: wrap; }
    .kb-search input { flex: 1 1 100%; order: 3; }

    /* Formulárové lišty a akcie tiketu sa zalamujú */
    .filter-bar { flex-wrap: wrap; }
    .ticket-header-actions { width: 100%; }

    /* Pohodlnejšie klikanie v navigácii */
    .app-nav-item { padding: 11px 12px; }

    /* Modálne okno tiketu na celú plochu */
    .tb-modal { width: calc(100vw - 16px) !important; height: calc(100vh - 16px) !important; }
}

/* Veľmi malé telefóny — KPI 1 v rade */
@media (max-width: 420px) {
    .kpi-grid { grid-template-columns: 1fr; }
}

/* ===============================================================
   Kartové zobrazenie tabuliek na mobile (.tb-stack — Zákazníci a pod.)
=============================================================== */
@media (max-width: 640px) {
    .tb-stack thead { display: none; }
    .tb-stack, .tb-stack tbody, .tb-stack tr, .tb-stack td { display: block; width: 100%; }
    .tb-stack tr {
        border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px;
        padding: 6px 4px; background: #fff; box-shadow: var(--shadow-card);
    }
    .tb-stack td {
        border: none; white-space: normal; padding: 7px 14px;
        display: flex; justify-content: space-between; gap: 12px; align-items: center;
    }
    .tb-stack td[data-label]::before {
        content: attr(data-label); font-size: 0.72rem; font-weight: 700;
        text-transform: uppercase; color: var(--text-faint); flex-shrink: 0;
    }
    /* bunky bez popisu (akcie) zarovnaj doprava na celú šírku */
    .tb-stack td[data-label="Akcia"], .tb-stack td[data-label="Akcie"] { justify-content: flex-end; }
}

/* --- @mentions autocomplete (ticket-view) --- */
.mention-box {
    position: absolute; z-index: 50; left: 0; right: 0;
    background: var(--surface, #fff); border: 1px solid var(--border-subtle);
    border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12);
    max-height: 220px; overflow-y: auto; margin-top: 2px;
}
.mention-item { padding: 7px 12px; cursor: pointer; font-size: .9rem; }
.mention-item.is-active, .mention-item:hover { background: var(--primary-soft, #eef2ff); }

/* --- Command palette (Ctrl+K) --- */
.cmdk-trigger {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    background: var(--surface-2, #f3f4f6); border: 1px solid var(--border-subtle);
    border-radius: 8px; padding: 6px 10px; color: var(--text-muted); font-size: .85rem;
}
.cmdk-trigger:hover { color: var(--text); border-color: var(--border); }
.cmdk-trigger-kbd {
    font-family: inherit; font-size: .7rem; background: var(--surface, #fff);
    border: 1px solid var(--border-subtle); border-radius: 4px; padding: 1px 5px; color: var(--text-faint);
}
@media (max-width: 640px) { .cmdk-trigger-label, .cmdk-trigger-kbd { display: none; } }
.cmdk-overlay {
    position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,42,.45);
    display: none; align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.cmdk-overlay.is-open { display: flex; }
.cmdk-modal {
    width: min(620px, 92vw); background: var(--surface, #fff); border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden; display: flex; flex-direction: column;
}
.cmdk-input {
    border: 0; border-bottom: 1px solid var(--border-subtle); padding: 16px 18px;
    font-size: 1.05rem; outline: none; background: transparent; color: var(--text);
}
.cmdk-results { max-height: 56vh; overflow-y: auto; }
.cmdk-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border-subtle);
}
.cmdk-item.is-active { background: var(--primary-soft, #eef2ff); }
.cmdk-ico { font-size: 1.1rem; flex-shrink: 0; }
.cmdk-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cmdk-label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-sub { font-size: .8rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-type { font-size: .72rem; color: var(--text-faint); flex-shrink: 0; text-transform: uppercase; letter-spacing: .03em; }
.cmdk-empty { padding: 20px; text-align: center; color: var(--text-faint); }
.cmdk-foot { padding: 8px 16px; border-top: 1px solid var(--border-subtle); font-size: .75rem; color: var(--text-faint); display: flex; gap: 8px; flex-wrap: wrap; }
.cmdk-foot kbd { font-family: inherit; background: var(--surface-2, #f3f4f6); border-radius: 4px; padding: 1px 5px; }

.kb-deflect-hint { display:block; margin-top:6px; font-size:.8rem; color:var(--text-faint); }

/* --- Service catalog (dlaždice) --- */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 16px; }
.catalog-tile {
    display: flex; flex-direction: column; gap: 6px; padding: 18px 16px;
    border: 1px solid var(--border-subtle); border-radius: 12px; text-decoration: none;
    color: var(--text); background: var(--surface, #fff); transition: border-color .15s, box-shadow .15s, transform .1s;
}
.catalog-tile:hover { border-color: var(--brand, #4f46e5); box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-2px); }
.catalog-tile-ico { font-size: 2rem; line-height: 1; }
.catalog-tile-name { font-weight: 600; }
.catalog-tile-desc { font-size: .82rem; color: var(--text-muted); }

/* --- Zákaznícka SLA viditeľnosť --- */
.sla-customer {
    margin-top: 10px; padding: 8px 12px; border-radius: 8px; font-size: .9rem;
    background: var(--primary-soft, #eef2ff); color: var(--text);
    border: 1px solid var(--border-subtle);
}
.sla-customer--overdue { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }

/* --- Asset lifecycle badge --- */
.lc-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:.78rem; font-weight:500; }
.lc-ok      { background:#dcfce7; color:#166534; }
.lc-plan    { background:#fef9c3; color:#854d0e; }
.lc-replace { background:#fee2e2; color:#991b1b; }
.lc-retired { background:#e5e7eb; color:#374151; }

/* --- Runbook checklist (ticket-view) --- */
.runbook-steps { display:flex; flex-direction:column; gap:2px; }
.runbook-step { display:flex; gap:8px; align-items:flex-start; padding:6px 4px; border-radius:6px; cursor:pointer; }
.runbook-step:hover { background:var(--surface-2,#f6f7f9); }
.runbook-step input { margin-top:3px; flex-shrink:0; }
.runbook-step-text { display:flex; flex-direction:column; }
.runbook-step-title { font-size:.9rem; }
.runbook-step.is-done .runbook-step-title { text-decoration:line-through; color:var(--text-faint); }
.runbook-step-detail { font-size:.78rem; color:var(--text-muted); }
.runbook-step-meta { font-size:.72rem; color:var(--text-faint); }

/* --- Workload bar --- */
.wl-bar { height:8px; background:var(--surface-2,#eef0f3); border-radius:5px; overflow:hidden; margin-bottom:3px; max-width:200px; }
.wl-bar-fill { height:100%; background:var(--brand,#4f46e5); }
.wl-bar-fill.wl-warn { background:#d97706; }
.wl-bar-fill.wl-over { background:#dc2626; }

/* --- Self-service booking --- */
.booking-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(160px,1fr)); gap:12px; margin-top:10px; }
.booking-slot { border:1px solid var(--border-subtle); border-radius:10px; padding:12px; text-align:center; margin:0; }
.booking-slot-when { display:flex; flex-direction:column; }
.booking-slot-when strong { font-size:.95rem; }
.booking-slot-when span { font-size:.85rem; color:var(--text-muted); }

/* --- Status page --- */
.status-overall { padding:14px 16px; border-radius:10px; font-weight:600; text-align:center; }
.status-overall.st-ok { background:#dcfce7; color:#166534; }
.status-overall.st-warn { background:#fef3c7; color:#92400e; }
.status-row { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--border-subtle); }
.status-pill { padding:3px 10px; border-radius:12px; font-size:.8rem; font-weight:500; }
.status-pill.st-ok { background:#dcfce7; color:#166534; }
.status-pill.st-warn { background:#fef9c3; color:#854d0e; }
.status-pill.st-down { background:#fee2e2; color:#991b1b; }
.status-pill.st-maint { background:#e0e7ff; color:#3730a3; }
.status-incident { border:1px solid var(--border-subtle); border-radius:10px; padding:12px 14px; margin-top:10px; }
.status-incident.st-active { border-color:#fecaca; background:#fff7f7; }

/* --- Vlákno tiketu: akordeón (zbaliteľné správy) --- */
.thread-collapsible .thread-toggle { cursor: pointer; user-select: none; align-items: center; }
.thread-collapsible .thread-toggle:hover { background: var(--surface-2, #f6f7f9); border-radius: 8px; }
.thread-chevron { margin-left: 8px; font-size: 1rem; color: var(--text-faint); transition: transform .15s ease; flex-shrink: 0; }
.thread-collapsible.is-collapsed .thread-chevron { transform: rotate(-90deg); }
.thread-collapse-body { margin-top: 8px; }
.thread-collapsible.is-collapsed .thread-collapse-body { display: none; }
/* náhľad textu sa zobrazí len keď je správa zbalená */
.thread-preview { display: none; color: var(--text-muted); font-weight: 400; font-size: .85rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38ch; }
.thread-collapsible.is-collapsed .thread-preview { display: inline-block; }
/* zbalené správy nech sú vizuálne tesnejšie */
.thread-collapsible.is-collapsed { padding-top: 8px; padding-bottom: 8px; }
.thread-expand-bar { display: flex; justify-content: flex-end; margin: 8px 0 4px; }
@media (max-width: 640px) { .thread-preview { max-width: 18ch; } }

/* --- Časová os ako rozbaľovací prvok --- */
.timeline-card > summary.timeline-summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.timeline-card > summary.timeline-summary::-webkit-details-marker { display: none; }
.timeline-card > summary.timeline-summary::before { content: '⌄'; color: var(--text-faint); transition: transform .15s; display: inline-block; }
.timeline-card[open] > summary.timeline-summary::before { transform: rotate(180deg); }

/* --- Kompaktný detail tiketu (menej skrolovania) --- */
.ticket-detail-layout .card,
.ticket-detail-layout details.card { padding: 14px 16px; margin-bottom: 12px; }
.ticket-detail-layout .card > h2,
.ticket-detail-layout details.card > summary h2 { font-size: 1.05rem; }
.ticket-detail-layout .ticket-main-col > .card:first-child h1 { font-size: 1.15rem; }
.ticket-detail-layout .thread-message { padding: 10px 12px; margin-bottom: 8px; }
.ticket-detail-layout .thread-section-title { margin: 10px 0 6px; }
.ticket-detail-layout .tb-reply-textarea { min-height: 90px; }
.ticket-detail-layout .form-group { margin-bottom: 10px; }
.ticket-detail-layout .sidebar-card { padding: 12px 14px; margin-bottom: 10px; }
.ticket-detail-layout .sidebar-card h3 { font-size: .95rem; margin: 0 0 8px; }
.ticket-detail-layout .timeline { gap: 6px; }
/* zbalené správy ešte tesnejšie */
.ticket-detail-layout .thread-collapsible.is-collapsed { padding: 7px 12px; margin-bottom: 5px; }

/* --- Hlavička tiketu: ⋯ Akcie dropdown --- */
.actions-menu { position: relative; }
.actions-menu > summary { list-style: none; cursor: pointer; }
.actions-menu > summary::-webkit-details-marker { display: none; }
.actions-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
    background: var(--surface, #fff); border: 1px solid var(--border-subtle);
    border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14);
    padding: 8px; min-width: 200px; display: flex; flex-direction: column; gap: 6px;
}
.actions-menu-panel form { margin: 0; }
.actions-menu-panel form button, .actions-menu-panel .ticket-merge-toggle > summary { width: 100%; justify-content: center; }
.actions-menu-panel .ticket-merge-panel { position: static; box-shadow: none; border: 0; padding: 6px 0 0; }

/* --- Zbaliteľné sidebar karty --- */
.sidebar-collapsible > h3 { cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between; }
.sidebar-chevron { color: var(--text-faint); transition: transform .15s; margin-left: 6px; }
.sidebar-collapsible.is-collapsed .sidebar-chevron { transform: rotate(-90deg); }
.sidebar-collapsible.is-collapsed .sidebar-collapse-body { display: none; }

/* --- Tabbed bočný panel tiketu (senior redesign) --- */
.sidebar-tabs { margin-top: 4px; }
.sidebar-tabbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.sidebar-tab {
    font-size: .78rem; padding: 4px 11px; border: 1px solid var(--border-subtle);
    background: var(--surface, #fff); border-radius: 999px; cursor: pointer;
    color: var(--text-muted); line-height: 1.4; transition: all .12s;
}
.sidebar-tab:hover { color: var(--text); border-color: var(--text-faint); }
.sidebar-tab.is-active { background: var(--brand, #4f46e5); color: #fff; border-color: transparent; font-weight: 500; }
.sidebar-tabpane > .sidebar-card { margin: 0; }
.sidebar-tab-content > h3 { display: none; }

/* --- Akčný toolbar ikon v hlavičke tiketu --- */
.ticket-actions-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ticket-actions-bar form { margin: 0; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0; border-radius: 9px;
    border: 1px solid var(--border-subtle); background: var(--surface, #fff);
    color: var(--text-muted); cursor: pointer; transition: all .12s; list-style: none;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { color: var(--text); border-color: var(--text-faint); background: var(--surface-2, #f6f7f9); }
.icon-btn--danger:hover { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
/* merge dropdown panel pod ikonou */
.ticket-merge-toggle { position: relative; }
.ticket-merge-toggle > .ticket-merge-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 320px; max-width: 80vw;
    background: var(--surface, #fff); border: 1px solid var(--border-subtle);
    border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 10px;
}
/* sub-hlavičky v zlúčených záložkách (Zákazník+Kontext, Štítky+Sledovatelia) */
.sidebar-tab-content.show-head > h3 { display: block; font-size: .9rem; margin: 0 0 8px; }
.sidebar-tabpane > .sidebar-card.show-head + .sidebar-card.show-head { margin-top: 12px; border-top: 1px solid var(--border-subtle); padding-top: 12px; }

/* --- Rýchle ikon-akcie v zozname tiketov --- */
.tb-row-actions { display: flex; gap: 5px; justify-content: flex-end; }
.tb-row-actions form { margin: 0; }
.icon-btn--sm { width: 30px; height: 30px; border-radius: 7px; }
.icon-btn--sm svg { width: 16px; height: 16px; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }

/* ===== Zoznam tiketov — modernizovaná lišta (senior redesign) ===== */
.tb-subtoolbar { flex-wrap: wrap; gap: 10px; align-items: center; }
.tb-subtoolbar-left { flex: 1 1 auto; min-width: 240px; }
.tb-subtoolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* filter pills (nahrádzajú view dropdown) */
.tb-view-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tb-pill {
    display: inline-flex; align-items: center; padding: 6px 13px; border-radius: 999px;
    font-size: .85rem; line-height: 1.3; text-decoration: none; white-space: nowrap;
    border: 1px solid var(--border-subtle); background: var(--surface, #fff);
    color: var(--text-muted); transition: all .12s;
}
.tb-pill:hover { color: var(--text); border-color: var(--text-faint); }
.tb-pill.is-active { background: var(--brand, #4f46e5); color: #fff; border-color: transparent; font-weight: 500; }

/* moderné vyhľadávanie s ikonou */
.tb-search { display: flex; margin: 0; }
.tb-search-wrap {
    display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
    border: 1px solid var(--border-subtle); border-radius: 9px; background: var(--surface, #fff);
    color: var(--text-faint); min-width: 220px; transition: border-color .12s, box-shadow .12s;
}
.tb-search-wrap:focus-within { border-color: var(--brand, #4f46e5); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }
.tb-search-wrap input { border: 0; outline: 0; background: transparent; flex: 1; font-size: .9rem; color: var(--text); min-width: 0; }

/* kontextový panel hromadných akcií (zobrazí sa len pri výbere riadkov) */
.tb-bulkbar {
    display: none; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 14px; margin-bottom: 12px; border-radius: 10px;
    background: var(--brand, #4f46e5); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.25);
}
.tb-bulkbar.visible { display: flex; }
.tb-bulkbar-info { font-size: .9rem; font-weight: 500; }
.tb-bulkbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.tb-bulkbar-actions .tb-select { height: 34px; border: 0; }

/* ===== Conversations / Komunikácia v tikete ===== */
.conv-section { padding: 14px 16px; }
.conv-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }
.conv-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conv-filter-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; color: var(--text-muted); cursor: pointer; }
.conv-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.conv-editor { border: 1px solid var(--border-subtle); border-radius: 10px; padding: 14px; margin-bottom: 16px; background: var(--surface-2, #f8fafc); }
.conv-editor-title { font-weight: 600; margin-bottom: 10px; }
.conv-bcc > summary { cursor: pointer; font-size: .8rem; color: var(--text-muted); }
.conv-editor-foot { display: flex; align-items: center; gap: 10px; }
.conv-sending { color: var(--text-muted); font-size: .85rem; }
.conv-save-p { display: flex; align-items: center; gap: 6px; font-size: .85rem; margin: 8px 0; }
.conv-attach-existing > summary, .conv-bcc > summary { user-select: none; }

.conv-timeline { display: flex; flex-direction: column; gap: 8px; }
.conv-item--system { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-size: .82rem; color: var(--text-muted); }
.conv-sys-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.conv-sys-text { flex: 1; }
.conv-sys-meta { color: var(--text-faint); font-size: .76rem; white-space: nowrap; }
.conv-type-badge { font-size: .68rem; padding: 1px 7px; border-radius: 8px; font-weight: 500; }
.conv-type-email { background: var(--primary-soft, #eef2ff); color: #3730a3; }
.conv-type-note { background: #fef9c3; color: #854d0e; }
.conv-mailmeta { font-size: .8rem; color: var(--text-muted); background: var(--surface-2,#f8fafc); border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }
.conv-mailmeta span { color: var(--text-faint); }

/* Účastníci (sidebar) */
.participant-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); }
.participant-row form { margin: 0; }
.participant-email { font-size: .85rem; }
.participant-role { font-size: .68rem; padding: 1px 6px; border-radius: 7px; background: var(--surface-2,#eef0f3); color: var(--text-muted); margin-left: 6px; }
.participant-add { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

/* --- Rich-text (markdown) toolbar --- */
.rt-toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.rt-btn { font-size: .8rem; padding: 3px 9px; border: 1px solid var(--border-subtle); background: var(--surface,#fff); border-radius: 6px; cursor: pointer; color: var(--text-muted); }
.rt-btn:hover { color: var(--text); border-color: var(--text-faint); }
.rt-hint { font-size: .72rem; color: var(--text-faint); margin-left: 4px; }

/* --- Záložky detailu zariadenia (asset-view) --- */
.asset-tabbar {
    display: flex; flex-wrap: wrap; gap: 7px;
    margin: 0 0 16px;
    position: sticky; top: calc(var(--app-topbar-h) + 8px); z-index: 20;
    padding: 8px; border-radius: 14px;
    background: rgba(246, 248, 251, 0.92); backdrop-filter: saturate(160%) blur(6px);
    border: 1px solid var(--border-subtle);
}
.asset-tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 15px; border-radius: 999px; white-space: nowrap;
    font-size: 0.9rem; font-weight: 500; line-height: 1.3; font-family: inherit;
    border: 1px solid var(--border-subtle); background: var(--surface, #fff);
    color: var(--text-muted); cursor: pointer; transition: all 0.12s ease;
}
.asset-tab:hover { color: var(--text); border-color: var(--text-faint); }
.asset-tab.is-active {
    background: var(--brand, #2563eb); color: #fff; border-color: transparent;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}
.asset-tabpane { display: none; }
.asset-tabpane.is-active { display: block; animation: assetPaneIn 0.16s ease; }
@keyframes assetPaneIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Na mobile sa lišta dá scrollovať vodorovne, nezalamuje sa do viacerých riadkov. */
@media (max-width: 640px) {
    .asset-tabbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; position: static; }
    .asset-tab { flex: 0 0 auto; }
}
