:root {
  --bg: #0f1419;
  --panel: #1c2530;
  --line: #2a3644;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #3d9a6a;
  --accent2: #2d7a54;
  --danger: #c45050;
  --radius: 10px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: Consolas, "Cascadia Code", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1000px 500px at 0% -10%, #1a2a22 0%, transparent 55%),
    radial-gradient(800px 400px at 100% 0%, #1a2433 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: #7ec8a3; text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }
code { background: #0c1015; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
pre { white-space: pre-wrap; margin: .35rem 0 0; color: #c5d2de; font-size: .82rem; line-height: 1.4; }

.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-card, .install-card {
  width: min(480px, 100%);
  background: linear-gradient(180deg, #1e2833, #161d25);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.install-card { width: min(640px, 100%); }
.brand-mark {
  font-size: .75rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: .75rem;
}
.lede, .hint { color: var(--muted); line-height: 1.5; }
.stack-form { display: grid; gap: .85rem; }
.stack-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0; }
.stack-form legend { padding: 0 .4rem; color: var(--muted); font-size: .85rem; }
.stack-form label, form label { display: grid; gap: .35rem; font-size: .9rem; color: var(--muted); }
input, select, textarea {
  background: #0f151b; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: .65rem .75rem; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(61,154,106,.35); border-color: var(--accent); }
.alert { padding: .75rem .9rem; border-radius: 8px; margin-bottom: .85rem; }
.alert.ok { background: rgba(61,154,106,.15); border: 1px solid rgba(61,154,106,.35); }
.alert.err { background: rgba(196,80,80,.15); border: 1px solid rgba(196,80,80,.35); }
.alert.info { background: rgba(58,124,165,.15); border: 1px solid rgba(58,124,165,.35); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 8px; padding: .6rem 1rem; font: inherit; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; font-weight: 600; }
.btn.danger { background: rgba(196,80,80,.2); border-color: rgba(196,80,80,.4); color: #f0b0b0; }
.btn.full { width: 100%; }
.btn.sm { padding: .35rem .65rem; font-size: .85rem; }

.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #121820; border-right: 1px solid var(--line); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.sidebar .logo { font-weight: 700; padding: .25rem .5rem; }
.sidebar .logo span { color: var(--accent); }
.nav { display: grid; gap: .25rem; }
.nav a { color: var(--muted); padding: .55rem .7rem; border-radius: 8px; text-decoration: none; }
.nav a:hover, .nav a.active { background: rgba(61,154,106,.12); color: var(--text); }
.sidebar .foot { margin-top: auto; color: var(--muted); font-size: .8rem; padding: .5rem; }
.main { padding: 1.5rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: 1.45rem; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.realtime-layout { display: grid; grid-template-columns: 1fr 360px; gap: 1rem; }
#map { height: 70vh; min-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }
.live-panel { max-height: 70vh; overflow: auto; }
.sms-box {
  background: #121a14; border: 1px dashed rgba(61,154,106,.4); border-radius: var(--radius);
  padding: 1rem; font-family: var(--mono); font-size: .9rem; word-break: break-all; margin: .5rem 0;
}
.terminal-form { display: flex; gap: .5rem; }
.terminal-form input { flex: 1; font-family: var(--mono); }
.stack-form { display: grid; gap: .85rem; }
.btn.full { width: 100%; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; font-weight: 600; }

.grid { display: grid; gap: 1rem; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.card .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.card .value { font-size: 1.6rem; font-weight: 700; margin-top: .25rem; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .7rem .85rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #151c24; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; }
.badge { display: inline-block; padding: .15rem .45rem; border-radius: 999px; font-size: .75rem; background: #243041; color: var(--muted); }
#map { height: 70vh; min-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }
.realtime-layout { display: grid; grid-template-columns: 1fr 360px; gap: 1rem; }
.live-panel { max-height: 70vh; overflow: auto; }
.log-item { border-bottom: 1px solid var(--line); padding: .65rem 0; }
.log-item .meta { color: var(--muted); font-size: .78rem; margin-bottom: .25rem; }
.sms-box {
  background: #121a14; border: 1px dashed rgba(61,154,106,.4); border-radius: var(--radius);
  padding: 1rem; font-family: var(--mono); font-size: .9rem; word-break: break-all; margin: .5rem 0;
}
.terminal-form { display: flex; gap: .5rem; }
.terminal-form input { flex: 1; font-family: var(--mono); }
.help-section { margin-bottom: 1.25rem; }
.cmd-row { display: grid; grid-template-columns: 180px 1fr 70px; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.cmd-row code { color: #9ad4b8; }
.hidden { display: none !important; }
.steps { color: var(--muted); line-height: 1.6; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .realtime-layout { grid-template-columns: 1fr; }
  .cmd-row { grid-template-columns: 1fr; }
}

.page-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1.25rem; }
.page-head h1 { margin:0; font-size:1.45rem; }
.page-head p { margin:.25rem 0 0; color:var(--muted); }
.alert.ok { background:rgba(61,154,106,.15); border:1px solid rgba(61,154,106,.35); }
.alert.err { background:rgba(196,80,80,.15); border:1px solid rgba(196,80,80,.35); }
.btn.primary { background:linear-gradient(180deg,var(--accent),var(--accent2)); border-color:transparent; color:#fff; font-weight:600; }
.btn.full { width:100%; }
.stack-form { display:grid; gap:.85rem; }
.brand-mark { font-size:.75rem; letter-spacing:.18em; text-transform:uppercase; color:var(--accent); font-weight:700; margin-bottom:.75rem; }
.lede { color:var(--muted); line-height:1.5; }
.hint { color:var(--muted); font-size:.9rem; }
