:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #1d2433; --muted: #667085; --line: #e3e6ec;
  --side: #1b1f2b; --side-ink: #c9cfdd; --accent: #5b4bdb; --accent-ink: #fff;
  --ok: #1a9c5b; --warn: #c97a09; --bad: #d1343f; --info: #2f6fde; --code-bg: #12151d; --code-ink: #d7dce8;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11141b; --panel: #1a1e29; --ink: #e6e9f0; --muted: #98a1b3; --line: #2a3040;
    --side: #0c0e14; --accent: #8577f0; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

.login { display: grid; place-items: center; height: 100%; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: 100%; max-width: 340px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input[type=text], input[type=password] { display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; }
.err { color: var(--bad); min-height: 1.4em; margin: 10px 0 0; }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px;
  padding: 6px 12px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 8px; font-size: 12.5px; }

.app { display: grid; grid-template-columns: 250px 1fr; height: 100%; }
aside { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; overflow: hidden; }
.brand { padding: 16px; font-weight: 600; color: #fff; font-size: 15px; }
nav { flex: 1; overflow-y: auto; padding: 0 8px; }
.proj { margin: 12px 8px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: #7f8aa3; }
.item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.item:hover { background: #ffffff12; }
.item.active { background: #ffffff1f; color: #fff; }
.item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.active { background: var(--ok); } .dot.failed { background: var(--bad); }
.dot.busy { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.side-foot { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.side-foot .btn { color: var(--side-ink); border-color: #ffffff26; }

main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
#host { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 10px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 13px; }
#host b { color: var(--ink); font-weight: 600; }
#view { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; min-height: 0; }

.head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.badge { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; text-transform: uppercase; letter-spacing: .04em; }
.badge.prod { color: var(--ok); } .badge.staging { color: var(--warn); } .badge.dev { color: var(--info); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.meta b { color: var(--ink); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { border: 0; background: none; color: var(--muted); padding: 8px 14px; font: inherit; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
#pane { flex: 1; min-height: 320px; display: flex; flex-direction: column; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.st { font-weight: 600; } .st.success { color: var(--ok); } .st.failed { color: var(--bad); } .st.running { color: var(--warn); }
.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; }
.note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.box h3 { margin: 0 0 8px; font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

pre.log { flex: 1; margin: 0; background: var(--code-bg); color: var(--code-ink); padding: 12px; border-radius: 8px;
  overflow: auto; white-space: pre-wrap; word-break: break-word; min-height: 300px; }
.term { flex: 1; background: #000; border-radius: 8px; padding: 6px; min-height: 340px; }
.table-wrap { overflow-x: auto; }

.modal { position: fixed; inset: 0; background: #0009; display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-box { background: var(--panel); border-radius: 10px; width: min(1000px, 100%); height: min(80vh, 720px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
#modal-body { flex: 1; display: flex; flex-direction: column; padding: 12px; min-height: 0; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  aside { max-height: 38vh; }
  #view { padding: 16px; }
}
