:root {
  --sidebar-w: 240px;
  --header-h: 60px;
  --brand: #2563eb;
  --brand-dark: #1e3a8a;
  --bg: #f3f4f6;
  --sidebar-bg: #111827;
  --sidebar-fg: #cbd5e1;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-family: -apple-system, "Segoe UI", "Microsoft JhengHei", Roboto, sans-serif; color: #1f2937; }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.auth-wrapper { width: 100%; max-width: 410px; padding: 1rem; }
.auth-card { background: #fff; border-radius: 16px; padding: 2.2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.auth-brand h1 { font-size: 1.15rem; margin: .6rem 0 0; }
.auth-title { font-size: 1.3rem; margin-bottom: 1.2rem; }
.auth-footer { text-align: center; color: rgba(255,255,255,.7); margin-top: 1rem; font-size: .85rem; }
.qr-img { width: 200px; height: 200px; border: 1px solid #e5e7eb; border-radius: 8px; }

/* ---------- Admin shell ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-fg); position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; z-index: 1030; transition: transform .25s; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.brand-text { font-weight: 600; color: #fff; font-size: .98rem; }
.sidebar-nav { padding: .8rem .6rem; display: flex; flex-direction: column; gap: .2rem; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: .75rem; padding: .65rem .85rem; border-radius: 8px; color: var(--sidebar-fg); text-decoration: none; font-size: .92rem; }
.sidebar-nav .nav-link i { font-size: 1.05rem; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; }

.admin-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.admin-header { height: var(--header-h); background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; gap: 1rem; padding: 0 1.2rem; position: sticky; top: 0; z-index: 1020; }
.header-title { font-size: 1.1rem; margin: 0; flex: 1; }
.header-right .dropdown-toggle { display: inline-flex; align-items: center; gap: .4rem; }
.sidebar-toggle { display: none; }
.admin-content { padding: 1.4rem; flex: 1; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card { background: #fff; border-radius: 12px; padding: 1.1rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: #6b7280; font-size: .85rem; }

/* ---------- Cards / tables ---------- */
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f3; font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.toolbar .spacer { flex: 1; }
.multi-cell { white-space: pre-line; line-height: 1.5; font-size: .85rem; }
.table thead th { background: #f9fafb; font-size: .8rem; text-transform: none; color: #6b7280; white-space: nowrap; }
.table td { vertical-align: middle; font-size: .88rem; }
.photo-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; cursor: pointer; }
.tag-chip { display: inline-block; background: #eef2ff; color: #4338ca; border-radius: 6px; padding: .05rem .4rem; font-size: .78rem; margin: 1px 0; }

/* ---------- Upload dropzone ---------- */
.dropzone { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 1.2rem; text-align: center; cursor: pointer; color: #6b7280; transition: .15s; }
.dropzone.dragover { border-color: var(--brand); background: #eff6ff; color: var(--brand); }
.dropzone img { max-width: 100%; max-height: 220px; border-radius: 8px; }

/* ---------- Repeatable rows ---------- */
.repeat-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.repeat-row .form-control { flex: 1; }

.badge-anon { background: #f3f4f6; color: #6b7280; }

@media (max-width: 992px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
}
