@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Manrope:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  --ink: #121a17;
  --muted: #5d6b64;
  --line: rgba(18, 26, 23, 0.1);
  --bg: #eef3ef;
  --panel: #fffdf9;
  --sidebar: #14241e;
  --sidebar-text: #d7e4dc;
  --accent: #0f7a5a;
  --accent-2: #c45c26;
  --danger: #b42318;
  --ok: #0f7a5a;
  --shadow: 0 16px 40px rgba(18, 26, 23, 0.1);
  --radius: 16px;
  --font-display: "Fraunces", "Noto Serif SC", Georgia, serif;
  --font-body: "Manrope", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

/* Auth */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(15, 122, 90, 0.2), transparent 55%),
    radial-gradient(700px 360px at 100% 0%, rgba(196, 92, 38, 0.16), transparent 50%),
    linear-gradient(160deg, #f4f7f3, #e7eee9 45%, #f3efe6);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 2rem 1.6rem;
  animation: rise 0.55s ease both;
}
.auth-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}
.auth-card h1 {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
}
.auth-sub {
  margin: 0.55rem 0 1.3rem;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

/* Shell */
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: #f4faf6;
  padding: 0.3rem 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.nav-list { display: grid; gap: 0.35rem; }
.nav-item {
  display: block;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  color: var(--sidebar-text);
  transition: background 0.15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-item.active {
  background: rgba(15, 122, 90, 0.35);
  color: #fff;
}
.sidebar-foot {
  margin-top: auto;
  padding: 0.6rem;
  font-size: 0.85rem;
  opacity: 0.75;
}
.main {
  padding: 1.5rem 1.6rem 2.5rem;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.3rem;
}
.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}
.topbar p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
}
.panel + .panel { margin-top: 1rem; }
.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-family: var(--font-display);
}

.stack { display: grid; gap: 0.9rem; }
.field { display: grid; gap: 0.35rem; }
.field span, .field > label { color: var(--muted); font-size: 0.9rem; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: #fff;
  outline: none;
}
.field input:focus, .field textarea:focus {
  border-color: rgba(15, 122, 90, 0.5);
  box-shadow: 0 0 0 4px rgba(15, 122, 90, 0.1);
}
.field textarea { min-height: 90px; resize: vertical; }
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.72rem 1.15rem;
  cursor: pointer;
  background: rgba(18, 26, 23, 0.08);
  color: var(--ink);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.88rem; }

.alert {
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.alert-error { background: rgba(180, 35, 24, 0.1); color: var(--danger); }
.alert-ok { background: rgba(15, 122, 90, 0.12); color: var(--ok); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin-top: 0.2rem;
}
.stat span { color: var(--muted); font-size: 0.9rem; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.92rem;
}
th { color: var(--muted); font-weight: 600; }
.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  background: #e8efe9;
}
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; word-break: break-all; }

.upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}
.preview {
  margin-top: 0.6rem;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  background: #e8efe9;
  display: none;
}
.preview.show { display: block; }

.qr-box {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}
.qr-box canvas,
.qr-box img,
.qr-img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: block;
  object-fit: contain;
}
.qr-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.qr-thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}

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

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
  }
  .sidebar-brand { border: none; padding: 0.3rem 0.5rem; width: 100%; }
  .nav-list { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; width: 100%; }
  .sidebar-foot { display: none; }
  .stats { grid-template-columns: 1fr; }
}
