:root {
  --bg0: #e8efe8;
  --bg1: #d7e4d7;
  --ink: #122017;
  --muted: #4d6356;
  --line: rgba(18, 32, 23, 0.14);
  --panel: rgba(255, 255, 255, 0.72);
  --accent: #0f7a4a;
  --accent-ink: #062416;
  --danger: #9b2c2c;
  --ok: #14532d;
  --shadow: 0 24px 60px rgba(18, 32, 23, 0.12);
  --radius: 18px;
  --font-display: "Syne", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-mono);
  background:
    radial-gradient(1200px 600px at 10% -10%, #f7fff7 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #cfe7d4 0%, transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
}

body {
  position: relative;
  overflow-x: hidden;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.05;
  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;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  animation: rise 0.7s ease both;
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
}

h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

.lead, .muted, .empty {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: rise 0.6s ease both;
}

.login-stage {
  min-height: calc(100vh - 4rem);
  display: grid;
  place-items: center;
}

.login-panel,
.create,
.account {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
}

.login-panel {
  width: min(460px, 100%);
  animation: rise 0.75s ease both;
}

.layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: 0.95fr 1.05fr;
    align-items: start;
  }
}

.create { animation: rise 0.7s ease both; }
.list { animation: rise 0.85s ease both; }

.stack {
  display: grid;
  gap: 0.9rem;
}

.form-grid {
  grid-template-columns: 1fr 1fr;
}

.form-grid .full { grid-column: 1 / -1; }

.compact { gap: 0.7rem; }

label, fieldset {
  display: grid;
  gap: 0.35rem;
}

label span, legend {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

input, textarea, button {
  font: inherit;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: rgba(255,255,255,0.85);
  color: var(--ink);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.rights {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn.primary {
  background: var(--accent);
  color: #f4fff8;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn.danger {
  background: transparent;
  border-color: rgba(155, 44, 44, 0.35);
  color: var(--danger);
}

.flash {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  animation: rise 0.45s ease both;
}

.flash-ok { background: rgba(20, 83, 45, 0.08); color: var(--ok); }
.flash-error { background: rgba(155, 44, 44, 0.08); color: var(--danger); }

.account-list {
  display: grid;
  gap: 1rem;
}

.account {
  position: relative;
}

.account header { margin-bottom: 0.75rem; }

.conn {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.conn code {
  display: inline-block;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: rgba(18, 32, 23, 0.06);
  font-size: 0.8rem;
}

.actions { display: flex; gap: 0.6rem; }

.delete-form {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar { align-items: start; flex-direction: column; }
}
