:root{
  --bg:#0b0d10;
  --panel:#0f1217;
  --text:#d7dde6;
  --muted:#8f9aaa;
  --faint:#505b6b;
  --border:#222a36;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --radius: 14px;
  --max: 860px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:
    radial-gradient(1200px 900px at 10% 0%, rgba(120,140,170,.10), transparent 55%),
    radial-gradient(900px 600px at 90% 20%, rgba(120,140,170,.08), transparent 55%),
    var(--bg);
  color:var(--text);
  font-family:var(--sans);
  line-height:1.45;
  min-height:100vh;
  display:flex;
  justify-content:center;
  align-items:center;
  padding: 28px 12px 40px;
}

/* Allow scrolling-first layout on short viewports */
@media (max-height: 740px){
  body{
    align-items:flex-start;
    padding-top: 18px;
  }
}

a{color:inherit; text-decoration:none}
a:hover{text-decoration:underline}

/* Outer container keeps page safe on mobile while centering the cluster */
.container{
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 24px 18px 44px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: auto;
}

/* Shell keeps the page elements cohesive and centered */
.shell{
  display:flex;
  flex-direction:column;
  gap: 14px;
  min-height: auto;
  justify-content: center;
}

/* On short viewports, fall back to normal flow */
@media (max-height: 760px){
  .shell{ justify-content: flex-start; }
}

.topbar{
  display:flex;
  gap:14px;
  align-items:flex-start;
  justify-content:space-between;
}

.brand{display:flex; flex-direction:column; gap:4px;}
.brand h1{font-size:22px; font-weight:560; letter-spacing:.2px; margin:0;}
.brand .sub{
  font-family:var(--mono);
  font-size:12px;
  color:var(--muted);
  line-height: 1.15;
  min-height: 14px;
}

.nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:flex-start;
}
.nav a{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
}
.nav a:hover{border-color:var(--border); background:rgba(255,255,255,.03); text-decoration:none; color:var(--text);}

.main{display:flex; flex-direction:column; flex: 0 0 auto;}
.card{
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
h2{margin:0 0 10px; font-size:16px; font-weight:560; letter-spacing:.2px;}
p{margin:10px 0; color:var(--text);}
.muted{color:var(--muted);}
.faint{color:var(--faint);}
.hr{height:1px; background:var(--border); margin:14px 0;}
.grid{display:grid; gap:14px;}
@media (min-width: 840px){ .grid.two{grid-template-columns: 1.2fr .8fr;} }

label{display:block; font-family:var(--mono); font-size:12px; color:var(--muted); margin:12px 0 6px;}
input,select,textarea{
  width:100%;
  font-family:var(--mono);
  font-size:13px;
  color:var(--text);
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  outline:none;
}
textarea{min-height:110px; resize:vertical;}
input:focus,select:focus,textarea:focus{border-color:rgba(207,215,227,.35); box-shadow:0 0 0 4px rgba(207,215,227,.08);}

.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center; justify-content:space-between; margin-top:14px;}
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:11px 14px; border-radius:12px; border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text); font-family:var(--mono); font-size:12.5px;
  cursor:pointer; user-select:none;
}
.btn:hover{background:rgba(255,255,255,.05);}
.btn.primary{border-color:rgba(207,215,227,.20);}

.kv{display:grid; grid-template-columns:180px 1fr; gap:8px 14px; font-family:var(--mono); font-size:12px;}
.kv .k{color:var(--muted);} .kv .v{color:var(--text);}

.notice{
  border: 1px dashed rgba(207,215,227,.25);
  background: rgba(207,215,227,.04);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.footer{
  margin-top: 4px;
  font-family:var(--mono);
  font-size:11px;
  color:#6b7583;
  letter-spacing:.12em;
  text-transform:uppercase;
}

/* Time-based degradation */
.degraded-1 .muted{ color:#7f8a99; }
.degraded-2 .muted{ color:#6f7a88; }
.degraded-2 p{ letter-spacing: .1px; }

/* Keep "center" pages visually centered inside their own card area */
.main.center{ justify-content: center; }

/* On small screens, reserve up to two lines for the subline */
@media (max-width: 560px){
  .brand .sub{ min-height: 28px; }
  .topbar{ gap: 10px; }
  .nav{
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}
