:root {
  color-scheme: dark;
  --bg: #07110f;
  --surface: #0d1b18;
  --surface-2: #112420;
  --border: #244039;
  --text: #f0f7f3;
  --muted: #94aaa2;
  --accent: #68f0b1;
  --accent-strong: #36d894;
  --danger: #ff7c83;
  --warning: #ffd37a;
  --shadow: 0 24px 80px rgba(0, 0, 0, .32);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 0%, #12372c 0, transparent 32rem), var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
.muted { color: var(--muted); line-height: 1.7; }
.eyebrow { margin: 0 0 .45rem; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .65rem; font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.045em; line-height: 1.02; }
h2 { margin-bottom: .2rem; font-size: 1.35rem; letter-spacing: -.025em; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; min-height: 76px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid rgba(104, 240, 177, .12); background: rgba(7, 17, 15, .82); backdrop-filter: blur(18px); }
.brand, .top-actions { display: flex; align-items: center; gap: 12px; }
.brand > div { display: grid; gap: 2px; }
.brand span { color: var(--muted); font-size: .8rem; }
.brand-mark { display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid rgba(104, 240, 177, .45); border-radius: 17px; background: linear-gradient(145deg, rgba(104,240,177,.22), rgba(104,240,177,.04)); color: var(--accent); font-weight: 900; letter-spacing: -.06em; box-shadow: inset 0 1px rgba(255,255,255,.1); }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: .82rem; }
.secure-pill, .step-badge { padding: 7px 11px; border: 1px solid rgba(104,240,177,.25); border-radius: 999px; background: rgba(104,240,177,.08); color: var(--accent); font-size: .75rem; font-weight: 700; }

.page-shell { width: min(1240px, calc(100% - 36px)); margin: 0 auto; padding: 58px 0 80px; }
.overview { display: flex; justify-content: space-between; align-items: end; gap: 34px; margin-bottom: 34px; }
.overview > div:first-child { max-width: 680px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(94px, 1fr)); gap: 10px; }
.stats article { min-width: 104px; padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: rgba(13,27,24,.76); }
.stats span { display: block; color: var(--muted); font-size: .76rem; }
.stats strong { display: block; margin-top: 8px; font-size: 1.75rem; }
.success { color: var(--accent); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; margin-bottom: 18px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17,36,32,.94), rgba(10,23,20,.95)); box-shadow: var(--shadow); }
.create-panel, .architecture-panel, .nodes-panel { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 22px; }
.node-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.node-form label, .stack label { display: grid; gap: 8px; color: #c9d8d2; font-size: .8rem; font-weight: 700; }
.node-form .full { grid-column: 1 / -1; }
input { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid #315047; border-radius: 11px; outline: none; background: #081512; color: var(--text); transition: border .15s, box-shadow .15s; }
input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(104,240,177,.1); }
.button { min-height: 42px; padding: 0 15px; border: 1px solid transparent; border-radius: 11px; font-weight: 800; color: var(--text); background: transparent; }
.button.primary { background: var(--accent); color: #052319; }
.button.primary:hover { background: #8bf7c7; }
.button.ghost { border-color: var(--border); background: rgba(255,255,255,.025); }
.button.wide { width: 100%; }
.form-error { min-height: 1.2em; margin: 0; color: var(--danger); font-size: .82rem; }
.architecture-panel h2 { word-break: break-all; }
.flow { display: grid; gap: 10px; margin: 28px 0; }
.flow span { padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: #0a1714; text-align: center; }
.flow b { color: var(--accent); text-align: center; }
.notice { margin: 0; padding: 14px; border-left: 2px solid var(--accent); background: rgba(104,240,177,.06); color: var(--muted); font-size: .82rem; line-height: 1.65; }

.nodes-heading { align-items: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 16px 14px; border-bottom: 1px solid rgba(36,64,57,.62); vertical-align: middle; }
td strong, td small { display: block; }
td small { margin-top: 6px; color: var(--muted); font-size: .72rem; }
code { color: #c9fbe2; font-family: "SFMono-Regular", Consolas, monospace; font-size: .78rem; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 800; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.status.online { color: var(--accent); }
.status.offline { color: var(--danger); }
.status.unknown { color: var(--warning); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 260px; }
.icon-button { padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: #0b1916; color: #cbd9d4; font-size: .72rem; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.icon-button.danger:hover { border-color: var(--danger); color: var(--danger); }
.disabled-row { opacity: .56; }
.empty-state { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 16px; border: 1px solid var(--border); border-radius: 50%; color: var(--accent); font-size: 1.6rem; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.modal-card { position: relative; z-index: 1; width: min(440px, 100%); padding: 28px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #183129; color: var(--text); font-size: 1.4rem; }
.modal-card img { width: min(280px, 100%); margin: 18px auto; border: 10px solid white; border-radius: 13px; background: white; }
.link-preview { display: block; max-height: 76px; margin-bottom: 16px; padding: 12px; overflow: auto; border-radius: 10px; background: #07120f; color: var(--muted); word-break: break-all; text-align: left; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: min(380px, calc(100% - 44px)); padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px; background: #132a24; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast[data-tone="success"] { border-color: var(--accent-strong); }
.toast[data-tone="error"] { border-color: var(--danger); }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(430px, 100%); }
.login-card { padding: 34px; border: 1px solid var(--border); border-radius: 24px; background: rgba(13,27,24,.93); box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 24px; }
.login-card h1 { font-size: 2.2rem; }
.stack { display: grid; gap: 16px; margin-top: 28px; }

@media (max-width: 860px) {
  .overview { align-items: stretch; flex-direction: column; }
  .stats { width: 100%; }
  .workspace-grid { grid-template-columns: 1fr; }
  .secure-pill { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 16px; }
  .brand > div span { display: none; }
  .page-shell { width: min(100% - 24px, 1240px); padding-top: 34px; }
  .node-form { grid-template-columns: 1fr; }
  .node-form .full { grid-column: auto; }
  .stats article { min-width: 0; padding: 12px; }
  .stats strong { font-size: 1.35rem; }
  .create-panel, .architecture-panel, .nodes-panel { padding: 18px; }
}

