:root {
  --bg0: #0c0d0f;
  --bg1: #14161a;
  --bg2: #1c1f26;
  --line: rgba(255, 236, 200, 0.08);
  --text: #f3efe6;
  --muted: #9a958a;
  --accent: #e8b86d;
  --accent-2: #f0d5a0;
  --ok: #6fbf8a;
  --warn: #e0a85c;
  --danger: #e07a6a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font-display: "Syne", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body {
  position: relative;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}
input, textarea, button, code { user-select: text; -webkit-user-select: text; }

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}
.glow {
  pointer-events: none;
  position: fixed;
  width: 60vw;
  height: 60vw;
  top: -20vw;
  right: -15vw;
  background: radial-gradient(circle, rgba(232, 184, 109, 0.14), transparent 65%);
  z-index: 0;
}

.view { position: relative; z-index: 1; }

.login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 36px 32px;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.03), transparent 40%),
    var(--bg1);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
}
.brand {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.28em;
  font-size: 12px;
  color: var(--accent);
}
.brand.sm { margin-bottom: 4px; }
.login-card h1, .top h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.03em;
}
.sub, .hint {
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}
.sub { margin: 10px 0 28px; }
.hint { margin: 0 0 16px; }
.hint code, .meta code, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--accent-2);
}

.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field span { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg0);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 14px;
  font: 500 15px/1.3 var(--font-body);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { resize: vertical; min-height: 100px; }
input:focus, textarea:focus {
  border-color: rgba(232, 184, 109, 0.45);
  box-shadow: 0 0 0 3px rgba(232, 184, 109, 0.12);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  font: 600 14px/1 var(--font-body);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #c9924a);
  color: #1a1208;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: rgba(232,184,109,0.35); }
.btn-ok { background: rgba(111,191,138,0.12); color: var(--ok); border-color: rgba(111,191,138,0.25); }
.btn-warn { background: rgba(224,168,92,0.12); color: var(--warn); border-color: rgba(224,168,92,0.25); }
.btn-danger { background: rgba(224,122,106,0.12); color: var(--danger); border-color: rgba(224,122,106,0.25); }

.err {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.app-view {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  animation: rise 0.45s ease both;
}
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.top-actions { display: flex; gap: 8px; }

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--bg2);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(111,191,138,0.0);
}
.pill.on .dot {
  background: var(--ok);
  box-shadow: 0 0 12px rgba(111,191,138,0.7);
  animation: pulse 1.8s ease infinite;
}
.pill.off .dot { background: var(--danger); }
.meta { color: var(--muted); font-size: 13px; margin-left: auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 30%), var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  animation: rise 0.5s ease both;
}
.panel:nth-child(2) { animation-delay: 0.05s; }
.panel:nth-child(3) { animation-delay: 0.1s; }
.panel:nth-child(4) { animation-delay: 0.15s; }
.panel:nth-child(5) { animation-delay: 0.2s; }
.panel.wide { grid-column: 1 / -1; }
.panel h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.02em;
}
.stack { display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row .btn { flex: 1 1 120px; }

.file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px dashed rgba(232,184,109,0.3);
  border-radius: 14px;
  background: rgba(232,184,109,0.04);
  cursor: pointer;
}
.file input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.file span { color: var(--accent-2); font-weight: 500; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1f232b;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: rise 0.25s ease both;
}
.toast.bad { border-color: rgba(224,122,106,0.4); color: #ffd2cb; }
.toast.ok { border-color: rgba(111,191,138,0.4); color: #d6ffe2; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(111,191,138,0.55); }
  50% { box-shadow: 0 0 0 8px rgba(111,191,138,0); }
}

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: stretch; }
  .meta { margin-left: 0; width: 100%; }
}
