/* Barvy podle panelů PID (ROPID, příloha 3): pozadí 25/50/100, autobus 0-120-160, výluky 255-170-30 */
:root {
  --a: #191919; --b: #323232; --c: #646464; --d: #969696; --stop: #b4b4b4;
  --bus: #0078a0; --amber: #ffaa1e; --red: #dc2828; --green: #d2d70f; --white: #fff;
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--a); color: var(--white); font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--d); font-weight: normal; font-size: 14px; }
.error { color: var(--red); min-height: 1.2em; }
a { color: #7cc3e0; }

header { display: flex; align-items: center; gap: 16px; background: #111; padding: 0 16px; height: 56px;
  position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--b); }
.brand { font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.badge { background: var(--white); color: var(--a); padding: 2px 8px; font-weight: 900; }
nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
nav a { color: var(--stop); text-decoration: none; padding: 18px 12px; border-bottom: 3px solid transparent; white-space: nowrap; }
nav a.active { color: var(--white); border-bottom-color: var(--bus); }
main { padding: 20px; max-width: 1300px; margin: 0 auto; }
h1 { font-size: 24px; margin: 0 0 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h1 .spacer { flex: 1; }

.card { background: var(--b); padding: 16px; border-radius: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat .label { color: var(--d); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .sub { color: var(--stop); font-size: 13px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--a); }
th { text-align: left; color: var(--d); font-weight: 500; font-size: 13px; padding: 8px; border-bottom: 1px solid var(--c); }
td { padding: 8px; border-bottom: 1px solid var(--b); vertical-align: middle; }
tr:hover td { background: #222; }
.line { display: inline-block; background: var(--white); color: var(--a); font-weight: 700; padding: 0 6px; margin: 1px 2px 1px 0; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: 13px; }
.ok { background: var(--green); color: var(--a); }
.warn { background: var(--amber); color: var(--a); }
.bad { background: var(--red); color: var(--white); }
.off { background: var(--c); color: var(--white); }

button, .btn { background: var(--c); color: var(--white); border: 0; padding: 8px 14px; border-radius: 4px;
  font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover { filter: brightness(1.15); }
button.primary { background: var(--bus); font-weight: 700; }
button.danger { background: var(--red); }
button.ghost { background: transparent; color: var(--stop); }
button.small { padding: 4px 10px; font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
td:last-child { white-space: nowrap; }

label { display: block; margin-bottom: 12px; color: var(--stop); font-size: 13px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; background: var(--a); color: var(--white);
  border: 1px solid var(--c); border-radius: 4px; padding: 8px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--bus); border-color: var(--bus); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--white); font-size: 15px; }
label.check input { width: auto; margin: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--d); font-size: 12px; margin-top: 4px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login form { width: 340px; }
.login .brand { margin-bottom: 20px; font-size: 26px; }

dialog { border: 0; padding: 0; background: transparent; color: var(--white); max-width: 560px; width: 95vw; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { margin: 0 0 16px; }
dialog .actions { justify-content: flex-end; margin-top: 8px; }

#map { height: 420px; border-radius: 6px; margin-bottom: 16px; }
.console { background: #000; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; padding: 12px;
  height: calc(100vh - 200px); overflow-y: auto; white-space: pre-wrap; border-radius: 6px; }
.console .WARNING { color: var(--amber); }
.console .ERROR, .console .CRITICAL { color: var(--red); }
.console .data { color: #8fd3ff; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar input { width: 260px; margin: 0; }

/* editor */
.ed-side table td { padding: 4px; }
.ed-side input, .ed-side select { padding: 5px; margin: 0; font-size: 13px; }
h3 { margin: 18px 0 8px; }

.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 12px; }
.split-left { grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); }
.ed-map { height: 560px; border-radius: 6px; }
.smap { height: 420px; border-radius: 6px; }
nav.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--b); overflow-x: auto; }
nav.tabs a { white-space: nowrap; }
.page-title, .menu-btn { display: none; }

/* ------------------------------------------------------------------ mobil */
@media (max-width: 760px) {
  body { font-size: 15px; }
  header { height: auto; min-height: 52px; flex-wrap: wrap; gap: 8px; padding: 0 8px 0 12px; }
  .brand { font-size: 17px; }
  .brand .badge { padding: 1px 6px; }
  #who { display: none; }
  .page-title { display: block; flex: 1; color: var(--stop); font-size: 15px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; }
  .menu-btn { display: block; font-size: 24px; padding: 6px 12px; color: var(--white); }
  header nav#nav, header #logout { display: none; }
  header.open nav#nav { display: flex; flex-direction: column; flex-basis: 100%; gap: 0; padding-bottom: 4px; }
  header.open nav#nav a { padding: 13px 4px; border-bottom: 1px solid var(--b); border-left: 3px solid transparent; }
  header.open nav#nav a.active { border-bottom-color: var(--b); border-left-color: var(--bus); padding-left: 10px; }
  header.open #logout { display: block; margin: 0 0 10px auto; }
  main { padding: 12px; }
  h1 { font-size: 20px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { padding: 12px; }
  .stat .value { font-size: 22px; }
  /* tabulky bez záhlaví (editor) se posouvají do strany, ostatní jsou karty */
  main table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards { background: transparent; overflow: visible; }
  table.cards tr.hdr { display: none; }
  table.cards tr { background: var(--b); border-radius: 6px; margin-bottom: 8px; padding: 8px 12px; }
  table.cards tr:hover td { background: transparent; }
  table.cards td { border: 0; padding: 3px 0; white-space: normal; }
  table.cards td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 120px;
    color: var(--d); font-size: 13px; }
  table.cards td:first-child::before { display: none; }
  table.cards td:first-child { font-size: 16px; padding-bottom: 6px; }
  table.cards td:empty { display: none; }
  table.cards td:last-child { white-space: normal; padding-top: 8px; }
  table.cards td .actions { justify-content: flex-start; }
  table.cards td.full { color: var(--d); }
  td, th { padding: 8px 6px; }
  .row { grid-template-columns: 1fr; gap: 0; }
  .toolbar input, .toolbar select { width: 100% !important; flex: 1 1 140px; }
  .split, .split-left { grid-template-columns: 1fr; }
  .ed-map { height: 55vh; }
  .smap { height: 45vh; }
  #map { height: 50vh; }
  .console { height: calc(100vh - 160px); font-size: 11.5px; }
  .login form { width: 92vw; }
  dialog { width: 96vw; }
  button.small { padding: 6px 10px; }
}
h1 select, h1 input { font-size: 15px; font-weight: normal; }
h1 button { font-size: 15px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
