/* ============================================================
   AUTH PAGES (login / register) + USER CHIP + ADMIN DASHBOARD
   Append to style.css
   ============================================================ */

/* ── User chip in nav bar ───────────────────────────────────── */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}

.user-chip .role-pill {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}

.user-chip .role-pill.dealer { background: #059669; color: #fff; }
.user-chip .role-pill.admin  { background: #7c3aed; color: #fff; }
.user-chip .role-pill.retail { background: rgba(255,255,255,0.18); }

.user-chip .logout-link {
  color: rgba(255,255,255,0.78);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
}
.user-chip .logout-link:hover { color: #fff; }

.auth-link {
  color: rgba(255,255,255,0.92);
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 999px;
}
.auth-link:hover { background: rgba(255,255,255,0.10); }

/* ── Dealer pricing banner ──────────────────────────────────── */
.dealer-banner {
  background: linear-gradient(135deg, #065f46, #059669);
  color: #fff;
  padding: 12px 0;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.dealer-banner strong { letter-spacing: 0.05em; }

/* ── Auth pages ─────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background:
    radial-gradient(circle at 20% 0%, rgba(37,99,235,0.10), transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(5,150,105,0.08), transparent 60%),
    #0f172a;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 22px;
  padding: 36px 32px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.35);
}

.auth-card .brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-card .brand-row h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.auth-card h2 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}
.auth-card .auth-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-form { display: grid; gap: 14px; }

.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.96rem;
  background: #fff;
  transition: border-color 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.role-toggle label {
  display: block;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: #fff;
}
.role-toggle label:hover { border-color: #cbd5e1; }
.role-toggle input { display: none; }
.role-toggle input:checked + .role-content {
  color: var(--accent);
}
.role-toggle label:has(input:checked) {
  border-color: var(--accent);
  background: #eff6ff;
}
.role-toggle .role-title {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 2px;
}
.role-toggle .role-desc {
  font-size: 0.78rem;
  color: var(--muted);
}

.auth-card .btn.primary { width: 100%; padding: 14px; font-size: 1rem; }

.auth-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.auth-foot a { color: var(--accent); font-weight: 600; }

.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  display: none;
}
.auth-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: var(--success);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.92rem;
  display: none;
}

/* ── Admin dashboard ────────────────────────────────────────── */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: #f1f5f9;
}

.admin-side {
  background: #0f172a;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-side .side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 24px;
  padding: 0 6px;
}

.admin-side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,0.78);
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
}
.admin-side a:hover    { background: rgba(255,255,255,0.06); color: #fff; }
.admin-side a.active   { background: var(--accent); color: #fff; }
.admin-side .side-foot {
  margin-top: auto;
  padding: 14px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.admin-main {
  padding: 28px 32px;
  overflow-y: auto;
}
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 20px;
  gap: 18px;
  flex-wrap: wrap;
}
.admin-head h2 { margin: 0; font-size: 1.6rem; }

.admin-section { display: none; }
.admin-section.active { display: block; }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 4px 12px rgba(15,23,42,0.04);
  border: 1px solid #e2e8f0;
}
.stat-card .stat-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  margin-top: 4px;
}
.stat-card.warn .stat-value { color: var(--warning); }
.stat-card.alert .stat-value { color: var(--danger); }
.stat-card.ok    .stat-value { color: var(--success); }

/* Data tables */
.data-table {
  width: 100%;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}
.data-table th {
  background: #f8fafc;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid #e2e8f0;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }

.role-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.role-tag.retail   { background: #f1f5f9; color: #475569; }
.role-tag.dealer   { background: #d1fae5; color: #065f46; }
.role-tag.admin    { background: #ede9fe; color: #6d28d9; }

.source-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  white-space: nowrap;
}

/* ===== Admin Pricing tab ===== */
.pricing-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.pricing-toolbar-left,
.pricing-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pricing-dirty-count {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.pricing-dirty-count.has-changes {
  color: #92400e;
  background: #fef3c7;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #fde68a;
}
.pricing-import-label {
  cursor: pointer;
}

.pricing-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 12px;
}
.pricing-msg.ok  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.pricing-msg.err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.pricing-import-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.pricing-table {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}
.pricing-table th { white-space: nowrap; }
.pricing-table td code { font-size: 0.82rem; }

.pricing-input {
  width: 90px;
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  text-align: right;
}
.pricing-input-stock { width: 72px; }
.pricing-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.pricing-row-dirty td {
  background: #fffbeb !important;
}
.pricing-row-dirty .pricing-input {
  border-color: #fbbf24;
  background: #fefce8;
}

/* Clickable filter chips */
.pricing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.pricing-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.pricing-chip:hover { background: #f1f5f9; border-color: #94a3b8; }
.pricing-chip.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.pricing-chip-count {
  display: inline-block;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}
.pricing-chip.active .pricing-chip-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* Per-category card */
.pricing-cat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 14px 4px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}
.pricing-cat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 6px 12px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}
.pricing-cat-head h3 {
  margin: 0;
  font-size: 1.1rem;
}
.pricing-cat-meta {
  display: inline-block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}
.pricing-cat-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pricing-cat-import {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}
.pricing-cat-import:hover { background: #eff6ff; border-color: #2563eb; color: #2563eb; }

.pricing-cat-card .data-table {
  margin: 0;
  border-radius: 0;
  background: transparent;
}

.status-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.status-tag.active    { background: #dcfce7; color: #166534; }
.status-tag.pending   { background: #fef3c7; color: #92400e; }
.status-tag.rejected  { background: #fee2e2; color: #991b1b; }
.status-tag.suspended { background: #f3f4f6; color: #374151; }
.status-tag.new          { background: #dbeafe; color: #1e40af; }
.status-tag.in_progress  { background: #fef3c7; color: #92400e; }
.status-tag.completed    { background: #dcfce7; color: #166534; }
.status-tag.cancelled    { background: #f3f4f6; color: #6b7280; }

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.btn-mini {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-mini:hover { background: #f8fafc; }
.btn-mini.approve { background: #059669; color: #fff; border-color: #059669; }
.btn-mini.approve:hover { background: #047857; }
.btn-mini.reject { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-mini.reject:hover { background: #b91c1c; }

.cart-block {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.cart-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.cart-block-head .who {
  font-weight: 700;
}
.cart-block-head .who small {
  font-weight: 500;
  color: var(--muted);
  margin-left: 6px;
}
.cart-block-items {
  font-size: 0.9rem;
  color: var(--text);
}
.cart-block-items .li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed #f1f5f9;
}
.cart-block-items .li:last-child { border-bottom: none; }

.settings-form {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px;
  max-width: 720px;
}

.section-help {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.toast {
  position: fixed;
  top: 24px; right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  font-size: 0.92rem;
  z-index: 2000;
  display: none;
}
.toast.ok    { background: #059669; }
.toast.err   { background: #dc2626; }

@media (max-width: 880px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side  { flex-direction: row; overflow-x: auto; padding: 14px; gap: 8px; }
  .admin-side .side-brand { display: none; }
  .admin-side .side-foot  { display: none; }
  .admin-side a { white-space: nowrap; }
}
