@import url('https://fonts.googleapis.com/css2?family=League+Gothic&family=Source+Sans+3:wght@300;400;600;700;900&display=swap');

:root {
  /* PuroClean brand */
  --pc-red:       #D12229;
  --pc-red-dark:  #A81B21;
  --pc-red-light: #F5C6C8;
  --pc-black:     #000000;
  --pc-gray-1:    #E1E1DE;
  --pc-gray-3:    #CACAC8;
  --pc-gray-7:    #9A9A9C;
  --pc-gray-11:   #616366;
  --pc-white:     #FFFFFF;

  /* Semantic aliases used throughout */
  --blue:    var(--pc-red);
  --blue-dk: var(--pc-red-dark);
  --green:   #057a55;
  --red:     var(--pc-red);
  --orange:  #c05600;
  --yellow:  #fbbf24;
  --gray-50: var(--pc-gray-1);
  --gray-100: var(--pc-gray-1);
  --gray-200: var(--pc-gray-3);
  --gray-400: var(--pc-gray-7);
  --gray-600: var(--pc-gray-11);
  --gray-800: var(--pc-black);
  --white:   var(--pc-white);

  --font-headline: 'League Gothic', 'Arial Narrow', sans-serif;
  --font-body:     'Source Sans 3', 'Segoe UI', sans-serif;

  --radius:  8px;
  --shadow:  0 1px 4px rgba(0,0,0,.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-body);
  background: var(--pc-gray-1);
  color: var(--pc-black);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Logo Banner ── */
.logo-banner {
  background: var(--pc-white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 2px solid var(--pc-red);
}
.logo-banner-img {
  height: 52px;
  width: auto;
}
.logo-banner-sub {
  font-family: var(--font-headline);
  font-size: 2rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--pc-red);
  border-left: 2px solid var(--pc-gray-3);
  padding-left: 14px;
}

/* ── Header ── */
.app-header {
  background: var(--pc-red);
  color: var(--pc-white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: var(--font-headline);
  font-size: 1.5rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: flex;
  align-items: baseline;
  gap: .25em;
  white-space: nowrap;
}
.logo-img {
  height: 38px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.logo-sub {
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.8);
}
nav { display: flex; gap: 2px; }
.nav-link {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 600;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.2);
  color: var(--pc-white);
}

/* ── Layout ── */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-title {
  font-family: var(--font-headline);
  font-size: 2rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--pc-black);
}

/* ── Dashboard Tabs ── */
.dash-tabs {
  display: flex;
  gap: 4px;
  background: var(--pc-white);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
}
.dash-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--pc-gray-11);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.dash-tab:hover { background: var(--pc-gray-1); color: var(--pc-black); }
.dash-tab.active { background: var(--pc-red); color: var(--pc-white); }

/* ── Card ── */
.card {
  background: var(--pc-white);
  border-radius: var(--radius);
  border: 1px solid var(--pc-gray-3);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-title {
  font-family: var(--font-headline);
  font-size: 1.25rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pc-black);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--pc-red);
}

/* ── Form ── */
.field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.field-row:last-child { margin-bottom: 0; }
label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-600);
}
.optional { font-weight: 400; color: var(--gray-400); }
select, input[type="text"], input[type="search"], input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--gray-800);
  background: var(--white);
  appearance: none;
  outline: none;
  transition: border-color .15s;
}
select:focus, input:focus {
  border-color: var(--pc-red);
  box-shadow: 0 0 0 3px rgba(209,34,41,.12);
}

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-bar input[type="search"] { flex: 1; min-width: 140px; }
.filter-bar select { flex: 0 0 auto; width: auto; min-width: 110px; }

/* ── Items list ── */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 55vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background .1s, border-color .1s;
  user-select: none;
}
.item-row:hover { background: var(--gray-50); }
.item-row.selected { background: var(--pc-red-light); border-color: var(--pc-red); }
.item-row.controlled .item-badge {
  background: #fef3c7;
  color: #92400e;
}
.item-row.priority-flag .item-name::after {
  content: ' ★';
  color: var(--orange);
  font-size: .8em;
}
.item-info { flex: 1; min-width: 0; }
.item-name {
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-meta {
  font-size: .75rem;
  color: var(--gray-400);
  margin-top: 1px;
}
.item-badge {
  font-size: .7rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.item-qty {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.qty-btn {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-800);
  transition: background .1s, border-color .1s;
}
.qty-btn:hover { background: var(--pc-gray-1); border-color: var(--pc-red); }
.qty-input {
  width: 44px !important;
  text-align: center;
  padding: 4px !important;
  font-size: .95rem !important;
}

/* ── Cart ── */
.cart-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 8px;
  gap: 10px;
}
.cart-item-name { font-size: .9rem; font-weight: 600; flex: 1; }
.cart-item-qty { font-size: .85rem; color: var(--gray-600); white-space: nowrap; }
.cart-remove {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .1s, background .1s;
}
.cart-remove:hover { color: var(--red); background: #fee2e2; }
.cart-total {
  font-size: .9rem;
  color: var(--gray-600);
  text-align: right;
  padding-top: 8px;
  border-top: 1px solid var(--gray-200);
  margin-bottom: 14px;
}
.cart-total strong { color: var(--gray-800); }

/* ── Buttons ── */
.btn-primary {
  background: var(--pc-red);
  color: var(--pc-white);
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--pc-red-dark); }
.btn-primary:disabled { background: var(--pc-gray-7); cursor: not-allowed; }
.btn-lg { width: 100%; padding: 14px; font-size: 1.05rem; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--gray-800);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ── Dashboard ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.stat-value { font-family: var(--font-headline); font-size: 2.2rem; letter-spacing: .04em; color: var(--pc-red); }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--pc-gray-11); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

.table-wrap { overflow-x: auto; }

/* ── Inventory tab: each section scrolls internally ── */
.section-scroll {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
}
/* Sticky headers inside scrollable table sections */
.section-scroll table thead th {
  position: sticky;
  top: 0;
  background: var(--pc-gray-1);
  z-index: 1;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
th, td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
th {
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-600);
  background: var(--gray-50);
  white-space: nowrap;
}
tr:hover td { background: var(--gray-50); }
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.pill-green  { background: #d1fae5; color: #065f46; }
.pill-yellow { background: #fef3c7; color: #92400e; }
.pill-red    { background: #fee2e2; color: #991b1b; }
.pill-blue   { background: var(--pc-red-light); color: var(--pc-red-dark); }
.pill-gray   { background: var(--gray-100); color: var(--gray-600); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-header h2 { font-family: var(--font-headline); font-size: 1.25rem; letter-spacing: .04em; text-transform: uppercase; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-800);
  transition: border-color .15s, background .15s;
}
.btn-sm:hover { border-color: var(--pc-red); background: var(--pc-red-light); color: var(--pc-red-dark); }
.btn-sm.active { border-color: var(--pc-red); background: var(--pc-red-light); color: var(--pc-red-dark); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
  font-size: .95rem;
}

/* ── PIN ── */
.pin-wrap { position: relative; }
#inp-pin {
  letter-spacing: .4em;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  max-width: 160px;
}
#pin-status {
  margin-top: 6px;
  font-size: .82rem;
  font-weight: 600;
  min-height: 18px;
}
#pin-status.ok  { color: var(--green); }
#pin-status.err { color: var(--pc-red); }
#change-pin-status {
  margin-top: 6px;
  font-size: .82rem;
  font-weight: 600;
  min-height: 18px;
}
#change-pin-status.ok  { color: var(--green); }
#change-pin-status.err { color: var(--pc-red); }

/* ── Custom Select ── */
.custom-select {
  position: relative;
  user-select: none;
}
.cs-trigger {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1.5px solid var(--pc-gray-3);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--pc-black);
  background: var(--pc-white);
  cursor: pointer;
  transition: border-color .15s;
  position: relative;
}
.cs-trigger::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pc-gray-11);
  pointer-events: none;
  font-size: .9rem;
}
.custom-select.open .cs-trigger {
  border-color: var(--pc-red);
  box-shadow: 0 0 0 3px rgba(209,34,41,.12);
}
.custom-select.has-value .cs-trigger {
  font-weight: 600;
  color: var(--pc-black);
}
.cs-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--pc-white);
  border: 1.5px solid var(--pc-gray-3);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
  list-style: none;
}
.custom-select.open .cs-list {
  display: block;
}
.cs-list li {
  padding: 11px 16px;
  font-size: .95rem;
  cursor: pointer;
  color: var(--pc-black);
  transition: background .1s, color .1s;
  -webkit-tap-highlight-color: transparent;
}
.cs-list li:hover,
.cs-list li:active {
  background: var(--pc-red-light);
  color: var(--pc-red-dark);
}
.cs-list li.selected {
  background: var(--pc-red);
  color: var(--pc-white);
  font-weight: 700;
}
.cs-list li.selected:hover,
.cs-list li.selected:active {
  background: var(--pc-red-dark);
  color: var(--pc-white);
}
.cs-list li.placeholder {
  color: var(--pc-gray-7);
  font-style: italic;
}

/* ── Mode toggle (Checkout / Return) ── */
.mode-toggle {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--pc-red);
  margin-bottom: 20px;
  width: fit-content;
}
.mode-toggle-btn {
  flex: 1;
  padding: 10px 24px;
  border: none;
  background: var(--pc-white);
  color: var(--pc-red);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.mode-toggle-btn.active {
  background: var(--pc-red);
  color: var(--pc-white);
}
.mode-toggle-btn:not(.active):hover {
  background: var(--pc-red-light);
}
.return-mode-note {
  margin-top: 10px;
  font-size: .85rem;
  color: var(--green);
  padding: 8px 12px;
  background: #d1fae5;
  border-radius: 6px;
}

/* ── color-success alias ── */
:root { --color-success: #057a55; }

/* ── PIN admin ── */
.pin-admin-list { display: flex; flex-direction: column; gap: 8px; }
.pin-admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--pc-gray-1);
  border-radius: 8px;
}
.pin-admin-name { flex: 1; font-weight: 600; font-size: .95rem; }
.pin-admin-status { font-size: .78rem; color: var(--pc-gray-7); }
.pin-admin-status.set { color: var(--green); font-weight: 600; }
.pin-admin-inp {
  width: 90px !important;
  text-align: center;
  letter-spacing: .2em;
  font-weight: 700;
}
.btn-set-pin {
  background: var(--pc-red);
  color: var(--pc-white);
  border: none;
  border-radius: 6px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.btn-set-pin:hover { background: var(--pc-red-dark); }

/* ── Stock Setup ── */
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (max-width: 600px) { .setup-grid { grid-template-columns: 1fr; } }
.setup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--pc-white);
  border: 1px solid var(--pc-gray-1);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.setup-item-name { flex: 1; font-size: .88rem; font-weight: 500; min-width: 0; }
.setup-qty-inp {
  width: 70px !important;
  text-align: center;
  font-weight: 700;
  font-size: .95rem;
}

/* ── Section note ── */
.section-note { font-size: .8rem; color: var(--pc-gray-7); }

/* ── Reorder alert row ── */
.alert-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: #fff5f5;
  border-left: 4px solid var(--pc-red);
}
.alert-row.warn {
  background: #fffbeb;
  border-left-color: var(--yellow);
}
.alert-info { flex: 1; }
.alert-name { font-weight: 700; font-size: .9rem; }
.alert-meta { font-size: .78rem; color: var(--pc-gray-11); margin-top: 2px; }

/* ── Approval card ── */
.approval-card {
  border: 1.5px solid var(--pc-gray-3);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.approval-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.approval-item { font-weight: 700; font-size: .95rem; }
.approval-meta { font-size: .8rem; color: var(--pc-gray-11); margin-top: 4px; }
.approval-costs { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.approval-cost-item { text-align: center; }
.approval-cost-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pc-gray-7); }
.approval-cost-val { font-weight: 700; font-size: 1rem; color: var(--pc-black); }
.approval-total { color: var(--pc-red); }
.approval-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn-approve {
  background: var(--green);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-approve:hover { opacity: .85; }
.btn-reject {
  background: none;
  border: 1.5px solid var(--pc-red);
  color: var(--pc-red);
  border-radius: 6px;
  padding: 7px 16px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-reject:hover { background: var(--pc-red); color: white; }

/* ── Item config ── */
.cfg-item {
  border: 1px solid var(--pc-gray-3);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 8px;
}
.cfg-item-name { font-weight: 700; font-size: .9rem; margin-bottom: 10px; }
.cfg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.cfg-field label { font-size: .75rem; font-weight: 600; color: var(--pc-gray-11); display: block; margin-bottom: 3px; }
.cfg-field input, .cfg-field select { padding: 7px 10px; font-size: .88rem; }
.btn-cfg-save {
  margin-top: 10px;
  background: var(--pc-black);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-cfg-save:hover { opacity: .75; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--pc-white);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-title {
  font-family: var(--font-headline);
  font-size: 1.4rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.modal-item-name {
  font-weight: 600;
  color: var(--pc-red);
  margin-bottom: 16px;
  font-size: .95rem;
}
.modal-total {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--pc-red);
  margin-bottom: 14px;
  min-height: 24px;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Stock Setup ── */
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (max-width: 600px) { .setup-grid { grid-template-columns: 1fr; } }
.setup-row { display: flex; align-items: center; gap: 10px; background: var(--pc-white); border: 1px solid var(--pc-gray-1); border-radius: var(--radius); padding: 8px 12px; }
.setup-item-name { flex: 1; font-size: .88rem; font-weight: 500; min-width: 0; }
.setup-qty-inp { width: 70px !important; text-align: center; font-weight: 700; font-size: .95rem; }

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--pc-white);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--pc-gray-1);
  border-top-color: var(--pc-red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.loading-label {
  font-size: .88rem;
  color: var(--pc-gray-11);
  font-weight: 600;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth overlay ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--pc-gray-1);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-box {
  background: var(--pc-white);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  text-align: center;
}
.auth-box h2 {
  font-family: var(--font-headline);
  font-size: 1.6rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.auth-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--pc-gray-3);
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  letter-spacing: .06em;
  outline: none;
}
.auth-input:focus {
  border-color: var(--pc-red);
  box-shadow: 0 0 0 3px rgba(209,34,41,.12);
}
.auth-status {
  margin-top: 10px;
  font-size: .85rem;
  font-weight: 600;
  min-height: 18px;
  color: var(--pc-red);
}
.auth-status.ok { color: var(--green); }
.auth-status.err { color: var(--pc-red); }

/* ── Header admin actions ── */
.header-admin-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.header-admin-actions .btn-sm {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
  color: var(--pc-white);
  font-size: .78rem;
  padding: 5px 10px;
}
.header-admin-actions .btn-sm:hover {
  background: rgba(255,255,255,.3);
  border-color: var(--pc-white);
  color: var(--pc-white);
}

/* ── User management ── */
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--pc-gray-1);
  border-radius: 8px;
  flex-wrap: wrap;
}
.user-name { flex: 1; font-weight: 600; font-size: .95rem; min-width: 100px; }
.user-role-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 160px;
  padding: 6px 10px;
  font-size: .88rem;
}
.user-active-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--pc-gray-11);
  cursor: pointer;
  white-space: nowrap;
}
.user-active-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--pc-red);
}
.user-save-btn { flex-shrink: 0; }

/* ── Add item form ── */
.add-item-form {
  background: var(--pc-gray-1);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

/* ── Advanced filter toggle ── */
.btn-filter-toggle {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-800);
  transition: border-color .15s, background .15s;
  white-space: nowrap;
}
.btn-filter-toggle:hover { border-color: var(--pc-red); background: var(--pc-red-light); color: var(--pc-red-dark); }

.filter-advanced {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.filter-advanced select { flex: 0 0 auto; width: auto; min-width: 120px; }

/* ── Report sub-tabs ── */
.report-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--pc-gray-3);
  padding-bottom: 0;
}
.report-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 600;
  color: var(--pc-gray-11);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  border-radius: 6px 6px 0 0;
}
.report-tab:hover { color: var(--pc-red); }
.report-tab.active {
  color: var(--pc-red);
  border-bottom-color: var(--pc-red);
  background: var(--pc-red-light);
}

/* ── Analytics grid (Overview) ── */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.analytics-card {
  background: var(--pc-white);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.analytics-card--wide {
  grid-column: 1 / -1;
}
.analytics-title {
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--pc-gray-11);
  margin-bottom: 12px;
}
.analytics-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--pc-gray-1);
  font-size: .88rem;
}
.analytics-row:last-child { border-bottom: none; }
.analytics-rank {
  width: 20px;
  text-align: center;
  font-weight: 700;
  color: var(--pc-red);
  font-size: .78rem;
  flex-shrink: 0;
}
.analytics-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analytics-val { font-weight: 700; font-size: .82rem; color: var(--pc-gray-11); white-space: nowrap; }

/* ── Monthly trend bar chart ── */
.trend-bars { display: flex; flex-direction: column; gap: 8px; }
.trend-bar-row { display: flex; align-items: center; gap: 10px; font-size: .84rem; }
.trend-bar-label { width: 56px; text-align: right; color: var(--pc-gray-11); flex-shrink: 0; }
.trend-bar-track {
  flex: 1;
  background: var(--pc-gray-1);
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
}
.trend-bar-fill {
  height: 100%;
  background: var(--pc-red);
  border-radius: 4px;
  transition: width .3s ease;
  min-width: 2px;
}
.trend-bar-val { width: 60px; font-weight: 700; color: var(--pc-black); font-size: .82rem; }

/* ── Responsive ── */
@media (max-width: 540px) {
  /* Tighter layout */
  .container { padding: 12px 10px 80px; }
  .card { padding: 14px; }
  .page-title { font-size: 1.6rem; }

  /* Filter bar stacks */
  .filter-bar { flex-direction: column; }
  .filter-bar input[type="search"],
  .filter-bar select { width: 100%; }

  /* Item rows: wrap qty to second line for more breathing room */
  .item-row { flex-wrap: wrap; padding: 10px; gap: 6px; }
  .item-info { flex: 1 1 calc(100% - 70px); order: 1; }
  .item-badge { order: 2; align-self: flex-start; margin-top: 2px; }
  .item-qty {
    order: 3;
    flex: 0 0 100%;
    justify-content: flex-end;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--pc-gray-3);
  }

  /* Bigger tap targets for qty buttons */
  .qty-btn { width: 44px; height: 44px; font-size: 1.3rem; border-radius: 8px; }
  .qty-input { width: 54px !important; font-size: 1rem !important; padding: 6px 4px !important; }

  /* Sticky submit button */
  #btn-submit {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    z-index: 300;
    padding: 16px;
    font-size: 1.1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,.15);
  }

  /* Big PIN style for change-PIN inputs */
  #inp-current-pin, #inp-new-pin, #inp-confirm-pin {
    letter-spacing: .4em;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    max-width: 160px;
  }

  /* Toast: allow wrapping on narrow screens */
  .toast { white-space: normal; text-align: center; width: 85vw; }

  /* Tab bar: scroll horizontally on small screens */
  .dash-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dash-tab  { white-space: nowrap; }

  /* Logo banner: smaller on mobile */
  .logo-banner { padding: 10px 12px; gap: 10px; }
  .logo-banner-img { height: 36px; }
  .logo-banner-sub { font-size: 1.4rem; padding-left: 10px; }

  /* Header nav: tighter on mobile */
  .header-inner { padding: 0 10px; gap: 6px; }
  .nav-link { padding: 5px 8px; font-size: .78rem; }
}
