:root {
  color-scheme: light;
  --bg-base: #f8fafc;
  --bg-card: #ffffff;
  --bg-soft: #f1f5f9;
  --ink: #0f172a;
  --ink-soft: #475569;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-glow: rgba(13, 148, 136, 0.2);
  --danger: #b91c1c;
  --border: #e2e8f0;
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font: "Space Grotesk", "Sora", "Avenir Next", "Futura", "Trebuchet MS", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 8% -10%, #fde68a 0%, transparent 60%),
    radial-gradient(780px 520px at 110% 0%, #bfdbfe 0%, transparent 55%),
    linear-gradient(160deg, #f8fafc 0%, #eef2ff 65%, #f8fafc 100%);
}

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

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 18px 80px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.login-card .brand {
  margin-bottom: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-center {
  justify-content: center;
  text-align: left;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(140deg, #0f766e, #38bdf8);
  box-shadow: 0 10px 24px rgba(14, 116, 144, 0.35);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 1.3rem;
  text-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
}

.brand-mark::before {
  content: "🛒";
}

.brand-mark.has-logo::before {
  content: "";
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.nav a:hover,
.nav a:focus {
  background: var(--bg-card);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
  font-size: 0.9rem;
  border: 1px solid rgba(15, 118, 110, 0.2);
}

.content {
  display: grid;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: fade-up 320ms ease;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.card p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.card hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.grid-2 {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  gap: 8px;
}

label {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-family: var(--font);
  font-size: 0.96rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  background: #ffffff;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.color-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.color-grid input[type="color"] {
  padding: 4px;
  height: 42px;
  width: 100%;
}

button,
.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-family: var(--font);
  font-size: 0.95rem;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(140deg, var(--accent), #0ea5a4);
  box-shadow: 0 14px 24px rgba(14, 116, 144, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

button:hover,
.btn:hover,
button:focus,
.btn:focus {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(14, 116, 144, 0.28);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.82rem;
  box-shadow: none;
}

.btn-muted {
  color: #334155;
  background: #e2e8f0;
  border: 1px solid #cbd5f5;
  box-shadow: none;
}

.btn-muted:hover,
.btn-muted:focus {
  box-shadow: none;
  background: #d7dee9;
}

.btn-secondary {
  color: var(--accent-strong);
  background: rgba(15, 118, 110, 0.12);
  border: 1px solid rgba(15, 118, 110, 0.3);
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(140deg, #dc2626, #f97316);
  box-shadow: 0 14px 24px rgba(220, 38, 38, 0.25);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.list .meta {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.meta {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.structure-list {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

.structure-list code {
  font-family: "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "Courier New", monospace;
  background: rgba(15, 118, 110, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
}

.code-editor {
  min-height: 180px;
  font-family: "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  border: 1px solid rgba(15, 118, 110, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  white-space: pre;
}

.code-editor:focus {
  background: #ffffff;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.25);
  color: #166534;
}

.alert-warning {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
  color: #b91c1c;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
  color: #991b1b;
}

.logo-preview {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.logo-preview img {
  max-height: 80px;
  border-radius: 14px;
}

.button-row .hint {
  color: var(--ink-soft);
  font-size: 0.9rem;
  align-self: center;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.qr-shell {
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(15, 118, 110, 0.35);
  background: rgba(255, 255, 255, 0.7);
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-right: 6px;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.radio-pill input {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid rgba(15, 118, 110, 0.35);
  display: inline-block;
  position: relative;
}

.radio-pill input:checked {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 0 55%, transparent 60%);
}

.radio-pill:has(input:checked) {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.3);
  box-shadow: 0 10px 18px rgba(14, 116, 144, 0.12);
}

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

.qr-shell img {
  width: 200px;
  height: 200px;
}

.full-height {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}

.full-width {
  width: 100%;
}

.login-card {
  max-width: 420px;
  width: 100%;
  text-align: left;
}

.login-card h2 {
  margin-bottom: 6px;
}

.no-margin-bottom {
  margin-bottom: 0;
}

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

@media (max-width: 720px) {
  .page {
    padding-top: 28px;
  }

  .topbar {
    align-items: flex-start;
  }

  .nav {
    width: 100%;
  }

  .card {
    padding: 20px;
  }
}
