/* ============================================================
   HPC Admin Design System
   Overrides sb-admin-2 / Bootstrap 4 for a clean, modern UI
   ============================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --hpc-bg:        #f1f5f9;
  --hpc-card:      #ffffff;
  --hpc-border:    #e2e8f0;
  --hpc-border2:   #cbd5e1;
  --hpc-text:      #0f172a;
  --hpc-muted:     #64748b;
  --hpc-subtle:    #94a3b8;
  --hpc-accent:    #1e293b;
  --hpc-accent-h:  #0f172a;
  --hpc-green:     #10b981;
  --hpc-red:       #ef4444;
  --hpc-gold:      #f59e0b;
  --hpc-blue:      #3b82f6;
  --hpc-purple:    #8b5cf6;
  --hpc-pink:      #ec4899;
  --hpc-cyan:      #06b6d4;
  /* Sidebar */
  --sb-bg:         #0f172a;
  --sb-border:     rgba(255,255,255,.07);
  --sb-text:       #94a3b8;
  --sb-text-hover: #f1f5f9;
  --sb-active:     #ffffff;
  --sb-active-bg:  rgba(255,255,255,.12);
  --sb-w:          240px;
  --sb-w-collapsed:64px;
  /* Common */
  --radius:    8px;
  --radius-sm: 5px;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
}

/* ── Base ───────────────────────────────────────────────────── */
body {
  background: var(--hpc-bg) !important;
  color: var(--hpc-text) !important;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-size: 14px !important;
}

a { color: var(--hpc-accent); }
a:hover { color: var(--hpc-accent-h); text-decoration: none; }

/* ── Layout wrapper ─────────────────────────────────────────── */
#wrapper { display: flex; }
#content-wrapper {
  background: var(--hpc-bg) !important;
  min-height: 100vh;
}
#content { flex: 1; }
.container-fluid { padding: 1.5rem 1.75rem; }
@media (max-width: 767px) { .container-fluid { padding: 1rem .875rem; } }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sb-w) !important;
  min-height: 100vh;
  background: var(--sb-bg) !important;
  border-right: 1px solid var(--sb-border) !important;
  display: flex;
  flex-direction: column;
  position: fixed !important;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .22s ease, transform .22s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* Brand */
.sidebar-brand {
  height: 60px !important;
  padding: 0 1.25rem !important;
  background: transparent !important;
  border-bottom: 1px solid var(--sb-border) !important;
  display: flex !important;
  align-items: center !important;
  text-decoration: none !important;
  gap: .625rem;
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 32px; height: 32px;
  background: var(--hpc-accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-icon i { color: #fff !important; }
.sidebar-brand-text {
  font-size: 13px !important;
  font-weight: 800 !important;
  letter-spacing: -.01em;
  color: #f1f5f9 !important;
  white-space: nowrap;
}

/* Divider */
.sidebar hr.sidebar-divider {
  border-color: var(--sb-border) !important;
  margin: .5rem 1rem !important;
}

/* Section heading */
.sidebar-heading {
  font-size: .65rem !important;
  font-weight: 700 !important;
  letter-spacing: .12em !important;
  text-transform: uppercase !important;
  color: rgba(148,163,184,.5) !important;
  padding: .75rem 1.25rem .25rem !important;
}

/* Nav items */
.sidebar .nav-item { padding: 0 .75rem; margin-bottom: 2px; }
.sidebar .nav-item .nav-link {
  display: flex !important;
  align-items: center !important;
  gap: .625rem !important;
  padding: .55rem .875rem !important;
  border-radius: var(--radius-sm) !important;
  color: var(--sb-text) !important;
  font-size: .8125rem !important;
  font-weight: 600 !important;
  letter-spacing: .01em !important;
  transition: background .15s, color .15s !important;
  white-space: nowrap;
  border: none !important;
}
.sidebar .nav-item .nav-link:hover {
  background: rgba(255,255,255,.06) !important;
  color: var(--sb-text-hover) !important;
}
.sidebar .nav-item.active .nav-link,
.sidebar .nav-item .nav-link.active-page {
  background: var(--sb-active-bg) !important;
  color: #ffffff !important;
}
.sidebar .nav-item .nav-link i {
  width: 18px; text-align: center;
  font-size: 13px !important;
  color: inherit !important;
  opacity: .8;
  flex-shrink: 0;
}
.sidebar .nav-item .nav-link span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Collapse arrow */
.sidebar .nav-item .nav-link[data-toggle="collapse"]::after {
  margin-left: auto !important;
  font-size: 10px !important;
  color: var(--sb-text) !important;
  opacity: .6;
}

/* Collapse inner */
.sidebar .collapse-inner {
  background: rgba(0,0,0,.25) !important;
  border-radius: var(--radius-sm) !important;
  padding: .25rem !important;
  margin: 0 0 .375rem !important;
}
.sidebar .collapse-inner .collapse-header {
  color: rgba(148,163,184,.5) !important;
  font-size: .65rem !important;
  letter-spacing: .1em !important;
  padding: .375rem .75rem .125rem !important;
}
.sidebar .collapse-inner .collapse-item {
  color: var(--sb-text) !important;
  font-size: .8rem !important;
  font-weight: 600 !important;
  padding: .45rem .875rem !important;
  border-radius: 4px !important;
  display: block !important;
  transition: background .12s, color .12s !important;
}
.sidebar .collapse-inner .collapse-item:hover {
  background: rgba(255,255,255,.07) !important;
  color: var(--sb-text-hover) !important;
  text-decoration: none !important;
}
.sidebar .collapse-inner .collapse-item.active {
  background: var(--sb-active-bg) !important;
  color: #ffffff !important;
}

/* Sidebar toggler */
#sidebarToggle, .rounded-circle {
  background: rgba(255,255,255,.08) !important;
  border: 1px solid var(--sb-border) !important;
  color: var(--sb-text) !important;
  width: 32px; height: 32px;
}
#sidebarToggle::after {
  color: var(--sb-text) !important;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: 60px !important;
  background: var(--hpc-card) !important;
  border-bottom: 1px solid var(--hpc-border) !important;
  box-shadow: none !important;
  padding: 0 1.5rem !important;
  position: sticky;
  top: 0;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .navbar-nav { flex-direction: row; align-items: center; gap: .5rem; margin: 0 !important; }

/* ── Content push (accounts for fixed sidebar) ──────────────── */
#content-wrapper { margin-left: var(--sb-w); transition: margin-left .22s ease; }
@media (max-width: 767px) {
  /* Sidebar — wider on mobile so nothing clips */
  .sidebar {
    transform: translateX(-290px) !important;
    width: 290px !important;
    overflow-x: visible !important;
  }
  .sidebar.sb-open { transform: translateX(0) !important; }
  #content-wrapper { margin-left: 0 !important; }

  /* Nav link text — allow wrapping, no clipping */
  .sidebar .nav-item .nav-link {
    white-space: normal !important;
    align-items: flex-start !important;
  }
  .sidebar .nav-item .nav-link span {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.35;
  }
  /* Collapse items — same */
  .sidebar .collapse-inner .collapse-item {
    white-space: normal !important;
    line-height: 1.35;
  }
  /* Keep icon vertically centred with first line of text */
  .sidebar .nav-item .nav-link i { margin-top: 2px; }
}

/* ── Page heading ────────────────────────────────────────────── */
h1.h3, .h3.mb-2.text-gray-800 {
  font-size: 1.4rem !important;
  font-weight: 800 !important;
  color: var(--hpc-text) !important;
  letter-spacing: -.02em !important;
  margin-bottom: 1.25rem !important;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--hpc-border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  background: var(--hpc-card) !important;
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md) !important; }

.card-header {
  background: var(--hpc-card) !important;
  border-bottom: 1px solid var(--hpc-border) !important;
  padding: 1rem 1.25rem !important;
  font-size: .875rem;
  font-weight: 700;
  color: var(--hpc-text);
}
.card-header h1, .card-header h6 {
  color: var(--hpc-text) !important;
  font-weight: 700 !important;
  font-size: .9375rem !important;
  margin: 0 !important;
}
.card-body { padding: 1.25rem !important; }

/* Coloured left-border KPI cards (sb-admin-2 pattern) */
.card.border-left-primary  { border-left: 3px solid var(--hpc-accent) !important; }
.card.border-left-success  { border-left: 3px solid var(--hpc-green) !important; }
.card.border-left-info     { border-left: 3px solid var(--hpc-cyan) !important; }
.card.border-left-warning  { border-left: 3px solid var(--hpc-gold) !important; }
.card.border-left-danger   { border-left: 3px solid var(--hpc-red) !important; }
.card.shadow { box-shadow: var(--shadow) !important; }
.card.shadow-lg { box-shadow: var(--shadow-md) !important; }

/* ── Tables ──────────────────────────────────────────────────── */
.table {
  color: var(--hpc-text) !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
.table th {
  background: #f8fafc !important;
  color: var(--hpc-muted) !important;
  font-size: .7rem !important;
  font-weight: 700 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
  border-bottom: 1px solid var(--hpc-border) !important;
  border-top: none !important;
  padding: .75rem 1rem !important;
  white-space: nowrap;
}
.table td {
  padding: .75rem 1rem !important;
  vertical-align: middle !important;
  border-color: var(--hpc-border) !important;
  font-size: .8375rem !important;
  color: var(--hpc-text) !important;
}
.table-bordered { border: 1px solid var(--hpc-border) !important; }
.table-bordered th, .table-bordered td { border: none !important; border-bottom: 1px solid var(--hpc-border) !important; }
.table tbody tr:last-child td { border-bottom: none !important; }
.table tbody tr { transition: background .1s; }
.table-hover tbody tr:hover, .table tbody tr:hover { background: #f8fafc !important; }
.table-responsive { border: none !important; border-radius: var(--radius) !important; }

/* ── DataTables overrides ────────────────────────────────────── */
div.dataTables_wrapper {
  font-family: 'Nunito', sans-serif;
  font-size: .8375rem;
  color: var(--hpc-text);
}
div.dataTables_length select,
div.dataTables_filter input {
  border: 1px solid var(--hpc-border) !important;
  border-radius: var(--radius-sm) !important;
  padding: .35rem .7rem !important;
  font-size: .8125rem !important;
  background: var(--hpc-card) !important;
  color: var(--hpc-text) !important;
  outline: none !important;
  transition: border-color .15s, box-shadow .15s !important;
}
div.dataTables_filter input:focus {
  border-color: var(--hpc-accent) !important;
  box-shadow: 0 0 0 3px rgba(0,0,0,.08) !important;
}
div.dataTables_length label,
div.dataTables_filter label,
div.dataTables_info,
div.dataTables_paginate {
  font-size: .8rem !important;
  color: var(--hpc-muted) !important;
}
div.dataTables_paginate .paginate_button {
  border-radius: var(--radius-sm) !important;
  font-size: .8rem !important;
  padding: .3rem .65rem !important;
  color: var(--hpc-muted) !important;
}
div.dataTables_paginate .paginate_button.current,
div.dataTables_paginate .paginate_button.current:hover {
  background: var(--hpc-accent) !important;
  border-color: var(--hpc-accent) !important;
  color: #fff !important;
  border-radius: var(--radius-sm) !important;
}
div.dataTables_paginate .paginate_button:hover {
  background: #f1f5f9 !important;
  border-color: var(--hpc-border) !important;
  color: var(--hpc-text) !important;
}
.dataTables_processing {
  background: rgba(255,255,255,.9) !important;
  border: 1px solid var(--hpc-border) !important;
  border-radius: var(--radius) !important;
  color: var(--hpc-muted) !important;
  font-size: .8rem !important;
  box-shadow: var(--shadow-md) !important;
}
table.dataTable thead th,
table.dataTable thead td {
  border-bottom: 2px solid var(--hpc-border) !important;
}
table.dataTable.no-footer { border-bottom: 1px solid var(--hpc-border) !important; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-control {
  border: 1px solid var(--hpc-border) !important;
  border-radius: var(--radius-sm) !important;
  padding: .45rem .8rem !important;
  font-size: .8375rem !important;
  color: var(--hpc-text) !important;
  background: var(--hpc-card) !important;
  transition: border-color .15s, box-shadow .15s !important;
  height: auto !important;
}
.form-control:focus {
  border-color: var(--hpc-accent) !important;
  box-shadow: 0 0 0 3px rgba(0,0,0,.08) !important;
  outline: none !important;
}
.form-control::placeholder { color: var(--hpc-subtle) !important; }
.form-group label {
  font-size: .78rem !important;
  font-weight: 700 !important;
  color: var(--hpc-muted) !important;
  letter-spacing: .03em !important;
  margin-bottom: .35rem !important;
  text-transform: uppercase;
}
select.form-control { background-image: none !important; }
textarea.form-control { min-height: 100px; }

/* Custom toggle switch (existing pattern) */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--hpc-border2);
  border-radius: 34px;
  transition: .3s;
}
.slider:before {
  content: ""; position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
input:checked + .slider { background: var(--hpc-accent); }
input:checked + .slider:before { transform: translateX(20px); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  font-family: 'Nunito', sans-serif !important;
  font-size: .8125rem !important;
  font-weight: 700 !important;
  letter-spacing: .02em !important;
  border-radius: var(--radius-sm) !important;
  padding: .45rem 1rem !important;
  transition: all .15s !important;
  border-width: 1px !important;
}
.btn-sm { padding: .3rem .7rem !important; font-size: .75rem !important; }
.btn-lg { padding: .65rem 1.4rem !important; font-size: .9rem !important; }

.btn-primary {
  background: var(--hpc-accent) !important;
  border-color: var(--hpc-accent) !important;
  color: #fff !important;
}
.btn-primary:hover { background: var(--hpc-accent-h) !important; border-color: var(--hpc-accent-h) !important; }

.btn-success {
  background: var(--hpc-green) !important;
  border-color: var(--hpc-green) !important;
  color: #fff !important;
}
.btn-success:hover { background: #059669 !important; border-color: #059669 !important; }

.btn-danger {
  background: var(--hpc-red) !important;
  border-color: var(--hpc-red) !important;
  color: #fff !important;
}
.btn-danger:hover { background: #dc2626 !important; border-color: #dc2626 !important; }

.btn-info {
  background: var(--hpc-cyan) !important;
  border-color: var(--hpc-cyan) !important;
  color: #fff !important;
}
.btn-info:hover { background: #0891b2 !important; border-color: #0891b2 !important; }

.btn-warning {
  background: var(--hpc-gold) !important;
  border-color: var(--hpc-gold) !important;
  color: #fff !important;
}
.btn-warning:hover { background: #d97706 !important; border-color: #d97706 !important; }

.btn-secondary {
  background: #f1f5f9 !important;
  border-color: var(--hpc-border) !important;
  color: var(--hpc-muted) !important;
}
.btn-secondary:hover { background: #e2e8f0 !important; color: var(--hpc-text) !important; }

.btn-outline-secondary {
  background: transparent !important;
  border-color: var(--hpc-border) !important;
  color: var(--hpc-muted) !important;
}
.btn-outline-secondary:hover {
  background: #f1f5f9 !important;
  border-color: var(--hpc-border2) !important;
  color: var(--hpc-text) !important;
}

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  font-size: .7rem !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  padding: .3em .65em !important;
  border-radius: 20px !important;
}
.badge-success, .badge-pill.badge-success { background: #ecfdf5 !important; color: var(--hpc-green) !important; border: 1px solid #a7f3d0 !important; }
.badge-danger,  .badge-pill.badge-danger  { background: #fef2f2 !important; color: var(--hpc-red) !important; border: 1px solid #fecaca !important; }
.badge-warning, .badge-pill.badge-warning { background: #fffbeb !important; color: #d97706 !important; border: 1px solid #fde68a !important; }
.badge-info,    .badge-pill.badge-info    { background: #ecfeff !important; color: var(--hpc-cyan) !important; border: 1px solid #a5f3fc !important; }
.badge-primary, .badge-pill.badge-primary { background: #eef2ff !important; color: var(--hpc-accent) !important; border: 1px solid #c7d2fe !important; }
.badge-secondary { background: #f1f5f9 !important; color: var(--hpc-muted) !important; border: 1px solid var(--hpc-border) !important; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius) !important;
  font-size: .8375rem !important;
  padding: .875rem 1.125rem !important;
  border-width: 1px !important;
}
.alert-success { background: #ecfdf5 !important; border-color: #a7f3d0 !important; color: #065f46 !important; }
.alert-danger  { background: #fef2f2 !important; border-color: #fecaca !important; color: #991b1b !important; }
.alert-warning { background: #fffbeb !important; border-color: #fde68a !important; color: #92400e !important; }
.alert-info    { background: #ecfeff !important; border-color: #a5f3fc !important; color: #164e63 !important; }

/* ── Modals ───────────────────────────────────────────────────── */
.modal-content {
  border: 1px solid var(--hpc-border) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.15) !important;
  overflow: hidden;
}
.modal-header {
  background: var(--hpc-card) !important;
  border-bottom: 1px solid var(--hpc-border) !important;
  padding: 1rem 1.25rem !important;
}
.modal-title { font-weight: 700 !important; font-size: .9375rem !important; color: var(--hpc-text) !important; }
.modal-body { padding: 1.25rem !important; }
.modal-footer {
  border-top: 1px solid var(--hpc-border) !important;
  padding: .875rem 1.25rem !important;
  background: #f8fafc !important;
}

/* ── Select2 overrides ────────────────────────────────────────── */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  border: 1px solid var(--hpc-border) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--hpc-card) !important;
  min-height: 36px !important;
}
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--hpc-accent) !important;
  box-shadow: 0 0 0 3px rgba(0,0,0,.08) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--hpc-text) !important;
  line-height: 36px !important;
  padding-left: .75rem !important;
  background: transparent !important;
}
.select2-results__option--highlighted[aria-selected] {
  background: var(--hpc-accent) !important;
  color: #fff !important;
}

/* ── Progress bars ────────────────────────────────────────────── */
.progress { background: #f1f5f9 !important; border-radius: 10px !important; height: 6px !important; }
.progress-bar { border-radius: 10px !important; }
.progress-bar.bg-info    { background: var(--hpc-cyan) !important; }
.progress-bar.bg-success { background: var(--hpc-green) !important; }
.progress-bar.bg-warning { background: var(--hpc-gold) !important; }
.progress-bar.bg-danger  { background: var(--hpc-red) !important; }

/* ── Footer ───────────────────────────────────────────────────── */
.sticky-footer { background: var(--hpc-card) !important; border-top: 1px solid var(--hpc-border) !important; padding: .875rem 0 !important; }

/* ── Logout / topbar buttons ──────────────────────────────────── */
.hpc-topbar-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #f1f5f9; border: 1px solid var(--hpc-border);
  border-radius: var(--radius-sm); padding: .35rem .875rem;
  font-size: .78rem; font-weight: 700; color: var(--hpc-muted);
  text-decoration: none; transition: all .15s;
}
.hpc-topbar-btn:hover { background: #e2e8f0; color: var(--hpc-text); text-decoration: none; }
.hpc-topbar-btn.danger:hover { background: #fef2f2; color: var(--hpc-red); border-color: #fecaca; }

/* Page title bar */
.hpc-topbar-title {
  font-size: .9375rem; font-weight: 800; color: var(--hpc-text);
  letter-spacing: -.01em;
}
.hpc-topbar-crumb { font-size: .78rem; color: var(--hpc-muted); margin-left: 1rem; }
.hpc-topbar-crumb a { color: var(--hpc-muted); }
.hpc-topbar-crumb a:hover { color: var(--hpc-accent); }

/* ── Filter bar (shared across list pages) ────────────────────── */
.hpc-filter-bar {
  background: var(--hpc-card);
  border: 1px solid var(--hpc-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  box-shadow: var(--shadow);
}
.hpc-filter-bar .form-group { margin-bottom: 0 !important; flex: 1 1 180px; }
.hpc-filter-bar .form-group label { margin-bottom: .3rem !important; }
.hpc-filter-bar .btn { align-self: flex-end; height: 36px; }

/* ── Status pills ─────────────────────────────────────────────── */
.hpc-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  padding: .25em .7em; border-radius: 20px; white-space: nowrap;
  border-width: 1px; border-style: solid;
}
.hpc-pill.green { background:#ecfdf5; color:var(--hpc-green); border-color:#a7f3d0; }
.hpc-pill.red   { background:#fef2f2; color:var(--hpc-red);   border-color:#fecaca; }
.hpc-pill.gold  { background:#fffbeb; color:#d97706;           border-color:#fde68a; }
.hpc-pill.blue  { background:#eff6ff; color:var(--hpc-blue);   border-color:#bfdbfe; }
.hpc-pill.gray  { background:#f1f5f9; color:var(--hpc-muted);  border-color:var(--hpc-border2); }
.hpc-pill.purple{ background:#f5f3ff; color:var(--hpc-purple); border-color:#ddd6fe; }
.hpc-pill::before {
  content:''; width:6px; height:6px; border-radius:50%;
  background:currentColor; flex-shrink:0;
}

/* ── Stat cards on order list ─────────────────────────────────── */
.hpc-stat-row { display:grid; grid-template-columns:repeat(3,1fr); gap:1rem; margin-bottom:1.25rem; }
@media(max-width:640px){ .hpc-stat-row{ grid-template-columns:1fr 1fr; } }

/* ── Page header pattern ─────────────────────────────────────── */
.hpc-page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: .75rem;
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.hpc-page-header h1 {
  font-size: 1.4rem !important; font-weight: 800 !important;
  color: var(--hpc-text) !important; letter-spacing: -.02em !important;
  margin: 0 !important;
}
.hpc-page-header p { font-size:.78rem; color:var(--hpc-muted); margin:.2rem 0 0; }
.hpc-page-header .actions { display:flex; gap:.5rem; align-items:center; flex-shrink:0; flex-wrap:wrap; }

/* ── Toastr overrides ─────────────────────────────────────────── */
#toast-container > .toast {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-md) !important;
  font-size: .8375rem !important;
  font-family: 'Nunito', sans-serif !important;
  opacity: 1 !important;
}
#toast-container > .toast-success { background: #059669 !important; }
#toast-container > .toast-error   { background: #dc2626 !important; }
#toast-container > .toast-warning { background: #d97706 !important; }
#toast-container > .toast-info    { background: var(--hpc-cyan) !important; }

/* ── Mobile sidebar toggle ────────────────────────────────────── */
.hpc-menu-btn {
  display: none;
  background: none; border: 1px solid var(--hpc-border);
  border-radius: var(--radius-sm); padding: .35rem .55rem;
  color: var(--hpc-muted); cursor: pointer; line-height: 1;
  font-size: 16px;
}
@media(max-width:767px){ .hpc-menu-btn { display: inline-flex; align-items:center; } }

/* Sidebar overlay on mobile */
.hpc-sidebar-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,.45); z-index:99;
}
.hpc-sidebar-overlay.show { display:block; }

/* ── Competition form toggle grid ────────────────────────────── */
.hpc-toggles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .625rem;
}
.hpc-toggle-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  background: #f8fafc;
  border: 1px solid var(--hpc-border);
  border-radius: var(--radius-sm);
  padding: .55rem 1rem;
}
.hpc-toggle-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--hpc-text);
  white-space: nowrap;
}

/* ── Notiflix / confirm overrides ────────────────────────────── */
.notiflix-confirm-wrap { font-family:'Nunito',sans-serif !important; border-radius:var(--radius) !important; }

/* ── CKEditor in forms ────────────────────────────────────────── */
.cke { border: 1px solid var(--hpc-border) !important; border-radius: var(--radius-sm) !important; }
.cke_top  { background: #f8fafc !important; border-bottom: 1px solid var(--hpc-border) !important; }
.cke_bottom { background: #f8fafc !important; border-top: 1px solid var(--hpc-border) !important; }

/* ── Responsive tweaks ────────────────────────────────────────── */
@media(max-width:767px) {
  .container-fluid { padding: .875rem !important; }
  .card-body { padding: 1rem !important; }
  .card-header { padding: .875rem 1rem !important; }
  .table th, .table td { padding: .6rem .75rem !important; font-size:.78rem !important; }
  .btn { padding: .4rem .875rem !important; }
  div.dataTables_length { display:none; }
  div.dataTables_filter { width:100%; }
  div.dataTables_filter label { width:100%; }
  div.dataTables_filter input { width:100% !important; }
  div.dataTables_info { display:none; }
  .hpc-filter-bar { gap:.5rem; }
  .hpc-filter-bar .form-group { flex: 1 1 100%; }
}
@media(max-width:400px) {
  h1.h3, .h3.mb-2 { font-size:1.2rem !important; }
}

/* ── Customer list — card layout on mobile ────────────────────── */
@media(max-width:767px) {
  /* Kill the horizontal scroll wrapper */
  #customer_data_table { width: 100% !important; }

  /* Hide the header row entirely */
  #customer_data_table thead { display: none !important; }

  /* Each row becomes a standalone card */
  #customer_data_table tbody tr {
    display: block !important;
    background: var(--hpc-card);
    border: 1px solid var(--hpc-border) !important;
    border-radius: var(--radius) !important;
    margin-bottom: .875rem !important;
    overflow: hidden;
    box-shadow: var(--shadow);
  }

  /* Each cell is a label/value row */
  #customer_data_table tbody td {
    display: flex !important;
    align-items: baseline !important;
    padding: .55rem 1rem !important;
    border: none !important;
    border-bottom: 1px solid var(--hpc-border) !important;
    font-size: .8375rem !important;
    gap: .75rem;
  }
  #customer_data_table tbody td:last-child {
    border-bottom: none !important;
    justify-content: flex-end;
  }

  /* Hide row-number column — not useful on mobile */
  #customer_data_table tbody td:first-child { display: none !important; }

  /* Label prefix for each visible cell */
  #customer_data_table tbody td::before {
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--hpc-muted);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
  }
  /* Suppress label on the actions cell */
  #customer_data_table tbody td:last-child::before { display: none; }

  /* DataTables info/pagination — keep readable */
  div.dataTables_info   { display: block !important; font-size: .78rem; margin-top: .5rem; }
  div.dataTables_paginate { margin-top: .5rem; }
  .table-responsive { overflow-x: visible !important; border-radius: 0 !important; }
}

/* ── List groups ──────────────────────────────────────────────── */
.list-group-item {
  background: var(--hpc-card) !important;
  border-color: var(--hpc-border) !important;
  color: var(--hpc-text) !important;
  font-size: .8375rem !important;
  padding: .75rem 1rem !important;
}
.list-group-item:first-child { border-radius: var(--radius) var(--radius) 0 0 !important; }
.list-group-item:last-child  { border-radius: 0 0 var(--radius) var(--radius) !important; }
.list-group-item + .list-group-item { border-top: 1px solid var(--hpc-border) !important; }
.list-group-item strong { font-weight: 700; }

/* ── Card header action button pattern ────────────────────────── */
.card-header .btn { vertical-align: middle; }
.card-header h6 .btn { margin: 0; }

/* ── p-0 override for flush tables ────────────────────────────── */
.card-body.p-0 { padding: 0 !important; }
.card-body.p-0 .table-responsive { border-radius: 0 !important; }
.card-body.p-0 .table { margin-bottom: 0 !important; border-radius: 0 !important; }

/* ── Text utility overrides ───────────────────────────────────── */
.text-gray-800 { color: var(--hpc-text) !important; }
.text-gray-600 { color: var(--hpc-muted) !important; }
.text-gray-300 { color: var(--hpc-subtle) !important; }
.text-primary  { color: var(--hpc-accent) !important; }
.text-success  { color: var(--hpc-green) !important; }
.text-danger   { color: var(--hpc-red) !important; }
.text-warning  { color: var(--hpc-gold) !important; }
.text-info     { color: var(--hpc-cyan) !important; }
.bg-gradient-primary { background: var(--hpc-accent) !important; }
