:root {
  --bg: #e8edf2;
  --bg-deep: #d5dee8;
  --surface: #f7f9fb;
  --ink: #152033;
  --muted: #5a6a7d;
  --line: #c5d0dc;
  --accent: #0b5fff;
  --accent-dark: #0847c2;
  --ok-bg: #e4f5ea;
  --ok-ink: #1f6b3a;
  --err-bg: #fde8e8;
  --err-ink: #9b1c1c;
  --shadow: 0 12px 40px rgba(21, 32, 51, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(11, 95, 255, 0.12), transparent 32%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(197, 208, 220, 0.8);
  background: rgba(247, 249, 251, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand strong {
  display: block;
  font-size: 1rem;
  line-height: 1.1;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  background: linear-gradient(145deg, #0b5fff, #083a9c);
  color: white;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark.large {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

nav a {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

nav a:hover,
nav a.active {
  background: rgba(11, 95, 255, 0.1);
  color: var(--accent-dark);
}

nav a.logout {
  color: #8a3b3b;
}

.page {
  width: min(920px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.8rem;
}

.page-head p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label,
.features legend {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: white;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(11, 95, 255, 0.35);
  outline-offset: 1px;
}

.features {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
  margin: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1rem;
  margin-top: 0.65rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.95rem;
}

.check input {
  margin-top: 0.2rem;
}

.readonly {
  justify-content: flex-end;
}

.readonly-value {
  font-family: var(--mono);
  font-size: 1.05rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: #eef3f8;
  border: 1px solid var(--line);
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.btn:hover {
  background: #eef3f8;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn.primary:hover {
  background: var(--accent-dark);
}

.btn.ghost {
  background: transparent;
}

.btn.full {
  width: 100%;
}

.alert {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.alert-error {
  background: var(--err-bg);
  color: var(--err-ink);
}

.alert-success {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.result-panel {
  margin-top: 1.25rem;
}

.result-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.code-display {
  font-family: var(--mono);
  font-size: 1.45rem;
  letter-spacing: 0.08em;
  padding: 1rem;
  border-radius: 12px;
  background: #10233f;
  color: #f4f7fb;
  margin-bottom: 1rem;
}

.batch-results {
  margin: 0 0 1rem;
  padding: 1rem;
  overflow: auto;
  max-height: 420px;
  border-radius: 12px;
  background: #10233f;
  color: #e8eef7;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.45;
}

.hint {
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.55rem;
}

.login-brand p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-form label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--muted);
}

@media (max-width: 720px) {
  .form-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
