/* PikoTV DAB/DAB+ Headend — ürün ailesi görsel dili
   Palet: lacivert (#0A2540) + turuncu (#E25C26)
   Aksiyon renkleri: yeşil=zararsız, mavi=kaynak, kırmızı=yıkıcı, sarı=güncelleme
   Açık/koyu tema (data-theme) + RTL (dir=rtl) destekli. */

:root {
  --navy: #0A2540; --navy-2: #10314f;
  --orange: #E25C26; --orange-2: #f0703a;
  --bg: #eef1f6; --panel: #f7f9fc; --card: #ffffff;
  --line: #dae0ea; --text: #1f2a37; --muted: #6b7683;
  --green: #2e9e44; --blue: #1f6fd0; --red: #d23b2f; --yellow: #d99a06;
  --shadow: 0 1px 3px rgba(16,49,79,.08), 0 4px 16px rgba(16,49,79,.06);
  --radius: 10px;
}
:root[data-theme="dark"] {
  --navy: #0b1524; --navy-2: #0f1e30;
  --bg: #0c1420; --panel: #111c2b; --card: #16233440; --card: #162334;
  --line: #26374d; --text: #e5edf7; --muted: #93a2b5;
  --green: #35b552; --blue: #4c93e6; --red: #e5564a; --yellow: #e6ab1f;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }        /* yazar kuralları ezmesin */
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); }
button { font-family: inherit; }

/* ---- header ---- */
header { display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, var(--navy), var(--navy-2));
  color: #fff; padding: 8px 16px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20; }
.brand-logo { height: 30px; width: 30px; border-radius: 7px; }
.brand { color: var(--orange); font-size: 21px; font-weight: 800; letter-spacing: .3px; }
.brand-sub { font-size: 13.5px; opacity: .9; }
.spacer { flex: 1; }
.hdr-right { font-size: 12.5px; opacity: .85; }
.hdr-user { font-size: 12.5px; background: rgba(255,255,255,.12); padding: 4px 10px; border-radius: 12px; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.conn-dot.ok { background: #37d067; box-shadow: 0 0 7px #37d067aa; }
.conn-dot.bad { background: var(--red); }
.lang-select { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 7px; padding: 4px 6px; font-size: 12.5px; }
.lang-select option { color: #000; }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 5px 10px; margin: 0; }
.btn.ghost:hover { background: rgba(255,255,255,.14); }
.btn.ghost.icon { padding: 5px 9px; font-size: 15px; line-height: 1; }

/* ---- login ---- */
#login-screen { position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #163b5e, var(--navy) 60%); }
.login-card { background: var(--card); border-radius: 16px; padding: 34px 38px;
  width: min(390px, 92vw); text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.login-logo { width: 78px; height: 78px; border-radius: 18px; }
.login-brand { margin-top: 8px; }
.login-brand .brand { font-size: 24px; }
.login-card h1 { margin: 4px 0 22px; font-size: 17px; color: var(--muted); font-weight: 600; }
.login-card input { display: block; width: 100%; margin-bottom: 12px; padding: 11px 12px;
  font-size: 14px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--text); }
.login-card .btn { width: 100%; margin: 4px 0 8px; }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; margin: 6px 0 0; }
.login-card code { font-size: 11px; }
.login-lang { margin-top: 14px; }
.login-lang .lang-select { background: var(--panel); color: var(--text); border-color: var(--line); }
.login-lang .lang-select option { color: var(--text); background: var(--panel); }

/* ---- layout ---- */
.layout { display: flex; min-height: calc(100vh - 47px); }
#menu { width: 210px; background: var(--navy-2); padding: 10px 0; flex-shrink: 0; }
.menu-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: start;
  background: none; border: 0; color: #c3cede; padding: 11px 18px; font-size: 14px;
  cursor: pointer; border-inline-start: 3px solid transparent; }
.menu-item .mi { width: 18px; text-align: center; opacity: .8; font-size: 14px; }
.menu-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-item.active { color: #fff; border-inline-start-color: var(--orange);
  background: rgba(226,92,38,.14); font-weight: 600; }
main { flex: 1; padding: 20px 26px; max-width: 1180px; min-width: 0; }
h2 { margin: 2px 0 16px; color: var(--text); font-size: 22px; }
.sub-h { margin: 26px 0 6px; color: var(--text); font-size: 15px; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.lg { color: var(--green); font-weight: 700; } .lb { color: var(--blue); font-weight: 700; }
.lr { color: var(--red); font-weight: 700; } .ly { color: var(--yellow); font-weight: 700; }

/* ---- dashboard özeti ---- */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; box-shadow: var(--shadow); }
.tile.attn { border-color: var(--orange); }
.tile-l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.tile-v { font-size: 17px; margin-top: 5px; }
.tile-v .hint { font-size: 12px; }
.tile-v .ok { color: var(--green); } .tile-v .warn { color: var(--orange); }
.tile-v .alarm-on { color: var(--red); }
.bar { height: 7px; background: color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 5px; overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--orange));
  border-radius: 5px; transition: width .3s; }
.bar-fill.over { background: var(--red); }

/* ---- M19: canlı izleme ölçer ---- */
.mon-row { display: grid; grid-template-columns: minmax(140px,1.2fr) minmax(120px,2fr) auto;
  gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mon-row:last-child { border-bottom: 0; }
.mon-name b { display: block; }
.meter { position: relative; height: 16px; background: color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 5px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 5px; transition: width .35s;
  background: var(--green); }
.meter-fill.ok { background: var(--green); }
.meter-fill.low { background: var(--blue); }
.meter-fill.hot { background: var(--red); }
.meter-val { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--fg); text-shadow: 0 0 3px var(--card); }
.row-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- M20: servis satır-içi (accordion) düzenleme paneli ---- */
tr[data-svc].editing > td { background: color-mix(in srgb, var(--blue) 12%, transparent); }
tr.svc-accordion > td { padding: 0; background: color-mix(in srgb, var(--line) 25%, transparent); }
.acc-body { margin: 0; border: 0; border-radius: 0; box-shadow: none;
  border-inline-start: 3px solid var(--blue); animation: accIn .18s ease; }
.acc-head { font-size: 14px; margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); }
@keyframes accIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---- M21: ensemble-başına kırılım (çoklu-mux) ---- */
.ens-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 14px; margin-bottom: 18px; }
.ens-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); border-inline-start: 3px solid var(--blue); }
.ens-card.over { border-inline-start-color: var(--red); }
.ens-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.ens-head b { font-size: 15px; }
.ens-head .tag.alarm { background: var(--red); color: #fff; margin-inline-start: auto; }
.ens-cu { margin-top: 10px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ens-cu .warn { color: var(--red); font-weight: 600; }
.ens-meta { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.ens-meta .ok { color: var(--green); } .ens-meta .warn { color: var(--orange); }
.node-groups { display: flex; flex-direction: column; gap: 6px; }
.node-group-head { font-size: 13px; margin: 12px 0 2px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 6px; }
.node-group-head b { letter-spacing: -.01em; }

/* ---- kartlar ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.node-card .node-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.node-card .node-head h3 { margin: 0; }
.card .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.info-card { margin-bottom: 14px; font-size: 13.5px; line-height: 1.6; }

/* ---- LED ---- */
.led { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.led-up { background: #37d067; box-shadow: 0 0 6px #37d067cc; }
.led-warn { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.led-down { background: var(--red); box-shadow: 0 0 6px var(--red); }
.led-muted { background: var(--muted); }

/* ---- rozetler ---- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11.5px; font-weight: 700; color: #fff; }
.badge.up { background: var(--green); } .badge.down { background: var(--red); }
.badge.stopped { background: var(--muted); } .badge.starting { background: var(--yellow); }
.tag { display: inline-block; background: var(--orange); color: #fff; font-size: 10px;
  font-weight: 800; padding: 1px 7px; border-radius: 9px; margin-inline-start: 6px; vertical-align: 1px; }
.evtag { font-family: Consolas, monospace; font-size: 12px; background: color-mix(in srgb, var(--blue) 15%, transparent);
  color: var(--blue); padding: 1px 8px; border-radius: 6px; }

/* ---- tablolar ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th { background: var(--navy); color: #fff; text-align: start; padding: 9px 12px; font-size: 12.5px; white-space: nowrap; }
td { padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13.5px; }
tr:nth-child(even) td { background: color-mix(in srgb, var(--panel) 60%, transparent); }
.mono { font-family: Consolas, monospace; font-size: 12px; white-space: nowrap; }

/* ---- butonlar ---- */
.btn { border: 0; border-radius: 7px; color: #fff; padding: 7px 13px; font-size: 12.5px;
  font-weight: 600; cursor: pointer; margin-inline-end: 6px; transition: filter .12s, transform .05s; }
.btn:hover { filter: brightness(1.08); } .btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.btn.green { background: var(--green); } .btn.blue { background: var(--blue); }
.btn.red { background: var(--red); } .btn.yellow { background: var(--yellow); }
.btn.primary { background: var(--orange); } .btn.big { font-size: 16px; padding: 12px 24px; }

.toolbar { margin: 12px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cu-badge { margin-inline-start: 6px; padding: 5px 12px; border-radius: 12px;
  background: var(--navy-2); color: #fff; font-size: 12.5px; font-weight: 700; }
.cu-badge.over { background: var(--red); }

/* ---- taslak çubuğu ---- */
#draft-bar { background: color-mix(in srgb, var(--yellow) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--yellow) 45%, var(--line));
  border-inline-start: 5px solid var(--yellow); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; font-size: 13.5px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.draft-actions { margin-inline-start: auto; }
#draft-issues, #cfg-issues { width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; font-size: 12px; white-space: pre-wrap; margin-top: 8px; }

/* ---- ASA ---- */
.alarm-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.alarm-state { font-size: 22px; font-weight: 800; text-align: center; padding: 16px;
  border-radius: var(--radius); margin-bottom: 14px; color: #fff; }
.alarm-state.idle { background: var(--green); }
.alarm-state.active { background: var(--red); animation: pulse .8s infinite; }
@keyframes pulse { 50% { opacity: .72; } }

/* ---- profil editör ---- */
#cfg-editor { width: 100%; height: 420px; font-family: Consolas, monospace; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  background: var(--card); color: var(--text); }

/* ---- modal + form ---- */
.modal { position: fixed; inset: 0; background: rgba(6,18,32,.6); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--card); color: var(--text); width: min(760px, 95vw);
  max-height: 88vh; border-radius: 12px; padding: 18px 20px; overflow: auto; box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.modal-box h3 { color: var(--text); margin: 0 0 12px; }
.modal-box pre { font-size: 12px; white-space: pre-wrap; background: var(--panel);
  padding: 10px; border-radius: 8px; max-height: 60vh; overflow: auto; }
.form-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 9px; margin: 0 0 10px; padding: 10px 12px; }
legend { font-size: 12.5px; font-weight: 700; color: var(--orange); padding: 0 6px; }
label.frm { display: block; margin-bottom: 10px; font-size: 12.5px; }
label.frm > span { display: block; font-weight: 600; margin-bottom: 3px; color: var(--muted); }
label.frm input, label.frm select { width: 100%; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 13px; background: var(--panel); color: var(--text); }
label.frm small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; }
.frm-chk { display: block; font-size: 12.5px; margin: 8px 0; cursor: pointer; }
.form-actions { text-align: end; margin-top: 12px; }
.form-error { color: var(--red); font-size: 13px; margin: 8px 0 0; }
fieldset.net-fs { margin-top: 8px; background: color-mix(in srgb, var(--blue) 6%, transparent); }
fieldset.net-fs legend { color: var(--blue); }

/* tooltip (i) */
.tip { display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; font-size: 10.5px; font-weight: 700;
  background: var(--blue); color: #fff; cursor: help; vertical-align: 1px;
  font-style: normal; user-select: none; }
.tip:hover, .tip:focus { background: var(--orange); outline: none; }

/* ayarlar kartları */
.settings-card { margin-bottom: 16px; }
.settings-card h3 { color: var(--orange); font-size: 16px; margin: 0 0 4px; }
.settings-card .form-cols { margin-top: 10px; }
.settings-card #tls-form { margin-top: 10px; max-width: 520px; }
.warn-note { color: var(--yellow); font-weight: 600; margin-top: 8px; }
#settings-issues { background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; font-size: 12px; white-space: pre-wrap; }

/* düğüm amaç cümlesi */
.purpose { font-style: italic; opacity: .9; }
.node-card .purpose { margin-top: 4px; }

/* TLS sertifika durum kartı */
#tls-status-card { margin-bottom: 12px; }
.tls-status { border-radius: 8px; padding: 10px 14px; border-inline-start: 5px solid var(--green);
  background: color-mix(in srgb, var(--green) 8%, var(--card)); }
.tls-status.warn { border-inline-start-color: var(--yellow);
  background: color-mix(in srgb, var(--yellow) 10%, var(--card)); }
.tls-status.crit { border-inline-start-color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, var(--card)); }
.tls-status .big { font-size: 18px; }
.tls-status.crit .big { color: var(--red); }
.tls-row { font-size: 14px; }
.tls-meta { margin-top: 4px; }
.tls-badge { padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); }
.tls-badge.warn { border-color: var(--yellow); }

/* çoklu-mux seçici */
.mux-selector { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--orange) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--orange) 30%, var(--line));
  border-radius: var(--radius); padding: 8px 12px; margin-bottom: 14px; }
.mux-selector select { padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 13px; background: var(--panel); color: var(--text);
  font-weight: 600; }
.mux-selector .btn { margin: 0; }

/* olaylar: tür çipleri + düğüm logu */
.chips { display: inline-flex; gap: 6px; margin-inline-end: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 14px; padding: 5px 14px; font-size: 12.5px; cursor: pointer; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.kindtag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 8px; color: #fff; }
.kindtag.user { background: var(--blue); }
.kindtag.system { background: var(--muted); }
.nodelog { background: #101820; color: #cde3c8; border-radius: var(--radius);
  padding: 12px; font-size: 12px; white-space: pre-wrap; max-height: 420px;
  overflow: auto; direction: ltr; text-align: left; }

/* kullanım kılavuzu */
.manual-layout { display: flex; gap: 18px; align-items: flex-start; }
.manual-toc { position: sticky; top: 60px; width: 230px; flex-shrink: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 0; box-shadow: var(--shadow); max-height: calc(100vh - 80px); overflow-y: auto; }
.toc-item { display: block; width: 100%; text-align: start; background: none; border: 0;
  color: var(--text); padding: 8px 14px; font-size: 12.5px; cursor: pointer;
  border-inline-start: 3px solid transparent; }
.toc-item:hover { background: color-mix(in srgb, var(--orange) 10%, transparent);
  border-inline-start-color: var(--orange); }
.manual-body { flex: 1; min-width: 0; }
.manual-sec { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px;
  box-shadow: var(--shadow); scroll-margin-top: 60px; }
.manual-sec h3 { margin: 0 0 10px; color: var(--orange); font-size: 16px; }
.manual-html { font-size: 13.5px; line-height: 1.65; }
.manual-html p { margin: 8px 0; }
.manual-html ul, .manual-html ol { margin: 8px 0; padding-inline-start: 22px; }
.manual-html li { margin: 5px 0; }
.manual-html code { background: var(--panel); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; font-size: 12px; direction: ltr;
  unicode-bidi: embed; display: inline-block; }
@media (max-width: 900px) {
  .manual-layout { flex-direction: column; }
  .manual-toc { position: static; width: 100%; max-height: none; }
}

/* ---- toast ---- */
#toast { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 90; }
.toast-item { background: var(--navy); color: #fff; padding: 10px 16px;
  border-inline-start: 4px solid var(--orange); border-radius: 8px; margin-top: 8px;
  font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.3); max-width: 340px; }

/* ---- RTL ince ayar ---- */
[dir="rtl"] .menu-item { text-align: right; }
[dir="rtl"] .mono, [dir="rtl"] .evtag, [dir="rtl"] #cfg-editor { direction: ltr; text-align: left; }

/* ---- responsive ---- */
@media (max-width: 720px) {
  #menu { width: 56px; } .menu-item span:not(.mi) { display: none; }
  main { padding: 14px; }
}
