/* BackUpGuard — same working-surface palette as NetMonSpy; meant to be left open on a second monitor. */
:root {
  color-scheme: dark;
  --plane: #0d0d0d; --surface-1: #1a1a19; --surface-2: #141413; --surface-3: #232322;
  --text-primary: #fff; --text-secondary: #c3c2b7; --text-muted: #898781;
  --border: rgba(255,255,255,.10); --border-strong: rgba(255,255,255,.18);
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b; --violet: #9085e9;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--plane); color: var(--text-primary); font-family: var(--sans); font-size: 14px; }
a { color: var(--violet); text-decoration: none; } a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); } .crit { color: var(--critical); } .mono { font-family: var(--mono); font-size: 12px; }
.pad { padding: 14px; } .pad0 { padding: 6px 8px 8px; }

/* login */
#login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 340px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 20px; display: flex; gap: 8px; align-items: center; } .login-card p { margin: 0 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.login-err { color: var(--critical); font-size: 13px; min-height: 18px; }

/* header */
header { display: flex; align-items: center; gap: 18px; padding: 10px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--plane); z-index: 5; flex-wrap: wrap; }
header h1 { font-size: 16px; margin: 0; display: flex; align-items: center; gap: 8px; } .mark { color: var(--violet); }
nav { display: flex; gap: 2px; }
nav a { color: var(--text-secondary); padding: 6px 12px; border-radius: 8px; font-size: 13px; }
nav a:hover { background: var(--surface-1); text-decoration: none; }
nav a.active { background: var(--surface-3); color: #fff; box-shadow: inset 0 -2px 0 var(--violet); }
.hdr-right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.who { font-size: 12px; color: var(--text-secondary); display: flex; gap: 8px; align-items: center; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(144,133,233,.2); color: var(--violet); text-transform: uppercase; letter-spacing: .04em; }

main { padding: 16px 20px 40px; max-width: 1240px; margin: 0 auto; }
footer { text-align: center; color: var(--text-muted); font-size: 12px; padding: 20px; }

/* cards, tiles */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 16px; overflow: hidden; }
.card h2 { font-size: 13px; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card h2 .small-h { font-weight: 400; font-size: 12px; } .card h2 .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card .body { padding: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; position: relative; }
.tile.bad { border-color: rgba(208,59,59,.5); }
.tile .label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 22px; font-family: var(--mono); margin-top: 4px; } .tile .value small { font-size: 12px; color: var(--text-muted); }
.tile .value.good { color: var(--good); } .tile .value.warn { color: var(--warning); } .tile .value.crit { color: var(--critical); }
.tile .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.tile button.small { position: absolute; right: 10px; top: 10px; }
.dueline { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } @media (max-width: 980px) { .two { grid-template-columns: 1fr; } }

/* tables */
table, .t { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-size: 11px; text-transform: uppercase; font-weight: 500; }
td.fn { max-width: 260px; overflow: hidden; text-overflow: ellipsis; } td.summary { white-space: normal; max-width: 420px; }
tr:last-child td { border-bottom: none; } tbody tr.click { cursor: pointer; } tbody tr.click:hover td { background: var(--surface-3); }
.empty { color: var(--text-muted); padding: 16px 14px; font-size: 13px; } .empty.idle { padding: 18px 14px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill.ok { background: rgba(12,163,12,.18); color: var(--good); } .pill.warn { background: rgba(250,178,25,.18); color: var(--warning); }
.pill.crit { background: rgba(208,59,59,.18); color: var(--critical); } .pill.muted { background: rgba(255,255,255,.08); color: var(--text-muted); }
.pill.serious { background: rgba(236,131,90,.18); color: var(--serious); }
.chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-secondary); }
.chip.muted { color: var(--text-muted); border-color: var(--border); } .chip.phase { border-color: #e0a43b; color: #e0a43b; }

/* forms */
input, select, textarea { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-primary); border-radius: 6px; padding: 6px 9px; font-size: 13px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; }
button { background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-primary); border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
button:hover:not(:disabled) { border-color: var(--violet); } button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--violet); border-color: var(--violet); color: #0d0d0d; font-weight: 600; }
button.small { padding: 3px 9px; font-size: 12px; } button.danger { border-color: rgba(208,59,59,.6); color: var(--critical); }
.btn-link { margin-left: auto; font-size: 12px; }

/* banners */
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-1); margin-bottom: 8px; flex-wrap: wrap; font-size: 13px; }
.banner .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); flex: none; }
.banner.ok .dot { background: var(--good); } .banner.crit { border-color: rgba(208,59,59,.55); background: rgba(208,59,59,.08); } .banner.crit .dot { background: var(--critical); }
.banner.warn { border-color: rgba(250,178,25,.5); background: rgba(250,178,25,.07); } .banner.warn .dot { background: var(--warning); }
.dot.pulse, .live-text { animation: blink 1.2s ease-in-out infinite; } .live-text { color: var(--violet); }
@keyframes blink { 50% { opacity: .3; } }
.issues { margin-bottom: 8px; } .issues .banner { margin-bottom: 6px; }

/* bars */
.bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; position: relative; min-width: 90px; }
.bar i { display: block; height: 100%; width: 0; background: var(--violet); border-radius: 4px; transition: width .6s linear; }
.bar.done i { background: var(--good); } .bar.warn i { background: var(--warning); } .bar.error i { background: var(--critical); }
.bar.indeterminate i { background: linear-gradient(90deg, transparent, var(--violet), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: slide 1.4s linear infinite; transition: none; }
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.tile .bar { margin-top: 8px; }

/* right-now cards */
#lv-cards { display: grid; gap: 1px; background: var(--border); }
.rn-card { background: var(--surface-1); padding: 12px 14px; display: grid; gap: 7px; }
.rn-card.quiet { background: rgba(250,178,25,.05); }
.rn-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .rn-ico { font-size: 16px; }
.rn-file { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; max-width: 420px; white-space: nowrap; } .rn-el { margin-left: auto; color: var(--text-secondary); }
.rn-stage { display: grid; grid-template-columns: 150px 1fr minmax(180px, 330px); gap: 10px; align-items: center; font-size: 12px; }
.rn-sl { color: var(--text-secondary); } .rn-st { color: var(--text-secondary); text-align: right; }
.rn-stage.pending .rn-sl { color: var(--text-muted); } .rn-stage.error .rn-st { color: var(--critical); }
.rn-warn { color: var(--warning); font-size: 12px; }
@media (max-width: 760px) { .rn-stage { grid-template-columns: 1fr; } .rn-st { text-align: left; } }

/* pipeline */
.fl-svg { width: 100%; height: auto; display: block; }
.fl-bg { fill: var(--surface-2); stroke: var(--border); } .fl-bg.live { stroke: rgba(144,133,233,.5); }
.fl-app { font-size: 15px; font-weight: 700; fill: #fff; } .fl-lane a:hover .fl-app { fill: var(--violet); }
.fl-sub { font-size: 10.5px; fill: var(--text-muted); } .fl-label { font-size: 10.5px; fill: var(--text-secondary); } .fl-metric { font-size: 10px; fill: var(--text-muted); font-family: var(--mono); }
.fl-glyph { font-size: 13px; } .fl-badge { font-size: 8px; font-weight: 700; fill: #fff; } .fl-badge.dark { fill: #1b1405; }
.fl-body { fill: var(--surface-1); }
.fl-node.off { opacity: .4; } .fl-node.idle .fl-body { stroke-opacity: .55; } .fl-node.active .fl-metric { fill: #fff; } .fl-node.error .fl-metric { fill: var(--critical); }
.fl-skel { fill: none; stroke: var(--border-strong); stroke-width: 1.3; stroke-dasharray: 2 4; } .fl-skel.dim { opacity: .35; }
.fl-flow { fill: none; stroke-width: 2.6; stroke-linecap: round; opacity: .55; }
.fl-ring { transition: stroke-dasharray .5s linear; }
.fl-pulse { transform-box: fill-box; transform-origin: center; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.45); opacity: 0; } }
.fl-legend { padding: 4px 14px 10px; font-size: 11px; }
@media (prefers-reduced-motion: reduce) { .fl-pulse, .dot.pulse, .live-text, .bar.indeterminate i { animation: none !important; } }

/* charts */
.chart { width: 100%; height: auto; display: block; } .chart .grid { stroke: var(--border); stroke-dasharray: 2 4; } .chart .axis { font-size: 9px; fill: var(--text-muted); font-family: var(--mono); }
.spark .sp { fill: var(--violet); opacity: .8; } .spark .sp.bad { fill: var(--critical); } .spark .sp.warn { fill: var(--warning); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); padding: 0 14px 12px; } .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

/* apps */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; margin-bottom: 16px; }
.app-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; cursor: pointer; display: grid; gap: 8px; }
.app-card:hover { border-color: var(--violet); } .app-card .nm { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; } .kv dt { color: var(--text-muted); } .kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 12px; }
.app-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; } .app-head h2 { font-size: 22px; margin: 0; } .app-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; } .checklist li { display: flex; gap: 8px; } .checklist .ck { width: 18px; text-align: center; } .checklist .yes { color: var(--good); } .checklist .no { color: var(--warning); }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 0; overflow: auto; font-size: 12px; line-height: 1.5; font-family: var(--mono); color: #d7d6cf; max-height: 420px; }
.tabs { display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--border); } .tabs button { border: 0; background: transparent; border-radius: 6px 6px 0 0; color: var(--text-secondary); border-bottom: 2px solid transparent; }
.tabs button.on { color: #fff; border-bottom-color: var(--violet); }
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; } @media (max-width: 1000px) { .cols { grid-template-columns: minmax(0, 1fr); } } .cols > div, .two > .card { min-width: 0; }

/* settings */
.set-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 6px 16px; padding: 10px 14px; border-bottom: 1px solid var(--border); align-items: start; } .set-row:last-of-type { border-bottom: 0; }
.set-row label { font-size: 13px; color: var(--text-secondary); padding-top: 6px; } .set-row .ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .set-row .ctl input[type=text], .set-row .ctl input[type=number], .set-row .ctl select { min-width: 220px; }
.set-row .hint { grid-column: 2; font-size: 12px; color: var(--text-muted); } .set-row .unit { color: var(--text-muted); font-size: 12px; } .set-row .def { font-size: 11px; color: var(--text-muted); }
.set-foot { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 700px) { .set-row { grid-template-columns: 1fr; } .set-row .hint { grid-column: 1; } }

/* modal, toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal { background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 14px; width: 460px; max-width: 100%; padding: 22px; display: grid; gap: 12px; } .modal h3 { margin: 0; }
.modal label { display: grid; gap: 4px; font-size: 12px; color: var(--text-secondary); } .modal .row { display: flex; gap: 8px; justify-content: flex-end; }
.token-reveal { background: var(--surface-2); border: 1px solid var(--warning); border-radius: 8px; padding: 10px 14px; font-family: var(--mono); font-size: 12px; word-break: break-all; } .token-reveal .warn-line { color: var(--warning); font-family: var(--sans); font-size: 12px; margin-bottom: 6px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--surface-3); border: 1px solid var(--border-strong); padding: 9px 16px; border-radius: 8px; opacity: 0; transition: .25s; z-index: 30; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%); } #toast.err { border-color: var(--critical); color: #ffb4b4; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); }

/* Hardware tab */
.hw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; padding: 12px 14px; }
.hw-disk { border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; background: var(--surface-2); }
.hw-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.hw-reasons { color: var(--warning); font-size: 12px; margin: 8px 0; }
.hw-disk table.kv { margin: 8px 0; font-size: 12px; } .hw-disk table.kv td { padding: 3px 8px 3px 0; border: 0; }
.hw-mount { margin-top: 8px; font-size: 12px; }
.bar { height: 6px; background: var(--surface-3); border-radius: 3px; margin-top: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; } .bar i.ok { background: var(--good); } .bar i.warn { background: var(--warning); } .bar i.crit { background: var(--critical); }

/* ---- polish: tables scroll instead of clipping, small screens ---- */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tscroll > table { min-width: 100%; }
.spark { max-width: 100%; height: auto; }
.app-grid { grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }
.login-card { max-width: 100%; }
#lv-flow, #ap-flow { overflow-x: auto; } .fl-svg { min-width: 640px; }
.tabs { overflow-x: auto; } .tabs button { white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; } td.actions > * { margin-left: 6px; }
.lock { color: var(--text-muted); cursor: help; font-size: 12px; }
.modal ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary); }
@media (max-width: 720px) {
  body { font-size: 14px; }
  header { padding: 8px 12px; gap: 8px 12px; }
  nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; } nav a { padding: 8px 12px; white-space: nowrap; }
  .hdr-right { gap: 8px; } .who { gap: 6px; }
  main { padding: 12px 10px 32px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .tile { padding: 10px 11px; } .tile .value { font-size: 18px; }
  .tile button.small { position: static; margin-top: 8px; }
  .card h2 { padding: 9px 11px; } .card .body { padding: 11px; }
  th, td { padding: 8px 10px; }
  .rn-head .rn-file { max-width: 100%; flex-basis: 100%; order: 5; } .rn-el { margin-left: 0; }
  .rn-card { padding: 11px; }
  .app-head { gap: 8px; } .app-head h2 { font-size: 19px; } .app-head .actions { margin-left: 0; width: 100%; }
  .filters select { flex: 1 1 140px; }
  button { min-height: 36px; } button.small { min-height: 30px; }
  .modal { padding: 16px; } .modal .row { flex-wrap: wrap; }
  .set-row .ctl input[type=text], .set-row .ctl input[type=number], .set-row .ctl select { min-width: 0; width: 100%; }
  .kv { font-size: 12px; } .legend { gap: 8px; }
  pre.code { font-size: 11px; }
  #ap-copy { right: 16px !important; }
}
@media (max-width: 400px) { .tiles { grid-template-columns: 1fr; } .who span:first-child { display: none; } }

tr.unowned td { background: rgba(250,178,25,.05); } select.mini { padding: 2px 6px; font-size: 12px; margin-left: 8px; max-width: 150px; }
.card h2 .right select { font-weight: 400; }
#tb-list table { table-layout: fixed; min-width: 560px; } #tb-list th:nth-child(1) { width: 38%; } #tb-list th:nth-child(2), #tb-list th:nth-child(3) { width: 14%; } #tb-list td:first-child { overflow: hidden; text-overflow: ellipsis; }
