/* Číselný font: FreeMono (self-hosted) – prázdná nula (bez lomítka/tečky),
   jasně odlišená od osmičky. Subset latinka+čeština+interpunkce, formát woff. */
@font-face {
  font-family: "FreeMono";
  src: url("fonts/FreeMono.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "FreeMono";
  src: url("fonts/FreeMonoBold.woff") format("woff");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* =========================================================================
   styles.css — Vzhled obchodního deníku
   -------------------------------------------------------------------------
   Tmavý/světlý režim řízený atributem data-theme na <html>. Přepínání jen
   přes CSS proměnné. Akcent: tlumená zlatá (peníze) — záměrně oddělená od
   zelené/červené, které jsou rezervované pro zisk/ztrátu.
   ========================================================================= */

/* ------------------------------- Témata --------------------------------- */
:root[data-theme="dark"] {
  --bg:        #0e1014;
  --bg-2:      #14171d;
  --surface:   #181c24;
  --surface-2: #1f2530;
  --border:    #262c38;
  --grid:      #232a36;
  --text:      #e8eaef;
  --text-dim:  #95a0b3;
  --accent:    #d7a94b;
  --accent-dim:#3a2f17;
  --btn-hover: #ecc066;
  --pos:       #3fb868;
  --neg:       #ff4d5a;
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  /* Stavy řádků tabulek (laděno tak, aby tmavý režim vypadal jako dosud) */
  --row-line:     #262c38;
  --row-hover:    #1f2530;
  --row-selected: #37332a;
}
:root[data-theme="light"] {
  --bg:        #f4f1ea;
  --bg-2:      #ece7dc;
  --surface:   #fffdf8;
  --surface-2: #f6f2e9;
  --border:    #e0d9c9;
  --grid:      #d2c8af;
  --text:      #20242c;
  --text-dim:  #6b7280;
  --accent:    #b07c1f;
  --accent-dim:#f0e4c6;
  --btn-hover: #c8932b;
  --pos:       #1f9d57;
  --neg:       #d61c2b;
  --shadow:    0 8px 24px rgba(60,50,30,.12);
  /* Stavy řádků tabulek – výrazně kontrastnější než béžové pozadí */
  --row-line:     #d0c5a9;
  --row-hover:    #ebe1c8;
  --row-selected: #e8d49f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  transition: background .25s ease, color .25s ease;
}
.num, .tile-value, td.num, .mono { font-family: "FreeMono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: "Sora", system-ui, sans-serif; font-weight: 600; letter-spacing: -.01em; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.zero, .muted { color: var(--text-dim); }
.hidden { display: none !important; }

/* ----------------------------- Načítací pruh ---------------------------- */
#loading-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 200;
  background: var(--accent); transition: width .3s ease, opacity .3s; opacity: 0;
}
#loading-bar.active { width: 90%; opacity: 1; transition: width 8s ease; }

/* -------------------------------- Hlavička ------------------------------ */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; background: var(--bg-2);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #8a6312);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-family: "Sora";
}
#app-title { font-size: 17px; margin: 0; }
header .ctrl {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 11px; cursor: pointer; font-size: 13px;
  transition: border-color .2s, background .2s;
}
header .ctrl:hover { border-color: var(--accent); }
/* Tlačítko pauzy cen: běží = zelené, pozastaveno = červené (id přebíjí header .ctrl). */
#price-pause.running { color: var(--pos); border-color: var(--pos); }
#price-pause.paused  { color: var(--neg); border-color: var(--neg); }
#price-pause.running:hover, #price-pause.paused:hover { border-color: var(--accent); }
#portfolio-select { min-width: 96px; max-width: 140px; }
#theme-toggle { font-size: 15px; line-height: 1; }
#settings-toggle { font-size: 15px; line-height: 1; }
.icon-only { width: 38px; text-align: center; padding: 8px 0; }

/* ------------------------------ Demo banner ----------------------------- */
#demo-banner {
  background: var(--accent-dim); color: var(--text);
  border-bottom: 1px solid var(--accent);
  padding: 8px 18px; font-size: 12.5px; text-align: center;
}

/* -------------------------------- Layout -------------------------------- */
.layout { display: grid; grid-template-columns: 190px 1fr; align-items: start; }
#sidebar {
  position: sticky; top: 56px; align-self: start;
  height: calc(100vh - 56px); overflow-y: auto;
  border-right: 1px solid var(--border); background: var(--bg-2);
  padding: 16px 14px;
}
main { padding: 18px 20px 60px; min-width: 0; }
.section { margin-bottom: 26px; }
.section > h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-dim); margin: 0 0 12px;
}

/* -------------------------------- Filtry -------------------------------- */
.filter-group { margin-bottom: 16px; }
.filter-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #15110a; font-weight: 600; }
.filter-date {
  width: 100%; max-width: 158px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 7px 9px; font-size: 12.5px;
}
.radios { display: flex; flex-direction: column; gap: 5px; }
.radio { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 9px; padding: 9px 14px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn-accent { background: var(--accent); color: #15110a; border-color: var(--accent); font-weight: 600; }
.btn-accent:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn.disabled { opacity: .4; pointer-events: none; }
.full { width: 100%; }

/* Hlavička sekce filtrů: nadpis vlevo, malé „Zrušit filtry" vpravo. */
.filters-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.filters-head > h2 { margin: 0; }
/* Kompaktní varianta tlačítka „Zrušit filtry" (užší než plné .btn). */
.btn-reset { padding: 5px 9px; font-size: 11.5px; white-space: nowrap; }

/* ------------------------------ Dashboard ------------------------------- */
.dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#fx-rate { font-size: 12.5px; color: var(--text-dim); font-family: "FreeMono"; }
#dashboard-grid, #open-positions-grid, #watchlist-grid {
  display: grid; gap: 12px; margin-top: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 15px; position: relative;
  animation: rise .45s ease both;
}
.tile::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); opacity: .5;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tile-label { font-size: 11.5px; color: var(--text-dim); line-height: 1.2; }
.tile-value { font-size: 22px; font-weight: 600; margin-top: 8px; }
.tile-sub { font-size: 13px; font-weight: 700; margin-top: 4px; font-family: "FreeMono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* Tooltip ⓘ */
.info { position: relative; cursor: help; }
.info-dot { color: var(--text-dim); font-size: 12px; }
.info:hover .info-dot, .info.open .info-dot { color: var(--accent); }
.tooltip {
  position: absolute; right: 0; top: 22px; z-index: 80; width: 230px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 11px; font-size: 12px; line-height: 1.4;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity .15s, transform .15s; font-family: "IBM Plex Sans";
}
.info:hover .tooltip, .info:focus-within .tooltip, .info.open .tooltip { opacity: 1; transform: none; pointer-events: auto; }
.info:focus { outline: none; }
.info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* -------------------------------- Grafy --------------------------------- */
.charts-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.chart-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px;
}
.chart-card h3 { font-size: 13px; margin: 0 0 10px; color: var(--text-dim); font-weight: 500; }
.chart-box { position: relative; height: 240px; }

/* -------------------------------- Taby ---------------------------------- */
.tabs-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  border-radius: 9px; padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.tab:hover { border-color: var(--accent); color: var(--text); }
.tab.active { background: var(--accent-dim); color: var(--text); border-color: var(--accent); }
.tabs-bar .spacer { margin-left: auto; }
.tab[draggable="true"] { cursor: grab; }
.tab.dragging { opacity: .45; cursor: grabbing; }

/* ------------------------------- Tabulky -------------------------------- */
.table-scroll { max-height: 70vh; overflow: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-dim);
  text-align: left; padding: 9px 11px; font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
}
thead th.num { text-align: right; }
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
thead th.sort-asc::after { content: " ▲"; color: var(--accent); font-size: 9px; }
thead th.sort-desc::after { content: " ▼"; color: var(--accent); font-size: 9px; }
tbody td { padding: 8px 11px; border-bottom: 1px solid var(--row-line); white-space: nowrap; }
tbody td.num { text-align: right; font-weight: 700; }  /* tučné hodnoty čísel ve všech kartách (FreeMonoBold) */
tbody tr:hover { background: var(--row-hover); }
/* Tabulka Obchody: klik = výběr/zrušení řádku, dvojklik = úprava */
#trades-body tr { cursor: pointer; }
#trades-body tr.selected td,
#trades-body tr.selected:hover td { background: var(--row-selected); }
#trades-body tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.totals-row td {
  position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); font-weight: 700;
  border-top: 2px solid var(--accent); border-bottom: none; white-space: nowrap;
  padding: 8px 11px; /* stejné jako tbody td, aby čísla lícovala se sloupci */
}
.totals-row td.num { text-align: right; }
td.empty { text-align: center; color: var(--text-dim); padding: 28px; }

/* Otevřené pozice */
#open-positions-grid .tile-info::before { opacity: .25; }
#open-positions-grid .tile-info .tile-value { font-size: 16px; font-weight: 600; }
.open-row { background: linear-gradient(90deg, var(--accent-dim) 0%, transparent 60%); }
.open-row:hover { background: var(--row-hover); }
.badge-open {
  display: inline-block; margin-left: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .06em;
  background: var(--accent); color: #15110a; border-radius: 5px; padding: 1px 6px; font-family: "IBM Plex Sans";
}
.pulse { animation: pulse .7s ease; }
@keyframes pulse { 0% { background: var(--accent); color: #15110a; } 100% { background: transparent; } }

/* Dashboard – přetahování dlaždic (změna pořadí) */
#dashboard-grid .tile[draggable="true"] { cursor: grab; }
#dashboard-grid .tile[draggable="true"]:active { cursor: grabbing; }
#dashboard-grid .tile.dragging { opacity: .45; cursor: grabbing; }
#dashboard-grid .tile .info { cursor: help; } /* tooltip ⓘ má vlastní kurzor */

/* Otevřené pozice + watchlist – přetahování dlaždic (změna pořadí) */
#open-positions-grid .tile[draggable="true"],
#watchlist-grid .tile[draggable="true"] { cursor: grab; }
#open-positions-grid .tile[draggable="true"]:active,
#watchlist-grid .tile[draggable="true"]:active { cursor: grabbing; }
#open-positions-grid .tile.dragging,
#watchlist-grid .tile.dragging { opacity: .45; cursor: grabbing; }

/* Otevřené opce – strike barvená dle rizika přiřazení (.pos/.neg) */
#open-positions-grid [data-opt="strike"] { font-weight: 600; }

/* Watchlist (sledované tituly na dashboardu) */
.wl-head { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; }
.wl-head .subhead { margin: 0; }
.wl-add-btn { font-size: 12px; padding: 5px 11px; }
#watchlist-grid .tile-value { font-size: 18px; }
.wl-remove { margin-left: auto; cursor: pointer; color: var(--text-dim); font-size: 16px; line-height: 1; padding: 0 2px; }
.wl-remove:hover { color: var(--neg); }
.wl-empty { font-size: 13px; padding: 4px 2px; }

/* Karta Týdny – kompaktní layout: pořadí u levého kraje, zisk hned vedle období */
#panel-weekly .table-scroll { display: inline-block; max-width: 100%; }
#panel-weekly table { width: auto; min-width: 340px; }
#panel-weekly th:first-child, #panel-weekly td:first-child { padding-left: 14px; }

/* Karta Měsíce – stejný kompaktní layout jako Týdny */
#panel-monthly .table-scroll { display: inline-block; max-width: 100%; }
#panel-monthly table { width: auto; min-width: 360px; }
#panel-monthly th:first-child, #panel-monthly td:first-child { padding-left: 14px; }

/* Součtový řádek zůstává přilepený dole i u kompaktních tabulek
   (sticky z .totals-row). Sticky hlavička na týchž tabulkách funguje, takže
   patička se chová stejně. */

/* Graf uvnitř karty: vedle tabulky (Týdny) nebo pod ní (Obchody) */
.panel-flex { display: flex; gap: 14px; align-items: stretch; }
.panel-flex > .table-scroll { flex: 0 1 auto; }
.card-chart {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px;
}
.panel-flex > .card-chart { flex: 1 1 0; min-width: 260px; }
.card-chart.below { margin-top: 14px; }
.card-chart .chart-box { position: relative; height: 100%; min-height: 320px; }
.card-chart.below .chart-box { height: 300px; min-height: 0; }
@media (max-width: 1100px) {
  .panel-flex { flex-direction: column; }
  .panel-flex > .table-scroll, .panel-flex > .card-chart { width: 100%; }
  .card-chart .chart-box { height: 300px; min-height: 0; }
}

.row-actions { white-space: nowrap; }
.icon-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 7px; width: 28px; height: 28px; cursor: pointer; margin-left: 4px; font-size: 13px;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.danger:hover { border-color: var(--neg); color: var(--neg); }

/* ------------------------- Import / Export / Set ------------------------ */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.panel h3 { margin: 0 0 4px; font-size: 14px; }
.muted { color: var(--text-dim); font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
input[type="file"] { color: var(--text-dim); font-size: 12.5px; }
.subhead { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin: 14px 0 8px; }
.import-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.imp-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; }
.imp-val { font-family: "FreeMono"; font-size: 18px; font-weight: 600; }
.imp-label { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.rec-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.rec-pill { border-radius: 999px; padding: 5px 12px; font-size: 12.5px; border: 1px solid var(--border); }
.rec-pill.ok { color: var(--pos); border-color: var(--pos); }
.rec-pill.warn { color: var(--accent); border-color: var(--accent); }
.rec-pill.muted { color: var(--text-dim); }
.mini-table { font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { font-size: 11.5px; color: var(--text-dim); }
.field input {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-family: "FreeMono"; font-size: 13px;
}

/* -------------------------------- Modál --------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 150; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal.open { display: flex; }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: min(720px, 100%); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px; }
#trade-form { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.form-back { margin-bottom: 12px; }
/* Volba typu obchodu (Akcie / Opce) – 1. krok přidání. */
.type-chooser { display: flex; flex-direction: column; gap: 14px; padding: 8px 2px 4px; }
.type-chooser-q { font-size: 14px; color: var(--text-dim); }
.type-chooser-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.type-pick { flex: 1 1 140px; padding: 22px 14px; font-size: 15px; font-weight: 600; }
.form-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); }
.form-field-full { grid-column: 1 / -1; }
.form-field input, .form-field select, .form-field textarea {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 9px; font-size: 13px;
}
.form-field textarea { min-height: 84px; resize: vertical; font-family: inherit; line-height: 1.45; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }

/* Detail obchodu (dvojklik na řádek): vysoké okno, popisky vlevo / hodnoty vpravo. */
#trade-detail-modal .modal-card { width: min(373px, 100%); max-height: 90vh; display: flex; flex-direction: column; }
#trade-detail-modal .modal-body { overflow-y: auto; }
/* Popisek vlevo, hodnota u pravého okraje; řádky přes subgrid, aby hover a výběr
   fungovaly na celý řádek a sloupce zůstaly zarovnané. */
.detail-grid { display: grid; grid-template-columns: auto 1fr; row-gap: 2px; column-gap: 24px; }
.detail-row {
  display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; align-items: baseline;
  padding: 6px 10px; border-radius: 8px; cursor: default;
}
.detail-row:hover { background: var(--row-hover); }
.detail-row.selected { background: var(--row-selected); }
.detail-label { font-size: 16px; color: var(--text-dim); }
.detail-value {
  font-size: 17px; font-weight: 700; text-align: right;
  font-family: "FreeMono", ui-monospace, monospace; font-variant-numeric: tabular-nums;
  word-break: break-word; overflow-wrap: anywhere;
}
.detail-value .badge-open { margin-left: 6px; }
/* Dole vedle sebe Upravit / Smazat, na celou šířku (pohodlný cíl i na dotyku). */
.detail-foot { justify-content: stretch; gap: 12px; }
.detail-foot .btn { flex: 1; padding: 12px; font-size: 15px; }
.btn-danger { border-color: color-mix(in srgb, var(--neg) 45%, var(--border)); color: var(--neg); }
.btn-danger:hover { background: var(--neg); border-color: var(--neg); color: #fff; }

/* ------------------------- Nastavení vzhledu (barvy) -------------------- */
/* Segmentový přepínač motivu (tmavý/světlý), který se edituje. */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg-btn { background: var(--surface); color: var(--text-dim); border: 0; padding: 7px 16px; cursor: pointer; font-size: 12.5px; font-family: inherit; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--accent-dim); color: var(--text); font-weight: 600; }
.color-grid { display: grid; gap: 2px; margin-top: 14px; }
.color-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 2px; border-bottom: 1px solid var(--border); }
.color-row:last-child { border-bottom: 0; }
.color-label { font-size: 13px; color: var(--text); }
.color-ctrls { display: flex; align-items: center; gap: 8px; }
.color-input { width: 44px; height: 28px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: none; border-radius: 6px; }
.color-input::-moz-color-swatch { border: none; border-radius: 6px; }
.color-reset { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; line-height: 1; font-size: 14px; }
.color-reset:hover { border-color: var(--accent); color: var(--accent); }
.color-foot { margin-top: 16px; display: flex; justify-content: flex-end; }

/* -------------------------------- Toast --------------------------------- */
#prices-updated { font-size: 11.5px; color: var(--text-dim); font-family: "FreeMono"; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 18px; font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 300; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-ok { border-color: var(--pos); }
.toast-error { border-color: var(--neg); }

/* ----------------------------- Skrytí panelu --------------------------- */
/* ☰ je vidět vždy (mobil i desktop). Na desktopu sbalí postranní panel. */
#filter-toggle { display: inline-flex; align-items: center; justify-content: center; }
.layout.sidebar-collapsed { grid-template-columns: 1fr; }
.layout.sidebar-collapsed > #sidebar { display: none; }

/* ------------------------------ Responzivita ---------------------------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 120;
    height: 100vh; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow);
  }
  #sidebar.open { transform: none; }
  #filter-toggle { display: inline-block; }
  .charts-row { grid-template-columns: 1fr; }
  .panel-grid { grid-template-columns: 1fr; }
  #app-title { font-size: 15px; }
}

/* ------------------- Přesouvání sloupců (drag&drop hlaviček) ------------ */
thead th[data-col-key] { cursor: grab; }
thead th[data-col-key]:active { cursor: grabbing; }
thead th.col-dragging { opacity: .5; background: var(--accent-dim); }

/* ------------------------------- Karta Vklady --------------------------- */
/* Stejný kompaktní layout jako Týdny/Měsíce: tabulka dle obsahu, graf vedle. */
#panel-deposits .table-scroll { display: inline-block; max-width: 100%; }
#panel-deposits table { width: auto; min-width: 480px; }
#panel-deposits th:first-child, #panel-deposits td:first-child { padding-left: 14px; }

/* ------------------------------ Karta Poznámky -------------------------- */
.notes-layout { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.notes-sidebar { display: flex; flex-direction: column; gap: 10px; }
.notes-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 64vh; overflow: auto;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 8px;
}
.notes-empty { padding: 16px 10px; text-align: center; font-size: 12.5px; }
.note-item {
  border: 1px solid transparent; border-radius: 10px; padding: 9px 11px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.note-item:hover { background: var(--row-hover); }
.note-item.active { background: var(--row-selected); border-color: var(--accent); }
.note-item-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item-date { font-size: 11px; color: var(--text-dim); font-family: "FreeMono", monospace; margin-top: 2px; }

.notes-editor {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  padding: 16px; min-height: 64vh; display: flex; flex-direction: column;
}
.notes-empty-state { display: flex; align-items: center; justify-content: center; flex: 1; text-align: center; font-size: 13px; }
.note-title-input {
  width: 100%; box-sizing: border-box; background: transparent; border: none;
  color: var(--text); font-family: "Sora", sans-serif; font-size: 20px; font-weight: 600;
  padding: 2px 0; border-bottom: 1px solid var(--border);
}
.note-title-input:focus { outline: none; border-bottom-color: var(--accent); }
.note-meta { font-size: 11.5px; color: var(--text-dim); font-family: "FreeMono", monospace; margin: 8px 0 12px; }

.note-toolbar { display: flex; flex-wrap: wrap; gap: 5px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.note-tool {
  min-width: 34px; height: 32px; padding: 0 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.note-tool:hover { border-color: var(--accent); }
.note-tool:active { background: var(--accent-dim); }
.note-color-wrap { position: relative; padding: 0; overflow: hidden; }
.note-color-glyph { font-weight: 700; font-size: 14px; border-bottom: 3px solid currentColor; line-height: 1.1; pointer-events: none; }
.note-color { position: absolute; inset: 0; opacity: 0; cursor: pointer; border: none; padding: 0; }
.note-size { padding: 0 6px; font-size: 13px; font-family: inherit; appearance: none; -webkit-appearance: none; text-align: center; }
.note-size:hover { border-color: var(--accent); }
.note-size option { background: var(--surface-2); color: var(--text); }

.note-content {
  flex: 1; min-height: 260px; margin-top: 12px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 14px; line-height: 1.55; overflow: auto;
}
.note-content:focus { outline: none; border-color: var(--accent); }
.note-content ul, .note-content ol { padding-left: 22px; margin: 6px 0; }
.note-content:empty::before { content: ""; }

.note-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.note-status { font-size: 11.5px; }

@media (max-width: 900px) {
  .notes-layout { grid-template-columns: 1fr; }
  .notes-list { max-height: 34vh; }
  .notes-editor { min-height: 0; }
}

/* ------------------------------- Mozek (karta) ------------------------- */
.brain-layout { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.brain-main {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  padding: 16px; min-height: 64vh; display: flex; flex-direction: column;
}
.brain-main-head { display: flex; align-items: center; gap: 12px; }
.brain-crumb { flex: 1; font-family: "Sora", sans-serif; font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brain-crumb.muted { color: var(--text-dim); font-weight: 400; }

.brain-capacity { margin: 12px 0 4px; }
.brain-cap-bar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.brain-cap-fill { height: 100%; background: var(--accent); transition: width .3s ease; }
.brain-cap-fill.full { background: #c0492f; }
.brain-cap-text { font-size: 11.5px; font-family: "FreeMono", monospace; margin-top: 5px; }

.brain-del-btn:not(:disabled) { border-color: #c0492f; color: #c0492f; }
.brain-del-btn:not(:disabled):hover { background: #c0492f; color: #fff; border-color: #c0492f; }
.brain-files { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; overflow: auto; flex: 1; }
.brain-hint { font-size: 11px; margin-top: 8px; }
.brain-empty { padding: 24px 10px; text-align: center; font-size: 13px; }
.brain-file {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; cursor: grab;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  user-select: none; -webkit-user-select: none;
}
.brain-file:active { cursor: grabbing; }
.brain-file.selected { background: var(--row-selected); border-color: var(--accent); }
.brain-file-icon { font-size: 18px; line-height: 1; }
.brain-file-info { flex: 1; min-width: 0; }
.brain-file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brain-file-meta { font-size: 11px; font-family: "FreeMono", monospace; margin-top: 2px; }

.brain-sidebar { display: flex; flex-direction: column; gap: 10px; }
.brain-folders {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 64vh; overflow: auto;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 8px;
}
.brain-folder {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px; cursor: pointer;
  border: 1px solid transparent; border-radius: 10px; transition: background .12s, border-color .12s;
}
.brain-folder.sub { margin-left: 16px; }
.brain-folder.sub::before { content: "↳"; color: var(--text-dim); font-size: 12px; }
.brain-folder:hover { background: var(--row-hover); }
.brain-folder.active { background: var(--row-selected); border-color: var(--accent); }
.brain-folder.drag-over { background: var(--accent-dim); border-color: var(--accent); border-style: dashed; }
.brain-folder-name { flex: 1; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brain-folder-acts { display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.brain-folder:hover .brain-folder-acts, .brain-folder.active .brain-folder-acts { opacity: 1; }
.brain-mini {
  min-width: 26px; height: 26px; padding: 0 5px; font-size: 12px; line-height: 1;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.brain-mini:hover { border-color: var(--accent); }

@media (max-width: 900px) {
  .brain-layout { grid-template-columns: 1fr; }
  .brain-main { min-height: 0; }
  .brain-folders { max-height: 34vh; }
}

/* ----------------------- Správa viditelnosti dlaždic -------------------- */
.tiles-list { display: flex; flex-direction: column; gap: 2px; max-height: 56vh; overflow: auto; }
.tile-toggle-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 8px; cursor: pointer; }
.tile-toggle-row:hover { background: var(--surface-2); }
.tile-toggle-row input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
#tiles-modal-hint { margin: 0 0 10px; }

/* -------- Výrazné „Zrušit filtry" v hlavičce (jen při aktivním filtru) --- */
/* Silnější selektor, ať přebije header .ctrl (jinak se styl neprojeví). */
header .ctrl.btn-clear-filters {
  background: var(--neg);
  color: #fff;
  border-color: var(--neg);
  font-weight: 600;
  white-space: nowrap;
}
header .ctrl.btn-clear-filters:hover {
  background: var(--neg);
  border-color: var(--neg);
  filter: brightness(1.08);
}

/* --------------- Čistý celkový zisk v hlavičce (vedle názvu) ------------- */
.header-pnl {
  font-family: "FreeMono", monospace;
  font-weight: 600;
  font-size: 14px;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.header-pnl.pos { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 45%, var(--border)); }
.header-pnl.neg { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 45%, var(--border)); }
@media (max-width: 640px) { .header-pnl { display: none; } }

/* ------------------------------ Záloha .xlsm ---------------------------- */
#backup-list { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.backup-row {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
}
.backup-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.backup-slot { font-weight: 600; font-size: 12px; color: var(--accent); }
.backup-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-when { font-size: 12px; }
.backup-dl { white-space: nowrap; text-decoration: none; text-align: center; }

/* ----------------------- Odpočet NYSE (střed hlavičky) ------------------ */
.nyse-countdown {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  font-family: "FreeMono", monospace; white-space: nowrap;
  pointer-events: none;  /* ať nepřekáží ovládacím prvkům v hlavičce */
}
.nyse-countdown .nyse-label { color: var(--text-dim); font-size: 12px; }
.nyse-countdown .nyse-time { font-weight: 700; font-size: 15px; }
.nyse-countdown .nyse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.nyse-countdown.open .nyse-dot { background: var(--pos); }
.nyse-countdown.open .nyse-time { color: var(--pos); }
/* Tablet/užší okna: zařadit odpočet do toku hlavičky, ať nepřekrývá tlačítka.
   Práh 1400px pokrývá i iPad Pro 12.9" v landscape (1366px). */
@media (max-width: 1400px) {
  .nyse-countdown { position: static; left: auto; transform: none; pointer-events: auto; }
}
@media (max-width: 700px) { .nyse-countdown { display: none; } }

/* ----------------------------- Přihlášení ------------------------------- */
/* Celostránkový overlay; po ověření tokenu se schová třídou .hidden. */
.auth-overlay {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: min(360px, 100%);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 30px 26px; text-align: center;
}
.auth-logo {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: #15110a;
  background: linear-gradient(135deg, var(--accent), #8a6312);
}
.auth-card h2 { margin: 0 0 4px; font-size: 19px; }
.auth-sub { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; }
.auth-input {
  width: 100%; box-sizing: border-box; margin-bottom: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 11px 12px; font-size: 14px;
}
.auth-input:focus { outline: none; border-color: var(--accent); }
.auth-btn { width: 100%; padding: 11px; font-size: 14px; margin-top: 4px; }
.auth-error { color: var(--neg); font-size: 12.5px; min-height: 18px; margin: 2px 0 8px; }
#account-modal .form-field label { font-size: 12px; color: var(--text-dim); }

/* ============================== ETF (koše) ============================== */
.etf-top { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.etf-baskets, .etf-composition { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.etf-baskets-head, .etf-comp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.etf-baskets-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.etf-baskets-actions .icon-only { padding: 6px 9px; }
.etf-comp-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.etf-comp-titles .subhead { display: inline; }
.etf-comp-note { font-size: 12px; max-width: 60ch; white-space: normal; }
.etf-comp-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.etf-comp-actions .icon-only { padding: 6px 9px; }
.etf-scroll { max-height: 46vh; }
.etf-num { text-align: right; font-family: "FreeMono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
thead th.etf-num { text-align: right; }
.etf-baskets thead th.etf-th-center,
.etf-composition thead th.etf-th-center { text-align: right; }
.etf-baskets .etf-updown { white-space: nowrap; }
/* Tučné hodnoty ve všech tabulkách ETF (tělo). Čísla → FreeMonoBold (700). */
.etf-baskets tbody td, .etf-composition tbody td { font-weight: 700; }
.etf-mover { font-weight: 700; }
/* Symbol je klikací = přejmenování firmy (sloupec Název je v tabulce zrušen). */
.etf-sym-cell { cursor: pointer; }
.etf-sym-cell:hover { color: var(--accent); }
/* Více oken výkonnosti (1T/1M/3M/6M/1R) → užší sloupce ve složení. */
.etf-composition tbody td, .etf-composition thead th { padding-left: 7px; padding-right: 7px; }
.etf-composition .etf-num { font-size: 12px; }
.etf-baskets tbody tr { cursor: pointer; }
.etf-baskets tbody tr.etf-selected td { background: var(--accent-dim); }
.etf-baskets tbody tr.etf-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* Řádky složení jsou klikací = přepínání křivky akcie na grafu; vybrané (na grafu)
   se zvýrazní stejně jako vybrané ETF. Mazání vybraných řeší koš v hlavičce. */
.etf-composition tbody tr { cursor: pointer; }
.etf-composition tbody tr.etf-comp-selected td { background: var(--accent-dim); }
.etf-composition tbody tr.etf-comp-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.etf-mover { color: var(--text-dim); }
.etf-name-cell { cursor: text; }
/* Sloupce „Vytvořeno" a „Poznámky" (obě tabulky ETF). Poznámka je editovatelná
   klikem (prompt), dlouhý text se ořízne s výpustkou. */
.etf-created { white-space: nowrap; text-align: right; }
.etf-note-cell { cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.etf-note-cell.etf-note-empty { text-align: right; }

.etf-chart .etf-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.etf-chart-val { font-size: 20px; font-weight: 600; font-family: "FreeMono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
/* Vlastní legenda vlevo nahoře: řádky [značka] [název] [výkonnost]. */
.etf-legend { display: inline-grid; grid-template-columns: auto auto auto; gap: 3px 8px; align-items: center; }
.etf-legend-row { display: contents; }   /* dot/název/% se zařadí přímo do gridu → % v jednom sloupci */
.etf-legend-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.etf-legend-name { font-size: 14px; font-weight: 600; color: var(--text); font-family: "IBM Plex Sans", system-ui, sans-serif; }
.etf-legend-ret { font-size: 18px; font-weight: 600; margin-left: 2px; font-family: "FreeMono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.etf-range { display: flex; gap: 4px; flex-wrap: wrap; }
.etf-range button {
  padding: 5px 9px; font-size: 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  font-family: "FreeMono", ui-monospace, monospace;
}
.etf-range button:hover { border-color: var(--accent); color: var(--text); }
.etf-range button.active { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }

@media (max-width: 1100px) {
  .etf-top { grid-template-columns: 1fr; }
  .etf-scroll { max-height: 38vh; }
}

/* ============================ Zprávy (karta) ============================ */
.news-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
/* Přepínač pohledů Portfolio / Ticker. */
.news-views { display: inline-flex; gap: 4px; }
.news-view {
  padding: 6px 12px; font-size: 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}
.news-view:hover { border-color: var(--accent); color: var(--text); }
.news-view.active { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }
.news-search { display: inline-flex; gap: 6px; align-items: center; }
.news-search input {
  padding: 6px 9px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; width: 160px;
  text-transform: uppercase;
}
.news-search input:focus { outline: none; border-color: var(--accent); }
.news-status { font-size: 12px; }
.news-status.news-error { color: var(--neg); }

/* Vlastní přepínací tlačítka tickerů (vedle Portfolio / Ticker). Pill se
   štítkem + ✕; aktivní se zvýrazní stejně jako .news-view.active. */
.news-tk {
  display: inline-flex; align-items: center; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); overflow: hidden;
}
.news-tk:hover { border-color: var(--accent); }
.news-tk.active { background: var(--accent-dim); border-color: var(--accent); }
.news-tk-label {
  border: none; background: transparent; cursor: pointer; color: var(--text-dim);
  font-size: 13px; font-weight: 700; padding: 6px 4px 6px 10px;
  font-family: "FreeMono", ui-monospace, monospace;
}
.news-tk.active .news-tk-label,
.news-tk:hover .news-tk-label { color: var(--text); }
.news-tk-x {
  border: none; background: transparent; cursor: pointer; color: var(--text-dim);
  font-size: 12px; line-height: 1; padding: 6px 8px 6px 4px;
}
.news-tk-x:hover { color: var(--neg); }

/* Pauza aktualizace zpráv (na kartě). Běží = zelené, pozastaveno = červené. */
#news-pause {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 11px; cursor: pointer; font-size: 13px;
  transition: border-color .2s, background .2s;
}
#news-pause.running { color: var(--pos); border-color: var(--pos); }
#news-pause.paused  { color: var(--neg); border-color: var(--neg); }
#news-pause:hover { border-color: var(--accent); }

/* Stáří zprávy – výrazně, zeleně a tučně (jako kladné hodnoty). */
.news-age { color: var(--pos); font-weight: 700; }

/* Seznam zpráv – karty pod sebou. */
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-empty { padding: 24px 4px; text-align: center; }
.news-card {
  position: relative;
  display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
}
.news-card:hover { border-color: var(--accent); }
/* Nová zpráva (od posledního zobrazení karty): jemné tónování, accent rámeček
   a tečka v rohu. Klik do karty mimo odkaz značku sundá (viz app.js). */
.news-card.news-new { border-color: var(--accent); background: var(--accent-dim); }
.news-card.news-new::after {
  content: ""; position: absolute; top: 9px; right: 11px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.news-thumb {
  width: 96px; height: 64px; object-fit: cover; border-radius: 8px; flex: none;
  background: var(--surface-2);
}
.news-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.news-headline {
  font-size: 15px; font-weight: 600; color: var(--text); text-decoration: none;
  font-family: "IBM Plex Sans", system-ui, sans-serif; line-height: 1.35;
}
.news-headline:hover { color: var(--accent); text-decoration: underline; }
/* Meta řádek: ticker · zdroj · poskytovatel · čas. */
.news-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--text-dim); }
.news-tag {
  font-weight: 700; color: var(--accent); font-family: "FreeMono", ui-monospace, monospace;
}
.news-provider {
  text-transform: uppercase; letter-spacing: .04em; font-size: 11px;
  padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-dim);
}
.news-when { font-family: "FreeMono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.news-summary { font-size: 13px; color: var(--text-dim); line-height: 1.4; }

@media (max-width: 700px) {
  .news-thumb { width: 72px; height: 54px; }
  .news-search input { width: 120px; }
}

/* ====================== AI analýza zprávy (tlačítko + modal) ============== */
/* Malé tlačítko „AI" v meta řádku karty zprávy. */
.news-ai-btn {
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); background: transparent;
  border: 1px solid var(--accent); border-radius: 6px;
  padding: 1px 7px; cursor: pointer; line-height: 1.5;
  transition: background .15s, color .15s;
}
.news-ai-btn:hover { background: var(--accent); color: #15110a; }

/* Modal analýzy – širší, vlastní křížek, scroll uvnitř těla. */
.news-ai-modal .modal-card { width: min(720px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.news-ai-body { overflow-y: auto; }
.news-ai-x {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.news-ai-x:hover { color: var(--text); background: var(--surface-2); }

.news-ai-loading { padding: 22px 2px; text-align: center; color: var(--text-dim); }
.news-ai-error { padding: 14px 2px; color: var(--neg); }
.news-ai-partial {
  font-size: 12.5px; color: var(--text-dim); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; margin-bottom: 12px;
}

/* Vykreslený text analýzy. */
.news-ai-content { line-height: 1.5; }
.news-ai-h { margin: 16px 0 6px; font-size: 14px; color: var(--accent); font-family: "Sora", system-ui, sans-serif; }
.news-ai-h:first-child { margin-top: 0; }
.news-ai-p { margin: 0 0 9px; }
.news-ai-ul { margin: 0 0 10px; padding-left: 20px; }
.news-ai-ul li { margin: 3px 0; }

/* Patička: vlevo přepínač poskytovatele + model, vpravo kopírovat/zavřít. */
.news-ai-foot { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.news-ai-foot-left { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.news-ai-foot-right { display: inline-flex; align-items: center; gap: 10px; }
.news-ai-prov {
  font: inherit; font-size: 12px; cursor: pointer; padding: 5px 11px; border-radius: 8px;
  background: var(--surface); color: var(--text-dim); border: 1px solid var(--border);
  transition: border-color .15s, color .15s, background .15s;
}
.news-ai-prov:hover { border-color: var(--accent); color: var(--text); }
.news-ai-prov.active { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }
.news-ai-model { font-size: 11px; color: var(--text-dim); font-family: "FreeMono", ui-monospace, monospace; }

@media (max-width: 700px) {
  .news-ai-foot { justify-content: flex-start; }
}
