/* =========================================================================
   Hai Phat Distribution Manager — UI 0.6.0
   One design system for wp-admin pages and the [hpdm_staff_portal] front end.
   Replaces the 0.5.x stylesheet, which had grown into 30+ stacked patches.
   Tokens: brand green kept from earlier versions; neutrals = slate scale.
   ========================================================================= */

:root {
  --hpdm-color-primary: #0b7a46;
  --hpdm-color-primary-light: #e7f5ee;
  --hpdm-color-primary-dark: #075a33;
  --hpdm-color-secondary: #2563eb;
  --hpdm-color-accent: #d97706;

  --hpdm-neutral-0: #ffffff;
  --hpdm-neutral-50: #f8fafc;
  --hpdm-neutral-100: #f1f5f9;
  --hpdm-neutral-200: #e2e8f0;
  --hpdm-neutral-300: #cbd5e1;
  --hpdm-neutral-400: #94a3b8;
  --hpdm-neutral-500: #64748b;
  --hpdm-neutral-600: #475569;
  --hpdm-neutral-700: #334155;
  --hpdm-neutral-800: #1e293b;
  --hpdm-neutral-900: #0f172a;

  /* Status palette: bg / text / dot. Text colours keep >= 4.5:1 on their bg. */
  --hpdm-success-bg: #e8f6ee; --hpdm-success: #0f7a43; --hpdm-success-dot: #16a34a;
  --hpdm-warning-bg: #fff4e0; --hpdm-warning: #9a5200; --hpdm-warning-dot: #f59e0b;
  --hpdm-error-bg: #fdecec;   --hpdm-error: #b42318;   --hpdm-error-dot: #ef4444;
  --hpdm-info-bg: #eaf1fe;    --hpdm-info: #1d4ed8;    --hpdm-info-dot: #3b82f6;
  --hpdm-violet-bg: #f1ecfe;  --hpdm-violet: #6d28d9;  --hpdm-violet-dot: #8b5cf6;
  --hpdm-neutral-bg: #f1f5f9; --hpdm-neutral: #475569; --hpdm-neutral-dot: #94a3b8;

  --hpdm-font-body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hpdm-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hpdm-radius: 12px;
  --hpdm-radius-sm: 8px;
  --hpdm-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --hpdm-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --hpdm-focus: 0 0 0 3px rgba(11, 122, 70, .25);
}

/* ---------- Shared base ---------- */
.hpdm-wrap, .hpdm-portal, .hpdm-browser-notification-bar { font-family: var(--hpdm-font-body); }
.hpdm-wrap *, .hpdm-portal *, .hpdm-wrap *::before, .hpdm-portal *::before, .hpdm-wrap *::after, .hpdm-portal *::after { box-sizing: border-box; }
.hpdm-wrap [hidden], .hpdm-portal [hidden], .hpdm-browser-notification-bar [hidden] { display: none !important; }
.hpdm-wrap :focus-visible, .hpdm-portal :focus-visible { outline: none; box-shadow: var(--hpdm-focus); }
.hpdm-num, .hpdm-wrap td, .hpdm-wrap th, .hpdm-portal td, .hpdm-stat-kpi strong, .hpdm-today-kpi strong, .hpdm-order-kpi strong { font-variant-numeric: tabular-nums; }
.hpdm-code { font-family: var(--hpdm-font-mono); font-size: 12px; background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-700); padding: 2px 6px; border-radius: 6px; }
.hpdm-eyebrow { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hpdm-color-primary); }
.hpdm-help, .hpdm-stats-help, .hpdm-wrap p.description { color: var(--hpdm-neutral-500); font-size: 13px; line-height: 1.5; margin: 8px 0 0; }
.hpdm-dash { color: var(--hpdm-neutral-400); }
.hpdm-warn-text { color: var(--hpdm-warning); }
.hpdm-error { color: var(--hpdm-error); background: var(--hpdm-error-bg); padding: 10px 12px; border-radius: var(--hpdm-radius-sm); font-weight: 600; }
.hpdm-cell-sub { display: block; margin-top: 2px; color: var(--hpdm-neutral-500); font-size: 12px; font-weight: 400; }

/* =========================================================================
   ADMIN SHELL
   ========================================================================= */
body.wp-admin[class*="hpdm"] #wpcontent { background: var(--hpdm-neutral-50); }
body.wp-admin[class*="hpdm"] #wpbody-content { padding-bottom: 40px; }
.hpdm-wrap { max-width: 1440px; margin: 20px 24px 32px 4px; color: var(--hpdm-neutral-800); font-size: 14px; line-height: 1.5; }
.hpdm-wrap h2 { font-size: 18px; line-height: 1.35; font-weight: 700; color: var(--hpdm-neutral-900); margin: 0; }
.hpdm-wrap h3 { font-size: 15px; line-height: 1.4; font-weight: 700; color: var(--hpdm-neutral-900); margin: 0; }
.hpdm-wrap .wp-header-end { margin: 0; visibility: hidden; height: 0; border: 0; }
.hpdm-wrap > .notice, .hpdm-wrap > .updated, .hpdm-wrap > .error { margin: 0 0 16px; border-radius: var(--hpdm-radius-sm); box-shadow: var(--hpdm-shadow-sm); }

/* Page header */
.hpdm-page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 20px; padding: 0 0 18px; border-bottom: 1px solid var(--hpdm-neutral-200); }
.hpdm-page-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hpdm-brand-mark { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--hpdm-color-primary), var(--hpdm-color-primary-dark)); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .02em; box-shadow: 0 6px 16px -6px rgba(11,122,70,.55); }
.hpdm-page-title h1 { margin: 0; padding: 0; font-size: 24px; line-height: 1.2; font-weight: 750; letter-spacing: -.02em; color: var(--hpdm-neutral-900); }
.hpdm-page-title p { margin: 3px 0 0; color: var(--hpdm-neutral-500); font-size: 13px; }
.hpdm-version { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 99px; background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-600); font-size: 11px; font-weight: 600; }

/* Chrome notification control (header pill on HPDM pages; full bar elsewhere) */
.hpdm-browser-notification-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); background: #fff; box-shadow: var(--hpdm-shadow-sm); }
.notice.hpdm-browser-notification-bar { border-left: 4px solid var(--hpdm-color-primary); margin: 12px 0; }
.hpdm-browser-notification-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hpdm-browser-notification-copy > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.hpdm-browser-notification-copy strong { font-size: 13px; color: var(--hpdm-neutral-900); }
.hpdm-browser-notification-copy small { color: var(--hpdm-neutral-500); font-size: 12px; line-height: 1.4; }
.hpdm-browser-notification-icon.dashicons { width: 34px; height: 34px; font-size: 18px; line-height: 34px; text-align: center; border-radius: 10px; background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary); flex: 0 0 auto; }
.hpdm-browser-notification-bar.is-compact { padding: 6px 6px 6px 10px; border-radius: 99px; gap: 10px; }
.hpdm-browser-notification-bar.is-compact .hpdm-browser-notification-icon.dashicons { width: 28px; height: 28px; line-height: 28px; font-size: 16px; border-radius: 99px; }
.hpdm-browser-notification-bar.is-compact .hpdm-browser-notification-hint { display: none; }
.hpdm-browser-notification-bar.is-compact .button { border-radius: 99px !important; min-height: 32px !important; padding: 0 14px !important; }
.hpdm-browser-notification-bar.is-blocked .hpdm-browser-notification-icon { background: var(--hpdm-error-bg); color: var(--hpdm-error); }
.hpdm-browser-notification-bar.is-unavailable .hpdm-browser-notification-icon { background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-500); }
/* Once permission is granted the control has nothing left to do. */
.hpdm-browser-notification-bar.is-enabled { display: none !important; }

/* =========================================================================
   ADMIN PRIMITIVES
   ========================================================================= */
.hpdm-panel { background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); padding: 20px; margin: 0 0 20px; box-shadow: var(--hpdm-shadow-sm); }
.hpdm-panel.is-highlight { border-color: var(--hpdm-color-primary); box-shadow: 0 0 0 3px var(--hpdm-color-primary-light); }
.hpdm-panel > h2 { margin-bottom: 14px; }
.hpdm-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.hpdm-panel-heading p { margin: 4px 0 0; color: var(--hpdm-neutral-500); font-size: 13px; max-width: 70ch; }
.hpdm-heading-icon.dashicons, .heading-icon.dashicons { flex: 0 0 auto; width: 40px; height: 40px; font-size: 20px; line-height: 40px; text-align: center; border-radius: 10px; background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary); }

/* Form fields */
.hpdm-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
.hpdm-field { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 13px; font-weight: 600; color: var(--hpdm-neutral-700); }
.hpdm-field.is-wide { grid-column: 1 / -1; }
.hpdm-wrap label { color: var(--hpdm-neutral-700); }
.hpdm-wrap input[type=text], .hpdm-wrap input[type=email], .hpdm-wrap input[type=password], .hpdm-wrap input[type=tel], .hpdm-wrap input[type=search], .hpdm-wrap input[type=number], .hpdm-wrap input[type=date], .hpdm-wrap select, .hpdm-wrap textarea {
  width: 100%; max-width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--hpdm-neutral-300); border-radius: var(--hpdm-radius-sm); background: #fff; color: var(--hpdm-neutral-900); font-size: 14px; line-height: 1.4; box-shadow: none; transition: border-color .15s, box-shadow .15s;
}
.hpdm-wrap select { padding-right: 32px; }
.hpdm-wrap input:focus, .hpdm-wrap select:focus, .hpdm-wrap textarea:focus { border-color: var(--hpdm-color-primary); box-shadow: var(--hpdm-focus); outline: none; }
.hpdm-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }

/* Buttons (WordPress .button restyled inside HPDM screens) */
.hpdm-wrap .button, .hpdm-browser-notification-bar .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: var(--hpdm-radius-sm); border: 1px solid var(--hpdm-neutral-300); background: #fff; color: var(--hpdm-neutral-700); font-size: 13px; font-weight: 600; line-height: 1; text-decoration: none; box-shadow: var(--hpdm-shadow-sm); transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.hpdm-wrap .button:hover { background: var(--hpdm-neutral-50); border-color: var(--hpdm-neutral-400); color: var(--hpdm-neutral-900); }
.hpdm-wrap .button-primary, .hpdm-browser-notification-bar .button-primary { background: var(--hpdm-color-primary); border-color: var(--hpdm-color-primary); color: #fff; }
.hpdm-wrap .button-primary:hover, .hpdm-browser-notification-bar .button-primary:hover { background: var(--hpdm-color-primary-dark); border-color: var(--hpdm-color-primary-dark); color: #fff; }
.hpdm-wrap .button:disabled, .hpdm-wrap .button[disabled] { opacity: .5; cursor: not-allowed; }
.hpdm-wrap .button.button-small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.hpdm-wrap .button.button-hero { min-height: 48px; padding: 0 24px; font-size: 15px; }
.hpdm-wrap .button .dashicons { font-size: 16px; width: 16px; height: 16px; margin: 0 !important; }
.hpdm-wrap .button.hpdm-button-danger, .hpdm-wrap .hpdm-order-cancel-button { color: var(--hpdm-error); border-color: #f3c4c0; }
.hpdm-wrap .button.hpdm-button-danger:hover, .hpdm-wrap .hpdm-order-cancel-button:hover { background: var(--hpdm-error-bg); border-color: var(--hpdm-error); color: var(--hpdm-error); }
.hpdm-wrap .button-link { color: var(--hpdm-color-primary); font-weight: 600; text-decoration: none; }
.hpdm-wrap a { color: var(--hpdm-color-primary); }
.hpdm-wrap a:hover { color: var(--hpdm-color-primary-dark); }
.hpdm-muted-link { font-size: 12px; color: var(--hpdm-neutral-500) !important; text-decoration: underline dotted; }

/* Status badges — one vocabulary everywhere */
.hpdm-order-status, .hpdm-category-status, .hpdm-status, .hpdm-order-mini-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--hpdm-neutral-bg); color: var(--hpdm-neutral);
}
.hpdm-order-status::before, .hpdm-category-status::before, .hpdm-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--hpdm-neutral-dot); flex: 0 0 auto; }
.hpdm-order-status.is-pending, .hpdm-order-mini-badge.is-pending { background: var(--hpdm-warning-bg); color: var(--hpdm-warning); }
.hpdm-order-status.is-pending::before { background: var(--hpdm-warning-dot); }
.hpdm-order-status.is-change, .hpdm-order-mini-badge.is-change { background: var(--hpdm-violet-bg); color: var(--hpdm-violet); }
.hpdm-order-status.is-change::before { background: var(--hpdm-violet-dot); }
.hpdm-order-status.is-confirmed, .hpdm-order-status.is-processing, .hpdm-order-status.is-delivered { background: var(--hpdm-info-bg); color: var(--hpdm-info); }
.hpdm-order-status.is-confirmed::before, .hpdm-order-status.is-processing::before, .hpdm-order-status.is-delivered::before { background: var(--hpdm-info-dot); }
.hpdm-order-status.is-warning { background: var(--hpdm-warning-bg); color: var(--hpdm-warning); }
.hpdm-order-status.is-warning::before { background: var(--hpdm-warning-dot); }
.hpdm-order-status.is-closed, .hpdm-category-status.is-active { background: var(--hpdm-success-bg); color: var(--hpdm-success); }
.hpdm-order-status.is-closed::before, .hpdm-category-status.is-active::before { background: var(--hpdm-success-dot); }
.hpdm-order-status.is-cancelled { background: var(--hpdm-error-bg); color: var(--hpdm-error); }
.hpdm-order-status.is-cancelled::before { background: var(--hpdm-error-dot); }
.hpdm-category-status.is-hidden { background: var(--hpdm-neutral-bg); color: var(--hpdm-neutral); }
.hpdm-order-mini-badge { padding: 2px 8px; font-size: 11px; }

/* Chips and tags */
.hpdm-unit-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 6px; background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-700); font-size: 12px; white-space: nowrap; }
.hpdm-unit-chip b { color: var(--hpdm-neutral-900); font-variant-numeric: tabular-nums; }
.hpdm-count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-600); font-size: 12px; font-weight: 600; }
.hpdm-tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.hpdm-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary-dark); font-size: 12px; font-weight: 500; }

/* People */
.hpdm-person { display: flex; align-items: center; gap: 10px; }
.hpdm-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary-dark); font-weight: 700; font-size: 13px; }

/* Data tables */
.hpdm-table-card { background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); margin: 0 0 20px; box-shadow: var(--hpdm-shadow-sm); overflow: hidden; }
.hpdm-table-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--hpdm-neutral-200); }
.hpdm-table-card-head > div { display: flex; align-items: center; gap: 10px; }
.hpdm-table-search, .hpdm-order-search, .hpdm-staff-search-label { position: relative; display: block; flex: 0 1 280px; min-width: 200px; }
.hpdm-table-search .dashicons, .hpdm-order-search .dashicons, .hpdm-staff-search-label .dashicons { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--hpdm-neutral-400); font-size: 18px; width: 18px; height: 18px; pointer-events: none; }
.hpdm-table-search input, .hpdm-order-search input, .hpdm-staff-search-label input { padding-left: 34px !important; }
.hpdm-table-scroll, .hpdm-order-table-wrap, .hpdm-stats-table-wrap, .hpdm-order-detail-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.hpdm-wrap table.widefat, .hpdm-order-table, .hpdm-stats-table { width: 100%; border: 0; border-collapse: collapse; background: #fff; box-shadow: none; font-size: 13px; }
.hpdm-wrap table.widefat thead th, .hpdm-order-table thead th, .hpdm-stats-table thead th {
  padding: 10px 14px; background: var(--hpdm-neutral-50); border-bottom: 1px solid var(--hpdm-neutral-200); color: var(--hpdm-neutral-500); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: left; white-space: nowrap;
}
.hpdm-wrap table.widefat td, .hpdm-order-table td, .hpdm-stats-table td { padding: 12px 14px; border-bottom: 1px solid var(--hpdm-neutral-100); color: var(--hpdm-neutral-700); vertical-align: middle; }
.hpdm-wrap table.widefat tbody tr:last-child td, .hpdm-order-table tbody tr:last-child td, .hpdm-stats-table tbody tr:last-child td { border-bottom: 0; }
.hpdm-wrap table.widefat tbody tr, .hpdm-order-table tbody tr, .hpdm-stats-table tbody tr { transition: background .12s; }
.hpdm-wrap table.widefat tbody tr:hover, .hpdm-order-table tbody tr:hover, .hpdm-stats-table tbody tr:hover { background: var(--hpdm-neutral-50); }
.hpdm-wrap table.widefat.striped > tbody > :nth-child(odd) { background: transparent; }
.hpdm-wrap table.widefat td strong, .hpdm-stats-table td strong { color: var(--hpdm-neutral-900); }
.hpdm-stats-table tfoot th { padding: 12px 14px; background: var(--hpdm-neutral-50); border-top: 2px solid var(--hpdm-neutral-200); text-align: left; color: var(--hpdm-neutral-900); font-size: 13px; }
.hpdm-wrap tr.is-muted td, .hpdm-stats-table tr.is-cancelled td { color: var(--hpdm-neutral-400); }
.hpdm-wrap tr.is-cancelled td strong { text-decoration: line-through; color: var(--hpdm-neutral-400); }
.hpdm-empty-row td { padding: 32px 16px !important; text-align: center; color: var(--hpdm-neutral-500) !important; }
.hpdm-row-actions { white-space: nowrap; text-align: right; }
.hpdm-row-actions > * { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.hpdm-row-actions form { margin: 0; }

/* Empty states */
.hpdm-today-empty, .hpdm-order-empty, .hpdm-category-empty, .hpdm-stats-empty, .hpdm-empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 20px; text-align: center; border: 1px dashed var(--hpdm-neutral-300); border-radius: var(--hpdm-radius); background: var(--hpdm-neutral-50); color: var(--hpdm-neutral-500);
}
.hpdm-today-empty { flex-direction: row; text-align: left; justify-content: flex-start; gap: 14px; }
.hpdm-today-empty > .dashicons, .hpdm-order-empty > .dashicons, .hpdm-category-empty > .dashicons { font-size: 28px; width: 28px; height: 28px; color: var(--hpdm-neutral-400); }
.hpdm-today-empty.is-clear > .dashicons, .hpdm-change-empty > .dashicons { color: var(--hpdm-success-dot); }
.hpdm-today-empty strong, .hpdm-order-empty strong, .hpdm-category-empty strong, .hpdm-stats-empty strong, .hpdm-empty-state strong { color: var(--hpdm-neutral-800); font-size: 14px; }
.hpdm-today-empty p, .hpdm-order-empty p, .hpdm-category-empty p, .hpdm-empty-state p { margin: 2px 0 0; font-size: 13px; }

/* DB diagnostic */
.hpdm-db-diagnostic { border-left-color: var(--hpdm-error) !important; border-radius: var(--hpdm-radius-sm); }
.hpdm-db-diagnostic form { margin: 0 0 10px; }

/* =========================================================================
   KPI TILES (dashboard, orders, reports)
   ========================================================================= */
.hpdm-today-kpis, .hpdm-stat-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 0 0 20px; }
.hpdm-today-kpi, .hpdm-stat-kpi { position: relative; padding: 16px 18px; background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); box-shadow: var(--hpdm-shadow-sm); overflow: hidden; }
.hpdm-today-kpi::before, .hpdm-stat-kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--hpdm-neutral-300); }
.hpdm-today-kpi span, .hpdm-stat-kpi span { display: block; color: var(--hpdm-neutral-500); font-size: 13px; font-weight: 600; }
.hpdm-today-kpi strong, .hpdm-stat-kpi strong { display: block; margin-top: 6px; font-size: 30px; line-height: 1.1; font-weight: 750; letter-spacing: -.02em; color: var(--hpdm-neutral-900); }
.hpdm-today-kpi small { display: block; margin-top: 6px; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-today-kpi.is-total::before { background: var(--hpdm-color-primary); }
.hpdm-today-kpi.is-pending::before, .hpdm-stat-kpi.is-warn::before { background: var(--hpdm-warning-dot); }
.hpdm-today-kpi.is-pending strong, .hpdm-stat-kpi.is-warn strong { color: var(--hpdm-warning); }
.hpdm-today-kpi.is-confirmed::before { background: var(--hpdm-info-dot); }
.hpdm-today-kpi.is-closed::before { background: var(--hpdm-success-dot); }
.hpdm-today-kpi.is-cancelled::before { background: var(--hpdm-error-dot); }

/* Orders page: clickable KPI cards */
.hpdm-order-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
@media (min-width: 1400px) { .hpdm-order-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } .hpdm-order-kpi-arrow { display: none; } }
.hpdm-order-kpi { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); box-shadow: var(--hpdm-shadow-sm); text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.hpdm-order-kpi:hover { border-color: var(--hpdm-neutral-300); box-shadow: var(--hpdm-shadow); transform: translateY(-1px); }
.hpdm-order-kpi-icon.dashicons { flex: 0 0 auto; width: 40px; height: 40px; font-size: 20px; line-height: 40px; text-align: center; border-radius: 10px; background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-600); }
.hpdm-order-kpi.is-pending .hpdm-order-kpi-icon { background: var(--hpdm-warning-bg); color: var(--hpdm-warning); }
.hpdm-order-kpi.is-change .hpdm-order-kpi-icon { background: var(--hpdm-violet-bg); color: var(--hpdm-violet); }
.hpdm-order-kpi.is-processing .hpdm-order-kpi-icon { background: var(--hpdm-info-bg); color: var(--hpdm-info); }
.hpdm-order-kpi.is-closed .hpdm-order-kpi-icon { background: var(--hpdm-success-bg); color: var(--hpdm-success); }
.hpdm-order-kpi.is-cancelled .hpdm-order-kpi-icon { background: var(--hpdm-error-bg); color: var(--hpdm-error); }
.hpdm-order-kpi-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.hpdm-order-kpi-copy small { color: var(--hpdm-neutral-500); font-size: 12px; font-weight: 600; }
.hpdm-order-kpi-copy strong { font-size: 24px; line-height: 1.15; font-weight: 750; color: var(--hpdm-neutral-900); }
.hpdm-order-kpi-copy em { font-style: normal; color: var(--hpdm-neutral-400); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpdm-order-kpi-arrow.dashicons { color: var(--hpdm-neutral-300); }
.hpdm-order-kpi:hover .hpdm-order-kpi-arrow { color: var(--hpdm-color-primary); }

/* =========================================================================
   DASHBOARD (Tổng quan)
   ========================================================================= */
.hpdm-today-dashboard-heading, .hpdm-order-dashboard-heading, .hpdm-change-requests-heading, .hpdm-products-list-heading, .hpdm-day-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 16px;
}
.hpdm-today-dashboard-heading h2, .hpdm-order-dashboard-heading h2, .hpdm-change-requests-heading h2, .hpdm-products-list-heading h2, .hpdm-day-head h2 { font-size: 20px; }
.hpdm-today-dashboard-heading p, .hpdm-order-dashboard-heading p, .hpdm-change-requests-heading p, .hpdm-products-list-heading p { margin: 4px 0 0; color: var(--hpdm-neutral-500); font-size: 13px; }
.hpdm-today-section { background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); padding: 18px; margin: 0 0 20px; box-shadow: var(--hpdm-shadow-sm); }
.hpdm-today-pending-section { border-top: 3px solid var(--hpdm-warning-dot); }
.hpdm-today-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.hpdm-today-section-heading > div { display: flex; align-items: center; gap: 12px; }
.hpdm-today-section-heading p { margin: 2px 0 0; color: var(--hpdm-neutral-500); font-size: 13px; }
.hpdm-today-section-icon.dashicons { width: 36px; height: 36px; font-size: 18px; line-height: 36px; text-align: center; border-radius: 10px; background: var(--hpdm-success-bg); color: var(--hpdm-success); }
.hpdm-today-pending-section .hpdm-today-section-icon { background: var(--hpdm-warning-bg); color: var(--hpdm-warning); }
.hpdm-today-section-count, .hpdm-change-total { padding: 4px 12px; border-radius: 99px; background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-700); font-size: 12px; font-weight: 700; }
.hpdm-today-section-count.is-pending { background: var(--hpdm-warning-bg); color: var(--hpdm-warning); }
.hpdm-today-location-group { margin: 0 0 14px; }
.hpdm-today-location-group:last-child { margin-bottom: 0; }
.hpdm-today-location-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 2px 8px; }
.hpdm-today-location-head > div { display: flex; align-items: center; gap: 6px; color: var(--hpdm-neutral-800); }
.hpdm-today-location-head .dashicons { color: var(--hpdm-color-primary); font-size: 18px; }
.hpdm-today-location-count { color: var(--hpdm-neutral-500); font-size: 12px; font-weight: 600; }
.hpdm-today-order-list { display: grid; gap: 8px; }
.hpdm-today-order-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border: 1px solid var(--hpdm-neutral-200); border-radius: 10px; background: #fff; transition: border-color .15s, background .15s; }
.hpdm-today-order-card:hover { border-color: var(--hpdm-neutral-300); background: var(--hpdm-neutral-50); }
.hpdm-today-order-card.is-needs-action { border-left: 3px solid var(--hpdm-warning-dot); }
.hpdm-today-order-main { min-width: 0; }
.hpdm-today-order-topline { display: flex; align-items: center; gap: 10px; }
.hpdm-today-order-code, .hpdm-order-code { font-family: var(--hpdm-font-mono); font-size: 13px; font-weight: 700; color: var(--hpdm-neutral-900); }
.hpdm-today-order-time { display: inline-flex; align-items: center; gap: 2px; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-today-order-time .dashicons { font-size: 14px; width: 14px; height: 14px; }
.hpdm-today-order-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; color: var(--hpdm-neutral-600); font-size: 13px; }
.hpdm-today-order-meta b { color: var(--hpdm-neutral-500); font-weight: 500; }
.hpdm-today-order-action { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* =========================================================================
   ORDERS PAGE
   ========================================================================= */
.hpdm-admin-notifications { border-left: 3px solid var(--hpdm-color-primary); }
.hpdm-admin-notifications h2 { font-size: 15px; margin-bottom: 10px; }
.hpdm-admin-notification-list { display: grid; gap: 8px; }
.hpdm-admin-notification-list > p { margin: 0; color: var(--hpdm-neutral-500); font-size: 13px; }
.hpdm-notice-item { padding: 12px 14px; border: 1px solid var(--hpdm-neutral-200); border-radius: 10px; background: #fff; }
.hpdm-notice-item strong { display: block; color: var(--hpdm-neutral-900); }
.hpdm-notice-item p { margin: 3px 0 0; color: var(--hpdm-neutral-600); font-size: 13px; }
.hpdm-notification-type { display: inline-block; margin-bottom: 4px; padding: 1px 8px; border-radius: 99px; background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary-dark); font-size: 10px; font-weight: 700; letter-spacing: .05em; }
.hpdm-admin-notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.hpdm-order-view-switch, .hpdm-rpt-tabs { display: inline-flex; padding: 4px; border-radius: 10px; background: var(--hpdm-neutral-100); gap: 2px; }
.hpdm-order-view-switch a, .hpdm-rpt-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; color: var(--hpdm-neutral-600) !important; font-size: 13px; font-weight: 600; text-decoration: none; }
.hpdm-order-view-switch a .dashicons, .hpdm-rpt-tabs a .dashicons { font-size: 16px; width: 16px; height: 16px; }
.hpdm-order-view-switch a.is-active, .hpdm-rpt-tabs a.is-active { background: #fff; color: var(--hpdm-neutral-900) !important; box-shadow: var(--hpdm-shadow-sm); }
.hpdm-rpt-tabs { margin: 0 0 20px; }

.hpdm-order-status-filters, .hpdm-report-period, .hpdm-product-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.hpdm-order-status-filters a, .hpdm-report-period a, .hpdm-product-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 14px; border: 1px solid var(--hpdm-neutral-200); border-radius: 99px; background: #fff; color: var(--hpdm-neutral-600) !important; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: all .15s; }
.hpdm-order-status-filters a:hover, .hpdm-report-period a:hover, .hpdm-product-filter:hover { border-color: var(--hpdm-neutral-400); color: var(--hpdm-neutral-900) !important; }
.hpdm-order-status-filters a.is-active, .hpdm-report-period a.is-active, .hpdm-product-filter.is-active { background: var(--hpdm-neutral-900); border-color: var(--hpdm-neutral-900); color: #fff !important; }
.hpdm-product-filter .dashicons { font-size: 15px; width: 15px; height: 15px; }

.hpdm-order-filter-form, .hpdm-report-date-filter, .hpdm-day-picker { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px; margin: 0 0 20px; background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); box-shadow: var(--hpdm-shadow-sm); }
.hpdm-order-filter-form > label:not(.hpdm-order-search), .hpdm-report-date-filter label, .hpdm-day-picker label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--hpdm-neutral-500); flex: 1 1 150px; }
.hpdm-order-filter-form .hpdm-order-search { flex: 2 1 260px; align-self: flex-end; }
.hpdm-order-reset { align-self: center; font-size: 13px; color: var(--hpdm-neutral-500) !important; }
.hpdm-day-picker { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; align-items: flex-end; }
.hpdm-day-picker label { flex: 0 1 auto; }

.hpdm-order-result-heading { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; }
.hpdm-order-result-heading strong { font-size: 15px; color: var(--hpdm-neutral-900); }
.hpdm-order-result-heading span { color: var(--hpdm-neutral-500); font-size: 13px; }
.hpdm-order-groups { display: grid; gap: 16px; margin: 0 0 28px; }
.hpdm-order-group { background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); box-shadow: var(--hpdm-shadow-sm); overflow: hidden; }
.hpdm-order-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--hpdm-neutral-200); background: var(--hpdm-neutral-50); }
.hpdm-order-group-title { display: flex; align-items: center; gap: 10px; }
.hpdm-order-group-title .dashicons { width: 32px; height: 32px; line-height: 32px; text-align: center; font-size: 17px; border-radius: 8px; background: #fff; border: 1px solid var(--hpdm-neutral-200); color: var(--hpdm-color-primary); }
.hpdm-order-group-title small { color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-order-group-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hpdm-order-group-link, .hpdm-order-detail-link { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; text-decoration: none; }
.hpdm-order-group-link .dashicons, .hpdm-order-detail-link .dashicons { font-size: 16px; width: 16px; height: 16px; }
.hpdm-order-table td:nth-child(5), .hpdm-order-table td:nth-child(6), .hpdm-order-table th:nth-child(5), .hpdm-order-table th:nth-child(6) { text-align: right; }
.hpdm-order-table td:last-child { text-align: right; }
/* Same column widths in every group so the stacked tables line up. */
.hpdm-order-table { table-layout: fixed; min-width: 820px; }
.hpdm-order-table th:nth-child(1) { width: 17%; } .hpdm-order-table th:nth-child(2) { width: 12%; }
.hpdm-order-table th:nth-child(3) { width: 17%; } .hpdm-order-table th:nth-child(4) { width: 11%; }
.hpdm-order-table th:nth-child(5), .hpdm-order-table th:nth-child(6) { width: 9%; }
.hpdm-order-table th:nth-child(7) { width: 15%; padding-left: 24px; } .hpdm-order-table td:nth-child(7) { padding-left: 24px; }
.hpdm-order-table th:nth-child(8) { width: 10%; }
.hpdm-order-date-badge { display: inline-flex; align-items: center; gap: 4px; color: var(--hpdm-neutral-600); white-space: nowrap; }
.hpdm-order-date-badge .dashicons { font-size: 14px; width: 14px; height: 14px; color: var(--hpdm-neutral-400); }

/* Order detail */
#hpdm-order-detail-anchor { scroll-margin-top: 48px; }
.hpdm-order-detail { border-top: 3px solid var(--hpdm-color-primary); }
.hpdm-order-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.hpdm-order-detail-heading h2 { font-family: var(--hpdm-font-mono); font-size: 19px; }
.hpdm-order-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin: 0 0 16px; border: 1px solid var(--hpdm-neutral-200); border-radius: 10px; overflow: hidden; background: var(--hpdm-neutral-200); }
.hpdm-order-facts > div { padding: 10px 12px; background: var(--hpdm-neutral-50); }
.hpdm-order-facts dt { color: var(--hpdm-neutral-500); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.hpdm-order-facts dd { margin: 3px 0 0; color: var(--hpdm-neutral-900); font-weight: 600; }
.hpdm-order-note { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; background: var(--hpdm-warning-bg); color: var(--hpdm-neutral-800); font-size: 13px; }
.hpdm-approval-instruction, .hpdm-order-stage-note { display: flex; flex-direction: column; gap: 2px; margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: var(--hpdm-info-bg); color: var(--hpdm-neutral-700); font-size: 13px; }
.hpdm-approval-instruction strong, .hpdm-order-stage-note strong { color: var(--hpdm-info); }
.hpdm-order-stage-note.is-change { background: var(--hpdm-violet-bg); }
.hpdm-order-stage-note.is-change strong { color: var(--hpdm-violet); }
.hpdm-order-detail-table-wrap { border: 1px solid var(--hpdm-neutral-200); border-radius: 10px; }
.hpdm-order-approval-table td small { display: block; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-order-approval-table td:not(:first-child), .hpdm-order-approval-table th:not(:first-child) { text-align: right; }
.hpdm-order-qty-value { font-size: 15px; font-weight: 700; color: var(--hpdm-neutral-900); }
.hpdm-approval-footer { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.hpdm-approval-footer p { margin: 0; color: var(--hpdm-neutral-500); font-size: 13px; }
.hpdm-inline-form { display: inline-flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin: 0; }
.hpdm-order-cancel-admin { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--hpdm-neutral-200); }
.hpdm-order-cancel-admin label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--hpdm-neutral-500); min-width: 280px; }

/* Quantity steppers (admin + portal) */
.hpdm-qty-stepper { display: inline-flex; align-items: stretch; height: 40px; border: 1px solid var(--hpdm-neutral-300); border-radius: 10px; overflow: hidden; background: #fff; vertical-align: middle; }
.hpdm-qty-stepper:focus-within { border-color: var(--hpdm-color-primary); box-shadow: var(--hpdm-focus); }
.hpdm-qty-stepper button { flex: 0 0 38px; width: 38px; padding: 0; margin: 0; border: 0; border-radius: 0; background: var(--hpdm-neutral-50); color: var(--hpdm-neutral-700); font-size: 20px; font-weight: 600; line-height: 1; cursor: pointer; transition: background .12s; touch-action: manipulation; }
/* Themes (e.g. Flatsome) give <button> their own padding / line-height / min-height; neutralise them. */
.hpdm-qty-stepper button { display: flex !important; align-items: center; justify-content: center; min-height: 0 !important; height: auto !important; line-height: 1 !important; padding: 0 !important; margin: 0 !important; text-transform: none; box-shadow: none; }
.hpdm-qty-stepper button:hover { background: var(--hpdm-neutral-100); }
.hpdm-qty-stepper button:active { background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary); }
.hpdm-qty-stepper input[type=number] { width: 64px !important; min-width: 0 !important; height: 100% !important; min-height: 0 !important; margin: 0 !important; padding: 0 4px !important; border: 0 !important; border-left: 1px solid var(--hpdm-neutral-200) !important; border-right: 1px solid var(--hpdm-neutral-200) !important; border-radius: 0 !important; box-shadow: none !important; text-align: center; font-size: 15px !important; font-weight: 700; color: var(--hpdm-neutral-900); -moz-appearance: textfield; }
.hpdm-qty-stepper input[type=number]::-webkit-inner-spin-button, .hpdm-qty-stepper input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* overflow stays visible so the "Đã lưu" line under the stepper is not clipped */
.hpdm-approval-stepper { position: relative; flex-wrap: nowrap; overflow: visible; }
.hpdm-approval-stepper > button:first-child { border-radius: 9px 0 0 9px; }
.hpdm-approval-stepper > button.hpdm-qty-plus { border-radius: 0 9px 9px 0; }
.hpdm-order-approval-table .hpdm-approval-stepper { margin-bottom: 18px; }
.hpdm-approval-save-state { position: absolute; right: 0; top: calc(100% + 3px); color: var(--hpdm-neutral-400); font-size: 11px; white-space: nowrap; }
.hpdm-approval-save-state.is-saved { color: var(--hpdm-success); }
.hpdm-approval-save-state.is-error { color: var(--hpdm-error); }
.hpdm-approval-stepper.is-saving { opacity: .6; }

/* Change / cancel requests (admin) */
.hpdm-change-requests-dashboard { margin-top: 8px; }
.hpdm-change-group { margin: 0 0 16px; padding: 14px; background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); box-shadow: var(--hpdm-shadow-sm); }
.hpdm-change-group > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; color: var(--hpdm-neutral-500); font-size: 12px; font-weight: 600; }
.hpdm-change-group > header > div { display: flex; align-items: center; gap: 6px; color: var(--hpdm-neutral-900); font-size: 14px; }
.hpdm-change-group > header .dashicons { color: var(--hpdm-color-primary); }
.hpdm-change-review-card { padding: 14px; margin: 0 0 10px; border: 1px solid var(--hpdm-neutral-200); border-left: 3px solid var(--hpdm-violet-dot); border-radius: 10px; }
.hpdm-change-review-card:last-child { margin-bottom: 0; }
.hpdm-change-review-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hpdm-change-review-card-head strong { font-family: var(--hpdm-font-mono); }
.hpdm-change-review-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 2px; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-change-request-date { display: inline-flex; align-items: center; gap: 4px; }
.hpdm-change-request-date .dashicons { font-size: 14px; width: 14px; height: 14px; }
.hpdm-change-reason { margin: 10px 0; padding: 8px 12px; border-radius: 8px; background: var(--hpdm-neutral-50); font-size: 13px; }
.hpdm-change-review-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 10px; }
.hpdm-change-review-form { flex: 1 1 100%; }
.hpdm-change-review-form > p.description { margin: 8px 0 0; }
.hpdm-change-review-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hpdm-change-review-buttons form { margin: 0; }
.hpdm-change-review-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hpdm-neutral-100); }
.hpdm-change-review-row small { display: block; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-change-review-qty { display: flex; align-items: center; gap: 10px; }
.hpdm-change-review-qty > span { color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-cancel-request-warning { margin: 0 0 10px; padding: 10px 12px; border-radius: 8px; background: var(--hpdm-error-bg); color: var(--hpdm-error); font-size: 13px; }

/* =========================================================================
   PRODUCTS PAGE
   ========================================================================= */
.hpdm-category-create-form, .hpdm-unit-create-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0 0 16px; }
.hpdm-category-create-form label, .hpdm-unit-create-form label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; font-size: 12px; font-weight: 600; color: var(--hpdm-neutral-500); }
.hpdm-category-name-field { flex: 2 1 280px !important; }
.hpdm-category-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 14px; color: var(--hpdm-neutral-500); font-size: 13px; }
.hpdm-category-summary strong { color: var(--hpdm-neutral-900); }
.hpdm-category-root-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.hpdm-category-root-card { border: 1px solid var(--hpdm-neutral-200); border-radius: 10px; padding: 6px; background: var(--hpdm-neutral-50); }
.hpdm-category-node-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.hpdm-category-node.is-root > .hpdm-category-node-main { background: #fff; border: 1px solid var(--hpdm-neutral-200); }
.hpdm-category-node-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hpdm-category-node-identity small { display: block; color: var(--hpdm-neutral-400); font-size: 11px; }
.hpdm-category-node-icon { color: var(--hpdm-neutral-400); font-size: 14px; }
.hpdm-category-node.is-root > .hpdm-category-node-main .hpdm-category-node-icon { color: var(--hpdm-color-primary); }
.hpdm-category-node-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hpdm-category-count { color: var(--hpdm-neutral-500); font-size: 12px; white-space: nowrap; }
.hpdm-category-toggle-form { margin: 0; }
.hpdm-category-toggle-form .button { min-height: 28px !important; padding: 0 10px !important; font-size: 12px !important; }
.hpdm-category-children { margin-left: 18px; padding-left: 8px; border-left: 2px solid var(--hpdm-neutral-200); }
.hpdm-category-footnote, .hpdm-unit-note { display: flex; align-items: center; gap: 6px; margin: 14px 0 0; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-category-footnote .dashicons { font-size: 16px; width: 16px; height: 16px; }
.hpdm-unit-list { display: flex; flex-wrap: wrap; gap: 8px; }
.hpdm-unit-list .hpdm-unit-chip { padding: 4px 4px 4px 12px; margin: 0; border: 1px solid var(--hpdm-neutral-200); background: #fff; font-size: 13px; font-weight: 600; border-radius: 99px; }
.hpdm-unit-list .hpdm-unit-chip form { margin: 0; display: inline-flex; }
.hpdm-unit-list .hpdm-unit-chip button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-500); font-size: 14px; line-height: 1; cursor: pointer; }
.hpdm-unit-list .hpdm-unit-chip button:hover { background: var(--hpdm-error-bg); color: var(--hpdm-error); }
.hpdm-product-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
.hpdm-product-form-grid > label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--hpdm-neutral-700); }
.hpdm-product-name-field { grid-column: span 2; }
.hpdm-allowed-units-field { grid-column: 1 / -1; margin: 0; padding: 12px 14px; border: 1px solid var(--hpdm-neutral-200); border-radius: 10px; }
.hpdm-allowed-units-field legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--hpdm-neutral-700); }
.hpdm-allowed-units-field small { display: block; margin-top: 6px; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-unit-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; }
.hpdm-unit-checkboxes label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--hpdm-neutral-200); border-radius: 99px; font-size: 13px; cursor: pointer; }
.hpdm-unit-checkboxes label:has(input:checked) { border-color: var(--hpdm-color-primary); background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary-dark); }
.hpdm-unit-checkboxes input { margin: 0 !important; }
.hpdm-product-image-field { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding: 12px; border: 1px dashed var(--hpdm-neutral-300); border-radius: 10px; color: var(--hpdm-neutral-500); font-size: 13px; }
.hpdm-product-form-preview { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--hpdm-neutral-200); }
.hpdm-products-list-heading { margin-top: 28px; }
.hpdm-products-list-heading .hpdm-product-filters { margin: 0; }
.hpdm-products-table-panel { padding: 0; overflow: hidden; }
.hpdm-products-table-panel.is-loading { opacity: .55; pointer-events: none; }
.hpdm-products-table-panel { overflow-x: auto; }
.hpdm-products-ajax-status:empty { display: none; }
.hpdm-products-ajax-status { padding: 10px 16px; background: var(--hpdm-info-bg); color: var(--hpdm-info); font-size: 13px; font-weight: 600; }
.hpdm-product-thumb, .hpdm-product-thumb-placeholder { display: grid; place-items: center; width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--hpdm-neutral-200); background: var(--hpdm-neutral-50); color: var(--hpdm-neutral-300); }
.hpdm-product-image-cell { width: 72px; }
.hpdm-admin-product-row td { font-size: 14px; }
.hpdm-admin-product-row.is-editing { background: var(--hpdm-color-primary-light) !important; }
.hpdm-admin-product-row.is-editing .hpdm-inline-view { display: none; }
.hpdm-inline-input { min-width: 140px; }
.hpdm-inline-image-editor { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.hpdm-inline-action-buttons { display: flex; gap: 6px; }
.hpdm-inline-row-message { display: block; margin-top: 4px; color: var(--hpdm-error); font-size: 12px; }
.hpdm-product-actions-cell { text-align: right; white-space: nowrap; }
.hpdm-product-edit { padding: 6px 12px !important; border: 1px solid var(--hpdm-neutral-300) !important; border-radius: 8px !important; background: #fff !important; }
.hpdm-products-empty { padding: 32px !important; text-align: center; color: var(--hpdm-neutral-500) !important; }

/* =========================================================================
   STAFF ASSIGNMENT
   ========================================================================= */
.hpdm-assignment-filter { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.hpdm-assignment-filter .hpdm-field { flex: 0 1 360px; }
.hpdm-assignment-lead { margin: 0 0 12px; color: var(--hpdm-neutral-600); }
.hpdm-assignment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.hpdm-assignment-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--hpdm-neutral-200); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.hpdm-assignment-option:hover { border-color: var(--hpdm-neutral-400); }
.hpdm-assignment-option:has(input:checked) { border-color: var(--hpdm-color-primary); background: var(--hpdm-color-primary-light); }
.hpdm-assignment-option input { margin: 2px 0 0 !important; }
.hpdm-assignment-option strong { display: block; color: var(--hpdm-neutral-900); }
.hpdm-assignment-option small { display: block; color: var(--hpdm-neutral-500); font-size: 12px; }

/* =========================================================================
   REPORTS
   ========================================================================= */
.hpdm-report-page { margin-top: 0; }
.hpdm-back-link { display: inline-block; margin-bottom: 4px; font-size: 13px; text-decoration: none; }
.hpdm-close-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 20px; padding: 16px 18px; border-radius: var(--hpdm-radius); border: 1px solid var(--hpdm-neutral-200); background: #fff; box-shadow: var(--hpdm-shadow-sm); }
.hpdm-close-banner form { margin: 0; }
.hpdm-close-copy { display: flex; flex-direction: column; gap: 2px; }
.hpdm-close-copy strong { font-size: 15px; color: var(--hpdm-neutral-900); }
.hpdm-close-copy span { color: var(--hpdm-neutral-600); font-size: 13px; }
.hpdm-close-banner.is-open { border-left: 4px solid var(--hpdm-info-dot); }
.hpdm-close-banner.is-late { border-left: 4px solid var(--hpdm-warning-dot); background: #fffbf3; }
.hpdm-close-banner.is-done { border-left: 4px solid var(--hpdm-success-dot); background: #f6fcf8; }
.hpdm-report-section { margin: 0 0 24px; }
.hpdm-report-section > h2 { margin: 0 0 12px; font-size: 16px; }
.hpdm-report-section .hpdm-stats-table-wrap, .hpdm-stats-block .hpdm-stats-table-wrap, .hpdm-report-page > .hpdm-stats-table-wrap { background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); box-shadow: var(--hpdm-shadow-sm); }
.hpdm-day-staff { margin: 0 0 10px; background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); box-shadow: var(--hpdm-shadow-sm); overflow: hidden; }
.hpdm-day-staff > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.hpdm-day-staff > summary::-webkit-details-marker { display: none; }
.hpdm-day-staff > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--hpdm-neutral-400); border-bottom: 2px solid var(--hpdm-neutral-400); transform: rotate(-45deg); transition: transform .15s; flex: 0 0 auto; }
.hpdm-day-staff[open] > summary::before { transform: rotate(45deg); }
.hpdm-day-staff[open] > summary { border-bottom: 1px solid var(--hpdm-neutral-200); background: var(--hpdm-neutral-50); }
.hpdm-day-staff-name { display: flex; flex-direction: column; flex: 1; }
.hpdm-day-staff-name small { color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-day-staff .hpdm-stats-table-wrap { border: 0; box-shadow: none; border-radius: 0; }
.hpdm-month-close-box, .hpdm-month-snapshot-note { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 20px; padding: 14px 16px; border-radius: var(--hpdm-radius); background: var(--hpdm-info-bg); border: 1px solid #cddcfb; color: var(--hpdm-neutral-700); }
.hpdm-month-close-box p { margin: 0; flex: 1 1 300px; font-size: 13px; }
.hpdm-month-close-box form { margin: 0; }
.hpdm-staff-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.hpdm-stats-range { margin: 0 0 14px; color: var(--hpdm-neutral-600); }
.hpdm-stats-block { margin: 0 0 20px; }
.hpdm-stats-block > h4 { margin: 0 0 10px; font-size: 15px; color: var(--hpdm-neutral-900); }
.hpdm-stats-fold { background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: var(--hpdm-radius); overflow: hidden; }
.hpdm-stats-fold > summary { padding: 12px 16px; font-weight: 700; cursor: pointer; color: var(--hpdm-neutral-800); }
.hpdm-stats-fold[open] > summary { border-bottom: 1px solid var(--hpdm-neutral-200); }
.hpdm-stats-fold .hpdm-stats-table-wrap { border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
.hpdm-report-delivered { color: var(--hpdm-success) !important; }
.hpdm-report-page > .hpdm-stats-help { margin: 10px 0 28px; }
.hpdm-report-detail-section { margin-top: 28px; }
.hpdm-report-detail-section > h2 { margin-bottom: 4px; }
.hpdm-report-detail-section > .hpdm-stats-help:first-of-type { margin: 0 0 12px; }
.hpdm-stats-table td[colspan], .hpdm-wrap table.widefat td[colspan] { padding: 28px 16px; text-align: center; color: var(--hpdm-neutral-500); }

/* =========================================================================
   STAFF PORTAL (front end, mobile first)
   ========================================================================= */
.hpdm-portal { max-width: 960px; margin: 16px auto 96px; padding: 0 12px; color: var(--hpdm-neutral-800); font-size: 15px; line-height: 1.5; }
.hpdm-portal h2, .hpdm-portal h3, .hpdm-portal h4, .hpdm-portal h5 { font-family: var(--hpdm-font-body); color: var(--hpdm-neutral-900); letter-spacing: -.01em; margin: 0; }
.hpdm-portal h2 { font-size: 22px; line-height: 1.25; }
.hpdm-portal h3 { font-size: 18px; line-height: 1.3; }
.hpdm-portal p, .hpdm-portal form { margin: 0; }
.hpdm-portal .hpdm-panel { background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: 16px; padding: 16px; margin: 0 0 16px; box-shadow: var(--hpdm-shadow-sm); }
.hpdm-portal label { display: block; margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--hpdm-neutral-700); }
.hpdm-portal input:not([type=checkbox]):not([type=radio]), .hpdm-portal select, .hpdm-portal textarea, .hpdm-login input {
  display: block; width: 100%; min-height: 46px; margin: 6px 0 0; padding: 10px 14px; border: 1px solid var(--hpdm-neutral-300); border-radius: 10px; background: #fff; color: var(--hpdm-neutral-900); font: inherit; font-size: 16px; box-shadow: none;
}
.hpdm-portal input:focus, .hpdm-portal select:focus, .hpdm-portal textarea:focus { border-color: var(--hpdm-color-primary); box-shadow: var(--hpdm-focus); outline: none; }
.hpdm-portal .hpdm-qty-stepper input[type=number] { margin: 0 !important; }

/* Buttons */
.hpdm-button, .hpdm-login button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border: 1px solid var(--hpdm-color-primary); border-radius: 12px; background: var(--hpdm-color-primary); color: #fff !important; font: inherit; font-size: 15px; font-weight: 700; line-height: 1; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; touch-action: manipulation; }
.hpdm-button:hover, .hpdm-login button:hover { background: var(--hpdm-color-primary-dark); border-color: var(--hpdm-color-primary-dark); }
.hpdm-button:active { transform: scale(.98); }
.hpdm-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.hpdm-button.secondary { background: #fff; border-color: var(--hpdm-neutral-300); color: var(--hpdm-neutral-700) !important; }
.hpdm-button.secondary:hover { background: var(--hpdm-neutral-50); border-color: var(--hpdm-neutral-400); }
.hpdm-cancel-request-button { background: #fff; border-color: #f3c4c0; color: var(--hpdm-error) !important; }
.hpdm-cancel-request-button:hover { background: var(--hpdm-error-bg); border-color: var(--hpdm-error); }

/* Login */
.hpdm-login { max-width: 420px; margin: 32px auto; padding: 28px 24px; background: #fff; border: 1px solid var(--hpdm-neutral-200); border-radius: 18px; box-shadow: var(--hpdm-shadow); }
.hpdm-login h2 { margin: 0 0 18px; font-size: 22px; text-align: center; }
.hpdm-login h2::before { content: "HP"; display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px; background: linear-gradient(135deg, var(--hpdm-color-primary), var(--hpdm-color-primary-dark)); color: #fff; font-size: 17px; font-weight: 800; }
.hpdm-login label { display: block; margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--hpdm-neutral-700); }
.hpdm-login button { width: 100%; margin-top: 6px; }
.hpdm-login .hpdm-error { margin: 0 0 14px; }

/* Header + tabs */
.hpdm-portal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.hpdm-portal-head p { margin-top: 2px; color: var(--hpdm-neutral-500); font-size: 14px; }
.hpdm-portal-head form { margin: 0; }
.hpdm-portal-head .hpdm-button { min-height: 40px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
.hpdm-portal button, .hpdm-portal .hpdm-button { font-family: var(--hpdm-font-body); letter-spacing: normal; text-transform: none; }
.hpdm-portal-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 16px; padding: 4px; border-radius: 14px; background: var(--hpdm-neutral-100); }
.hpdm-portal-nav-btn { min-height: 42px; margin: 0; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--hpdm-neutral-600); font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; cursor: pointer; box-shadow: none; }
.hpdm-portal-nav-btn.is-active { background: #fff; color: var(--hpdm-neutral-900); box-shadow: var(--hpdm-shadow-sm); }

.hpdm-section-heading, .hpdm-my-orders-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.hpdm-section-heading p, .hpdm-my-orders-heading p { margin-top: 2px; color: var(--hpdm-neutral-500); font-size: 14px; }
.hpdm-location-count, .hpdm-order-history-count { flex: 0 0 auto; padding: 3px 10px; border-radius: 99px; background: var(--hpdm-neutral-100); color: var(--hpdm-neutral-600); font-size: 12px; font-weight: 700; white-space: nowrap; }

/* Location picker */
.hpdm-location-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.hpdm-location-card { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 14px; border: 1px solid var(--hpdm-neutral-200); border-radius: 14px; background: #fff; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s; }
.hpdm-location-card:hover { border-color: var(--hpdm-color-primary); box-shadow: 0 0 0 3px var(--hpdm-color-primary-light); }
.hpdm-location-card:active { transform: scale(.99); }
.hpdm-location-card-icon { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary); font-size: 28px; line-height: 1; }
.hpdm-location-card-content { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.hpdm-location-card-content strong { color: var(--hpdm-neutral-900); font-size: 16px; }
.hpdm-location-card-content small { color: var(--hpdm-neutral-500); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hpdm-location-card-arrow { color: var(--hpdm-neutral-300); font-size: 26px; line-height: 1; }

/* Order workspace */
.hpdm-order-workspace-head { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 0 0 14px; border-bottom: 1px solid var(--hpdm-neutral-200); }
.hpdm-order-workspace-head > div span { display: block; color: var(--hpdm-color-primary); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.hpdm-order-workspace-head .hpdm-button { min-height: 40px; padding: 0 12px; font-size: 14px; flex: 0 0 auto; }
#hpdm-order-form > label:first-of-type { max-width: 260px; }
.hpdm-product-picker { margin: 4px 0 16px; }
.hpdm-product-picker > strong { display: block; margin: 0 0 8px; color: var(--hpdm-neutral-900); font-size: 16px; }

/* Search */
.hpdm-staff-product-search { position: relative; margin: 0 0 10px; }
.hpdm-staff-product-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: var(--hpdm-neutral-500); font-size: 26px; line-height: 1; pointer-events: none; z-index: 1; }
.hpdm-portal .hpdm-staff-product-search-input { margin: 0 !important; padding-left: 42px !important; padding-right: 44px !important; border-radius: 12px !important; background: var(--hpdm-neutral-50) !important; }
.hpdm-portal .hpdm-staff-product-search-input:focus { background: #fff !important; }
.hpdm-staff-product-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--hpdm-neutral-200); color: var(--hpdm-neutral-600); font-size: 18px; line-height: 1; cursor: pointer; }
.hpdm-staff-product-search-status { display: block; margin-top: 4px; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-staff-product-search-status:empty { display: none; }
.hpdm-staff-product-search-results { display: grid; gap: 8px; margin: 0 0 12px; }
.hpdm-staff-product-search-empty { display: flex; flex-direction: column; gap: 2px; padding: 20px; border: 1px dashed var(--hpdm-neutral-300); border-radius: 12px; text-align: center; color: var(--hpdm-neutral-500); }
.hpdm-product-picker.is-searching .hpdm-category-tabs, .hpdm-product-picker.is-searching .hpdm-category-panel { display: none !important; }

/* Category tabs: sticky so staff can switch while scrolling */
.hpdm-category-tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; margin: 0 -4px 10px; padding: 8px 4px; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); overflow-x: auto; scrollbar-width: none; }
.hpdm-category-tabs::-webkit-scrollbar { display: none; }
body.admin-bar .hpdm-category-tabs { top: 32px; }
.hpdm-category-tab { flex: 1 1 0; margin: 0; min-height: 44px; padding: 0 18px; border: 1px solid var(--hpdm-neutral-200); border-radius: 12px; background: #fff; color: var(--hpdm-neutral-600); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.hpdm-category-tab.is-active { background: var(--hpdm-neutral-900); border-color: var(--hpdm-neutral-900); color: #fff; }
.hpdm-product-group-title { margin: 6px 0 8px; font-size: 13px !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--hpdm-neutral-500) !important; }
.hpdm-product-subgroup { margin: 16px 0 6px; padding: 0 0 0 10px; border-left: 3px solid var(--hpdm-color-primary); color: var(--hpdm-color-primary-dark) !important; font-size: 14px !important; }

/* Product rows (catalogue + search results) */
.hpdm-category-panel { display: grid; gap: 8px; }
.hpdm-category-panel > h4, .hpdm-category-panel > h5 { grid-column: 1 / -1; }
.hpdm-product-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--hpdm-neutral-200); border-radius: 14px; background: #fff; transition: border-color .15s, background .15s; }
.hpdm-product-row.is-selected { border-color: var(--hpdm-color-primary); background: var(--hpdm-color-primary-light); }
.hpdm-staff-product-visual { width: 52px; height: 52px; }
.hpdm-staff-product-thumb, .hpdm-review-thumb, .hpdm-history-product-thumb { display: grid; place-items: center; width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1px solid var(--hpdm-neutral-200); background: var(--hpdm-neutral-50); color: var(--hpdm-neutral-300); font-size: 20px; }
.hpdm-product-info { min-width: 0; }
.hpdm-product-info strong { display: block; color: var(--hpdm-neutral-900); font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.hpdm-product-info small { display: block; margin-top: 2px; color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-product-info small:empty { display: none; }
.hpdm-product-order-controls { display: flex; align-items: center; gap: 6px; }
.hpdm-portal .hpdm-product-order-controls select { width: auto !important; min-width: 78px; min-height: 44px !important; margin: 0 !important; padding: 0 28px 0 10px !important; font-size: 14px !important; font-weight: 600; }
.hpdm-portal .hpdm-qty-stepper { height: 44px; border-radius: 12px; }
.hpdm-portal .hpdm-qty-stepper button { flex-basis: 42px; width: 42px; font-size: 22px; }
.hpdm-portal .hpdm-qty-stepper input[type=number] { width: 52px !important; font-size: 16px !important; }

/* Submit bar: sticks to the bottom of the screen while picking products */
.hpdm-order-submit-bar { position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px -16px -16px; padding: 12px 16px; border-top: 1px solid var(--hpdm-neutral-200); border-radius: 0 0 16px 16px; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); }
.hpdm-cart-summary { color: var(--hpdm-neutral-500); font-size: 14px; font-weight: 600; }
.hpdm-cart-summary.has-items { color: var(--hpdm-color-primary-dark); }
.hpdm-review-trigger { flex: 0 0 auto; }
.hpdm-order-submit-bar:has(.hpdm-review-trigger[hidden]) { display: none; }
/* The theme's floating Zalo / call buttons cover the submit bar; staff do not need them on the portal. */
body:has(.hpdm-portal) .dv-float { display: none !important; }

/* Review panel */
.hpdm-review-panel { margin-top: 16px; padding: 16px; border: 2px solid var(--hpdm-color-primary); border-radius: 16px; background: #fff; }
.hpdm-review-head h3 { margin: 0 0 8px; }
.hpdm-review-head p { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--hpdm-neutral-50); font-size: 14px; }
.hpdm-review-items { display: grid; }
.hpdm-review-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hpdm-neutral-100); }
.hpdm-review-product { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hpdm-review-thumb { width: 40px !important; height: 40px !important; flex: 0 0 40px; }
.hpdm-review-item > span { flex: 0 0 auto; padding: 4px 10px; border-radius: 8px; background: var(--hpdm-color-primary-light); color: var(--hpdm-color-primary-dark); font-weight: 800; font-variant-numeric: tabular-nums; }
.hpdm-review-count { margin: 12px 0 !important; font-weight: 700; color: var(--hpdm-neutral-800); }
.hpdm-customer-confirm { display: flex !important; align-items: flex-start; gap: 10px; margin: 0 0 12px !important; padding: 12px; border-radius: 12px; background: var(--hpdm-warning-bg); color: var(--hpdm-neutral-800) !important; font-weight: 600; line-height: 1.45; cursor: pointer; }
.hpdm-customer-confirm input { flex: 0 0 22px; width: 22px; height: 22px; margin: 0 !important; accent-color: var(--hpdm-color-primary); }
.hpdm-review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hpdm-review-actions .hpdm-button { width: 100%; }
.hpdm-form-message { margin-top: 10px; font-weight: 600; color: var(--hpdm-color-primary-dark); }
.hpdm-form-message:empty { display: none; }

/* Order history */
.hpdm-history-loading { padding: 16px; border-radius: 12px; background: var(--hpdm-neutral-50); color: var(--hpdm-neutral-500); font-size: 14px; text-align: center; }
.hpdm-location-history-slot { margin-top: 20px; }
.hpdm-location-history-slot .hpdm-panel { margin: 0; border: 0; padding: 0; box-shadow: none; }
.hpdm-order-list { display: grid; gap: 8px; }
.hpdm-order { border: 1px solid var(--hpdm-neutral-200); border-radius: 14px; background: #fff; overflow: hidden; }
.hpdm-order > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.hpdm-order > summary::-webkit-details-marker { display: none; }
.hpdm-order[open] > summary { border-bottom: 1px solid var(--hpdm-neutral-200); background: var(--hpdm-neutral-50); }
.hpdm-order-summary-main { display: flex; flex-direction: column; min-width: 0; }
.hpdm-order-summary-main strong { font-family: var(--hpdm-font-mono); font-size: 14px; color: var(--hpdm-neutral-900); }
.hpdm-order-summary-location { color: var(--hpdm-neutral-500); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hpdm-order-summary-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.hpdm-order-date { color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-order > p, .hpdm-order-totals { margin: 0; padding: 10px 14px 0; color: var(--hpdm-neutral-600); font-size: 14px; }
.hpdm-order-products { padding: 10px 14px 14px; }
.hpdm-order-products-heading { margin: 0 0 6px; color: var(--hpdm-neutral-500); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.hpdm-history-item { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hpdm-neutral-100); }
.hpdm-history-item:last-child { border-bottom: 0; }
.hpdm-history-image { width: 40px; height: 40px; }
.hpdm-history-product-name strong { display: block; font-size: 14px; color: var(--hpdm-neutral-900); }
.hpdm-history-product-name small { color: var(--hpdm-neutral-500); font-size: 12px; }
.hpdm-history-quantities { display: flex; gap: 12px; }
.hpdm-history-qty { display: flex; flex-direction: column; align-items: flex-end; min-width: 56px; }
.hpdm-history-qty span { color: var(--hpdm-neutral-400); font-size: 11px; }
.hpdm-history-qty strong { color: var(--hpdm-neutral-900); font-size: 15px; font-variant-numeric: tabular-nums; }
.hpdm-history-qty small { color: var(--hpdm-neutral-500); font-size: 11px; }
.hpdm-order-empty-items { color: var(--hpdm-neutral-500); font-size: 14px; }
.hpdm-order-request-actions { display: grid; gap: 8px; padding: 0 14px 14px; }
.hpdm-request-fold { border: 1px solid var(--hpdm-neutral-200); border-radius: 12px; }
.hpdm-request-fold > summary { padding: 10px 14px; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--hpdm-neutral-700); }
.hpdm-request-fold.is-danger > summary { color: var(--hpdm-error); }
.hpdm-request-fold > form { padding: 0 14px 14px; }
.hpdm-change-qty-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hpdm-neutral-100); }
.hpdm-change-qty-row label { margin: 0 !important; font-weight: 600; }
.hpdm-change-qty-row label small { color: var(--hpdm-neutral-500); font-weight: 400; }
.hpdm-change-form > .hpdm-button, .hpdm-cancel-request-form > .hpdm-button { margin-top: 12px; width: 100%; }
.hpdm-cancel-pending-note { margin: 0 14px 14px !important; padding: 10px 12px; border-radius: 10px; background: var(--hpdm-violet-bg); color: var(--hpdm-violet); font-size: 14px; font-weight: 600; }

/* Staff statistics */
.hpdm-stats-periods { display: flex; gap: 6px; margin: 0 0 12px; overflow-x: auto; scrollbar-width: none; }
.hpdm-stats-periods::-webkit-scrollbar { display: none; }
.hpdm-stats-period-btn { flex: 0 0 auto; min-height: 38px; padding: 0 14px; border: 1px solid var(--hpdm-neutral-200); border-radius: 99px; background: #fff; color: var(--hpdm-neutral-600); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.hpdm-stats-period-btn.is-active { background: var(--hpdm-neutral-900); border-color: var(--hpdm-neutral-900); color: #fff; }
.hpdm-stats-custom { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 8px; margin: 0 0 12px; }
.hpdm-stats-custom label { margin: 0; }
.hpdm-portal .hpdm-stat-kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
.hpdm-portal .hpdm-stat-kpi strong { font-size: 24px; }
.hpdm-portal .hpdm-stats-table-wrap { border: 1px solid var(--hpdm-neutral-200); border-radius: 12px; }
.hpdm-portal .hpdm-stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hpdm-portal .hpdm-stats-table th { padding: 8px 10px; background: var(--hpdm-neutral-50); color: var(--hpdm-neutral-500); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; text-align: left; white-space: nowrap; }
.hpdm-portal .hpdm-stats-table td { padding: 10px; border-top: 1px solid var(--hpdm-neutral-100); }
.hpdm-portal .hpdm-report-section > h2 { font-size: 16px; margin: 0 0 8px; }

/* Staff in-page notifications */
.hpdm-notifications { margin-top: 8px; }
.hpdm-notification-list { display: grid; gap: 8px; margin-top: 10px; }
.hpdm-notifications .hpdm-enable-notifications { min-height: 40px; font-size: 14px; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1100px) {
  .hpdm-product-name-field { grid-column: auto; }
}
@media (max-width: 782px) {
  .hpdm-wrap { margin: 12px 10px 24px 0; }
  .hpdm-page-title h1 { font-size: 20px; }
  .hpdm-brand-mark { width: 38px; height: 38px; font-size: 13px; }
  .hpdm-panel { padding: 16px; }
  .hpdm-panel-heading .hpdm-heading-icon { display: none; }
  .hpdm-browser-notification-bar.is-compact { width: 100%; border-radius: var(--hpdm-radius); }
  .hpdm-today-kpis, .hpdm-stat-kpis, .hpdm-order-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hpdm-today-kpi strong, .hpdm-stat-kpi strong { font-size: 24px; }
  .hpdm-order-kpi-copy em, .hpdm-order-kpi-arrow { display: none; }
  .hpdm-today-order-card { flex-direction: column; align-items: stretch; }
  .hpdm-today-order-action { justify-content: space-between; }
  .hpdm-order-view-switch { width: 100%; }
  .hpdm-order-view-switch a { flex: 1; justify-content: center; }
  .hpdm-order-status-filters, .hpdm-report-period, .hpdm-rpt-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hpdm-rpt-tabs a { white-space: nowrap; }
  .hpdm-order-status-filters a, .hpdm-report-period a { flex: 0 0 auto; }
  .hpdm-category-root-grid { grid-template-columns: 1fr; }
  .hpdm-close-banner .button-hero { width: 100%; }
  .hpdm-close-banner form { width: 100%; }
  .hpdm-order-cancel-admin label { min-width: 0; width: 100%; }
  .hpdm-wrap table.widefat td, .hpdm-order-table td, .hpdm-stats-table td { padding: 10px; }
  .hpdm-table-search { flex: 1 1 100%; }
}
@media (max-width: 560px) {
  .hpdm-portal { padding: 0 8px; }
  .hpdm-portal .hpdm-panel { padding: 12px; border-radius: 14px; }
  .hpdm-order-submit-bar { margin: 16px -12px -12px; padding: 10px 12px; border-radius: 0 0 14px 14px; }
  .hpdm-portal-head h2 { font-size: 19px; }
  .hpdm-location-grid { grid-template-columns: 1fr; }
  /* Product row: name on top, controls below so nothing is squeezed. */
  .hpdm-product-row { grid-template-columns: 44px minmax(0, 1fr); gap: 8px 10px; padding: 10px; }
  .hpdm-staff-product-visual { width: 44px; height: 44px; }
  .hpdm-product-order-controls { grid-column: 1 / -1; justify-content: space-between; }
  .hpdm-product-order-controls .hpdm-qty-stepper { flex: 1 1 auto; max-width: 220px; }
  .hpdm-product-order-controls .hpdm-qty-stepper input[type=number] { flex: 1 1 auto; width: auto !important; }
  .hpdm-change-qty-row .hpdm-qty-stepper { flex: 0 0 auto; }
  .hpdm-change-qty-row .hpdm-qty-stepper button { width: 38px; flex-basis: 38px; }
  .hpdm-change-qty-row .hpdm-qty-stepper input[type=number] { width: 46px !important; }
  .hpdm-review-actions { grid-template-columns: 1fr; }
  .hpdm-history-item { grid-template-columns: 36px minmax(0,1fr); }
  .hpdm-history-image { width: 36px; height: 36px; }
  .hpdm-history-quantities { grid-column: 2; justify-content: flex-start; }
  .hpdm-history-qty { align-items: flex-start; }
  .hpdm-stats-custom { grid-template-columns: 1fr 1fr; }
  .hpdm-stats-custom .hpdm-button { grid-column: 1 / -1; }
  .hpdm-order-workspace-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .hpdm-wrap *, .hpdm-portal * { transition: none !important; }
}
