/* fx-podproc – svetlý, pracovný dizajn zameraný na programy a profily */
:root {
  --bg: #F4F5F2;
  --card: #FFFFFF;
  --ink: #1D2421;
  --soft: #5D6863;
  --faint: #8C9590;
  --line: #E3E6E1;
  --line2: #EEF0EC;
  --accent: #1F6F5C;
  --accent-soft: #E3F0EB;
  --on: #D9572B;
  --ok: #2E8B57;
  --warn: #B7791F;
  --bad: #C0392B;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
a { color: var(--accent); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted, .hint { color: var(--faint); }
.hint { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- horná lišta ---------- */
.bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px;
  padding: calc(12px + env(safe-area-inset-top)) clamp(14px, 3vw, 32px) 12px; background: rgba(244, 245, 242, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand b { display: block; font-size: 18px; letter-spacing: -0.02em; }
.brand span { display: block; font-size: 13px; color: var(--soft); }
.logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #3B82C4 0%, #1F6F5C 50%, #D9572B 100%); }
.readbox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.readinfo { font-size: 13px; color: var(--soft); text-align: right; }
.readinfo b { color: var(--ink); font-weight: 600; }
.primary { min-height: 42px; padding: 0 18px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.primary:hover { background: #185A4A; }
.primary[disabled] { background: var(--faint); cursor: progress; }
.progress { position: relative; flex-basis: 100%; height: 26px; border-radius: 8px; background: var(--line2); overflow: hidden; }
.progress .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent-soft); transition: width .3s; }
.progress span { position: relative; display: block; padding: 0 10px; line-height: 26px; font-size: 13px; color: var(--accent); font-weight: 500; }

.notice { margin: 14px clamp(14px, 3vw, 32px) 0; padding: 10px 14px; border-radius: 10px; background: #FCEFE3; color: #7A3E12; font-size: 14px; }
.notice.bad { background: #FBE6E3; color: #7E2318; }
.notice.ok { background: var(--accent-soft); color: #164B3E; }

/* ---------- rozloženie ---------- */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; padding: 18px clamp(14px, 3vw, 32px) calc(40px + env(safe-area-inset-bottom)); max-width: 1500px; margin: 0 auto; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } .side { position: static !important; } .readinfo { text-align: left; } }
.side { position: sticky; top: 92px; align-self: start; }
.side h2 { margin: 2px 4px 10px; }
.main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.cardhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; }
.empty { color: var(--faint); padding: 30px 0; text-align: center; }
.scroll { overflow-x: auto; }

/* ---------- zoznam kanálov ---------- */
.chlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.chlist button { width: 100%; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 2px 10px; padding: 9px 12px; border: 1px solid transparent;
  border-radius: 10px; background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.chlist button:hover { background: var(--card); border-color: var(--line); }
.chlist button.sel { background: var(--card); border-color: var(--accent); box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.chlist .n { grid-row: span 2; font-size: 12px; color: var(--faint); font-family: var(--mono); }
.chlist .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chlist .t { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.chlist .sub { font-size: 12px; color: var(--faint); }
.chlist .sub2 { font-size: 12px; color: var(--faint); text-align: right; }
.flame { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-right: 5px; vertical-align: 1px; }
.flame.on { background: var(--on); box-shadow: 0 0 0 3px rgba(217, 87, 43, .15); }
.legend { margin: 16px 4px 0; font-size: 12px; color: var(--faint); }
.legend .scale { height: 8px; border-radius: 4px; margin: 6px 0 3px; }
.legend .ends { display: flex; justify-content: space-between; }

/* ---------- detail kanála ---------- */
.chhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line2); }
.chhead .title .k { font-size: 13px; color: var(--faint); font-family: var(--mono); }
.chhead .title h2 { font-size: 24px; }
.figs { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.fig .k { display: block; font-size: 12px; color: var(--faint); }
.fig .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.fig .v small { font-size: 14px; font-weight: 500; color: var(--soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--line2); color: var(--soft); }
.tag.on { background: #FBE5DC; color: #9A3412; }
.tag.warn { background: #FCF1DC; color: #8A5A0F; }
.tag.bad { background: #FBE6E3; color: #7E2318; }
.tag.ok { background: var(--accent-soft); color: #164B3E; }

/* týždenný program kanála */
.week { margin-top: 18px; }
.wrow { display: grid; grid-template-columns: 34px 74px minmax(0, 1fr); align-items: center; gap: 10px; padding: 4px 0; }
.wrow .d { font-weight: 600; color: var(--soft); }
.wrow.today .d { color: var(--accent); }
.psel { display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); font-weight: 600; font-size: 13px; color: var(--ink); cursor: not-allowed; }
.psel::after { content: "▾"; color: var(--faint); font-size: 11px; }
.psel .sw { width: 10px; height: 10px; border-radius: 3px; }
.tl { position: relative; height: 34px; border-radius: 8px; overflow: hidden; display: flex; background: var(--line2); }
.tl .seg { min-width: 3px; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.2);
  border-right: 1px solid rgba(255,255,255,.5); white-space: nowrap; overflow: hidden; }
.tl .seg:last-child { border-right: 0; }
.tl .seg.none { background: repeating-linear-gradient(135deg, #E9ECE8 0 8px, #F1F3F0 8px 16px); color: var(--faint); text-shadow: none; font-weight: 500; }
.tl .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.axis { display: grid; grid-template-columns: 34px 74px minmax(0, 1fr); gap: 10px; }
.axis .ticks { position: relative; height: 18px; font-size: 11px; color: var(--faint); font-family: var(--mono); }
.axis .ticks span { position: absolute; transform: translateX(-50%); }
.axis .ticks span:first-child { transform: none; }
.axis .ticks span:last-child { transform: translateX(-100%); }
.editnote { margin-top: 10px; font-size: 13px; color: var(--faint); }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 24px; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line2); font-size: 14px; }
.kv .k { color: var(--soft); }
.kv .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.bars { display: flex; align-items: flex-end; gap: 2px; height: 70px; margin-top: 6px; }
.bars i { flex: 1; background: #F2B49D; border-radius: 2px 2px 0 0; min-height: 1px; }
.bars i:hover { background: var(--on); }
.bars-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); font-family: var(--mono); margin-top: 3px; }

/* ---------- profily ---------- */
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.prof { border: 1px solid var(--line); border-radius: 12px; padding: 14px; transition: opacity .15s, border-color .15s; }
.prof.hl { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.prof.unused { opacity: .55; }
.prof .ph { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.prof .ph b { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
.prof .ph .sw { width: 12px; height: 12px; border-radius: 3px; }
.prof .use { font-size: 12px; color: var(--faint); margin-top: 8px; }
.prof .mini { height: 14px; border-radius: 4px; overflow: hidden; display: flex; }
.prof .mini div { height: 100%; }
.steps { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.steps td { padding: 4px 0; border-bottom: 1px solid var(--line2); font-variant-numeric: tabular-nums; }
.steps td:first-child { color: var(--faint); width: 26px; font-family: var(--mono); font-size: 12px; }
.steps td:last-child { text-align: right; font-weight: 600; }
.steps tr.off td { color: var(--faint); font-weight: 400; }

/* ---------- matica týždňa ---------- */
table.matrix { border-collapse: separate; border-spacing: 4px; font-size: 13px; }
table.matrix th { font-weight: 600; color: var(--soft); padding: 0 6px; text-align: center; }
table.matrix th.l, table.matrix td.l { text-align: left; white-space: nowrap; padding-right: 12px; }
table.matrix td.l button { border: 0; background: none; padding: 0; color: var(--ink); cursor: pointer; font: inherit; }
table.matrix td.l button:hover { color: var(--accent); }
table.matrix td.p { width: 44px; height: 30px; text-align: center; border-radius: 6px; font-weight: 600; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.2); }

/* ---------- regulátor, čítania, surové dáta ---------- */
table.runs { border-collapse: collapse; font-size: 13px; width: 100%; }
table.runs td, table.runs th { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line2); text-align: left; white-space: nowrap; }
table.runs th { color: var(--faint); font-weight: 500; }
table.runs td.msg { white-space: normal; color: var(--soft); }
details.raw { margin-top: 16px; }
details.raw summary { cursor: pointer; color: var(--soft); }
.rawlist { font-family: var(--mono); font-size: 12px; color: var(--soft); columns: 3 260px; column-gap: 24px; margin-top: 8px; }
.rawlist div { break-inside: avoid; padding: 1px 0; }
.rawlist .bad { color: var(--bad); }

/* mobil: kanály ako vodorovný pás, aby detail kanála bol hneď viditeľný */
@media (max-width: 900px) {
  .chlist { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; scroll-snap-type: x mandatory; }
  .chlist li { flex: 0 0 168px; scroll-snap-align: start; }
  .chlist button { grid-template-columns: 1fr auto; }
  .chlist .n { display: none; }
  .card { padding: 16px 14px; }
  .chlist button { background: var(--card); border-color: var(--line); }
  .legend { display: none; }
  .wrow, .axis { grid-template-columns: 26px 62px minmax(0, 1fr); gap: 6px; }
  .tl .seg { font-size: 10px; }
}

/* premenovanie kanála */
.nameline { display: flex; align-items: center; gap: 8px; }
.ren { border: 1px solid transparent; background: none; color: var(--faint); font-size: 16px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.ren:hover { border-color: var(--line); color: var(--accent); background: var(--accent-soft); }
.renform { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.renform input { font: inherit; font-size: 18px; font-weight: 600; padding: 6px 10px; border: 1px solid var(--accent); border-radius: 8px; min-width: 220px; }
.primary.small { min-height: 38px; padding: 0 14px; }
.ghost { min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }

[hidden] { display: none !important; }
