/* Dashboard styles, part 7 of 8: "i" popups, segmented controls, setting rows, dialogs, the preview, the Input tab, backups.
 * The parts load in this order, and a later rule wins over an earlier one. */

/* ---------- info popups: explanations behind a small "i" ---------- */
.info-wrap { display: inline-flex; vertical-align: middle; }
.info-btn {
  display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; margin-left: 7px; padding: 0;
  border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--muted);
  font: 700 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; text-transform: none; letter-spacing: 0;
  cursor: pointer; transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.info-btn:hover, .info-btn.open { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
.info-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.info-btn.open { box-shadow: 0 0 0 3px var(--ring); }
.pop {
  position: absolute; z-index: 120; width: 310px; max-width: calc(100vw - 24px); padding: 13px 15px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 44px -14px rgba(16, 24, 40, 0.32), 0 2px 6px rgba(16, 24, 40, 0.08);
  font-size: 13.5px; line-height: 1.55; font-weight: 400; text-transform: none; letter-spacing: 0; text-align: left; white-space: normal;
}
.pop[hidden] { display: none; }
.pop b { display: block; margin-bottom: 4px; font-weight: 650; }
.pop p { margin: 0; }
.pop p + p { margin-top: 6px; }
.pop a { color: var(--accent-strong); }
.pop::before {
  content: ""; position: absolute; top: -6px; left: var(--ax, 18px); width: 10px; height: 10px;
  background: var(--surface); border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg);
}
.pop.up::before { top: auto; bottom: -6px; transform: rotate(225deg); }
h1 + .info-wrap .info-btn { width: 20px; height: 20px; }

/* ---------- segmented control ---------- */
.seg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.seg button {
  border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 6px 13px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 0 0 1px var(--border); }
.seg button:disabled { opacity: 0.45; cursor: default; }
.seg button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* ---------- setting rows: name and status left, control right ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 18px 24px; border-top: 1px solid var(--border); }
.card-head + .set-row, .set-rows > .set-row:first-child { border-top: 0; }
.set-label { min-width: 0; flex: 1 1 260px; }
.set-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; font-weight: 600; }
.set-title > .pill, .set-title > .badge, .set-title > .tag { margin-left: 10px; }
.set-sub { color: var(--muted); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.set-control { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.set-control select, .set-control input[type=text], .set-control input[type=number] { width: auto; min-width: 200px; max-width: 280px; }
.set-row.stack { align-items: flex-start; flex-direction: column; }
.set-row.stack .set-control { justify-content: flex-start; width: 100%; }
.set-note { margin: 0; padding: 0 24px 18px; }
@media (max-width: 640px) {
  .set-row { flex-direction: column; align-items: flex-start; padding: 16px; }
  .set-control { justify-content: flex-start; width: 100%; }
  .set-control select, .set-control input[type=text] { max-width: none; flex: 1; }
  .set-note { padding: 0 16px 16px; }
}

/* ---------- dialogs ---------- */
body.modal-open { overflow: hidden; }
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); }
.modal {
  position: fixed; z-index: 101; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 560px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); color: var(--text); border-radius: 16px; box-shadow: 0 30px 70px -20px rgba(15, 23, 42, 0.5);
}
.modal-head { display: flex; gap: 14px; align-items: flex-start; padding: 22px 24px 16px; }
.modal-title { flex: 1; min-width: 0; }
.modal-head h2 { font-size: 18px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.modal-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-border); }
.modal-ico .icon { width: 20px; height: 20px; }
.modal-x { margin: -6px -8px 0 0; }
.modal-body { padding: 4px 24px 20px; }
.modal-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot .grow { flex: 1; }

/* ---------- stream page preview: sound meter and player choice ---------- */
.pv-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px; background: #0b1220; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.pv-row .preview { border-radius: 0; }
.pv-tag { position: absolute; right: 10px; bottom: 10px; font-size: 12px; font-weight: 600; color: #e2e8f0; background: rgba(15, 23, 42, 0.72); padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.pv-tag:empty { display: none; }
.pvm { display: flex; flex-direction: column; padding: 12px 10px 10px 2px; color: #94a3b8; font-size: 10px; font-variant-numeric: tabular-nums; min-height: 0; }
.pvm-body { flex: 1; display: grid; grid-template-columns: 22px auto; gap: 4px; min-height: 0; }
.pvm-scale { position: relative; }
.pvm-scale span { position: absolute; right: 2px; transform: translateY(-50%); line-height: 1; }
.pvm-bars { display: flex; gap: 4px; height: 100%; }
.pvm-bars .vu-bar { width: 9px; border-radius: 3px; }
.pvm-bars .vu-cover { background: #1e293b; }
.pvm-foot { display: grid; grid-template-columns: 22px 9px 9px; gap: 4px; margin-top: 6px; text-align: center; }
.pvm-read { margin-top: 6px; text-align: center; color: #e2e8f0; font-size: 11px; font-weight: 650; white-space: nowrap; }
.pvm-off { flex: 1; display: grid; place-items: center; text-align: center; font-size: 10.5px; line-height: 1.3; color: #94a3b8; padding: 0 2px; }
.pv-bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.pv-bar .grow { flex: 1; }
.pv-bar .icon-btn { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; }
@media (max-width: 560px) { .pv-row { grid-template-columns: minmax(0, 1fr) 48px; } .pvm-scale { display: none; } .pvm-body { grid-template-columns: auto; } .pvm-foot { grid-template-columns: 9px 9px; } .pvm-foot span:first-child { display: none; } }
.data.links td.name { white-space: nowrap; }
.data.links td.link-url code { overflow-wrap: anywhere; }
.pvm-on { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pvm-on[hidden], .pvm-off[hidden] { display: none; }
.pvm-read.bad { color: #fca5a5; }

/* ---------- Input tab: one roomy row per input ---------- */
.input-row { padding: 18px 24px; }
.input-head { gap: 16px 18px; flex-wrap: nowrap; align-items: center; }
.input-head .grow.stacked { display: block; min-width: 0; flex: 1; }
.input-pic { width: 136px; }
.in-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; font-size: 15px; }
.in-title .badge { margin-left: 10px; }
.in-detail { margin-top: 2px; }
.in-detail .input-form { margin-top: 10px; }
.in-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-top: 6px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.chip { font-family: var(--mono); font-size: 12.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; overflow-wrap: anywhere; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); }
.in-extras .set-control { justify-content: flex-start; }
.in-extras .set-control input[type=text] { min-width: 180px; }
@media (max-width: 760px) {
  .input-head { flex-wrap: wrap; }
  .input-head .row-actions { width: 100%; justify-content: flex-end; }
}
@media (max-width: 640px) { .input-row { padding: 16px; } .card-foot { padding: 12px 16px; } }

/* ---------- Server → Status: database backups ---------- */
.span-all { grid-column: 1 / -1; }
.bk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bk-stat { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); min-width: 0; }
.bk-stat .lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.bk-stat .val { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin-top: 6px; }
.bk-stat .sub { display: flex; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.bk-off { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 20px; padding: 16px 18px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-border); }
.bk-off .grow { flex: 1; min-width: 200px; }
.bk-off .t { font-weight: 650; }
.bk-off .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.bk-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-border); }
.bk-ico .icon { width: 20px; height: 20px; }
.bk-why { display: inline-flex; align-items: center; font-size: 13px; }
.bk-inside { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.bk-inside > div { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.bk-inside .lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.bk-inside ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13px; }
.bk-inside li { display: flex; gap: 8px; align-items: baseline; }
.bk-inside .y { color: var(--ok); font-weight: 800; }
.bk-inside .n { color: var(--faint); font-weight: 800; }
.bk-step { display: flex; align-items: center; gap: 10px; font-weight: 650; margin: 4px 0 12px; }
.bk-step .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; font-weight: 750; }
.bk-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld { margin-bottom: 12px; }
.fld label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.fld input { width: 100%; }
.pw-box { position: relative; }
.pw-box input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 6px; cursor: pointer; border-radius: 6px; display: grid; }
.pw-eye:hover { color: var(--text); }
.fld-ok { font-size: 12px; color: var(--muted); margin-top: 5px; min-height: 18px; }
.fld-ok.good { color: var(--ok); font-weight: 600; }
.bk-warn { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); border: 1px solid var(--warn-border); color: var(--warn); font-size: 13px; font-weight: 550; }
.bk-warn .icon { margin-top: 1px; }
.dl-status { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.dl-status:empty { display: none; }
.dl-status.bad { color: var(--danger); font-weight: 600; }
.dl-status.good { color: var(--ok); font-weight: 600; }
@media (max-width: 640px) { .bk-stats, .bk-inside, .bk-two { grid-template-columns: 1fr; } }
.set-row.stack .set-label { flex: none; width: 100%; }
@media (max-width: 640px) { .set-label { flex: none; width: 100%; } .seg button { padding: 6px 10px; } }
/* a tab bar with the open tab's explanation behind an "i" */
.tabbar-row { display: flex; align-items: center; gap: 4px; margin: 0 0 20px; }
.tabbar-row .subtabs { margin: 0; }
label.label-tip, .label-tip { display: inline-flex; align-items: center; }
label.label-tip .info-btn { margin-left: 6px; }
/* a setting row inside a padded card body */
.card-body > .set-row { padding: 0 0 18px; margin-bottom: 18px; border-top: 0; border-bottom: 1px solid var(--border); }
/* figures and dates stay on one line in tables */
.data td.num, .data th.num { white-space: nowrap; }
.media-table td.name { min-width: 220px; }
.media-name-row { display: flex; align-items: center; gap: 4px; }
.media-name-row .media-name { overflow-wrap: anywhere; }
.media-name-row .icon-btn { flex: none; }
/* list rows (channels, keys, users…): room to breathe */
.row-item { padding: 16px 20px; gap: 12px 16px; }
.row-item .grow.stacked .fineprint { margin: 6px 0 0; }
.obs-help { padding: 12px 16px; }
@media (max-width: 640px) { .row-item { padding: 14px 16px; } }
/* an "i" in a table heading keeps its own look (headings style their sort buttons) */
.data th button.info-btn {
  display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: 7px; vertical-align: -3px;
  border: 1.5px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--muted);
  font: 700 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; text-transform: none; letter-spacing: 0;
}
.data th button.info-btn:hover, .data th button.info-btn.open { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
