/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:    #2563eb;
  --brand-dk: #1d4ed8;
  --bg:       #f8fafc;
  --surface:  #ffffff;
  --border:   #e2e8f0;
  --text:     #0f172a;
  --muted:    #64748b;
  --success:  #16a34a;
  --error:    #dc2626;
  --radius:   10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.nav-logo svg { flex-shrink: 0; }

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 14px;
}

.nav-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-avatar-placeholder {
  background: linear-gradient(135deg, var(--brand), #06b6d4);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-user {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); text-decoration: none; }

.btn-small {
  padding: 5px 12px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
}
.btn-small:hover { background: var(--bg); }

.btn-full { width: 100%; }

/* ── Messages ── */
.success {
  background: #dcfce7;
  color: var(--success);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

.error {
  background: #fee2e2;
  color: var(--error);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Forms (shared) ── */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.form-group { margin-bottom: 18px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.profile-form { max-width: 680px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  background: var(--bg);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: #eff6ff;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.drop-input {
  display: none;
}

.drop-icon {
  font-size: 36px;
  line-height: 1;
}

.drop-label {
  font-size: 13px;
  color: var(--muted);
}

.drop-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.error-text {
  color: var(--error);
  margin-top: 6px;
}

.slug-display {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  font-family: monospace;
  font-size: 15px;
  color: var(--brand);
  margin-bottom: 6px;
}

/* ── Auth page ── */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06);
}

.auth-box h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
}

.auth-box label { margin-top: 14px; }
.auth-box input { margin-bottom: 4px; }
.auth-box .btn-full { margin-top: 20px; }

/* ── Dashboard ── */
main.dashboard {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 24px 80px;
}

main.dashboard h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 24px;
}

/* ── Admin ── */
main.admin {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 24px 80px;
}

main.admin h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 24px;
}

.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 32px;
}

.admin-section h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.active   { background: #dcfce7; color: #15803d; }
.status-badge.inactive { background: #f1f5f9; color: var(--muted); }

/* ── Profile card (public NFC page) ── */
body.profile-page {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.profile-card {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,.10);
  padding: 40px 32px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.profile-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 20px;
  display: block;
  border: 3px solid var(--border);
}

.profile-photo-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #06b6d4);
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}

.profile-actions {
  margin-bottom: 28px;
}

.profile-actions .btn {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 12px;
  width: 100%;
}

.profile-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.profile-link:hover {
  background: var(--bg);
  border-color: #cbd5e1;
  text-decoration: none;
}

.link-icon { font-size: 18px; flex-shrink: 0; }

/* ── Home page ── */
body.home-page { background: var(--bg); }

main.home {
  max-width: 680px;
  margin: 72px auto 0;
  padding: 0 24px;
  text-align: center;
}

.home-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brand);
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.2);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}

main.home h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 18px;
}

main.home p {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.65;
}

.home-cta {
  padding: 14px 32px;
  font-size: 15px;
  border-radius: 12px;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 64px;
  text-align: left;
}

.home-feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feature-icon { font-size: 22px; margin-bottom: 4px; }
.home-feature strong { font-size: 14px; font-weight: 600; }
.home-feature span { font-size: 13px; color: var(--muted); line-height: 1.5; }

.home-footer {
  text-align: center;
  padding: 48px 24px 32px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 600px) {
  main.home h1 { font-size: 34px; }
  .home-features { grid-template-columns: 1fr; }
}

/* ── Dashboard tabs ── */
.dash-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.dash-tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.dash-tab:hover { color: var(--text); text-decoration: none; }
.dash-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ── Settings block ── */
.settings-block {
  max-width: 680px;
  margin-bottom: 32px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.settings-block h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ── QR code in dashboard ── */
.qr-dashboard {
  display: flex;
  align-items: center;
  gap: 20px;
}

.qr-dashboard-img {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Profile brand footer ── */
.profile-brand {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.profile-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.profile-brand-link:hover { color: var(--brand); text-decoration: none; }

/* ── Admin actions ── */
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Danger zone ── */
.danger-zone {
  max-width: 680px;
  margin-top: 0;
  padding: 24px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: #fff5f5;
}

.danger-zone h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--error);
  margin-bottom: 8px;
}

.danger-zone p {
  font-size: 13px;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.5;
}

.btn-danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; text-decoration: none; }

.btn-danger-small {
  background: #fff0f0;
  color: var(--error);
  border-color: #fecaca;
}
.btn-danger-small:hover { background: #fee2e2; }

/* ── Language switch ── */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.lang-switch a {
  color: var(--muted);
  text-decoration: none;
}

.lang-switch a:hover { color: var(--text); }
.lang-switch a.lang-active { color: var(--brand); }

.lang-switch--centered {
  justify-content: center;
  margin-top: 20px;
}

.lang-hero-switch {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.lang-pill:hover { border-color: #cbd5e1; color: var(--text); text-decoration: none; }
.lang-pill--active { border-color: var(--brand); color: var(--brand); background: #eff6ff; font-weight: 600; }

/* ── Admin KPI dashboard ── */
.overview-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.kpi-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi-grid--3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid--2 { grid-template-columns: repeat(2, 1fr); }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
}

.kpi-card--green  { border-top: 3px solid #16a34a; }
.kpi-card--blue   { border-top: 3px solid var(--brand); }
.kpi-card--brand  { border-top: 3px solid var(--brand); }
.kpi-card--muted  { border-top: 3px solid var(--border); }

.kpi-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 6px;
}

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.kpi-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  opacity: 0.75;
}

.plan-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.plan-badge--none     { background: var(--bg); color: var(--muted); }
.plan-badge--basic    { background: #eff6ff; color: var(--brand); }
.plan-badge--standard { background: #f0fdf4; color: #15803d; }

@media (max-width: 900px) {
  .kpi-grid     { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid--3  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .kpi-grid, .kpi-grid--3, .kpi-grid--2 { grid-template-columns: 1fr 1fr; }
}

/* ── Admin sidebar layout ── */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.admin-content {
  flex: 1;
  padding: 32px 32px 80px;
  min-width: 0;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s;
  margin-bottom: 2px;
}

.sidebar-link:hover { background: var(--bg); text-decoration: none; }
.sidebar-link.active { background: rgba(37,99,235,.1); color: var(--brand); font-weight: 600; }
.sidebar-link svg { flex-shrink: 0; opacity: 0.6; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-badge {
  margin-left: auto;
  background: var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}

/* ── Select inputs ── */
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.form-select-small {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

/* ── Hamburger toggle (mobile) ── */
.sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background 0.15s;
}

.sidebar-toggle:hover span { background: var(--brand); }

@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }

  .admin-sidebar {
    position: fixed;
    top: 56px;
    left: -240px;
    width: 220px;
    height: calc(100vh - 56px);
    z-index: 20;
    transition: left 0.22s ease;
    box-shadow: none;
  }

  .admin-sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,.12);
  }

  body.sidebar-open::after {
    content: '';
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0,0,0,.25);
    z-index: 19;
  }

  .admin-content {
    padding: 20px 16px 60px;
  }
}
