/* mirinae-ops. Dark by default (it is an operations screen), light if the OS asks for it.
   Hairlines instead of cards, tabular numerals, one accent, colour only where it means something. */

:root {
  --bg: #0f1216; --panel: #141920; --line: #232a33; --line2: #2e3845;
  --ink: #d7dde5; --dim: #8a94a3; --faint: #5b6573;
  --ok: #3fb950; --warn: #d29922; --bad: #f85149; --accent: #58a6ff;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f7f9; --panel: #fff; --line: #e3e6ea; --line2: #cfd4db; --ink: #1f2328; --dim: #636c76; --faint: #8c959f;
          --ok: #1a7f37; --warn: #9a6700; --bad: #cf222e; --accent: #0969da; }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.45 -apple-system, "Segoe UI", system-ui, sans-serif; }
a { color: inherit; }
code, .mono { font-family: var(--mono); font-size: 12px; }
h2 { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 22px 0 8px; }
.quiet { color: var(--dim); } .ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.grow { flex: 1; }

/* header */
header { display: flex; align-items: center; gap: 28px; padding: 0 20px; height: 44px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-weight: 600; letter-spacing: -.01em; }
.brand .host { color: var(--dim); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(63,185,80,.6); animation: pulse 2s infinite; }
.dot.off { background: var(--bad); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,185,80,.55); } 70% { box-shadow: 0 0 0 7px rgba(63,185,80,0); } 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); } }
nav { display: flex; gap: 2px; height: 100%; }
nav a { display: flex; align-items: center; padding: 0 12px; text-decoration: none; color: var(--dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
nav a.on { color: var(--ink); border-color: var(--accent); }
.meta { margin-left: auto; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.meta.bad { color: var(--bad); }

main { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }

/* live strip */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tile { background: var(--panel); padding: 12px 14px 10px; position: relative; min-height: 96px; }
.tile .label { font-size: 11px; color: var(--dim); letter-spacing: .04em; text-transform: uppercase; }
.tile .label .sub { text-transform: none; letter-spacing: 0; color: var(--faint); }
.tile .num { font-size: 26px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 2px 0 0; line-height: 1.1; }
.tile .foot { font-size: 11.5px; color: var(--faint); margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .spark { position: absolute; right: 10px; bottom: 8px; width: 46%; height: 28px; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.spark .area { fill: var(--accent); opacity: .10; }
.tile.warn .num { color: var(--warn); } .tile.warn .spark .line { stroke: var(--warn); } .tile.warn .spark .area { fill: var(--warn); }
.tile.bad .num { color: var(--bad); } .tile.bad .spark .line { stroke: var(--bad); } .tile.bad .spark .area { fill: var(--bad); }
.tile.off .num { color: var(--faint); }

/* two columns */
.cols.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; max-width: 1100px; }
@media (max-width: 900px) { .cols.two { grid-template-columns: 1fr; } }
#containers { max-width: 1100px; }
.block { border-top: 1px solid var(--line); }

/* key/value tables (side column) */
table { border-collapse: collapse; width: 100%; }
.kv th, .kv td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; font-variant-numeric: tabular-nums; }
.kv th { font-weight: 400; color: var(--dim); width: 40%; padding-right: 12px; white-space: nowrap; }
.bar { display: inline-block; width: 70px; height: 5px; background: var(--line2); vertical-align: middle; margin-right: 6px; }
.bar i { display: block; height: 100%; background: var(--ok); }
.cores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 16px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cores .quiet { display: inline-block; width: 1.6em; text-align: right; }
.bar.warn i { background: var(--warn); } .bar.bad i { background: var(--bad); }
.tag { display: inline-block; font-size: 10.5px; padding: 0 6px; border: 1px solid var(--line2); color: var(--dim); border-radius: 3px; margin-left: 4px; vertical-align: 1px; }
.tag.ok { color: var(--ok); border-color: var(--ok); }

/* containers */
.container { border-bottom: 1px solid var(--line); }
.chead { display: flex; align-items: center; gap: 10px; padding: 10px 0 8px; }
.chead b { font-weight: 600; }
.state { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.state.running { background: var(--ok); } .state.exited, .state.missing { background: var(--bad); } .state.restarting { background: var(--warn); }
.procs td { padding: 5px 0 5px 18px; border-top: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.procs td:first-child { width: 34%; }
.procs td.actions { text-align: right; white-space: nowrap; padding-right: 0; }
.st { font-size: 11.5px; } .st.RUNNING { color: var(--ok); } .st.STOPPED { color: var(--dim); }
.st.STARTING, .st.BACKOFF { color: var(--warn); } .st.FATAL, .st.EXITED, .st.UNKNOWN { color: var(--bad); }

/* generic list tables (audit) */
.list th { text-align: left; font-weight: 500; color: var(--dim); font-size: 11.5px; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line2); }
.list td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }

/* controls */
button, .btn { font: inherit; font-size: 12px; padding: 3px 10px; border: 1px solid var(--line2); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.ghost, .btn.ghost { background: transparent; color: var(--dim); }
button.ghost:hover { color: var(--ink); }
.actions button { margin-left: 4px; }
select, input[type=text], input:not([type]) { font: inherit; font-size: 12.5px; padding: 4px 8px; border: 1px solid var(--line2); border-radius: 4px; background: var(--panel); color: var(--ink); }
.toolbar { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.toolbar input:not([type]) { width: 260px; }
.chk { color: var(--dim); display: flex; align-items: center; gap: 4px; }

/* logs */
#log-view { margin: 0; height: calc(100vh - 150px); overflow: auto; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; color: var(--ink); }

/* dialog and toast */
dialog { border: 1px solid var(--line2); border-radius: 6px; background: var(--panel); color: var(--ink); padding: 18px 20px; max-width: 440px; }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 { margin: 0 0 6px; font-size: 14px; }
dialog p { margin: 0 0 14px; color: var(--dim); }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; margin: 0; padding: 0; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 4px; font-size: 12.5px; max-width: 80vw; z-index: 9; }
#toast.bad { background: var(--bad); color: #fff; }

/* errors tab */
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.errs { border: 1px solid var(--line); background: var(--panel); margin-bottom: 8px; }
.errs summary { padding: 8px 12px; cursor: pointer; display: flex; gap: 12px; align-items: baseline; }
.errs pre { margin: 0; max-height: 40vh; overflow: auto; padding: 8px 12px; border-top: 1px solid var(--line); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; }

/* header: who is logged in */
.who { color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 8px; }

/* login page */
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login { width: 300px; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.login .brand { margin-bottom: 4px; }
.login p { margin: 0 0 18px; }
.login label { display: block; color: var(--dim); font-size: 12px; margin-bottom: 12px; }
.login input { display: block; width: 100%; margin-top: 4px; padding: 7px 9px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; }
.login input:focus { outline: none; border-color: var(--accent); }
.login #err { min-height: 1.45em; margin: 0 0 10px; font-size: 12px; }
.login button { width: 100%; padding: 7px; font-size: 13px; background: var(--accent); border-color: var(--accent); color: #fff; }
