:root {
  --hc-orange: #ff5f1f;
  --hc-orange-dark: #e04e12;
  --hc-navy: #10233a;
  --hc-navy-2: #16314f;
  --hc-text: #1c2530;
  --hc-muted: #5b6b7c;
  --hc-border: #e4e9ef;
  --hc-bg: #f5f7fa;
  --hc-white: #ffffff;
  --hc-success: #1e9e63;
  --hc-danger: #d64545;
  --hc-warning: #b8860b;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--hc-bg);
  color: var(--hc-text);
}
a { color: var(--hc-orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Centered auth pages (login / check-email / errors) ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--hc-navy), var(--hc-navy-2));
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--hc-white);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  text-align: center;
}
.auth-logo { display: block; margin: 0 auto 28px; height: 42px; width: auto; }
.auth-card h1 { font-size: 20px; margin: 0 0 8px; font-weight: 700; }
.auth-card p.subtitle { color: var(--hc-muted); font-size: 14px; margin: 0 0 24px; line-height: 1.5; }

.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--hc-text); }

/* Base text-like input styling applies everywhere (not just inside .field)
   so form controls placed in grids/rows outside a .field wrapper — e.g. the
   product line-item rows on the deal form — still get the branded look. */
input[type="email"],
input[type="text"],
input[type="tel"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--hc-border);
  border-radius: 8px;
  font-size: 15px;
  background: #fbfcfd;
  font-family: inherit;
  color: var(--hc-text);
  line-height: 1.3;
}
input[type="date"] { color-scheme: light; }
input:disabled, select:disabled, textarea:disabled {
  background: #eef1f5;
  color: var(--hc-muted);
  cursor: not-allowed;
}
input[type="radio"], input[type="checkbox"] {
  width: auto;
  accent-color: var(--hc-orange);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--hc-orange);
  border-color: var(--hc-orange);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 12px 20px;
  background: var(--hc-orange);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--hc-orange-dark); text-decoration: none; }
.btn-secondary { background: var(--hc-white); color: var(--hc-text); border: 1px solid var(--hc-border); }
.btn-secondary:hover { background: #f0f2f5; }
.btn-sm { width: auto; padding: 7px 14px; font-size: 13px; }
.btn-danger { background: var(--hc-danger); }
.btn-danger:hover { background: #b93838; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 18px;
  text-align: left;
}
.alert-error { background: #fdecec; color: #a12f2f; border: 1px solid #f6c9c9; }
.alert-success { background: #e8f7ee; color: #1c7a4c; border: 1px solid #bfe6cf; }
.alert-info { background: #eef4fb; color: #285a8a; border: 1px solid #cadff2; }

.icon-circle {
  width: 56px; height: 56px; border-radius: 50%;
  background: #fff1ea; color: var(--hc-orange);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; font-size: 26px;
}

.small-note { font-size: 12.5px; color: var(--hc-muted); margin-top: 20px; }

/* ---------- App shell (dashboard) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--hc-navy);
  color: #cfe0ee;
  flex-shrink: 0;
  padding: 22px 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 22px 22px; }
.sidebar .brand img { height: 26px; }
.sidebar nav { flex: 1; margin-top: 10px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 22px; color: #b7c8da; font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(255,95,31,0.15); color: #fff; border-left-color: var(--hc-orange); font-weight: 600; }
.sidebar .badge-role {
  margin: 0 22px 18px; padding: 6px 10px; border-radius: 6px;
  background: rgba(255,95,31,0.18); color: #ffcdb3; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; text-align: center;
}
.sidebar .user-box { padding: 16px 22px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar .user-box .email { font-size: 12.5px; color: #9fb3c8; word-break: break-all; margin-bottom: 10px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--hc-white); border-bottom: 1px solid var(--hc-border);
  padding: 16px 32px; display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; }
.content { padding: 28px 32px; flex: 1; }

.card {
  background: var(--hc-white); border: 1px solid var(--hc-border);
  border-radius: 12px; padding: 22px 24px; margin-bottom: 22px;
}
.card h2 { font-size: 15px; margin: 0 0 16px; font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--hc-white); border: 1px solid var(--hc-border); border-radius: 12px;
  padding: 18px 20px;
}
.stat-card .value { font-size: 28px; font-weight: 800; color: var(--hc-navy); }
.stat-card .label { font-size: 12.5px; color: var(--hc-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 4px; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left; padding: 10px 12px; color: var(--hc-muted);
  font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--hc-border);
}
table.data-table td { padding: 11px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
table.data-table tr:hover td { background: #fafbfc; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.pill-superadmin { background: #fdeee6; color: var(--hc-orange-dark); }
.pill-dealer_admin { background: #e6f0fb; color: #2a5c9c; }
.pill-dealer_user { background: #eef1f5; color: var(--hc-muted); }
.pill-pending { background: #fdf3d8; color: var(--hc-warning); }
.pill-active { background: #e6f7ed; color: var(--hc-success); }
.pill-disabled { background: #fdecec; color: var(--hc-danger); }
.pill-suspended { background: #fdecec; color: var(--hc-danger); }
.pill-approved { background: #e6f7ed; color: var(--hc-success); }
.pill-rejected { background: #fdecec; color: var(--hc-danger); }
.pill-stale { background: #f0e9fb; color: #7a4fc9; }

/* ---------- Deal registration form ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .field.full { grid-column: 1 / -1; }
textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--hc-border);
  border-radius: 8px; font-size: 14px; background: #fbfcfd; font-family: inherit;
  resize: vertical; min-height: 90px;
}
.radio-group { display: flex; gap: 18px; align-items: center; padding-top: 8px; }
.radio-group label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }

table.line-items th, table.line-items td { padding: 8px 10px; }
table.line-items select, table.line-items input { margin: 0; }
.line-item-row { display: grid; grid-template-columns: 2fr 100px 40px; gap: 10px; align-items: center; margin-bottom: 8px; }
.line-item-row select,
.line-item-row input[type="text"],
.line-item-row input[type="number"] { padding: 9px 12px; font-size: 13.5px; }
.remove-line { background: none; border: none; color: var(--hc-danger); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; }
.add-line-btn { margin-top: 6px; }

.news-post-body { white-space: pre-wrap; line-height: 1.7; font-size: 15px; }
.news-card { margin-bottom: 18px; }
.news-card h2 { margin-bottom: 4px; }
.news-card .post-date { font-size: 12.5px; color: var(--hc-muted); margin-bottom: 12px; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; }
.detail-grid .kv { padding: 10px 0; border-bottom: 1px solid #eef1f5; }
.detail-grid .kv .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--hc-muted); margin-bottom: 3px; }
.detail-grid .kv .v { font-size: 14.5px; }
.text-block { white-space: pre-wrap; font-size: 14px; line-height: 1.6; background: #fbfcfd; border: 1px solid var(--hc-border); border-radius: 8px; padding: 14px 16px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--hc-muted); }

.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .field { margin-bottom: 0; min-width: 220px; flex: 1; }
select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--hc-border);
  border-radius: 8px; font-size: 14px; background: #fbfcfd;
}

.actions-cell { display: flex; gap: 8px; }
form.inline-form { display: inline; }

.top-actions { display: flex; gap: 10px; }

.muted { color: var(--hc-muted); }
.text-right { text-align: right; }

.search-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.search-bar .search-input { flex: 1; min-width: 220px; margin: 0; }
.search-bar .btn-sm { flex-shrink: 0; }

.switch-row { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.switch-row input[type="checkbox"] { width: 36px; height: 20px; }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .content { padding: 20px 16px; }
  .topbar { padding: 14px 18px; }
}

/* ---------- Product catalog (dealer browse + admin list/form) ---------- */
.category-filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.category-pill {
  display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 13px;
  font-weight: 600; background: var(--hc-white); border: 1px solid var(--hc-border);
  color: var(--hc-text);
}
.category-pill:hover { background: #f0f2f5; text-decoration: none; }
.category-pill.active { background: var(--hc-orange); color: #fff; border-color: var(--hc-orange); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.product-card {
  display: flex; flex-direction: column; background: var(--hc-white);
  border: 1px solid var(--hc-border); border-radius: 12px; overflow: hidden;
  color: var(--hc-text); transition: box-shadow 0.15s, transform 0.15s;
}
.product-card:hover { text-decoration: none; box-shadow: 0 10px 24px rgba(16,35,58,0.1); transform: translateY(-2px); }
.product-thumb { width: 100%; height: 160px; object-fit: contain; background: #fbfcfd; border-bottom: 1px solid var(--hc-border); }
.product-thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--hc-muted); font-size: 13px; background: #f5f7fa;
}
.product-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.product-card-body h3 { font-size: 15.5px; margin: 2px 0 6px; font-weight: 700; }
.product-category { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--hc-muted); font-weight: 700; }
.product-sku { font-size: 12.5px; color: var(--hc-muted); margin: 4px 0 10px; }
.product-card .tagline, .product-detail-info .tagline { font-size: 13.5px; color: var(--hc-muted); margin: 0 0 10px; line-height: 1.4; }
.product-card .price { margin-top: auto; font-weight: 700; font-size: 14px; color: var(--hc-navy); }

.product-detail-layout { display: grid; grid-template-columns: minmax(240px, 380px) 1fr; gap: 28px; }
.product-detail-hero {
  width: 100%; height: 300px; object-fit: contain; background: #fbfcfd;
  border: 1px solid var(--hc-border); border-radius: 10px;
}
.product-detail-hero.product-thumb-placeholder { height: 300px; }
.product-gallery { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.product-gallery img {
  width: 64px; height: 64px; object-fit: contain; background: #fbfcfd;
  border: 1px solid var(--hc-border); border-radius: 6px;
}
.product-detail-price { font-size: 22px; font-weight: 800; color: var(--hc-navy); margin-top: 14px; }

.resource-list { display: flex; flex-direction: column; gap: 8px; }
.resource-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--hc-border); border-radius: 8px; color: var(--hc-text);
  background: #fbfcfd;
}
.resource-item:hover { background: #f0f2f5; text-decoration: none; }
.resource-icon {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 28px; padding: 0 6px; border-radius: 6px;
  background: var(--hc-navy); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.02em;
}
.resource-title { font-size: 14px; font-weight: 600; }

@media (max-width: 760px) {
  .product-detail-layout { grid-template-columns: 1fr; }
}
