/* Komponenty – button, card, table, input, modal, toast, badge.
   Style: SimplyWall.st-inspired dark mode, CLAUDE.md compliance:
   - Active-scale (0.98 → 1.05) micro-interactions
   - Sharp depth shadows
   - Color-coded health pills (good/fair/poor/bad) */

/* ─── Button — sharp pill, active scale, primary teal CTA ─── */
.btn {
  --btn-bg: var(--c-bg-elev);
  --btn-fg: var(--c-fg);
  --btn-bd: var(--c-border-strong);

  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-full);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  font: 600 13px/1.2 inherit;
  letter-spacing: 0.005em;
  cursor: pointer;
  /* CLAUDE.md: micro-interactions – scale 0.98 → 1.05, spring ease. */
  transition:
    transform var(--t-fast) var(--ease-spring),
    box-shadow var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    filter var(--t-fast) var(--ease-out);
}

.btn:hover { transform: scale(1.05); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 0; box-shadow: var(--shadow-glow); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn--primary {
  --btn-bg: var(--c-primary-500);
  --btn-fg: #001b15;                  /* tmavý text na teal pozadí pro kontrast */
  --btn-bd: transparent;
  font-weight: 700;
  box-shadow:
    0 0 0 1px rgba(0, 212, 170, .35) inset,
    0 8px 24px rgba(0, 212, 170, .25);
}
.btn--primary:hover { filter: brightness(1.08); }

.btn--secondary {
  --btn-bg: var(--c-bg-elev-2);
  --btn-bd: transparent;
  font-weight: 500;
}
.btn--secondary:hover { background: rgba(255, 255, 255, .08); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
}
.btn--ghost:hover { background: var(--c-bg-soft); }

.btn--danger {
  --btn-bg: transparent;
  --btn-bd: transparent;
  --btn-fg: var(--c-error);
  font-weight: 500;
}
.btn--danger:hover { background: var(--c-error-bg); }

.btn--icon { padding: 9px 11px; }
.btn--sm { padding: 6px 12px; font-size: 12px; }

/* ─── EODHD search results v Resolve modálu ─── */
.search-results {
  max-height: 360px;
  overflow-y: auto;
  margin: var(--sp-3) 0;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-bg-soft);
}
.search-results__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  transition: background var(--t-fast);
}
.search-results__row:last-child { border-bottom: 0; }
.search-results__row:hover { background: var(--c-bg-elev); }
.search-results__sym {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13px;
  min-width: 120px;
}
.search-results__name {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-results__meta {
  font-size: 11.5px;
  color: var(--c-fg-muted);
  white-space: nowrap;
}
.search-results__empty {
  padding: var(--sp-5);
  text-align: center;
  color: var(--c-fg-muted);
  font-size: 13px;
}

.btn[data-spinning="1"] {
  pointer-events: none;
  opacity: .6;
  animation: btn-spin 1s linear infinite;
}
@keyframes btn-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.btn .plus {
  font-size: 16px;
  line-height: 1;
}

/* ─── Card — SWS-style: sharper, layered depth, subtle gradient lip ─── */
.card {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  position: relative;
  isolation: isolate;
  transition:
    box-shadow var(--t-mid) var(--ease-out),
    transform var(--t-mid) var(--ease-out),
    border-color var(--t-mid) var(--ease-out);
}
/* Decentní vnitřní top-light pro 3D efekt (CLAUDE.md: 3D shadows for depth) */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, .035) 0%,
    rgba(255, 255, 255, 0) 30%
  );
  z-index: -1;
}
:root.theme-light .card::before {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, .6) 0%,
    rgba(255, 255, 255, 0) 30%
  );
}

.card--elevated { box-shadow: var(--shadow-sm); }
.card--elevated:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--c-border-strong);
  transform: translateY(-1px);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
}
.card-head__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-head__actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.card-foot {
  margin-top: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--c-fg-muted);
}

/* ─── KPI — SWS-style data tile s color-coded glow + wide mono hodnotou ─── */
.kpi {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition:
    box-shadow var(--t-mid) var(--ease-out),
    transform var(--t-mid) var(--ease-out),
    border-color var(--t-mid) var(--ease-out);
}
.kpi:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--c-border-strong);
  transform: translateY(-2px);
}

.kpi__label {
  font-size: 11px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--c-fg-muted);
  font-weight: 600;
}

.kpi__value {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: clamp(24px, 1.8vw + 12px, 32px);
  font-weight: 600;
  letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  color: var(--c-fg-strong);
  line-height: 1.05;
}

/* Když řádek KPI obsahuje aspoň jednu 8-cifernou hodnotu (např. „123 456 789 Kč"),
   všechny hodnoty v gridu se zmenší na 28 px → uniformní řádek bez ořezávání.
   Aktivuje se přidáním .kpi-grid--compact rodičovskému gridu. */
.kpi-grid--compact .kpi__value {
  font-size: 28px;
}

.kpi__sub {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--c-fg-muted);
  letter-spacing: -.003em;
}

.kpi__sub_link {
  color: var(--c-primary-500);
}

/* SWS-style „glow" v rohu KPI — barva podle akcentu */
.kpi__accent { position: relative; }
.kpi__accent::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--mesh-blob-1), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.kpi__accent--info::before  { background: radial-gradient(circle, var(--mesh-blob-2), transparent 70%); }
.kpi__accent--good::before  { background: radial-gradient(circle, rgba(0, 212, 170, .18), transparent 70%); }
.kpi__accent--bad::before   { background: radial-gradient(circle, rgba(239, 79, 110, .18), transparent 70%); }
.kpi__accent--warn::before  { background: radial-gradient(circle, rgba(255, 167, 38, .18), transparent 70%); }
.kpi > * { position: relative; z-index: 1; }

/* ─── Tabulka ─── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  margin: calc(-1 * var(--sp-2));
  padding: var(--sp-2);
  /* Subtilní fade na pravém okraji = vizuální hint, že je čím skrolovat. */
  background:
    linear-gradient(to right, transparent calc(100% - 24px), color-mix(in srgb, var(--c-bg) 70%, transparent) 100%) no-repeat;
}
/* Bez tohoto `width: 100%` z `.table` nutí tabulku scvrknout sloupce a parent
   .table-scroll nikdy nepřeteče → žádný scroll. `min-width: 100%` drží
   defaultní vzhled na desktopu (tabulka roztažená na šíři karty), `width:
   max-content` ji nechá expandovat, když buňky potřebují víc místa, čímž se
   spustí horizontální scroll v parent kontejneru. */
.table-scroll > .table,
.table-scroll > table.table {
  width: max-content;
  min-width: 100%;
}
/* Buňky uvnitř scroll containeru nezalamujeme — wrap by jinak roztáhl řádky
   do několika řad místo aby aktivoval horizontální scroll. Výjimka: muted/
   long-text buňky (popisy aktiv apod.) si můžou nechat wrap přes explicit
   `style={{ whiteSpace: 'normal' }}`. */
.table-scroll th,
.table-scroll td {
  white-space: nowrap;
}

/* Sticky první sloupec (název metriky) – při horizontalním scrollu zůstává
   viditelný. Použito pro Ratios + Financials s historií 10+ let. */
.table-scroll--sticky table th:first-child,
.table-scroll--sticky table td:first-child {
  position: sticky;
  left: 0;
  background: var(--c-bg-elev);
  z-index: 2;
  box-shadow: 1px 0 0 var(--c-border);
}
.table-scroll--sticky table thead th:first-child {
  background: var(--c-bg-elev-2);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-fg-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg-elev);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table th.num, .table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  letter-spacing: 0;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  font-size: 13.5px;
}
.table tbody tr { transition: background var(--t-fast) var(--ease-out); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--c-bg-elev-2); }

/* ─── Input / select — sharper border, teal focus glow ─── */
/* Globální styling pro nativní form prvky (bez nutnosti dávat class="input")
   – v dark modu defaultní browser select/input vypadá hrozně, takže je
   pravidlem srovnáme se zámyslem v `.input`. .switch input je výjimka
   (skrytý checkbox uvnitř toggle-slideru). */
.input,
select,
textarea,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
  appearance: none;
  -webkit-appearance: none;
  background: var(--c-bg-soft);
  color: var(--c-fg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font: 14px inherit;
  letter-spacing: -.003em;
  transition:
    border-color var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
}
.input::placeholder,
input::placeholder,
textarea::placeholder { color: var(--c-fg-faint); }
.input:hover,
select:not(:disabled):hover,
textarea:hover,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not(:disabled):hover { border-color: var(--c-border-strong); }
.input:focus,
select:focus,
textarea:focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):focus {
  outline: 0;
  background: var(--c-bg-elev);
  border-color: var(--c-primary-500);
  box-shadow: var(--shadow-glow);
}

/* Select — vlastní chevron (appearance:none zruší native arrow). */
select {
  cursor: pointer;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23ecf0f8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}
select option {
  background: var(--c-bg-elev);
  color: var(--c-fg);
}

/* Custom checkbox + radio — dark mode, teal accent. .switch input zůstává
   skrytý (má width:0;height:0 níže), tohle se na něj neaplikuje. */
input[type="checkbox"]:not(.switch input),
input[type="radio"]:not(.switch input) {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--c-border-strong);
  background: var(--c-bg-soft);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
  flex-shrink: 0;
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
}
input[type="checkbox"]:not(.switch input) { border-radius: var(--r-sm); }
input[type="radio"]:not(.switch input)    { border-radius: 50%; }

input[type="checkbox"]:not(.switch input)::before {
  content: '';
  width: 10px;
  height: 10px;
  transform: scale(0);
  background: var(--c-primary-500);
  border-radius: 2px;
  transition: transform var(--t-fast) var(--ease-spring);
}
input[type="radio"]:not(.switch input)::before {
  content: '';
  width: 8px;
  height: 8px;
  transform: scale(0);
  background: var(--c-primary-500);
  border-radius: 50%;
  transition: transform var(--t-fast) var(--ease-spring);
}
input[type="checkbox"]:checked:not(.switch input),
input[type="radio"]:checked:not(.switch input) {
  border-color: var(--c-primary-500);
}
input[type="checkbox"]:checked:not(.switch input)::before,
input[type="radio"]:checked:not(.switch input)::before { transform: scale(1); }
input[type="checkbox"]:hover:not(:disabled):not(.switch input),
input[type="radio"]:hover:not(:disabled):not(.switch input) { border-color: var(--c-primary-500); }
input[type="checkbox"]:focus-visible:not(.switch input),
input[type="radio"]:focus-visible:not(.switch input) {
  outline: 0;
  box-shadow: var(--shadow-glow);
}
input[type="checkbox"]:disabled:not(.switch input),
input[type="radio"]:disabled:not(.switch input) { opacity: .4; cursor: not-allowed; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
}
.field__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  color: var(--c-fg-muted);
}

/* ─── Dropzone (Apple-style) ─── */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-8);
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--c-border-strong);
  background: var(--c-bg-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone:hover {
  border-color: var(--c-primary-500);
  background: color-mix(in srgb, var(--c-primary-500) 5%, var(--c-bg-soft));
}
.dropzone p { margin: 0; }
.dropzone__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone__hint { color: var(--c-fg-muted); font-size: 14px; }
.dropzone__filename {
  margin-top: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--c-fg);
}
.dropzone.is-drag { border-color: var(--c-primary-500); background: color-mix(in srgb, var(--c-primary-500) 12%, var(--c-bg-soft)); }

/* Seznam vybraných souborů pod dropzone (FileUploadCard). */
.file-list {
  list-style: none;
  padding: 0;
  margin: var(--sp-3) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.file-list__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.file-list__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ─── Inline field (checkbox + label) ─── */
.field--inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--sp-2);
}
.field--inline .field__label { margin: 0; cursor: pointer; }

/* ─── Progress bar — teal s glow ─── */
.progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--c-bg-soft);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary-600), var(--c-primary-400));
  box-shadow: 0 0 12px rgba(0, 212, 170, .5);
  transition: width var(--t-mid) var(--ease-out);
}

/* ─── Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}
.modal.is-open { display: block; }
.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 10, .55);
  backdrop-filter: blur(6px);
  animation: fade var(--t-fast) var(--ease-out);
}
.modal__panel {
  position: relative;
  margin: 8vh auto;
  width: min(560px, 92vw);
  background: var(--c-bg-elev);
  border-radius: var(--r-xl);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-lg);
  animation: scale-in var(--t-mid) var(--ease-out);
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
}
.modal__body { padding: var(--sp-6); }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

/* ─── Roční tabulka pod performance chartem ─── */
.yearly-table-wrap {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-border);
}
.yearly-table-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-fg-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0 0 var(--sp-3);
}
.table--compact th {
  padding: 8px 10px;
}
.table--compact td {
  padding: 8px 10px;
  font-size: 13px;
}
.year-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: var(--r-full);
  background: var(--c-success-bg);
  color: var(--c-success);
}

/* ─── Fees detail (rozbalovací tabulka) ─── */
.fees-detail {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-border);
  animation: fade-up var(--t-mid) var(--ease-out);
}

/* ─── Performance card (dashboard) ─── */
.perf-head {
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.perf-controls {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.input--sm {
  padding: 6px 10px;
  font-size: 13px;
}
.perf-meta {
  display: flex;
  gap: var(--sp-5);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
  font-size: 13px;
  color: var(--c-fg-muted);
}
.perf-meta strong {
  color: var(--c-fg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ─── Import card (page „Importy") ─── */
.import-card {
  padding: 0;
  overflow: hidden;
}
.import-card .tabs {
  margin: var(--sp-4) var(--sp-5) 0;
}
.import-pane {
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  border-top: 1px solid var(--c-border);
  margin-top: var(--sp-4);
}
.import-pane__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

/* ─── Form mřížka pro modal s více poli ─── */
.grid-2-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
@media (max-width: 600px) {
  .grid-2-form { grid-template-columns: 1fr; }
}

/* ─── Sortable table headers ─── */
.table--sortable th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;       /* prostor pro arrow indicator */
}
.table--sortable th[data-sort]:hover {
  color: var(--c-fg);
  background: var(--c-bg-elev-2);
}
.table--sortable th[data-sort]::after {
  content: '↕';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.3;
  font-size: 11px;
  font-weight: 400;
}
.table--sortable th[data-sort].is-sorted-asc::after {
  content: '▲';
  opacity: 0.9;
  color: var(--c-primary-500);
}
.table--sortable th[data-sort].is-sorted-desc::after {
  content: '▼';
  opacity: 0.9;
  color: var(--c-primary-500);
}

/* ─── Tabs (modal i import card) ─── */
.tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
}
.tab {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--c-fg-muted);
  padding: 8px 14px;
  border-radius: calc(var(--r-md) - 2px);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.tab:hover { color: var(--c-fg); }
.tab.is-active {
  background: var(--c-bg-elev);
  color: var(--c-fg);
  box-shadow: var(--shadow-xs);
}

/* ─── Seznam souborů pod dropzone ─── */
.file-list {
  list-style: none;
  margin: var(--sp-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--c-bg-elev);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.file-list .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: left;
}
.file-list .remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--c-fg-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.file-list .remove:hover { color: var(--c-error); background: var(--c-error-bg); }

/* ─── Badges + Health Pills (SWS snowflake-style) ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--c-bg-soft);
  color: var(--c-fg-muted);
  border: 1px solid var(--c-border);
  white-space: nowrap;
}
.badge--BUY      { color: var(--c-success); background: var(--c-success-bg); border-color: transparent; }
.badge--SELL     { color: var(--c-error);   background: var(--c-error-bg);   border-color: transparent; }
.badge--DIVIDEND { color: #c4b5fd;          background: rgba(167, 139, 250, .15); border-color: transparent; }
.badge--DEPOSIT, .badge--INTEREST { color: var(--c-accent-400); background: var(--c-info-bg); border-color: transparent; }
.badge--WITHDRAWAL, .badge--FEE { color: var(--c-warning); background: var(--c-warning-bg); border-color: transparent; }
.badge--SPLIT, .badge--MERGER, .badge--SPINOFF { color: var(--c-fg); background: var(--c-bg-soft); }

/* SWS health pills – good / fair / poor / bad – s tečkou vlevo */
.health {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .03em;
}
.health::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent);
}
.health--good { color: var(--c-health-good); background: var(--c-health-good-bg); }
.health--fair { color: var(--c-health-fair); background: var(--c-health-fair-bg); }
.health--poor { color: var(--c-health-poor); background: var(--c-health-poor-bg); }
.health--bad  { color: var(--c-health-bad);  background: var(--c-health-bad-bg); }
.health--neutral { color: var(--c-health-neutral); background: var(--c-health-neutral-bg); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
}
.status::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.status--completed { color: var(--c-success); }
.status--processing, .status--pending { color: var(--c-info); }
.status--failed { color: var(--c-error); }

/* ─── Toast ─── */
.toast-wrap {
  position: fixed;
  z-index: 2000;
  right: var(--sp-5);
  bottom: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  /* Toast je čistě informativní – nezachytává klik, aby nepřekrýval
     funkční elementy pod ním (např. submit tlačítko v import formuláři). */
  pointer-events: none;
  min-width: 260px;
  max-width: 380px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-lg);
  animation: slide-in var(--t-mid) var(--ease-out);
  font-size: 14px;
}
.toast--success { border-left: 3px solid var(--c-success); }
.toast--error   { border-left: 3px solid var(--c-error); }
.toast--info    { border-left: 3px solid var(--c-info); }
.toast small { display: block; color: var(--c-fg-muted); margin-top: 4px; font-size: 12.5px; }

/* ─── Charts + skeleton loading (Apple shimmer) ─── */
.chart-wrap {
  position: relative;
  height: 240px;
}
.chart-wrap--tall { height: 320px; }

/* Skeleton overlay – shimmer dokud chart není vykreslen */
.chart-wrap.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-md);
  background:
    linear-gradient(
      100deg,
      transparent 0%,
      transparent 30%,
      var(--c-border) 50%,
      transparent 70%,
      transparent 100%
    ),
    var(--c-bg-soft);
  background-size: 220% 100%, 100% 100%;
  background-position: -100% 0, 0 0;
  animation: skeleton-shimmer 1.6s var(--ease-in-out) infinite;
  z-index: 1;
  pointer-events: none;
}
.chart-wrap.is-loading > canvas {
  opacity: 0;
}
.chart-wrap > canvas {
  transition: opacity var(--t-mid) var(--ease-out);
}

@keyframes skeleton-shimmer {
  0%   { background-position: -100% 0, 0 0; }
  100% { background-position: 200% 0, 0 0; }
}

/* Skeleton row – pro tabulky (volitelně) */
.skeleton-line {
  display: block;
  height: 12px;
  border-radius: var(--r-sm);
  background: linear-gradient(
    100deg,
    var(--c-bg-soft) 0%,
    var(--c-border) 50%,
    var(--c-bg-soft) 100%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.6s var(--ease-in-out) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .chart-wrap.is-loading::before,
  .skeleton-line { animation: none; }
}

/* ─── Empty state ─── */
.empty {
  padding: var(--sp-12) var(--sp-5);
  text-align: center;
  color: var(--c-fg-muted);
  font-size: 14px;
}

/* ─── Currency switcher (CZK/EUR/USD) ─── */
.currency-switcher {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-full);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
}
.currency-switcher__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--c-fg-muted);
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.currency-switcher__btn:hover { color: var(--c-fg); }
.currency-switcher__btn.is-active {
  background: var(--c-bg-elev);
  color: var(--c-fg);
  box-shadow: var(--shadow-xs);
}
.currency-switcher__btn:disabled {
  opacity: .5;
  cursor: wait;
}

/* ─── User chip (přihlášený uživatel + logout) ─── */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  border-radius: var(--r-full);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  font-size: 13px;
  max-width: 260px;
}
.user-chip__avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 0% 0%, var(--c-primary-300) 0%, transparent 60%),
    linear-gradient(135deg, var(--c-primary-600), var(--c-primary-800));
  flex-shrink: 0;
}
.user-chip__email {
  color: var(--c-fg);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.user-chip__logout {
  appearance: none;
  background: transparent;
  border: 0;
  width: 26px; height: 26px;
  border-radius: var(--r-full);
  color: var(--c-fg-muted);
  cursor: pointer;
  font-size: 14px;
  transition: background var(--t-fast), color var(--t-fast);
}
.user-chip__logout:hover {
  background: var(--c-error-bg);
  color: var(--c-error);
}

/* ─── Stock search v topbaru ─── */
.stock-search {
  position: relative;
  width: 280px;
  max-width: 280px;
}
@media (max-width: 1024px) {
  .stock-search { width: 100%; max-width: none; order: 4; flex-basis: 100%; }
}
.stock-search__input {
  width: 100%;
  padding: 8px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: var(--c-bg-soft);
  color: var(--c-fg);
  font: 500 13px/1.2 inherit;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.stock-search__input::placeholder { color: var(--c-fg-muted); }
.stock-search__input:focus {
  border-color: var(--c-primary-500);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}
.stock-search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  /* Vyšší než shellnav, dropdown menu i další overlay elementy. */
  z-index: 1000;
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  max-height: 360px;
  overflow-y: auto;
  padding: 4px;
}
.stock-search__empty--error { color: var(--c-error, #dc2626); }
.stock-search__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--c-fg);
  font: inherit;
}
.stock-search__item:hover,
.stock-search__item.is-active {
  background: var(--c-bg-soft);
}
.stock-search__item-symbol {
  font-weight: 600;
  color: var(--c-fg);
  min-width: 90px;
}
.stock-search__item-name {
  flex: 1;
  color: var(--c-fg-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stock-search__item-meta {
  font-size: 11px;
  color: var(--c-fg-muted);
}
.stock-search__empty {
  padding: 14px;
  color: var(--c-fg-muted);
  font-size: 13px;
  text-align: center;
}

/* ─── Stock detail page ─── */
.stock-header-card { padding: var(--sp-5) var(--sp-6); }
.stock-header {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.stock-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--c-fg);
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
}
.stock-logo img { width: 100%; height: 100%; object-fit: cover; }
.stock-info { flex: 1; min-width: 0; }
.stock-info .display { margin: 0; font-size: 28px; }
.stock-info .muted { margin: 4px 0 0; font-size: 13px; }
.stock-price-block { text-align: right; }
.stock-price {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 600;
  color: var(--c-fg-strong);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stock-price-change { font-size: 14px; font-weight: 600; margin-top: 4px; font-family: var(--font-mono); }
.stock-price-change.pos { color: var(--c-success); }
.stock-price-change.neg { color: var(--c-error); }

/* CLAUDE.md: Asymmetrical bento grid pro stock detail. Replikuje stock3.ejs
   layout: 4 stejně široké sloupce, první = Stock Price (clickable, dark
   gradient), 3 další = info cards (Size & Growth, Valuation, Profitability). */
.stock-bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin: var(--sp-5) 0;
}
.stock-bento > * { min-width: 0; }
@media (max-width: 1100px) {
  .stock-bento { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .stock-bento { grid-template-columns: 1fr; }
}

/* Stock Price card – první v bento. Tmavý gradient + clickable (toggle metric).
   Replika `metric-card.stock-price-card` z legacy. */
.stock-price-card {
  background: linear-gradient(135deg, var(--c-bg-elev), var(--c-bg-elev-2));
  border: 2px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-height: 200px;
}
.stock-price-card:hover {
  border-color: var(--c-primary-500);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stock-price-card.is-selected {
  border-color: var(--c-primary-500);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, .25);
}
.stock-price-card__check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--c-primary-500);
  color: #001b15;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: all var(--t-fast) var(--ease-spring);
  font-weight: 700;
}
.stock-price-card.is-selected .stock-price-card__check { opacity: 1; transform: scale(1); }
.stock-price-card__head { display: flex; align-items: center; gap: var(--sp-3); }
.stock-price-card__logo {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--c-bg-soft);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  color: var(--c-fg-strong);
}
.stock-price-card__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stock-price-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--c-fg-strong);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stock-price-card__ticker { font-family: var(--font-mono); color: var(--c-fg-muted); font-size: 12px; }
.stock-price-card__price {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--c-fg-strong);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stock-price-card__change { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.stock-price-card__change.pos { color: var(--c-success); }
.stock-price-card__change.neg { color: var(--c-error); }
.stock-price-card__asof { font-size: 11px; color: var(--c-fg-faint); margin-top: auto; }

/* Info card – non-clickable, 6 metrik v 2-col gridu. Replika `info-card`. */
.info-card {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
}
.info-card__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-fg-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--c-border);
}
.info-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.info-card__metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: default;
  padding: 0;
  background: transparent;
  border: 0;
  text-align: left;
}
.info-card__metric--clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background var(--t-fast) var(--ease-out);
}
.info-card__metric--clickable:hover { background: var(--c-bg-soft); }
.info-card__metric--active {
  background: rgba(0, 212, 170, .08);
  box-shadow: inset 0 0 0 1px var(--c-primary-500);
}
.info-card__metric-label {
  font-size: 11px;
  color: var(--c-fg-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.info-card__metric-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-fg-strong);
  font-variant-numeric: tabular-nums;
}
.info-card__metric-check { color: var(--c-primary-500); font-weight: 700; }

/* CLAUDE.md: dashboard bento – 12-col grid, asymmetrické rozmístění karet
   místo dvoj-sloupcového col-md-8/4 stacku. Každý child se chová jako grid
   item (RevealItem = motion.div) a Card uvnitř roztáhne na 100 %. */
.dashboard-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--sp-5);
  margin-top: var(--sp-6);
}
.dashboard-bento > *           { grid-column: span 6; min-width: 0; }
.dashboard-bento > .bento--hero { grid-column: span 8; grid-row: span 2; }
.dashboard-bento > .bento--lg   { grid-column: span 8; }
.dashboard-bento > .bento--md   { grid-column: span 4; }
.dashboard-bento > .bento--third{ grid-column: span 4; }
.dashboard-bento > .bento--full { grid-column: span 12; }
/* Pokud je item přímý wrapper Card komponenty, nech ji dotáhnout celou výšku
   buňky (důležité pro hero variant span 2 řádky). */
.dashboard-bento > * > .card    { height: 100%; }

@media (max-width: 1100px) {
  .dashboard-bento > .bento--hero { grid-column: span 12; grid-row: auto; }
  .dashboard-bento > .bento--lg   { grid-column: span 12; }
  .dashboard-bento > *            { grid-column: span 6; }
}
@media (max-width: 720px) {
  .dashboard-bento > * { grid-column: 1 / -1 !important; grid-row: auto !important; }
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3) var(--sp-4);
}
.info-grid--narrow { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .info-grid--narrow { grid-template-columns: 1fr 1fr; }
}
.info-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--c-border);
}
.info-metric:nth-last-child(-n+2) { border-bottom: 0; }
.info-metric__label {
  font-size: 11px;
  color: var(--c-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.info-metric__value {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-fg);
  font-variant-numeric: tabular-nums;
}

/* ─── Clickable metric tile (stock detail bento) ─── */
button.info-metric {
  appearance: none;
  text-align: left;
  font-family: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: var(--sp-2);
  width: 100%;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}
.info-metric--clickable:hover {
  background: var(--c-bg-elev-2);
  border-color: var(--c-border-strong);
  transform: scale(1.01);
}
.info-metric--clickable:active { transform: scale(0.99); }
button.info-metric.info-metric--active {
  background: rgba(0, 212, 170, .10);
  border-color: rgba(0, 212, 170, .35);
  box-shadow: 0 0 0 1px rgba(0, 212, 170, .25) inset;
}
.info-metric--active .info-metric__value { color: var(--c-primary-300); }
.info-metric__check {
  display: inline-block;
  margin-left: 6px;
  color: var(--c-primary-500);
  font-weight: 700;
  font-size: 11px;
}

/* ─── Clickable table row (financials) ─── */
.row-clickable { cursor: pointer; transition: background var(--t-fast) var(--ease-out); }
.row-clickable:hover { background: var(--c-bg-elev-2); }
.row-clickable--active {
  background: rgba(0, 212, 170, .08);
  box-shadow: inset 3px 0 0 var(--c-primary-500);
}
.row-clickable__label { display: block; font-weight: 600; }
.row-clickable__hint {
  display: block;
  font-size: 10.5px;
  color: var(--c-fg-faint);
  letter-spacing: .04em;
  margin-top: 2px;
}
.row-clickable--active .row-clickable__hint { color: var(--c-primary-400); }

/* ─── Financial-statements table: group headers + indented sub-rows ─── */
.fin-table__group td {
  background: linear-gradient(180deg, var(--c-bg-elev-2), var(--c-bg-elev-1));
  font-family: var(--font-display, var(--font-sans));
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--c-primary-300);
  font-weight: 700;
  padding-top: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  left: 0;
}
.fin-table__group:first-child td { border-top: 0; padding-top: var(--sp-2); }
.fin-table__group:hover td { background: linear-gradient(180deg, var(--c-bg-elev-2), var(--c-bg-elev-1)); }
.fin-table__row--indent td:first-child { padding-left: var(--sp-5); }
.fin-table__row--indent .row-clickable__label { font-weight: 500; color: var(--c-fg-muted); }

/* ─── Recalc status panel (SSE progress) ─── */
.recalc-status {
  margin: var(--sp-2) 0 var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-md, 10px);
  background: var(--c-bg-elev-1);
  border: 1px solid var(--c-border);
  overflow: hidden;
}
.recalc-status__row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.recalc-status__label {
  font-size: 13px;
  color: var(--c-fg);
  font-weight: 500;
  flex: 1;
}
.recalc-status__elapsed { font-variant-numeric: tabular-nums; }
.recalc-status__pct {
  font-variant-numeric: tabular-nums;
  min-width: 3.5em;
  text-align: right;
  font-weight: 600;
  color: var(--c-fg);
}
.recalc-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-primary-500);
  box-shadow: 0 0 0 0 var(--c-primary-500);
  animation: recalc-pulse 1.4s ease-out infinite;
}
.recalc-status__dot--complete,
.recalc-status__dot--done { background: #00d4aa; animation: none; box-shadow: 0 0 0 4px rgba(0, 212, 170, .15); }
.recalc-status__dot--error { background: #ef4f6e; animation: none; }
@keyframes recalc-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(0, 122, 255, .55); }
  70%  { box-shadow: 0 0 0 8px rgba(0, 122, 255, 0); }
  100% { box-shadow: 0 0 0 0   rgba(0, 122, 255, 0); }
}
.recalc-status__bar {
  height: 4px;
  border-radius: 2px;
  background: var(--c-bg-elev-2);
  overflow: hidden;
}
.recalc-status__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary-400), var(--c-primary-600));
  border-radius: 2px;
}
.recalc-status__bar-fill--complete,
.recalc-status__bar-fill--done { background: linear-gradient(90deg, #00d4aa, #00b89a); }
.recalc-status__bar-fill--error { background: #ef4f6e; }

/* ─── Metric chips (above selected-metrics chart) ─── */
.metric-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
}
.metric-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.metric-chip__remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .65;
  cursor: pointer;
  font-size: 13px;
  padding: 0 0 0 4px;
  line-height: 1;
  transition: opacity var(--t-fast);
}
.metric-chip__remove:hover { opacity: 1; }

/* ─── Selected metrics panel toolbar (Normal / Procenta + Clear) ─── */
.metrics-panel-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* ─── Cookie consent banner ─── */
/* `[hidden]` musí přebít `display: flex` (jinak banner zůstane viditelný
   po kliknutí Accept/Reject, protože hidden=true se přepíše displayem). */
.cookie-consent[hidden] { display: none !important; }
.cookie-consent {
  position: fixed;
  bottom: var(--sp-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  max-width: 720px;
  width: calc(100% - var(--sp-6));
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  animation: fade-up var(--t-mid) var(--ease-out);
}
.cookie-consent p { margin: 0; flex: 1 1 280px; color: var(--c-fg); }
.cookie-consent__actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ─── Stock quality scores (Omaha + Lukáš) ─── */
.score-overview {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-5);
  background: var(--c-bg-soft);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
}
.score-overview__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: flex-start;
}
.score-overview__verdict { font-size: 14px; padding: 6px 14px; font-weight: 600; }
.score-overview__caption { margin: 0; line-height: 1.5; }

/* Score ring – kruhový progress kolem total skóre. */
.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.score-ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.score-ring__total {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-fg-strong);
  letter-spacing: -.02em;
}
.score-ring__max {
  font-size: 12px;
  color: var(--c-fg-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* Citát pod sekcemi */
.score-quote {
  margin: var(--sp-4) 0 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg-soft);
  border-left: 3px solid var(--c-primary-500);
  border-radius: var(--r-sm);
}
.score-quote p {
  margin: 0 0 var(--sp-2);
  font-style: italic;
  color: var(--c-fg);
  line-height: 1.5;
}
.score-quote cite {
  font-style: normal;
  color: var(--c-fg-muted);
  font-size: 13px;
}

.score-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
@media (max-width: 800px) {
  .score-sections { grid-template-columns: 1fr; }
}
.score-section {
  background: var(--c-bg-elev-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
}
.score-section__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.score-section__label { font-weight: 600; font-size: 14px; }
.score-section__value { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.score-section__bar {
  height: 6px;
  background: var(--c-bg-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: var(--sp-3);
}
.score-section__bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width var(--t-mid) var(--ease-spring);
}
.score-section__bar-fill--good { background: var(--c-health-good); }
.score-section__bar-fill--fair { background: var(--c-health-fair); }
.score-section__bar-fill--poor { background: var(--c-health-poor); }
.score-section__bar-fill--bad  { background: var(--c-health-bad); }

.score-section__factors {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.score-factor {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--sp-2);
  padding: 6px 0;
  border-top: 1px solid var(--c-border);
  font-size: 13px;
}
.score-factor:first-child { border-top: 0; }
.score-factor__detail { font-size: 12px; }
.score-factor__score { font-variant-numeric: tabular-nums; min-width: 50px; text-align: right; }

/* ─── DCF Valuation tab — 2-col layout (inputs vlevo, output vpravo) ─── */
.dcf__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}
@media (max-width: 1024px) {
  .dcf__layout { grid-template-columns: 1fr; }
}
.dcf__inputs { display: flex; flex-direction: column; gap: var(--sp-3); }
.dcf__output { display: flex; flex-direction: column; gap: var(--sp-3); }
.dcf__chart { padding: var(--sp-3); background: var(--c-bg-soft); border-radius: var(--r-md); }

/* Field uvnitř DCF má suffix v label řádku (např. "Roční růst FCF [%]") */
.dcf-field { gap: 4px; }
.dcf-field .field__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  text-transform: none;       /* override globální uppercase pro field__label */
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-fg);
}
.dcf-field__suffix {
  font-family: var(--font-mono);
  color: var(--c-fg-muted);
  font-weight: 400;
  font-size: 11px;
  text-transform: none;
}
.dcf-field__hint {
  font-size: 11px;
  color: var(--c-fg-faint);
  line-height: 1.3;
  margin-top: 2px;
}

/* Result tile — 2-col grid, hlavní (intrinsic) je hero, ostatní small. */
.dcf-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--c-bg-soft);
  border-radius: var(--r-md);
}
.dcf-result__row { display: flex; flex-direction: column; gap: 4px; }
.dcf-result__row--hero { grid-column: 1 / -1; }
.dcf-result__row--margin { grid-column: 1 / -1; }
.dcf-result__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-fg-muted);
  font-weight: 600;
}
.dcf-result__value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--c-fg-strong);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.dcf-result__value--sm { font-size: 18px; font-weight: 600; }
.dcf-result__currency { font-size: 12px; color: var(--c-fg-muted); font-weight: 500; }

.dcf-row-total td { border-top: 2px solid var(--c-border); padding-top: 10px; }
.dcf-row-final td { border-top: 1px solid var(--c-border); background: var(--c-bg-soft); }

/* Vzorec footer */
.dcf-formula {
  padding: var(--sp-3);
  background: var(--c-bg-soft);
  border-left: 3px solid var(--c-primary-500);
  border-radius: var(--r-sm);
}
.dcf-formula__title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-fg-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.dcf-formula__code {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--c-fg-strong);
  display: block;
  margin-bottom: 4px;
}
.dcf-formula__legend { font-size: 12px; }

/* ─── FX comparison legend (3-row table pod bar chartem) ─── */
.fx-comparison-legend {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-1);
  font-variant-numeric: tabular-nums;
}
.fx-comparison-legend__item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: var(--sp-3);
  align-items: baseline;
  padding: var(--sp-1) 0;
  border-bottom: 1px solid var(--c-border);
}
.fx-comparison-legend__item:last-child { border-bottom: 0; }

/* ─── Popover (Radix) — nastavení karet, dropdowny ─── */
.popover {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  width: min(320px, 92vw);
  z-index: 1000;
  outline: 0;
  animation: popover-in var(--t-fast) var(--ease-spring);
}
.popover__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--sp-3);
}
.popover__arrow {
  fill: var(--c-bg-elev);
  stroke: var(--c-border-strong);
}
@keyframes popover-in {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ─── News list (portfolio news) ─── */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0 var(--sp-2) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-height: 520px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.news-list::-webkit-scrollbar { width: 8px; }
.news-list::-webkit-scrollbar-thumb {
  background: var(--c-border-strong);
  border-radius: 4px;
}
.news-list::-webkit-scrollbar-thumb:hover { background: var(--c-fg-faint); }
.news-list::-webkit-scrollbar-track { background: transparent; }
.news-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-column-gap: var(--sp-3);
  grid-row-gap: 4px;
  padding: var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-bg-elev-2);
  transition: border-color var(--t-fast);
}
.news-item:hover { border-color: var(--c-border-strong); }
.news-item .health { grid-row: 1 / span 1; align-self: start; }
.news-item__title {
  grid-column: 2;
  font-weight: 600;
  color: var(--c-fg-strong);
  text-decoration: none;
  line-height: 1.35;
}
.news-item__title:hover { color: var(--c-primary-400); }
.news-item__summary { grid-column: 2; margin: 0; }
.news-item__meta    { grid-column: 2; margin: 0; font-size: 11.5px; }

.timeframe-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--c-bg-soft);
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
}
.timeframe-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font: 500 12px/1 inherit;
  color: var(--c-fg-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}
.timeframe-btn:hover { color: var(--c-fg); }
.timeframe-btn.is-active {
  background: var(--c-bg-elev);
  color: var(--c-fg);
  box-shadow: var(--shadow-sm);
}

.tabs--inline { border-bottom: 0; gap: 4px; }
.tabs--scroll {
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: thin;
  max-width: 100%;
}
.tabs--scroll .tab {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ─── Goal tracker (Cesta k cíli) ─── */
.goal-block {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
}
.goal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-3);
}
.goal-row strong { font-variant-numeric: tabular-nums; }
.goal-progress {
  width: 100%;
  height: 12px;
  background: var(--c-bg-soft);
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  overflow: hidden;
}
.goal-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary-500), var(--c-primary-700));
  border-radius: var(--r-full);
  transition: width var(--t-medium) var(--ease-out);
}

/* ─── Projection controls ─── */
.projection-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-4);
  align-items: end;
  padding: var(--sp-3) 0 var(--sp-4);
}
.field--sm { gap: 4px; }
.field--sm .field__label { font-size: 11px; }
.field--sm .input { padding: 6px 10px; font-size: 13px; max-width: 140px; }

/* ─── Settings ─── */
.settings-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--c-border);
}
.settings-row:last-child { border-bottom: 0; }
.settings-row__main { flex: 1; min-width: 0; }
.settings-row__main strong { font-size: 14px; color: var(--c-fg); }
.settings-row__main p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; }

/* iOS-style toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider {
  position: absolute;
  inset: 0;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: 9999px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.switch__slider::before {
  content: '';
  position: absolute;
  width: 27px;
  height: 27px;
  top: 1px; left: 1px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--t-fast) var(--ease-out);
}
.switch input:checked + .switch__slider {
  background: var(--c-primary-500);
  border-color: var(--c-primary-500);
}
.switch input:checked + .switch__slider::before { transform: translateX(20px); }
.switch input:focus-visible + .switch__slider { box-shadow: var(--shadow-glow); }

/* Segmented control (TWR / MWR) */
.seg {
  display: inline-flex;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 3px;
  gap: 2px;
}
.seg__btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font: 600 12px/1 inherit;
  color: var(--c-fg-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}
.seg__btn:hover { color: var(--c-fg); }
.seg__btn.is-active {
  background: var(--c-bg-elev);
  color: var(--c-fg);
  box-shadow: var(--shadow-sm);
}

.input-row {
  display: flex;
  gap: var(--sp-2);
  align-items: stretch;
}
.input-row .input { flex: 1; }
.settings-share-link { padding: var(--sp-3) 0; }

/* Shared portfolio detail */
.shared-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  padding: var(--sp-3) 0 var(--sp-5);
}
@media (max-width: 768px) {
  .shared-detail-grid { grid-template-columns: 1fr; }
}
.list-bare { list-style: none; padding: 0; margin: 0; }
.list-bare li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
}
.list-bare li:last-child { border-bottom: 0; }

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
