/* Základ, layout, komponenty. */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

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

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 var(--space-2); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
body.modal-open { overflow: hidden; }
body.is-dragging { cursor: grabbing; user-select: none; }

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

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width var(--transition), flex-basis var(--transition);
  z-index: 40;
}

:root.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); flex-basis: var(--sidebar-collapsed); }
:root.sidebar-collapsed .nav-label,
:root.sidebar-collapsed .brand-text,
:root.sidebar-collapsed .nav-section-title,
:root.sidebar-collapsed .nav-empty { display: none; }
:root.sidebar-collapsed .nav-item { justify-content: center; }
:root.sidebar-collapsed .nav-section { justify-content: center; padding-inline: 0; }

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

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

.page-title { font-size: 16px; font-weight: 650; white-space: nowrap; }
.view { flex: 1; min-height: 0; }
.page { padding: var(--space-5) var(--space-5) var(--space-7); max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: var(--space-5); gap: var(--space-4); }
.page-heading { font-size: 22px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: var(--space-3); }

/* ---------- Sidebar ---------- */
.sidebar-head { padding: var(--space-4) var(--space-3) var(--space-2); }
.brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); border-radius: var(--radius); }
.brand:hover { background: var(--surface-2); }
.brand-logo {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff; display: grid; place-items: center; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 14px; }
.brand-text span { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--space-2) var(--space-3) var(--space-4); }
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.nav-icon svg { width: 18px; height: 18px; fill: currentColor; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-icon { font-size: 15px; border-radius: 6px; }
.nav-board.active { background: color-mix(in srgb, var(--board-color, var(--primary)) 14%, transparent); color: var(--text); }

.nav-section { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) 10px var(--space-1); }
.nav-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); font-weight: 600; }
.nav-section-action { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.nav-section-action:hover { background: var(--surface-2); color: var(--text); }
.nav-empty { padding: 0 10px; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600;
  border-radius: var(--radius-full); padding: 1px 6px; min-width: 18px; text-align: center;
}

.sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3); border-top: 1px solid var(--border); }
.connection { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); margin-left: 8px; }
.connection.online { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent); }
.collapse-btn svg { width: 18px; height: 18px; fill: currentColor; transition: transform var(--transition); }
:root.sidebar-collapsed .collapse-btn svg { transform: rotate(180deg); }
.sidebar-scrim { position: fixed; inset: 0; background: rgba(6, 8, 12, .45); z-index: 35; }

/* ---------- Tlačidlá ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 570; cursor: pointer; white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: var(--surface-2); color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-new .plus { font-size: 16px; line-height: 1; }

.icon-btn {
  background: transparent; border: none; cursor: pointer; color: var(--text-secondary);
  width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center;
  transition: background var(--transition), color var(--transition); position: relative; font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.btn-sm { width: 26px; height: 26px; font-size: 14px; }
.icon-btn.btn-xs { width: 22px; height: 22px; font-size: 13px; }
.link-btn { background: none; border: none; padding: 0; cursor: pointer; color: var(--primary); font-weight: 550; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.back-link { display: inline-block; margin-bottom: var(--space-4); }

/* ---------- Formuláre ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; width: 100%; transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
input:disabled, textarea:disabled, select:disabled { background: var(--surface-2); color: var(--text-muted); }
textarea { resize: vertical; min-height: 60px; }
input[type='color'] { padding: 3px; height: 36px; }
input[type='checkbox'] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.small-field { margin-top: var(--space-2); }

/* ---------- Vyhľadávanie ---------- */
.search-wrap { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search-input { background: var(--surface-2); border-color: transparent; border-radius: var(--radius-full); padding: 7px 14px; }
.search-input:focus { background: var(--surface); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: var(--space-2); max-height: 60vh; overflow-y: auto;
}
.search-section + .search-section { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.search-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 4px 8px; }
.search-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer;
}
.search-item:hover { background: var(--surface-2); }
.search-item-main { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--priority-normal); }
.dot.priority-low { background: var(--priority-low); }
.dot.priority-high { background: var(--priority-high); }
.dot.priority-urgent { background: var(--priority-urgent); }

/* ---------- Topbar akcie ---------- */
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.mobile-menu { display: none; }
.avatar-btn { background: none; border: none; padding: 0; cursor: pointer; border-radius: 50%; }
.bell-badge {
  position: absolute; top: 2px; right: 0; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: var(--radius-full); padding: 0 4px; min-width: 15px;
}

.dropdown {
  position: absolute; top: calc(var(--topbar-height) - 6px); right: var(--space-5); width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 70; overflow: hidden;
}
.dropdown-sm { width: 220px; }
.dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-direction: column; align-items: flex-start; }
.dropdown-head { flex-direction: row; }
.dropdown-item { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 14px; cursor: pointer; }
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-label { display: block; padding: 4px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.user-switch { display: flex; align-items: center; gap: 8px; }
.user-switch.current { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.dropdown-foot { display: block; text-align: center; padding: 10px; border-top: 1px solid var(--border); color: var(--primary); font-weight: 550; }
.dropdown-empty { padding: var(--space-5); text-align: center; }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-row {
  display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: none;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.notif-row:hover { background: var(--surface-2); }
.notif-row.unread { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.notif-row.unread .notif-title { font-weight: 640; }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-page-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.notif-page-list .notif-row:last-child { border-bottom: none; }

/* ---------- Avatary ---------- */
.avatar {
  width: var(--avatar-size, 28px); height: var(--avatar-size, 28px);
  border-radius: 50%; background: var(--avatar-bg, var(--primary)); color: #fff;
  display: inline-grid; place-items: center; font-size: calc(var(--avatar-size, 28px) * .38);
  font-weight: 650; flex: none; object-fit: cover; border: 2px solid var(--surface);
}
.avatar-empty { background: var(--surface-3); color: var(--text-muted); }
.avatar-system { background: var(--surface-3); font-size: calc(var(--avatar-size, 28px) * .5); }
.avatar-more { background: var(--surface-3); color: var(--text-secondary); }
.avatar-group { display: inline-flex; }
.avatar-group .avatar + .avatar { margin-left: -8px; }

/* ---------- Pilulky a odznaky ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
  border-radius: var(--radius-full); font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-secondary);
}
.pill-compact { padding: 1px 7px; font-size: 11px; }
.priority-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.priority-low { color: var(--priority-low); background: color-mix(in srgb, var(--priority-low) 14%, transparent); }
.pill.priority-normal { color: var(--priority-normal); background: color-mix(in srgb, var(--priority-normal) 14%, transparent); }
.pill.priority-high { color: var(--priority-high); background: color-mix(in srgb, var(--priority-high) 16%, transparent); }
.pill.priority-urgent { color: var(--priority-urgent); background: color-mix(in srgb, var(--priority-urgent) 16%, transparent); }
.pill-ok { color: var(--success); background: var(--success-soft); }
.pill-danger { color: var(--danger); background: var(--danger-soft); }
.pill-muted { color: var(--text-muted); background: var(--surface-2); }
.pill-done { color: var(--success); background: var(--success-soft); }

.due-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-secondary); }
.due-ok { color: var(--success); background: var(--success-soft); }
.due-soon { color: var(--warning); background: var(--warning-soft); }
.due-overdue { color: var(--danger); background: var(--danger-soft); }
.due-done { color: var(--text-muted); background: var(--surface-2); }

.label-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 620; color: var(--label-color);
  background: color-mix(in srgb, var(--label-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--label-color) 30%, transparent);
}
.label-remove { background: none; border: none; cursor: pointer; color: inherit; padding: 0 0 0 2px; font-size: 13px; }
.meta-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-muted); }
.meta-done { color: var(--success); }

/* ---------- Panely, tabuľky ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-4); box-shadow: var(--shadow-xs); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.panel-head h3 { font-size: 15px; }
.panel-actions { display: flex; gap: 6px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: none; }
.detail-list { margin: 0; display: grid; gap: var(--space-2); }
.detail-list div { display: grid; grid-template-columns: 130px 1fr; gap: var(--space-3); }
.detail-list dt { color: var(--text-muted); font-size: 13px; }
.detail-list dd { margin: 0; }

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); cursor: pointer; }
.row-inactive { opacity: .55; }
/*  Bunka musí zostať bunkou tabuľky - s display:flex by vypadla z riadku.  */
.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * + * { margin-left: 10px; }
/*  Užšie okno (menší notebook, tablet): akcie sa radšej zalomia, než aby tabuľka pretiekla.  */
@media (min-width: 901px) and (max-width: 1250px) {
  .row-actions { white-space: normal; min-width: 215px; }
  .row-actions > * { white-space: nowrap; line-height: 1.9; }
  .users-table th:nth-child(4), .users-table td:nth-child(4) { display: none; }
}
.user-cell { display: flex; align-items: center; gap: 10px; }
.theme-switch { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.theme-option { background: none; border: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.theme-option.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); font-weight: 600; }
.shortcut-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shortcut-list kbd { background: var(--surface-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 7px; font-family: ui-monospace, monospace; font-size: 12px; margin-right: 8px; }
.label-manage { display: flex; flex-wrap: wrap; gap: 8px; }
.board-emoji { display: inline-block; margin-right: 6px; }
.scope-note { margin-bottom: var(--space-3); }

/* ---------- Dashboard ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4); display: flex; flex-direction: column; gap: 2px;
  box-shadow: var(--shadow-xs); transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.stat-value { font-size: 26px; font-weight: 680; letter-spacing: -.02em; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-danger .stat-value { color: var(--danger); }
.stat-warn .stat-value { color: var(--warning); }
.stat-zero .stat-value { color: var(--text-muted); }

.board-summary { margin-bottom: var(--space-5); }
.board-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-3); }
.board-summary-card {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); transition: border-color var(--transition), transform var(--transition);
}
.board-summary-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.board-summary-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: color-mix(in srgb, var(--board-color) 15%, transparent); }
.board-summary-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--space-4); }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow-xs); }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.dash-card-head h3 { font-size: 14px; }
.dash-empty { padding: var(--space-3) 0; }

.card-rows { display: flex; flex-direction: column; gap: 6px; }
.card-row {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.card-row:hover { background: var(--surface-2); }
.card-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-row-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row-meta { display: flex; align-items: center; gap: 8px; }
.list-foot { margin-top: var(--space-3); }

/* ---------- Filtre ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: var(--space-4); }
.filter-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 5px 13px; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--text-secondary);
}
.filter-chip:hover { border-color: var(--border-strong); }
.filter-chip.active { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, transparent); color: var(--primary); }
.filter-select { width: auto; padding: 5px 10px; border-radius: var(--radius-full); font-size: 13px; background: var(--surface); }
.filter-search { width: 220px; padding: 5px 12px; border-radius: var(--radius-full); font-size: 13px; }
.filter-search.wide { width: 360px; max-width: 100%; }

/* ---------- Modály ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 18, .5); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh var(--space-4);
  z-index: 100; overflow-y: auto; animation: fade-in 140ms ease;
}
.modal-overlay.closing { animation: fade-out 130ms ease forwards; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; animation: modal-in 160ms cubic-bezier(.2, .8, .3, 1);
  border: 1px solid var(--border); display: flex; flex-direction: column; max-height: 90vh;
}
.modal-sm { max-width: 460px; }
.modal-lg { max-width: 1040px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; }
.modal-body { padding: var(--space-5); overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); }
.confirm-text { color: var(--text-secondary); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(-10px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- Výbery ---------- */
.user-picker, .label-picker { display: flex; flex-direction: column; gap: 3px; max-height: 55vh; overflow-y: auto; }
.user-option, .label-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: none; border: none; cursor: pointer; text-align: left; width: 100%;
}
.user-option:hover, .label-option:hover { background: var(--surface-2); }
.user-option.selected, .label-option.selected { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.user-option .muted { margin-left: auto; }
.label-swatch { width: 14px; height: 14px; border-radius: 4px; }

.client-picker-input { display: flex; gap: 6px; }
.client-results { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 4px; overflow: hidden; }
.client-option { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; background: none; border: none; padding: 8px 10px; cursor: pointer; }
.client-option:hover { background: var(--surface-2); }
.client-option.create { color: var(--primary); font-weight: 550; }
.client-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 4px 10px; }
.chip-remove { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 15px; padding: 0; }

/* ---------- Mentions ---------- */
.mention { background: var(--primary-soft); color: var(--primary); border-radius: 4px; padding: 0 4px; font-weight: 600; cursor: default; }
.mention-panel {
  position: fixed; z-index: 200; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 4px; max-height: 220px; overflow-y: auto;
}
.mention-option { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.mention-option.active, .mention-option:hover { background: var(--primary-soft); }
.mention-option .muted { margin-left: auto; }

/* ---------- Toasty ---------- */
.toast-stack { position: fixed; bottom: var(--space-4); right: var(--space-4); display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow-md);
  min-width: 260px; max-width: 380px; animation: toast-in 180ms cubic-bezier(.2, .8, .3, 1);
}
.toast-leaving { animation: toast-out 160ms ease forwards; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-text { flex: 1; font-size: 13px; }
.toast-action { background: none; border: none; color: var(--primary); font-weight: 600; cursor: pointer; font-size: 13px; }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Prázdne stavy a skeletony ---------- */
.empty-state { text-align: center; padding: var(--space-7) var(--space-4); }
.empty-icon { font-size: 34px; margin-bottom: var(--space-2); }
.empty-state h3 { font-size: 16px; margin-bottom: 4px; }

.skeleton-stack { display: flex; flex-direction: column; gap: 10px; padding: var(--space-2); }
.skeleton-row, .skeleton-card {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius-sm); height: 44px;
}
.skeleton-card { height: 70px; margin-bottom: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Prihlásenie ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background:
  radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent),
  var(--bg); }
.login-shell { width: 100%; max-width: 420px; padding: var(--space-4); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.login-logo { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.login-brand h1 { font-size: 19px; }
#login-form { display: flex; flex-direction: column; gap: var(--space-4); }
.login-hint { margin-top: var(--space-4); text-align: center; font-size: 12px; }

/* ---------- Responzivita ---------- */
@media (max-width: 1100px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform var(--transition); box-shadow: var(--shadow-lg);
  }
  :root.sidebar-open .sidebar { transform: none; }
  :root.sidebar-collapsed .sidebar { width: var(--sidebar-width); flex-basis: var(--sidebar-width); }
  :root.sidebar-collapsed .nav-label, :root.sidebar-collapsed .brand-text,
  :root.sidebar-collapsed .nav-section-title { display: block; }
  .mobile-menu { display: grid; }
  .page-title { display: none; }
  .search-wrap { max-width: none; }
  .btn-new-label { display: none; }
  .page { padding: var(--space-4) var(--space-3) var(--space-6); }
  .grid-2 { grid-template-columns: 1fr; }
  .dropdown { right: var(--space-2); left: var(--space-2); width: auto; }
  .detail-list div { grid-template-columns: 1fr; gap: 0; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border-bottom: 1px solid var(--border); padding: var(--space-2) 0; }
  .data-table td { border: none; padding: 4px 14px; }
  .data-table td.row-actions { text-align: left; padding-top: 8px; }
}

@media (max-width: 560px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .toast-stack { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); }
  .toast { max-width: none; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 94vh; }
}

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

/* ---------- Štatistiky ---------- */
.stat-row-6 { grid-template-columns: repeat(6, 1fr); }
.stat-static { cursor: default; }
.stat-static:hover { transform: none; box-shadow: var(--shadow-xs); }
.stat-hint { margin-top: 2px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: var(--space-4); }
.stats-grid .panel { margin-bottom: 0; }

.chart-scroll { padding-bottom: 4px; }
.chart { display: block; width: 100%; height: auto; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { font-size: 10px; fill: var(--text-muted); }
.chart .bar-created { fill: var(--primary); opacity: .75; }
.chart .bar-completed { fill: var(--success); }
.chart-legend { display: flex; gap: var(--space-3); font-size: 12px; color: var(--text-muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch-created { background: var(--primary); opacity: .75; }
.swatch-completed { background: var(--success); }

.table-scroll { overflow-x: auto; }
.stats-table { min-width: 420px; }
.stats-table td { vertical-align: middle; }
.stats-table tbody tr:hover { background: transparent; cursor: default; }
.stats-num { font-weight: 650; margin-right: 8px; }
.stats-danger { color: var(--danger); font-weight: 650; }

.mini-bar { display: block; height: 5px; background: var(--surface-3); border-radius: var(--radius-full); overflow: hidden; margin-top: 4px; }
.mini-bar i { display: block; height: 100%; border-radius: var(--radius-full); background: var(--primary); }
.mini-bar i.tone-ok { background: var(--success); }
.mini-bar i.tone-danger { background: var(--danger); }
.mini-bar i.tone-neutral { background: var(--primary); opacity: .7; }

.stats-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.stats-list li { display: flex; flex-direction: column; gap: 2px; }
.stats-row-link { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%; }
.stats-row-values .stats-num { margin-right: 0; }
.stats-row-link:hover .stats-row-name { color: var(--primary); }
.stats-row-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; }
.stats-row-values { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }

@media (max-width: 1100px) { .stat-row-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .stat-row-6 { grid-template-columns: repeat(2, 1fr); } }

/* --- Hviezdičky a hodnotenie v štatistikách --- */
.stars { display: inline-flex; gap: 1px; font-size: 16px; line-height: 1; }
.stars i { font-style: normal; color: var(--border-strong); }
.stars i.on { color: #f5a524; }
.stars-sm { font-size: 12px; }
.meta-rating { color: #d98b0b; font-weight: 600; }

.rating-team { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.rating-team strong { color: var(--text); font-size: 16px; }
.rating-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-3); }
.rating-person { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); display: flex; flex-direction: column; gap: 6px; }
.rating-person-head { display: flex; align-items: center; gap: 10px; }
.rating-person-name { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.rating-average { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.dist { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.dist-row { display: grid; grid-template-columns: 26px 1fr 22px; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.dist-row .mini-bar { margin-top: 0; }
.dist-count { text-align: right; }
.rating-notes-title { margin: var(--space-4) 0 var(--space-2); }
.rating-notes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-2); }
.rating-note { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.rating-note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rating-note p { margin: 6px 0 4px; }

/* --- Hviezdičky na dashboarde --- */
.stars-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
.stars-hero { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.stars-hero-value { font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.stars-hero-meta { display: flex; flex-direction: column; gap: 4px; }
.stars-hero-meta .stars { font-size: 20px; }
.stars-recent, .stars-group { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stars-recent-item { display: flex; gap: 10px; align-items: flex-start; }
.stars-recent-text { display: flex; flex-direction: column; font-size: 13px; }
.stars-group-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stars-group-name { flex: 1; font-weight: 550; }
.rating-privacy-note { margin: -4px 0 var(--space-3); }

/* --- Skupiny v nastaveniach --- */
.group-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.group-row:first-child { border-top: none; }
.group-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.group-partner { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }
.check-list .check { padding: 3px 0; }
.check-list .muted { margin-left: auto; }

/* --- Rozbalenie zbaleného panela: vždy viditeľné hore pod logom --- */
.sidebar-expand {
  display: none;
  margin: 8px auto 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.sidebar-expand:hover { background: var(--primary); color: #fff; }
:root.sidebar-collapsed .sidebar-expand { display: grid; place-items: center; }
:root.sidebar-collapsed .sidebar-head { display: flex; flex-direction: column; align-items: center; }
:root.sidebar-collapsed .brand { cursor: e-resize; }
@media (max-width: 900px) { .sidebar-expand, :root.sidebar-collapsed .sidebar-expand { display: none; } }

/* --- Úloha hlasom --- */
.voice-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.voice-row { display: flex; gap: 10px; align-items: flex-start; }
.voice-row textarea { min-height: 52px; background: var(--surface); }
.voice-mic {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; font-size: 20px; cursor: pointer; box-shadow: var(--shadow-sm);
}
.voice-mic:disabled { background: var(--surface-3); color: var(--text-muted); cursor: not-allowed; box-shadow: none; }
.voice-mic.listening { background: var(--danger); animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 45%, transparent); }
  50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--danger) 0%, transparent); }
}
.voice-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.voice-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.voice-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; background: var(--success-soft); color: var(--success); }
.voice-chip.ask { background: var(--warning-soft); color: var(--warning); }
.voice-chip button { background: none; border: 1px solid currentColor; border-radius: var(--radius-full); color: inherit; font: inherit; padding: 0 7px; cursor: pointer; }

/* --- Dashboard: dôležité info a dovolenky --- */
.team-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--space-4); margin-bottom: var(--space-5); align-items: start; }
.notice-list, .absence-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notice { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); }
.notice-important { border-left-color: var(--warning); }
.notice-urgent { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.notice-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.notice-level { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.notice-important .notice-level { color: var(--warning); }
.notice-urgent .notice-level { color: var(--danger); }
.notice-pin { font-size: 11px; color: var(--text-muted); background: var(--surface-2); border-radius: var(--radius-full); padding: 0 7px; }
.notice-edit { margin-left: auto; }
.notice-title { font-size: 14.5px; margin: 0 0 4px; text-wrap: balance; }
.notice-body { color: var(--text-secondary); font-size: 13.5px; line-height: 1.55; }
.notice-meta { margin: 6px 0 0; }
.absence-status { font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: var(--radius-sm); margin: 0 0 4px; }
.absence-status.ok { background: var(--success-soft); color: var(--success); }
.absence-status.warn { background: var(--warning-soft); color: var(--warning); }
.absence-group-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 14px 0 6px; }
.absence { display: flex; gap: 10px; align-items: flex-start; }
.absence-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.absence-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.absence.is-now .absence-when { color: var(--warning); font-weight: 600; }
.role-chip { font-size: 10.5px; padding: 0 7px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); }
.role-chip.role-assistant { background: color-mix(in srgb, #ec4899 16%, transparent); color: #db2777; }
@media (max-width: 900px) { .team-row { grid-template-columns: minmax(0, 1fr); } }

/* --- Štatistiky: najaktívnejší makléri --- */
.broker-table, .broker-matrix { min-width: 640px; }
.broker-table tbody tr:hover, .broker-matrix tbody tr:hover { background: transparent; cursor: default; }
.broker-table td, .broker-matrix td { vertical-align: middle; }
.broker-table .num, .broker-matrix .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.broker-table th.num, .broker-matrix th.num { text-align: right; }
.broker-table .rank { width: 2.5em; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.load-cell { min-width: 150px; }
.load-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.broker-matrix-title { margin: var(--space-5) 0 var(--space-2); }
.broker-matrix .heat { background: color-mix(in srgb, var(--primary) calc(var(--heat) * 45%), transparent); font-weight: 600; }
.broker-matrix tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); background: var(--surface-2); }
.broker-rule { margin: var(--space-3) 0 0; }

/* --- Používatelia: filter podľa roly --- */
.users-filter { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.chip-count { margin-left: 4px; font-variant-numeric: tabular-nums; opacity: .7; }

/* --- Prvé spustenie a nastavenie hesla --- */
.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.setup-heading { font-size: 18px; margin: 0 0 var(--space-2); }
.setup-lede { margin: 0 0 var(--space-4); }
.setup-shell { max-width: 640px; }
.flag-note { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); margin: 0 0 var(--space-3); font-size: 13px; }
.link-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.link-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.link-person { display: flex; flex-direction: column; min-width: 0; }
.link-actions { display: flex; gap: var(--space-2); }
.link-output { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.pill-pending { background: var(--warning-soft); color: var(--warning); }
.bulk-preview { max-height: 320px; overflow: auto; margin-top: var(--space-3); }
.bulk-preview .row-error td { color: var(--danger); }
