/* ServerDeck — Server Detail redesign
   Dense ops dashboard styles. Layers on top of tokens.css / app.css / screens.css. */

/* ---------- standalone shell ---------- */
.sd-shell { height: 100vh; display: flex; flex-direction: column; min-height: 0; }
.sd-page { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 30px 64px; }
.sd-inner { max-width: 1560px; margin: 0 auto; }

/* compact-ish top bar tuned for the standalone page */
.sd-topbar {
  display: flex; align-items: center; gap: 14px; padding: 11px 26px; min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30; flex: none;
}
.sd-topbar .brand { padding: 0; }
.sd-srv-select {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px 5px 12px;
}
.sd-srv-select .ic { width: 15px; height: 15px; color: var(--text-3); }
.sd-srv-select select {
  appearance: none; -webkit-appearance: none; border: none; background: none; outline: none;
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--text);
  cursor: pointer; padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A92A9' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center;
}

/* ---------- header / identity ---------- */
.sd-head { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.sd-head .dh-id { font-family: var(--font-mono); font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.sd-head .dh-alias { font-size: 12.5px; color: var(--text-3); font-family: var(--font-mono); }
.sd-head .dh-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }

/* prominent action bar — Terminal is the hero */
.sd-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; align-self: flex-start; }
.btn.hero {
  padding: 11px 18px; font-size: 13.5px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-on); border: 1px solid transparent;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.22); font-weight: 700;
}
.btn.hero .ic { width: 17px; height: 17px; }
.btn.hero:hover { background: var(--accent-press); transform: translateY(-1px); }
.btn.hero kbd {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; opacity: .8;
  border: 1px solid color-mix(in srgb, var(--accent-on) 45%, transparent); border-radius: 4px;
  padding: 1px 5px; margin-left: 3px;
}
.sd-act-div { width: 1px; height: 26px; background: var(--line); margin: 0 3px; }

/* ---------- metric strip ---------- */
.sd-metrics { display: grid; grid-template-columns: 1.25fr 1.25fr 1.25fr 1fr 1fr 1fr 1fr; gap: 11px; margin-bottom: 16px; }
@media (max-width: 1240px) { .sd-metrics { grid-template-columns: 1fr 1fr 1fr 1fr; } }
@media (max-width: 720px)  { .sd-metrics { grid-template-columns: 1fr 1fr; } }

.mtile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 14px 11px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: border-color .16s, box-shadow .16s, transform .16s var(--ease);
}
.mtile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.mtile .mt-h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.mtile .mt-h .ic { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.mtile .mt-lbl { font-size: 11px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.mtile .mt-h { min-width: 0; }
.mtile .mt-num { font-family: var(--font-mono); font-weight: 800; letter-spacing: -.02em; font-feature-settings:"tnum" 1; }
.mtile.big .mt-num { font-size: 26px; }
.mtile.sm .mt-num { font-size: 18px; }
.mtile .mt-num small { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.mtile .mt-sub { font-size: 10.5px; color: var(--text-3); margin-top: 2px; font-family: var(--font-mono); }
.mtile .mt-spark-h { display: flex; align-items: baseline; gap: 7px; }
.mtile .mt-delta { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; margin-left: auto; }
.mt-delta.up { color: var(--danger); }   /* rising util reads as caution */
.mt-delta.dn { color: var(--success); }
.mt-delta.flat { color: var(--text-3); }

/* bar sparkline */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 34px; margin-top: 9px; }
.mtile.sm .bars { height: 24px; margin-top: 7px; }
.bars .bar {
  flex: 1; min-width: 0; border-radius: 2px 2px 0 0;
  background: color-mix(in srgb, var(--accent) 70%, transparent);
  transition: height .5s var(--ease), background .4s;
}
.bars.alt .bar { background: color-mix(in srgb, var(--accent-2) 70%, transparent); }
.bars .bar.hot { background: var(--warning); }
.bars .bar.crit { background: var(--danger); }
.bars .bar:last-child { background: var(--accent); }
.bars.alt .bar:last-child { background: var(--accent-2); }
.bars .bar.hot:last-child { background: var(--warning); }
.bars .bar.crit:last-child { background: var(--danger); }
.mtile.offline { opacity: .62; }
.mtile.offline .mt-num { color: var(--text-3); }

/* ---------- tab body ---------- */
.sd-detail-card { overflow: visible; }
.sd-tabbody { padding: 0; }
.sd-pane { display: none; animation: fadeup .3s var(--ease); }
.sd-pane.active { display: block; }

.pane-pad { padding: 16px; }
.sub-label { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }

/* ---------- STATUS: services grid ---------- */
.svc-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.svc-bar .sl { font-size: 12px; color: var(--text-2); }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; padding: 14px 16px; }
.svc-card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 13px; position: relative; transition: border-color .14s, transform .14s var(--ease), box-shadow .14s;
}
.svc-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.svc-card .sc-top { display: flex; align-items: center; gap: 8px; padding-right: 22px; }
.svc-card .sc-top .ic { width: 16px; height: 16px; color: var(--text-2); flex: none; }
.svc-card .sc-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.svc-card .sc-st { font-size: 11.5px; font-weight: 600; margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.svc-card .sc-unit { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-top: 3px; }
.svc-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
/* active / running — green */
.svc-dot.active   { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
/* degraded / warning — amber */
.svc-dot.degraded { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
/* failed / error — red */
.svc-dot.failed, .svc-dot.error { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
/* starting / activating / installing — accent + pulse */
.svc-dot.starting, .svc-dot.activating, .svc-dot.installing {
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
  animation: blink 1.1s ease-in-out infinite;
}
/* inactive / stopped / pending / offline — muted grey */
.svc-dot.inactive, .svc-dot.pending, .svc-dot.offline, .svc-dot.deactivating {
  background: var(--text-3); box-shadow: 0 0 0 3px var(--surface-3);
}
/* sc-st text colour mirrors dot colour */
.sc-st.active   { color: var(--success); }
.sc-st.degraded { color: var(--warning); }
.sc-st.failed, .sc-st.error, .sc-st.offline { color: var(--danger); }
.sc-st.starting, .sc-st.activating, .sc-st.installing { color: var(--accent); }
.sc-st.inactive, .sc-st.pending, .sc-st.deactivating  { color: var(--text-3); }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.svc-card .sc-act { position: absolute; top: 9px; right: 9px; opacity: 0; transition: opacity .14s; }
.svc-card:hover .sc-act { opacity: 1; }
.icon-mini {
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
}
.icon-mini .ic { width: 13px; height: 13px; }
.icon-mini:hover { border-color: var(--accent); color: var(--accent); }

/* status two-column lower */
.status-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0; border-top: 1px solid var(--line); }
@media (max-width: 980px) { .status-cols { grid-template-columns: 1fr; } }
.status-col { padding: 16px; }
.status-col + .status-col { border-left: 1px solid var(--line); }
@media (max-width: 980px) { .status-col + .status-col { border-left: none; border-top: 1px solid var(--line); } }

/* activity timeline */
.tl { margin-top: 12px; }
.tl-row { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tl-row:last-child { border-bottom: none; }
.tl-ic { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.tl-ic .ic { width: 14px; height: 14px; }
.tl-ic.failed { background: var(--danger-soft); color: var(--danger); }
.tl-ic.warn { background: var(--warning-soft); color: var(--warning); }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-size: 12.5px; font-weight: 600; }
.tl-detail { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.tl-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

/* alert mini cards */
.alert-card { background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--r-sm); padding: 10px 12px; margin-top: 9px; }
.alert-card.critical { border-left-color: var(--danger); }
.alert-card.warning { border-left-color: var(--warning); }
.alert-card .ac-top { display: flex; align-items: center; gap: 8px; }
.alert-card .ac-title { font-size: 12.5px; font-weight: 600; }
.alert-card .ac-msg { font-size: 11px; color: var(--text-2); margin-top: 3px; }
.alert-card .ac-age { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-left: auto; }

.posture { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.posture .pt { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.posture .pt .pn { font-family: var(--font-mono); font-size: 19px; font-weight: 800; }
.posture .pt .pl { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* facts inline strip on status */
.facts-strip { display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--line); }
.fact { padding: 11px 18px; border-right: 1px solid var(--line); }
.fact .fk { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.fact .fv { font-family: var(--font-mono); font-size: 13px; font-weight: 700; margin-top: 3px; }

/* ---------- SECURITY & ACCESS ---------- */
.sec-block { padding: 16px; border-bottom: 1px solid var(--line); }
.sec-block:last-child { border-bottom: none; }
.sec-h { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.sec-h .ic { width: 17px; height: 17px; color: var(--text-2); }
.sec-h b { font-size: 13.5px; white-space: nowrap; }
.jail { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 13px; margin-bottom: 10px; }
.jail .jh { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.jail .jname { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.ban-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 11.5px; }
.ban-row:last-child { border-bottom: none; }
.ban-row .bip { flex: 1; }

.codeblock {
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; overflow-x: auto; color: var(--text-2);
}
.codeblock .num { color: var(--text-3); }
.ufw-tbl { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
.ufw-tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.ufw-tbl tr:last-child td { border-bottom: none; }
.ufw-tbl .uact { color: var(--success); font-weight: 700; }
.ufw-tbl .ucmt { color: var(--text-3); }

.acc-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.acc-row:last-child { border-bottom: none; }
.acc-k { width: 130px; flex: none; font-size: 12px; font-weight: 600; color: var(--text-2); }
.acc-v { flex: 1; font-family: var(--font-mono); font-size: 12.5px; word-break: break-all; }
.acc-v.masked { letter-spacing: 2px; color: var(--text-3); }

.diag-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.diag-row:last-child { border-bottom: none; }
.diag-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.diag-dot.ok { background: var(--success); } .diag-dot.warn { background: var(--warning); } .diag-dot.fail { background: var(--danger); }
.diag-row .dlabel { font-size: 12.5px; font-weight: 600; }
.diag-row .ddetail { font-size: 11.5px; color: var(--text-2); }

/* ---------- CONFIG & STACK ---------- */
.cfg-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 28px; padding: 16px; }
@media (max-width: 900px) { .cfg-grid { grid-template-columns: 1fr; } }
.cfg-grid .kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.cfg-grid .kv .k { color: var(--text-2); white-space: nowrap; } .cfg-grid .kv .v { font-family: var(--font-mono); font-weight: 600; text-align: right; white-space: nowrap; }
.ver-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; }
.ver-badge { font-family: var(--font-mono); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); }
.ver-badge.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* snapshot list */
.snap-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.snap-row:last-child { border-bottom: none; }
.snap-ic { width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.snap-meta { flex: 1; min-width: 0; }
.snap-title { font-size: 12.5px; font-weight: 600; }
.snap-sub { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); margin-top: 1px; }

/* ---------- provisioning + offline empty states ---------- */
.prov-wrap { padding: 22px 18px; }
.prov-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.prov-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: provspin .8s linear infinite; flex: none; }
@keyframes provspin { to { transform: rotate(360deg); } }
.prov-steps { display: flex; flex-direction: column; gap: 0; }
.prov-step { display: flex; align-items: flex-start; gap: 13px; padding: 11px 0; position: relative; }
.prov-step::before { content: ""; position: absolute; left: 12px; top: 30px; bottom: -11px; width: 2px; background: var(--line); }
.prov-step:last-child::before { display: none; }
.prov-step .ps-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; z-index: 1; background: var(--surface-2); border: 1px solid var(--line); }
.prov-step.done .ps-dot { background: var(--success); color: #fff; border-color: transparent; }
.prov-step.done .ps-dot .ic { width: 13px; height: 13px; }
.prov-step.active .ps-dot { background: var(--accent); border-color: transparent; }
.prov-step.active .ps-dot .ic { color: #fff; width: 13px; height: 13px; }
.prov-step .ps-body { flex: 1; padding-top: 3px; }
.prov-step .ps-title { font-size: 13px; font-weight: 600; }
.prov-step.pending .ps-title { color: var(--text-3); }
.prov-step .ps-detail { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.prov-bar { height: 7px; border-radius: 7px; background: var(--meter-track); overflow: hidden; margin: 4px 0 18px; }
.prov-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2))); border-radius: 7px; transition: width .6s var(--ease); }

.empty-state { padding: 40px 24px; text-align: center; }
.empty-state .es-ic { width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.empty-state .es-ic .ic { width: 24px; height: 24px; }
.empty-state .es-title { font-size: 15px; font-weight: 700; }
.empty-state .es-sub { font-size: 12.5px; color: var(--text-2); max-width: 420px; margin: 6px auto 0; line-height: 1.5; }

/* offline banner */
.offline-banner {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; margin-bottom: 16px;
  border: 1px solid var(--danger); background: var(--danger-soft); border-radius: var(--r-md);
}
.offline-banner.prov { border-color: var(--accent); background: var(--accent-soft); }
.offline-banner .ic { width: 20px; height: 20px; flex: none; }

/* ============================================================
   TERMINAL MODAL — PuTTY-style SSH session
   ============================================================ */
/* ── SSH Terminal overlay ─────────────────────────────────────────── */
.term-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8,10,16,.55);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 30px;
  transition: background .2s, backdrop-filter .2s;
}
.term-overlay.open { display: flex; animation: fadeup .2s var(--ease); }

/* Terminal window — fixed size, never grows with content */
.putty {
  /* Fixed dimensions — content never changes the window size */
  width:  min(960px, 94vw);
  height: min(580px, 84vh);
  min-width:  400px;
  min-height: 260px;
  display: flex; flex-direction: column;
  background: #000; border-radius: 8px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
  font-family: "Consolas", "IBM Plex Mono", ui-monospace, Menlo, monospace;
  /* Allow JS resize dragging */
  position: relative;
  resize: none; /* we handle resize manually */
}

/* Title bar */
.putty-bar {
  height: 30px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 6px 0 10px;
  background: linear-gradient(#3a6ea5, #2a5286); color: #fff;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 12.5px; user-select: none; cursor: move;
}
.putty-bar .pt-ico { width: 15px; height: 15px; border-radius: 3px; background: #f0c020; display: grid; place-items: center; flex: none; }
.putty-bar .pt-ico svg { width: 11px; height: 11px; color: #000; }
.putty-bar .pt-title { flex: 1; font-weight: 600; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.putty-bar .pt-win { display: flex; gap: 3px; }
.putty-bar .pt-win button { width: 22px; height: 20px; border-radius: 3px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; }
.putty-bar .pt-win button:hover { background: rgba(255,255,255,.28); }
.putty-bar .pt-win button.cls:hover { background: #e03b3b; }

/* Resize handle — bottom-right corner drag */
.putty-resize-handle {
  position: absolute; bottom: 0; right: 0;
  width: 18px; height: 18px; cursor: se-resize; z-index: 10;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,.15) 50%);
  border-bottom-right-radius: 8px;
}

/* Terminal screen — fills remaining space, never overflows */
#sdTermScreen {
  flex: 1; min-height: 0; min-width: 0;
  overflow: hidden; padding: 0;
  background: #000;
}
/* xterm.js must fill its container exactly */
#sdTermScreen .xterm        { height: 100%; }
#sdTermScreen .xterm-screen { height: 100% !important; }
#sdTermScreen .xterm-viewport { overflow-y: hidden !important; }

/* Maximised state */
.term-overlay.maximised .putty {
  width: 99vw !important; height: 98vh !important;
  border-radius: 4px;
}

/* ── Minimised drawer tab ─────────────────────────────────────────── */
/* Sits at bottom-right of screen, overlay stays open but transparent  */
.term-drawer {
  position: fixed;
  bottom: 0; right: 24px;
  height: 32px;
  min-width: 220px; max-width: 320px;
  display: none; align-items: center; gap: 8px;
  padding: 0 8px 0 12px;
  background: linear-gradient(#3a6ea5, #2a5286);
  border-radius: 6px 6px 0 0;
  color: #fff; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 -2px 12px rgba(0,0,0,.3);
  cursor: pointer; user-select: none;
  z-index: 201;
  white-space: nowrap; overflow: hidden;
}
.term-drawer .td-ico { width: 14px; height: 14px; flex: none; display: grid; place-items: center; }
.term-drawer .td-ico svg { width: 11px; height: 11px; }
.term-drawer .td-title { flex: 1; overflow: hidden; text-overflow: ellipsis; font-family: "Segoe UI", system-ui, sans-serif; }
.term-drawer .td-restore {
  width: 22px; height: 20px; border-radius: 3px; flex: none;
  display: grid; place-items: center;
  background: rgba(255,255,255,.12); color: #fff; font-size: 11px;
  cursor: pointer;
}
.term-drawer .td-restore:hover { background: rgba(255,255,255,.28); }
.term-drawer .td-close {
  width: 22px; height: 20px; border-radius: 3px; flex: none;
  display: grid; place-items: center;
  background: rgba(255,255,255,.12); color: #fff; font-size: 13px;
  cursor: pointer;
}
.term-drawer .td-close:hover { background: #e03b3b; }
.putty-screen::-webkit-scrollbar { width: 14px; }
.putty-screen::-webkit-scrollbar-track { background: #1a1a1a; }
.putty-screen::-webkit-scrollbar-thumb { background: #4a4a4a; border: 3px solid #1a1a1a; }
.putty-screen .t-green { color: #4ec94e; }
.putty-screen .t-cyan { color: #4ec9d6; }
.putty-screen .t-yellow { color: #e6d24e; }
.putty-screen .t-red { color: #f25b5b; }
.putty-screen .t-blue { color: #6a9ef0; }
.putty-screen .t-mag { color: #c678dd; }
.putty-screen .t-dim { color: #8a8a7a; }
.putty-screen .t-white { color: #fff; font-weight: 600; }
.putty-line { white-space: pre-wrap; }
.putty-input-line { display: flex; align-items: baseline; }
.putty-input-line .ps1 { color: #4ec94e; flex: none; white-space: nowrap; }
.putty-input-line .ps1 .path { color: #6a9ef0; }
.putty-cmd {
  background: #000 !important;
  background-color: #000 !important;
  border: none;
  outline: none;
  color: #d6d6c8 !important;
  font: inherit;
  flex: 1;
  padding: 0;
  margin-left: 4px;
  caret-color: #d6d6c8;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
}
/* kill browser autofill white flash */
.putty-cmd:-webkit-autofill,
.putty-cmd:-webkit-autofill:hover,
.putty-cmd:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #000 inset !important;
  -webkit-text-fill-color: #d6d6c8 !important;
  caret-color: #d6d6c8;
}
.putty-cursor { display: inline-block; width: 8px; height: 15px; background: #d6d6c8; vertical-align: text-bottom; animation: tcurs 1.05s step-end infinite; }
@keyframes tcurs { 50% { opacity: 0; } }
.putty-hint { font-family: "Segoe UI", system-ui, sans-serif; font-size: 11px; color: #7a7a6a; padding: 4px 10px 7px; background: #000; flex: none; border-top: 1px solid #1d1d1d; }
.putty-hint b { color: #b8b8a8; }

/* ═══════════════════════════════════════════════════════════════
   Stage 2 finishing panel
   ═══════════════════════════════════════════════════════════════ */

/* Container — sits between service grid and status-cols */
/* ═══════════════════════════════════════════════════════════════
   Stage 2 finishing panel — collapsible, fixed height, own scroll
   Never pushes the page — sits inline between service grid and
   activity timeline, collapses to just the header bar.
   ═══════════════════════════════════════════════════════════════ */

.fin-panel {
  margin: 0 0 2px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

/* ── Header bar — always visible, click to expand/collapse ──── */
.fin-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  /* No border-bottom — body has its own top border */
}
.fin-header:hover { filter: brightness(.97); }
.fin-header.run  { background: var(--warning-soft);  color: var(--warning); }
.fin-header.ok   { background: var(--success-soft);  color: var(--success); }
.fin-header.fail { background: var(--danger-soft);   color: var(--danger);  }

.fin-header-label { flex: 1; }

/* Chevron — rotates when expanded */
.fin-chevron {
  width: 16px; height: 16px; flex: none; display: grid; place-items: center;
  transition: transform .2s var(--ease);
  opacity: .6;
}
.fin-panel.expanded .fin-chevron { transform: rotate(180deg); }

/* Spinner dot in header */
.fin-spin-dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: fin-spin .8s linear infinite; flex: none;
}

/* ── Collapsible body ────────────────────────────────────────── */
/* Hidden by default — JS adds .expanded to .fin-panel to show */
.fin-body {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--line);
  /* Fixed max height — tasks scroll inside, page never moves */
  max-height: 320px;
  overflow: hidden;
}
.fin-panel.expanded .fin-body { display: flex; }

/* ── Progress bar ────────────────────────────────────────────── */
.fin-progress {
  height: 3px; flex: none;
  background: var(--meter-track); overflow: hidden;
}
.fin-progress-bar {
  height: 100%; background: var(--accent);
  transition: width .5s var(--ease); border-radius: 3px;
}

/* ── Task list — scrolls within the fixed-height body ───────── */
.fin-tasks {
  flex: 1; overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; gap: 0;
  padding: 4px 0;
  /* Thin custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.fin-tasks::-webkit-scrollbar { width: 4px; }
.fin-tasks::-webkit-scrollbar-track { background: transparent; }
.fin-tasks::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.fin-task {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; font-size: 12px;
  border-bottom: 1px solid var(--line);
  transition: background .12s; flex: none;
}
.fin-task:last-child { border-bottom: none; }
.fin-task.run  { background: var(--accent-soft); }
.fin-task.fail { background: var(--danger-soft); }
.fin-task.warn { background: var(--warning-soft); }

.fin-task-ic {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
}
.fin-task-ic .ic { width: 11px; height: 11px; }
.fin-task-ic.ok      { background: var(--success-soft); color: var(--success); }
.fin-task-ic.fail    { background: var(--danger-soft);  color: var(--danger);  }
.fin-task-ic.warn    { background: var(--warning-soft); color: var(--warning); }
.fin-task-ic.run     { background: var(--accent-soft);  color: var(--accent); animation: fin-spin .8s linear infinite; }
.fin-task-ic.pending { background: var(--surface-2);    color: var(--text-3);  }

.fin-task-body { flex: 1; min-width: 0; }
.fin-task-label { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-task-msg   { font-size: 11px; color: var(--text-2); margin-top: 1px; }

.fin-task.run .fin-task-label  { color: var(--accent); }
.fin-task.fail .fin-task-label { color: var(--danger); }
.fin-task.warn .fin-task-label { color: var(--warning); }

.fin-retry-task { flex: none; margin-left: auto; }

/* ── Log window — inside the body, own scroll ───────────────── */
#sdFinLogWrap { border-top: 1px solid var(--line); flex: none; }
.fin-log {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.65;
  background: #09090b; color: #d4d4d8;
  padding: 10px 14px;
  height: 180px;       /* fixed height — no more max-height expansion */
  overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
  scrollbar-width: thin; scrollbar-color: #333 transparent;
}
.fin-log::-webkit-scrollbar { width: 4px; }
.fin-log::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
.fin-log-line { display: block; }
[data-theme="dark"] .fin-log { background: #000; color: #e4e4e7; }

/* ── Spinning animation (shared) ────────────────────────────── */
@keyframes fin-spin { to { transform: rotate(360deg); } }

/* ── svc-dot.starting state (installing) ────────────────────── */
.svc-dot.starting {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: blink 1.1s ease-in-out infinite;
}
/* pill.accent for "N installing" count */
.pill.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Daemon rows ─────────────────────────────────────────────── */
.daemon-row { display:flex; align-items:flex-start; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.daemon-row:last-child { border-bottom:none; }
.daemon-ic  { padding-top:4px; }
.daemon-body { flex:1; min-width:0; }
.daemon-name { font-size:13px; font-weight:600; color:var(--text); margin-bottom:2px; }
.daemon-cmd  { font-size:11.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:3px; }
.daemon-meta { font-size:11.5px; }
.daemon-acts { display:flex; gap:4px; flex-shrink:0; }

/* ── DB manager ──────────────────────────────────────────────── */
.db-mgr { padding:16px; }
.db-header { margin-bottom:14px; }
.db-row { display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); font-size:12.5px; }
.db-row:last-child { border-bottom:none; }
.db-name { font-family:var(--font-mono); font-weight:600; flex:1; }
.db-meta { color:var(--text-2); font-size:12px; }

/* ── Firewall table ──────────────────────────────────────────── */
.ufw-tbl { width:100%; border-collapse:collapse; font-size:12.5px; }
.ufw-tbl th { text-align:left; font-size:11px; font-weight:500; color:var(--text-2); padding:6px 8px; border-bottom:1px solid var(--line); }
.ufw-tbl td { padding:7px 8px; border-bottom:1px solid var(--line); }
.ufw-tbl tr:last-child td { border-bottom:none; }
.btn.danger-hover:hover { color:var(--danger); border-color:var(--danger); }

/* ── Field labels ────────────────────────────────────────────── */
.field-label { font-size:11.5px; font-weight:500; color:var(--text-2); margin-bottom:4px; }

/* ── Updates tab ─────────────────────────────────────────────── */
.upd-log-line { padding:2px 0; white-space:pre-wrap; word-break:break-all; color:var(--text-2); font-size:12px; }
.upd-log-line.upd-log-err { color:var(--danger); }
.upd-log-line.upd-log-ok  { color:var(--success); }
