:root {
  --bg: #0d1117; --panel: #161b22; --panel2: #1c2330; --line: #2d333b;
  --text: #e6edf3; --muted: #8b949e; --pri: #2f81f7; --ok: #3fb950;
  --warn: #d29922; --bad: #f85149; --radius: 10px; --sidebar-w: 230px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, sans-serif; overflow: hidden; height: 100vh; }
code, .cmdline { font-family: Consolas, "Cascadia Mono", monospace; }

/* ── App layout ── */
.app-layout { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  transition: width .2s ease, min-width .2s ease; z-index: 10;
}
#sidebar.collapsed { width: 56px; min-width: 56px; }
#sidebar.collapsed .logo, #sidebar.collapsed .nav-label, #sidebar.collapsed .nav-badge, #sidebar.collapsed #nginx-pill { display: none; }
#sidebar.collapsed .sidebar-head { justify-content: center; }
#sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
#sidebar.collapsed .sidebar-footer { flex-direction: column; gap: 8px; align-items: center; }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.logo { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.logo-big { font-weight: 700; font-size: 22px; margin-bottom: 4px; }

nav { display: flex; flex-direction: column; gap: 4px; padding: 12px 8px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item.active { background: #1f2937; color: #fff; font-weight: 600; }
.nav-icon { font-size: 16px; min-width: 20px; text-align: center; }
.nav-label { flex: 1; white-space: nowrap; }
.nav-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.nav-badge.hidden { display: none; }

.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.footer-btns { display: flex; gap: 4px; }

/* ── Main Area ── */
.main-area { flex: 1; overflow-y: auto; padding: 22px 28px; display: flex; flex-direction: column; gap: 18px; }

/* ── Sections ── */
.section { display: none; flex-direction: column; gap: 14px; }
.section.active { display: flex; }
.section-head { display: flex; align-items: center; gap: 12px; }
.section-head h2 { font-size: 18px; font-weight: 600; color: #fff; }
.section-desc { font-size: 13px; margin-top: -6px; }
.sub-title { font-size: 14px; font-weight: 600; color: var(--muted); margin-top: 10px; text-transform: uppercase; letter-spacing: .5px; }

/* ── Cards & Tables ── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.job-card { border-color: var(--pri); }
.sub-card { margin-top: 12px; }

.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; background: var(--panel); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }
td a { color: var(--pri); text-decoration: none; }
td a:hover { text-decoration: underline; }
td.center, th.center { text-align: center; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 6px; }

/* ── Pills & Badges ── */
.pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.bad { color: var(--bad); border-color: var(--bad); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.running { color: var(--pri); border-color: var(--pri); }

/* ── Buttons ── */
.btn { font: inherit; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .15s; }
.btn:hover { border-color: var(--pri); color: #fff; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel2); border-color: var(--line); }
.btn-icon { width: 32px; height: 32px; padding: 0; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 3px 9px; font-size: 12px; }

/* ── Forms ── */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
.grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.grid label.wide { grid-column: span 2; }
.grid input { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.grid input:focus { outline: none; border-color: var(--pri); }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }

/* ── Logs ── */
.log { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; line-height: 1.6; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.log.log-tall { max-height: calc(100vh - 200px); }
.cmdline { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }

/* ── Overlay / Login ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 30; }
.overlay.hidden { display: none; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 380px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.login-card p { color: var(--muted); font-size: 13px; }
.login-card input { font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); text-align: center; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }
.chk { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ── Toast ── */
.toast { position: fixed; bottom: 22px; right: 28px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); padding: 10px 18px; border-radius: 10px; z-index: 40; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.toast.ok { border-color: var(--ok); }
.toast.bad { border-color: var(--bad); }
