/* Dishory Admin — operator console
   Modern shell on Tabler/SQLAdmin. */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root,
[data-bs-theme="dark"] {
  --dh-canvas: #0e1216;
  --dh-surface: #161b22;
  --dh-elevated: #1c232c;
  --dh-ink: #e8eef4;
  --dh-muted: #8b9aab;
  --dh-border: #2a3340;
  --dh-border-strong: #3a4656;
  --dh-primary: #3dba8a;
  --dh-primary-hover: #5dffb5;
  --dh-primary-soft: rgba(61, 186, 138, 0.14);
  --dh-pending: #e0a04a;
  --dh-pending-soft: rgba(224, 160, 74, 0.16);
  --dh-sidebar: #12171d;
  --dh-sidebar-width: 15.5rem;
  --dh-topbar-h: 3.25rem;
  --dh-radius: 8px;
  --dh-radius-sm: 6px;
  --dh-font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --dh-mono: "IBM Plex Mono", ui-monospace, monospace;
  --dh-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --dh-neon: #5dffb5;
  --dh-glow-sm: 0 0 10px rgba(93, 255, 181, 0.35);
  --dh-glow: 0 0 12px rgba(93, 255, 181, 0.45), 0 0 28px rgba(61, 186, 138, 0.28);
  --dh-glow-lg: 0 0 16px rgba(93, 255, 181, 0.5), 0 0 40px rgba(61, 186, 138, 0.3);

  --tblr-font-sans-serif: var(--dh-font);
  --tblr-body-font-family: var(--dh-font);
  --tblr-body-bg: var(--dh-canvas);
  --tblr-body-color: var(--dh-ink);
  --tblr-primary: var(--dh-primary);
  --tblr-primary-rgb: 61, 186, 138;
  --tblr-primary-fg: #0e1216;
  --tblr-link-color: var(--dh-primary);
  --tblr-link-hover-color: var(--dh-primary-hover);
  --tblr-border-color: var(--dh-border);
  --tblr-border-radius: var(--dh-radius);
  --tblr-border-radius-sm: var(--dh-radius-sm);
  --tblr-border-radius-lg: 10px;
  --tblr-card-border-radius: var(--dh-radius);
  --tblr-card-border-color: var(--dh-border);
  --tblr-secondary: var(--dh-muted);
  --tblr-navbar-bg: var(--dh-sidebar);
  --tblr-navbar-color: var(--dh-ink);
  --tblr-navbar-border-color: var(--dh-border);
  --tblr-bg-surface: var(--dh-surface);
  --tblr-bg-surface-primary: var(--dh-surface);
  --tblr-bg-surface-secondary: #1c232c;
  --tblr-bg-surface-tertiary: #243038;
  --tblr-secondary-lt: rgba(139, 154, 171, 0.16);
  --tblr-dark: #0e1216;
  --tblr-gray-900: #0e1216;
  --tblr-gray-800: #161b22;
  --tblr-gray-700: #1c232c;
  --tblr-gray-600: #2a3340;
  --tblr-gray-500: #5c6b76;
  --tblr-gray-400: #8b9aab;
  --tblr-gray-300: #b8c4ce;
  color-scheme: dark;
}

html,
body,
body.dh-admin {
  background-color: var(--dh-canvas) !important;
  background-image: none !important;
  color: var(--dh-ink);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--dh-font);
  color: var(--dh-ink);
  background: var(--dh-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--dh-primary-soft);
  color: var(--dh-ink);
}

.dh-mono,
code,
kbd,
samp,
.product-id,
.user-id {
  font-family: var(--dh-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* ——— Shell ——— */

.dh-shell.wrapper {
  background: var(--dh-canvas) !important;
  min-height: 100vh;
}

@media (min-width: 768px) {
  .dh-shell .navbar-vertical.navbar-expand-md {
    width: var(--dh-sidebar-width);
  }

  .dh-shell .page-wrapper {
    margin-left: var(--dh-sidebar-width);
  }
}

.dh-sidebar.navbar-vertical {
  background: var(--dh-sidebar) !important;
  border-right: 1px solid var(--dh-border) !important;
  box-shadow: none !important;
}

.dh-sidebar .navbar-brand {
  padding: 1.1rem 1.1rem 0.85rem;
  margin: 0;
}

.dh-sidebar .navbar-brand a {
  text-decoration: none;
  color: var(--dh-ink);
}

.dh-brand-mark {
  font-family: var(--dh-font);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--dh-ink);
  line-height: 1;
}

.dh-brand-mark span {
  color: var(--dh-neon);
  text-shadow: var(--dh-glow-sm);
}

.dh-sidebar .nav-link {
  border-radius: var(--dh-radius-sm);
  margin: 0.08rem 0.65rem;
  padding: 0.5rem 0.7rem;
  color: var(--dh-muted) !important;
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.dh-sidebar .nav-link:hover {
  background: var(--dh-canvas);
  color: var(--dh-ink) !important;
}

.dh-sidebar .nav-link.active,
.dh-sidebar .nav-item.active > .nav-link {
  background: var(--dh-primary-soft) !important;
  color: var(--dh-primary) !important;
  font-weight: 600;
  box-shadow: none;
}

.dh-sidebar .nav-item.dropdown {
  margin-top: 0.35rem;
}

.dh-sidebar .nav-item.dropdown > .nav-link {
  color: var(--dh-ink) !important;
  font-weight: 600;
}

.dh-sidebar .nav-item.dropdown > .nav-link.active,
.dh-sidebar .nav-item.dropdown > .nav-link.show,
.dh-sidebar .nav-item.dropdown > .nav-link[aria-expanded="true"] {
  background: var(--dh-primary-soft) !important;
  color: var(--dh-primary) !important;
  box-shadow: none;
}

.dh-sidebar .dropdown-menu {
  background: transparent;
  border: 0;
  padding: 0.2rem 0 0.4rem;
  box-shadow: none;
}

.dh-sidebar .dropdown-menu .nav-link {
  margin-left: 1.65rem;
  font-size: 0.8125rem;
  font-weight: 400;
}

.dh-sidebar .dropdown-menu .nav-link.active {
  background: var(--dh-elevated) !important;
  font-weight: 600;
}

.dh-sidebar .nav-link-icon {
  opacity: 0.7;
  width: 1.1rem;
}

.dh-sidebar .navbar-toggler {
  border-color: var(--dh-border);
}

/* Topbar */

.dh-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--dh-topbar-h);
  background: rgba(18, 23, 29, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(93, 255, 181, 0.18);
  box-shadow: 0 1px 16px rgba(61, 186, 138, 0.08);
}

.dh-topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
}

.dh-topbar-meta {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--dh-muted);
  letter-spacing: -0.01em;
}

.dh-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dh-ghost-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--dh-muted) !important;
  font-weight: 550;
  box-shadow: none !important;
}

.dh-ghost-btn:hover {
  background: var(--dh-canvas) !important;
  border-color: var(--dh-border) !important;
  color: var(--dh-ink) !important;
}

.dh-page-pad {
  padding-left: 1.5rem !important;
  padding-right: 1.5rem !important;
}

/* ——— Page header / type ——— */

.page-header {
  padding: 1.35rem 0 0.85rem;
  margin-bottom: 0;
  border-bottom: none;
}

.page-header > .d-flex > div:first-child,
.page-header > .row > .col {
  display: flex;
  flex-direction: column;
}

.page-title {
  order: 1;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--dh-ink);
  margin: 0;
  line-height: 1.15;
}

.page-pretitle {
  order: 2;
  color: var(--dh-muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  margin: 0.3rem 0 0;
}

.page-header p.text-secondary {
  order: 3;
  font-size: 0.9rem;
  color: var(--dh-muted) !important;
  max-width: 40rem;
  margin-top: 0.4rem !important;
}

.page-body {
  padding-top: 0.35rem;
  padding-bottom: 2.5rem;
}

.page-body > .container-fluid > .row.row-deck.row-cards {
  --bs-gutter-y: 1rem;
}

.subheader {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dh-muted);
  text-transform: none;
  letter-spacing: -0.01em;
}

/* ——— Surfaces ——— */

.card {
  background: var(--dh-surface);
  border: 1px solid var(--dh-border);
  border-radius: var(--dh-radius);
  box-shadow: none;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--dh-border);
  padding: 0.85rem 1.1rem;
  min-height: 0;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--dh-ink);
}

.card-body {
  padding: 1.1rem;
}

.card-footer {
  background: transparent;
  border-top: 1px solid var(--dh-border);
  padding: 0.75rem 1.1rem;
}

.dh-list .card,
.directory-list > .card,
.verification-list > .card,
.diary-list > .card,
.dh-panel {
  border: 1px solid var(--dh-border);
  border-radius: var(--dh-radius);
  box-shadow: var(--dh-shadow);
  overflow: hidden;
  background: var(--dh-surface);
}

.dh-section {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  margin-bottom: 1.75rem;
}

.dh-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.dh-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--dh-ink);
}

.dh-section-title i {
  display: none;
}

.dh-section-meta {
  font-size: 0.8rem;
  color: var(--dh-muted);
}

.dh-onboarding-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
}

.dh-onboarding-completed {
  color: var(--dh-primary);
}

.dh-onboarding-skipped {
  color: var(--dh-pending);
}

.dh-onboarding-legend span::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.35rem;
  border-radius: 2px;
  background: currentColor;
}

.dh-onboarding-chart {
  list-style: none;
  padding: 0.85rem 1.1rem;
  margin: 0;
  gap: 0.65rem;
}

.dh-onboarding-row {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.dh-onboarding-label {
  font-size: 0.85rem;
}

.dh-onboarding-bars {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.dh-onboarding-series {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 0.65rem;
}

.dh-onboarding-track {
  height: 0.45rem;
  background: var(--dh-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.dh-onboarding-track span {
  display: block;
  height: 100%;
  background: currentColor;
  border-radius: inherit;
}

.dh-onboarding-count {
  min-width: 5ch;
  text-align: right;
  font: 0.75rem var(--dh-mono);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 575.98px) {
  .dh-onboarding-row {
    grid-template-columns: minmax(0, 8rem) minmax(0, 1fr);
    gap: 0.5rem;
  }
}

.dh-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  width: 100%;
}

@media (max-width: 1239px) {
  .dh-dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}

.dh-chart-column {
  container-type: inline-size;
  min-width: 0;
}

.dh-dashboard-top {
  grid-column: 1 / -1;
  min-width: 0;
}

.dh-user-access {
  --dh-user-free: var(--dh-muted);
  --dh-user-trial: var(--dh-pending);
  --dh-user-paid: var(--dh-primary);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  margin: 0;
  padding: 1rem;
}

.dh-user-pie {
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  flex: none;
  margin-inline: auto;
  display: grid;
  place-items: center;
  position: relative;
}

.dh-user-pie--empty {
  background: var(--dh-elevated);
}

.dh-user-pie::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: var(--dh-surface);
}

.dh-user-pie-total {
  position: relative;
  z-index: 1;
  font-size: 1.35rem;
  font-weight: 650;
  line-height: 1.1;
  text-align: center;
}

.dh-user-pie-total small {
  display: block;
  margin-top: 0.15rem;
  color: var(--dh-muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.dh-user-access-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 0.35rem;
}

.dh-user-access-legend a {
  display: grid;
  grid-template-columns: .55rem minmax(0, 1fr) max-content;
  align-items: baseline;
  justify-content: space-between;
  gap: .55rem;
  padding: 0.45rem 0.2rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--dh-radius-sm);
}

.dh-user-access-legend a:hover span:first-of-type {
  color: var(--dh-primary-hover);
}

.dh-user-access-legend a::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  background: currentColor;
  flex: none;
  align-self: center;
}

.dh-user-access-legend a.dh-user-access-free { color: var(--dh-user-free); }
.dh-user-access-legend a.dh-user-access-trial { color: var(--dh-user-trial); }
.dh-user-access-legend a.dh-user-access-subscription {
  color: var(--dh-user-paid);
}

.dh-user-access-legend a span:first-of-type {
  color: var(--dh-ink);
  flex: 1;
}

.dh-user-access-numbers {
  display: grid;
  grid-template-columns: max-content 6ch;
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
  gap: 0.5rem;
  font: 0.8rem var(--dh-mono);
  font-variant-numeric: tabular-nums;
  color: var(--dh-muted);
}

.dh-user-access-numbers b {
  color: var(--dh-ink);
  font-weight: 500;
}

.dh-user-access figcaption {
  min-width: 0;
  width: 100%;
}

/* Reflow each chart by its actual width, including beside the sidebar. */
@container (min-width: 30rem) {
  .dh-user-access {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  .dh-user-access .dh-user-pie {
    width: 12rem;
    height: auto;
    aspect-ratio: 1;
    margin-inline: 0;
  }
  .dh-user-access figcaption {
    flex: 1;
    width: auto;
  }
}

.dh-metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1px;
  background: var(--dh-border);
  border: 1px solid var(--dh-border);
  border-radius: var(--dh-radius);
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: var(--dh-shadow);
}

/* Dashboard catalog: 3 + 2 rows, matching pre-redesign layout */
.dh-metric-strip--thirds {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dh-metric {
  background: var(--dh-surface);
  padding: 0.95rem 1.1rem;
  text-decoration: none;
  color: inherit;
  display: block;
  min-width: 0;
  transition: background 0.12s ease;
}

a.dh-metric:hover {
  background: rgba(61, 186, 138, 0.08);
  color: inherit;
  text-decoration: none;
}

.dh-metric.active {
  background: var(--dh-primary-soft);
  box-shadow: inset 0 -2px 0 var(--dh-neon), 0 0 18px rgba(93, 255, 181, 0.12);
}

.dh-metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--dh-muted);
  font-weight: 550;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.dh-metric-label i {
  opacity: 0.55;
  font-size: 0.85rem;
}

.dh-metric-value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--dh-ink);
}

.dh-metric-hint {
  font-size: 0.72rem;
  color: var(--dh-muted);
  margin-top: 0.2rem;
}

.dh-metric-pct {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.dh-metric .progress {
  height: 2px;
  margin-top: 0.55rem;
  background: var(--dh-canvas);
}

.dh-metric .progress-bar {
  background: var(--dh-primary);
}

.dh-stat,
.product-stat,
.diary-stat {
  border: 1px solid var(--dh-border);
  border-radius: var(--dh-radius-sm);
  padding: 0.85rem;
  height: 100%;
  background: var(--dh-canvas);
}

.dh-stat-value,
.product-stat-value,
.diary-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0.25rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  font-family: var(--dh-mono);
}

.dh-stat-value.text-primary,
.product-stat-value.text-primary,
.diary-stat-value.text-primary {
  color: var(--dh-primary) !important;
}

/* ——— Tables ——— */

.table {
  --tblr-table-bg: transparent;
  margin-bottom: 0;
}

.table thead th {
  text-transform: none;
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--dh-muted);
  background: #1c232c;
  border-bottom: 1px solid var(--dh-border);
  padding: 0.6rem 1rem;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.table thead th a {
  color: var(--dh-muted);
  text-decoration: none;
}

.table thead th a:hover {
  color: var(--dh-primary);
}

.table td {
  padding: 0.7rem 1rem;
  vertical-align: middle;
  border-color: var(--dh-border);
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

.card-table tr:hover > *,
.directory-row:hover,
.request-row:hover,
.brand-product-row:hover,
.diary-row:hover {
  background: rgba(61, 186, 138, 0.06) !important;
}

.table .fw-semibold,
a.fw-semibold {
  font-weight: 600 !important;
  letter-spacing: -0.015em;
}

/* ——— Forms ——— */

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dh-ink);
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}

.form-control,
.form-select {
  border-color: var(--dh-border);
  border-radius: var(--dh-radius-sm);
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  color: var(--dh-ink);
  background-color: var(--dh-surface);
  letter-spacing: -0.01em;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--dh-neon);
  box-shadow: 0 0 0 3px rgba(93, 255, 181, 0.2), var(--dh-glow-sm);
  background-color: var(--dh-surface);
  color: var(--dh-ink);
}

.form-fieldset {
  border: 1px solid var(--dh-border);
  border-radius: var(--dh-radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
  background: #1c232c;
}

.form-check-input:checked {
  background-color: var(--dh-primary);
  border-color: var(--dh-primary);
}

.input-group .btn {
  border-color: var(--dh-border);
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  border-color: var(--dh-border) !important;
  border-radius: var(--dh-radius-sm) !important;
}

/* ——— Buttons ——— */

.btn {
  border-radius: var(--dh-radius-sm);
  font-weight: 600;
  font-size: 0.84rem;
  padding: 0.42rem 0.8rem;
  letter-spacing: -0.015em;
  box-shadow: none !important;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.28rem 0.55rem;
}

.btn-primary {
  background: var(--dh-primary);
  border-color: var(--dh-neon);
  color: #0e1216;
  box-shadow: var(--dh-glow) !important;
  text-shadow: none;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
  background: var(--dh-neon) !important;
  border-color: var(--dh-neon) !important;
  color: #0e1216 !important;
  box-shadow: var(--dh-glow-lg) !important;
}

.btn-outline-primary {
  color: var(--dh-neon);
  border-color: rgba(93, 255, 181, 0.45);
  background: transparent;
  box-shadow: var(--dh-glow-sm) !important;
}

.btn-outline-primary:hover {
  background: var(--dh-primary-soft);
  border-color: var(--dh-neon);
  color: var(--dh-neon);
  box-shadow: var(--dh-glow) !important;
}

.btn-secondary,
.btn:not(.btn-primary):not(.btn-danger):not(.btn-success):not(.btn-warning):not(.btn-info):not(.btn-outline-danger):not(.btn-outline-primary):not(.btn-outline-secondary):not(.btn-link):not(.dh-ghost-btn) {
  background: var(--dh-surface);
  border-color: var(--dh-border-strong);
  color: var(--dh-ink);
}

.btn-secondary:hover,
.btn:not(.btn-primary):not(.btn-danger):not(.btn-success):not(.btn-warning):not(.btn-info):not(.btn-outline-danger):not(.btn-outline-primary):not(.btn-outline-secondary):not(.btn-link):not(.dh-ghost-btn):hover {
  background: var(--dh-canvas);
  border-color: var(--dh-border-strong);
  color: var(--dh-ink);
}

.btn-outline-secondary {
  color: var(--dh-muted);
  border-color: var(--dh-border-strong);
  background: var(--dh-surface);
}

.btn-outline-secondary:hover {
  background: var(--dh-canvas);
  color: var(--dh-ink);
  border-color: var(--dh-border-strong);
}

.btn-outline-danger {
  border-color: rgba(214, 57, 57, 0.45);
  color: #f0a0a0;
}

/* ——— Badges ——— */

.badge {
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.28em 0.5em;
  letter-spacing: -0.01em;
}

.bg-green-lt,
.badge.bg-green-lt {
  background: var(--dh-primary-soft) !important;
  color: var(--dh-neon) !important;
  box-shadow: 0 0 8px rgba(93, 255, 181, 0.2);
}

.bg-yellow-lt,
.badge.bg-yellow-lt {
  background: var(--dh-pending-soft) !important;
  color: var(--dh-pending) !important;
}

.bg-blue-lt,
.badge.bg-blue-lt {
  background: rgba(66, 153, 225, 0.16) !important;
  color: #8ec5ef !important;
}

.bg-primary-lt {
  background: var(--dh-primary-soft) !important;
  color: var(--dh-primary) !important;
}

.text-primary,
.text-blue {
  color: var(--dh-neon) !important;
  text-shadow: 0 0 12px rgba(93, 255, 181, 0.25);
}

/* ——— Pagination / filters ——— */

.pagination .page-link {
  border-radius: var(--dh-radius-sm) !important;
  margin: 0 0.1rem;
  border-color: var(--dh-border);
  color: var(--dh-ink);
  font-size: 0.82rem;
  min-width: 2rem;
  text-align: center;
  font-weight: 550;
}

.pagination .page-item.active .page-link {
  background: var(--dh-primary);
  border-color: var(--dh-neon);
  color: #0e1216;
  box-shadow: var(--dh-glow-sm);
}

.pagination .page-link:hover {
  background: var(--dh-primary-soft);
  border-color: var(--dh-border);
  color: var(--dh-primary);
}

.filter-sidebar-col {
  width: 260px;
  flex-shrink: 0;
}

#filter-sidebar.card {
  border-radius: var(--dh-radius);
  box-shadow: var(--dh-shadow);
}

#filter-sidebar .card-header {
  padding: 0.75rem 0.9rem;
}

#filter-sidebar .card-body {
  padding: 0.9rem;
}

.filter-form {
  gap: 0.65rem;
}

/* ——— Alerts / empty ——— */

.alert {
  border-radius: var(--dh-radius-sm);
  border: 1px solid var(--dh-border);
  font-size: 0.875rem;
}

.alert-danger {
  background: rgba(214, 57, 57, 0.12);
  border-color: rgba(214, 57, 57, 0.35);
  color: #f0b0b0;
}

.alert-info {
  background: rgba(66, 153, 225, 0.12);
  border-color: rgba(66, 153, 225, 0.32);
  color: #a8d0f0;
}

.alert-warning {
  background: var(--dh-pending-soft);
  border-color: rgba(224, 160, 74, 0.35);
  color: #efc98a;
}

.dh-empty {
  text-align: center;
  padding: 2.75rem 1.25rem;
}

.dh-empty h3 {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.dh-empty p {
  color: var(--dh-muted);
  font-size: 0.875rem;
  margin-bottom: 0.85rem;
  max-width: 24rem;
  margin-left: auto;
  margin-right: auto;
}

.dh-empty .avatar {
  background: var(--dh-canvas) !important;
  color: var(--dh-muted) !important;
  border: 1px solid var(--dh-border);
  border-radius: var(--dh-radius) !important;
}

/* ——— Login ——— */

.dh-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(
      ellipse 70% 45% at 50% -5%,
      rgba(93, 255, 181, 0.18),
      transparent 55%
    ),
    var(--dh-canvas);
}

.dh-login-brand {
  margin-bottom: 1.75rem;
}

.dh-login-brand .dh-brand-mark {
  font-size: 1.75rem;
}

.dh-login-brand .dh-brand-mark span {
  color: var(--dh-neon);
  text-shadow: var(--dh-glow);
}

.dh-login-panel {
  width: 100%;
  max-width: 400px;
  background: var(--dh-surface);
  border: 1px solid rgba(93, 255, 181, 0.28);
  border-radius: 12px;
  padding: 2rem 1.85rem 1.85rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), var(--dh-glow-sm);
}

.dh-login h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  color: var(--dh-ink);
}

.dh-login-lead {
  font-size: 0.875rem;
  color: var(--dh-muted);
  margin: 0 0 1.5rem;
}

/* ——— Page helpers ——— */

.directory-list .directory-table {
  min-width: 760px;
}

.directory-list .directory-table td {
  vertical-align: middle;
  white-space: normal;
}

.directory-list .directory-identity {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.directory-list .directory-subtitle {
  font-size: 0.78rem;
  font-family: var(--dh-mono);
  color: var(--dh-muted);
}

.directory-list .directory-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--dh-radius-sm);
}

.directory-list .directory-actions {
  white-space: nowrap !important;
}

.verification-list .request-title,
.verification-list .request-user {
  overflow-wrap: anywhere;
}

.verification-list .request-table {
  min-width: 780px;
}

.verification-list .request-table td {
  white-space: normal;
  vertical-align: middle;
}

.verification-list .request-product {
  width: 34%;
  max-width: 430px;
}

.verification-list .request-user {
  width: 24%;
  max-width: 280px;
}

.verification-list .request-status {
  white-space: nowrap;
}

.product-page .product-value,
.brand-page .brand-value,
.diary-page .diary-value,
.user-page .user-value {
  overflow-wrap: anywhere;
  min-width: 0;
}

.product-page .product-id,
.user-page .user-id {
  font-size: 0.75rem;
  overflow-wrap: anywhere;
  font-family: var(--dh-mono);
}

.product-page .product-portions td {
  overflow-wrap: anywhere;
}

.product-page .product-portions .btn {
  white-space: nowrap;
}

.diary-page .diary-entries td {
  vertical-align: middle;
}

.diary-page .diary-product {
  min-width: 12rem;
  max-width: 24rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.user-page .user-avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  object-fit: cover;
  border-radius: var(--dh-radius);
}

.user-page [data-save-button][hidden] {
  display: none !important;
}

.user-page summary {
  cursor: pointer;
  list-style: none;
}

.user-page summary::-webkit-details-marker {
  display: none;
}

.user-page [data-goal-history-panel][open] .goal-history-chevron {
  transform: rotate(180deg);
}

.brand-page .brand-products {
  min-width: 720px;
}

.brand-page .brand-product-name {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.brand-page .brand-products td {
  white-space: normal;
  vertical-align: middle;
}

.diary-list .diary-table {
  min-width: 680px;
}

.diary-list .diary-table td {
  vertical-align: middle;
}

.diary-list .diary-user {
  max-width: 360px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.diary-list .diary-actions {
  white-space: nowrap;
}

.diary-entry-page .diary-value {
  overflow-wrap: anywhere;
  min-width: 0;
}

.diary-entry-page .diary-id {
  font-size: 0.75rem;
  overflow-wrap: anywhere;
  font-family: var(--dh-mono);
}

.verification-page .verification-value {
  overflow-wrap: anywhere;
  min-width: 0;
}

.verification-page .verification-table {
  table-layout: fixed;
  min-width: 620px;
}

.verification-page .verification-table th:first-child {
  width: 20%;
}

.verification-page .verification-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.verification-page .verification-section {
  background: var(--dh-elevated);
}

.verification-page .verification-changed {
  background: var(--dh-primary-soft);
  outline: 1px solid rgba(61, 186, 138, 0.35);
  outline-offset: -1px;
}

.verification-page .verification-comment {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.verification-page .verification-id {
  font-size: 0.75rem;
  overflow-wrap: anywhere;
  font-family: var(--dh-mono);
}

.dh-list .card-header,
.dh-list .card-body.border-bottom {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.dh-list .table td,
.dh-list .table th {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.card-title > .fa-solid,
.card-title > i.fa-solid {
  color: var(--dh-muted) !important;
  opacity: 0.7;
}

:focus-visible {
  outline: 2px solid var(--dh-neon);
  outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible,
.page-link:focus-visible {
  outline: 2px solid var(--dh-neon);
  outline-offset: 2px;
  box-shadow: var(--dh-glow-sm);
}

@media (max-width: 991.98px) {
  .dh-metric-strip,
  .dh-metric-strip--thirds {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-sidebar-col {
    width: 100%;
    margin-top: 1rem;
  }

  .page-title {
    font-size: 1.4rem;
  }

  .dh-page-pad {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .dh-topbar-inner {
    padding: 0 1rem;
  }
}

@media (max-width: 575.98px) {
  .dh-metric-strip,
  .dh-metric-strip--thirds {
    grid-template-columns: 1fr;
  }

  .dh-login-panel {
    padding: 1.5rem 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .dh-topbar {
    backdrop-filter: none;
    background: var(--dh-sidebar);
  }

  .dh-brand-mark span,
  .dh-login-brand .dh-brand-mark span,
  .text-primary,
  .text-blue {
    text-shadow: none !important;
  }

  .btn-primary,
  .btn-primary:hover,
  .btn-outline-primary,
  .btn-outline-primary:hover,
  .dh-sidebar .nav-link.active,
  .pagination .page-item.active .page-link,
  .badge.bg-green-lt,
  .dh-login-panel,
  .dh-metric.active {
    box-shadow: none !important;
  }
}

/* ——— Dark Tabler leftovers ——— */

.page-wrapper {
  background: var(--dh-canvas) !important;
}

.text-secondary,
.text-muted {
  color: var(--dh-muted) !important;
}

.dropdown-menu {
  background: var(--dh-surface);
  border-color: var(--dh-border);
  color: var(--dh-ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.dropdown-item {
  color: var(--dh-ink);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--dh-primary-soft);
  color: var(--dh-ink);
}

.dropdown-item.active {
  background: var(--dh-primary);
  color: #0e1216;
}

.modal-content {
  background: var(--dh-surface);
  border-color: var(--dh-border);
  color: var(--dh-ink);
}

.modal-header,
.modal-footer {
  border-color: var(--dh-border);
}

.bg-secondary-lt,
.badge.bg-secondary-lt {
  background: rgba(139, 154, 171, 0.16) !important;
  color: #b0becd !important;
}

.bg-orange-lt,
.badge.bg-orange-lt {
  background: rgba(247, 103, 7, 0.18) !important;
  color: #f0b07a !important;
}

.bg-red-lt,
.badge.bg-red-lt {
  background: rgba(214, 57, 57, 0.18) !important;
  color: #f0a0a0 !important;
}

.form-control,
.form-select {
  background-color: #12171d;
  color: var(--dh-ink);
}

.form-control::placeholder {
  color: #6a6a6a;
}

.input-group-flat .form-control {
  background-color: #12171d;
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background-color: #12171d !important;
  color: var(--dh-ink) !important;
}

.select2-dropdown {
  background: var(--dh-surface);
  border-color: var(--dh-border);
  color: var(--dh-ink);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--dh-primary-soft);
  color: var(--dh-ink);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  background: #12171d;
  border-color: var(--dh-border);
  color: var(--dh-ink);
}

.flatpickr-calendar {
  background: var(--dh-surface);
  border: 1px solid var(--dh-border);
  border-radius: var(--dh-radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  color: var(--dh-ink);
  font-family: var(--dh-font);
}

.flatpickr-calendar.arrowTop:before {
  border-bottom-color: var(--dh-border);
}

.flatpickr-calendar.arrowTop:after {
  border-bottom-color: var(--dh-surface);
}

.flatpickr-calendar.arrowBottom:before {
  border-top-color: var(--dh-border);
}

.flatpickr-calendar.arrowBottom:after {
  border-top-color: var(--dh-surface);
}

.flatpickr-months .flatpickr-month,
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month,
.flatpickr-current-month,
.flatpickr-current-month input.cur-year,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-time input,
.flatpickr-time .flatpickr-time-separator,
.flatpickr-time .flatpickr-am-pm {
  background: transparent;
  color: var(--dh-ink);
  fill: var(--dh-ink);
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover,
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
  color: var(--dh-primary);
  fill: var(--dh-primary);
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover,
.flatpickr-current-month span.cur-month:hover,
.flatpickr-time input:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time .flatpickr-am-pm:focus {
  background: var(--dh-elevated);
}

.flatpickr-current-month .numInputWrapper span.arrowUp:after,
.flatpickr-time .numInputWrapper span.arrowUp:after {
  border-bottom-color: var(--dh-ink);
}

.flatpickr-current-month .numInputWrapper span.arrowDown:after,
.flatpickr-time .numInputWrapper span.arrowDown:after {
  border-top-color: var(--dh-ink);
}

span.flatpickr-weekday {
  background: transparent;
  color: var(--dh-muted);
}

.flatpickr-day {
  border-radius: var(--dh-radius-sm);
  color: var(--dh-ink);
}

.flatpickr-day:hover,
.flatpickr-day:focus {
  background: var(--dh-elevated);
  border-color: var(--dh-border-strong);
  color: var(--dh-ink);
}

.flatpickr-day.today {
  border-color: var(--dh-primary);
}

.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
  background: var(--dh-primary-soft);
  border-color: var(--dh-primary);
  color: var(--dh-ink);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus {
  background: var(--dh-primary);
  border-color: var(--dh-primary);
  color: var(--tblr-primary-fg);
}

.flatpickr-day.inRange {
  background: var(--dh-primary-soft);
  border-color: transparent;
  box-shadow: none;
  color: var(--dh-ink);
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay,
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover,
.flatpickr-day.notAllowed {
  background: transparent;
  border-color: transparent;
  color: var(--dh-muted);
}

.flatpickr-calendar.hasTime .flatpickr-time {
  border-top-color: var(--dh-border);
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.badge) {
  color: var(--dh-neon);
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.badge):hover {
  color: #9affd0;
  text-shadow: var(--dh-glow-sm);
}

.table a.text-reset,
a.text-reset {
  color: var(--dh-ink) !important;
}

.table a.text-reset:hover,
a.text-reset:hover {
  color: var(--dh-primary) !important;
}

hr {
  border-color: var(--dh-border);
  opacity: 1;
}

.list-group-item {
  background: var(--dh-surface);
  border-color: var(--dh-border);
  color: var(--dh-ink);
}

/* Feature controls: the two switches describe different scopes. */
.feature-identity { min-width: 240px; max-width: 360px; }
.feature-heading { display: flex; align-items: center; gap: 10px; font-size: 1rem; }
.feature-icon { color: var(--dh-primary); }
.feature-description { margin: 8px 0; color: var(--dh-muted); white-space: normal; line-height: 1.5; }
.feature-key { color: var(--dh-muted); font-size: .75rem; overflow-wrap: anywhere; white-space: normal; }
.feature-control { min-width: 210px; max-width: 260px; }
.feature-switch-label { display: flex; align-items: center; gap: 10px; padding: 0; margin: 0; cursor: pointer; }
.feature-switch-label .form-check-input { flex-shrink: 0; float: none; margin: 0; cursor: pointer; }
.feature-switch:focus-visible { outline: 2px solid var(--dh-primary); outline-offset: 4px; }
.feature-hint { margin: 8px 0 0; color: var(--dh-muted); font-size: .8rem; line-height: 1.5; white-space: normal; }
.feature-experiment { min-width: 180px; max-width: 250px; }
.feature-experiment-link { display: block; margin-top: 8px; white-space: normal; }
.feature-feedback { margin-top: 8px; min-height: 1.2em; color: var(--dh-primary); font-size: .8rem; white-space: normal; }
.feature-feedback-error { color: var(--tblr-danger, #fb7777); }
tr[aria-busy="true"] .feature-switch { cursor: wait; }
.feature-control-title { display: none; }
@media (max-width: 1100px) {
  .directory-table:has(.feature-identity) thead { display: none; }
  .directory-table:has(.feature-identity) tbody { display: block; }
  .directory-table:has(.feature-identity) tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 16px;
    gap: 18px;
    border-bottom: 1px solid var(--dh-border);
  }
  .directory-table:has(.feature-identity) td {
    display: block;
    padding: 0;
    min-width: 0;
    max-width: none;
    border: 0;
  }
  .directory-table:has(.feature-identity) .feature-identity { grid-column: 1 / -1; }
  .feature-control-title { display: block; color: var(--dh-muted); font-size: .8rem; margin-bottom: 10px; }
  .directory-table:has(.feature-identity) .directory-actions { align-self: end; }
}
@media (max-width: 480px) {
  .directory-table:has(.feature-identity) tr { grid-template-columns: minmax(0, 1fr); }
  .directory-table:has(.feature-identity) .directory-actions { text-align: left !important; }
}

/* Product creation: a work surface beside a live nutrition label. */
.product-create-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; }
.product-create-back { display: inline-flex; gap: 8px; align-items: center; font-size: .85rem; margin-bottom: 16px; }
.product-create-heading h1 { font-size: 2rem; letter-spacing: -.04em; margin: 0 0 8px; }
.product-create-heading p { color: var(--dh-muted); margin: 0; }
.product-create-catalog { display: flex; align-items: center; gap: 10px; color: var(--dh-muted); white-space: nowrap; }
.product-create-page { display: block !important; width: 100%; }
.product-create-page > form { width: 100%; }
.product-create-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.product-create-fields { min-width: 0; background: var(--dh-surface); border: 1px solid var(--dh-border); border-radius: 12px; }
.product-create-section { padding: 28px 32px 12px; }
.product-create-section + .product-create-section { border-top: 1px solid var(--dh-border); padding-bottom: 24px; }
.product-create-section-title { display: flex; gap: 14px; margin-bottom: 24px; align-items: baseline; }
.product-create-section-title > i { color: var(--dh-muted); font-size: 1rem; }
.product-create-section-title h2, .product-create-settings h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 6px; }
.product-create-section-title p { color: var(--dh-muted); margin: 0; font-size: .85rem; }
.product-create-page .form-control { min-height: 44px; border-radius: 6px; }
.product-create-page .form-control:focus-visible, .product-create-page summary:focus-visible { outline: 2px solid var(--dh-primary); outline-offset: 3px; }
.product-create-page .form-hint { line-height: 1.5; }
.product-create-page .select2-container .select2-selection--single { min-height: 44px; display: flex; align-items: center; border-radius: 6px; }
.product-create-page .select2-container .select2-selection__arrow { top: 9px; }
.product-create-page .select2-container .select2-selection__rendered { padding-left: 12px; padding-right: 30px; }
.product-create-page .select2-container .select2-selection__clear { margin-right: 12px; }
.product-create-page .select2-container--focus .select2-selection { border-color: var(--dh-primary) !important; }
.product-create-page .is-invalid + .select2-container .select2-selection { border-color: var(--tblr-danger, #fb7777) !important; }
.product-create-nutrients { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.product-create-energy { grid-column: 1 / -1; max-width: 240px; }
.product-create-energy .form-control { font-size: 1.5rem; font-weight: 500; color: #8cc8ef; min-height: 56px; }
.product-create-extra { border-top: 1px solid var(--dh-border); margin-top: 8px; padding-top: 18px; }
.product-create-extra summary { cursor: pointer; font-weight: 500; }
.product-create-extra summary span { color: var(--dh-muted); font-weight: 400; font-size: .8rem; margin-left: 10px; }
.product-create-note { display: flex; gap: 12px; padding: 20px 32px; background: var(--dh-canvas); border-radius: 0 0 12px 12px; border-top: 1px solid var(--dh-border); color: var(--dh-muted); }
.product-create-note > i { margin-top: 4px; }
.product-create-note p { font-size: .85rem; line-height: 1.6; margin: 0; }
.product-create-note strong { color: var(--dh-ink); font-weight: 500; }
.product-create-aside { position: sticky; top: 24px; min-width: 0; }
.product-create-preview { padding: 26px; border: 1px solid #466176; border-top: 3px solid #8cc8ef; border-radius: 4px 4px 10px 10px; background: #17212b; overflow-wrap: anywhere; }
.product-create-preview-label { color: #a7bfd1; font-size: .8rem; margin-bottom: 24px; }
.product-create-preview h2 { font-size: 1.5rem; line-height: 1.25; letter-spacing: -.025em; margin-bottom: 8px; }
.product-create-preview > p { color: #a7bfd1; margin-bottom: 12px; }
.product-create-preview.has-brand > [data-preview-brand] { color: var(--dh-ink); font-weight: 500; }
.product-create-preview-category { font-size: .8rem; color: #a7bfd1; }
.product-create-preview-nutrition { margin-top: 22px; border-top: 2px solid #8cc8ef; }
.product-create-preview-basis { font-size: .8rem; color: #a7bfd1; padding-top: 14px; }
.product-create-preview-energy { display: flex; align-items: baseline; gap: 10px; padding: 4px 0 18px; font-variant-numeric: tabular-nums; }
.product-create-preview-energy strong { font-size: 3.25rem; font-weight: 500; letter-spacing: -.05em; line-height: 1.2; color: #c8e7ff; }
.product-create-preview-energy > span { color: #a7bfd1; }
.product-create-preview-macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid #466176; border-bottom: 1px solid #466176; padding: 14px 0; gap: 10px; }
.product-create-preview-macros > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.product-create-preview-macros > div > span { color: #a7bfd1; font-size: .8rem; }
.product-create-preview-macros strong { font-size: 1.1rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.product-create-preview-macros small { font-weight: 400; color: #a7bfd1; }
.product-create-preview-status { font-size: .8rem; color: #a7bfd1; padding-top: 18px; }
.product-create-preview.is-verified .product-create-preview-status { color: var(--dh-primary-hover); }
.product-create-settings { padding: 26px 2px 0; }
.product-create-settings h2 { margin-bottom: 20px; }
.product-create-settings .form-hint { margin-top: 8px; }
.product-create-settings .form-check-input { cursor: pointer; }
.product-create-actions { position: sticky; bottom: 12px; z-index: 10; margin-top: 24px; background: var(--dh-surface); border: 1px solid var(--dh-border-strong); border-radius: 10px; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; box-shadow: 0 8px 24px #0004; }
.product-create-required { color: var(--dh-muted); font-size: .8rem; }
.product-create-actions > div { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 1199px) {
  .product-create-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; }
  .product-create-section { padding-left: 22px; padding-right: 22px; }
  .product-create-note { padding: 20px 22px; }
  .product-create-required { display: none; }
  .product-create-actions { justify-content: flex-end; }
}
@media (max-width: 900px) {
  .product-create-grid { grid-template-columns: minmax(0, 1fr); }
  .product-create-aside { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .product-create-settings { padding-top: 4px; }
  .product-create-catalog { display: none; }
}
@media (max-width: 575px) {
  .product-create-heading h1 { font-size: 1.65rem; }
  .product-create-section { padding: 22px 18px 12px; }
  .product-create-aside { grid-template-columns: minmax(0, 1fr); }
  .product-create-nutrients { grid-template-columns: minmax(0, 1fr); }
  .product-create-energy { max-width: none; }
  .product-create-actions { bottom: 0; padding: 12px; border-radius: 8px 8px 0 0; }
  .product-create-actions > div { width: 100%; }
  .product-create-actions .btn-primary { flex: 1 1 100%; }
  .product-create-actions .btn { white-space: normal; }
}

/* Selected brand text must stay distinct from the empty search prompt. */
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--dh-ink);
  font-weight: 500;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--dh-muted);
  font-weight: 400;
}
.select2-container--default .select2-selection--single .select2-selection__clear {
  color: var(--dh-muted);
}
.select2-container--default .select2-selection--single .select2-selection__clear:hover {
  color: var(--dh-ink);
}
.product-category-picker { padding: 4px 0 16px; margin: 0; border: 0; min-width: 0; }
.product-category-picker legend { float: none; width: auto; font-size: .875rem; margin-bottom: 12px; }
.product-category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.product-category-option { position: relative; cursor: pointer; min-width: 0; }
.product-category-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.product-category-tile { display: flex; align-items: center; gap: 10px; height: 100%; min-height: 62px; padding: 12px; border: 1px solid var(--dh-border); border-radius: 7px; background: var(--dh-canvas); color: var(--dh-muted); font-size: .85rem; line-height: 1.3; }
.product-category-tile > i:first-child { width: 20px; flex-shrink: 0; text-align: center; font-size: 1.1rem; color: #a7bfd1; }
.product-category-tile > span { flex: 1; }
.product-category-tile .product-category-check { visibility: hidden; font-size: .7rem; color: var(--dh-primary-hover); }
.product-category-option:hover .product-category-tile { border-color: var(--dh-border-strong); color: var(--dh-ink); background: var(--dh-elevated); }
.product-category-option input:checked + .product-category-tile { border-color: var(--dh-primary); background: var(--dh-primary-soft); color: var(--dh-ink); }
.product-category-option input:checked + .product-category-tile > i:first-child { color: var(--dh-primary-hover); }
.product-category-option input:checked + .product-category-tile .product-category-check { visibility: visible; }
.product-category-option input:focus-visible + .product-category-tile { outline: 2px solid var(--dh-primary); outline-offset: 3px; }
.product-category-picker[aria-invalid="true"] .product-category-tile { border-color: var(--tblr-danger, #fb7777); }
@media (max-width: 1199px) {
  .product-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575px) {
  .product-category-tile { padding: 10px 8px; gap: 6px; font-size: .8rem; }
  .product-category-tile .product-category-check { display: none; }
}

/* User accent colors */
:root {
  --dh-accent-green: #2fb344;
  --dh-accent-red: #d63939;
  --dh-accent-yellow: #f5c211;
  --dh-accent-purple: #ae3ec9;
  --dh-accent-blue: #206bc4;
  --dh-accent-cyan: #17a2b8;
  --dh-accent-orange: #f76707;
}
.dh-accent-swatch {
  display: inline-block;
  width: .75rem;
  height: .75rem;
  margin-right: .4rem;
  border-radius: 50%;
  vertical-align: middle;
  border: 1px solid rgb(0 0 0 / 15%);
}
.dh-accent-green { background-color: var(--dh-accent-green); }
.dh-accent-red { background-color: var(--dh-accent-red); }
.dh-accent-yellow { background-color: var(--dh-accent-yellow); }
.dh-accent-purple { background-color: var(--dh-accent-purple); }
.dh-accent-blue { background-color: var(--dh-accent-blue); }
.dh-accent-cyan { background-color: var(--dh-accent-cyan); }
.dh-accent-orange { background-color: var(--dh-accent-orange); }

.dh-accent-legend li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .15rem .2rem;
}

.dh-diary-activity-legend li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  padding: .45rem .2rem;
}
.dh-diary-activity-label::before {
  content: "";
  display: inline-block;
  width: .55rem;
  height: .55rem;
  margin-right: .55rem;
  border-radius: 2px;
  background: var(--dh-muted);
}
.dh-diary-activity-recent::before { background: var(--dh-primary); }
.dh-diary-activity-previous::before { background: var(--dh-pending); }

.dh-country-legend li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  padding: .15rem .2rem;
}
.dh-country-label { overflow-wrap: anywhere; }
.dh-country-label::before {
  content: "";
  display: inline-block;
  width: .55rem;
  height: .55rem;
  margin-right: .55rem;
  border-radius: 2px;
  background: var(--dh-country-color);
}


/* Diagnostic JSON keeps indentation, including on narrow screens. */
.dh-admin .dh-json-viewer {
  max-height: 36rem;
  overflow: auto;
  padding: 1rem 1.25rem;
  border: 1px solid var(--dh-border);
  border-radius: var(--dh-radius-sm);
  background: var(--dh-canvas);
  color: var(--dh-ink);
  font-family: var(--dh-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre;
  tab-size: 2;
}

.dh-admin .dh-json-viewer code {
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.dh-admin .dh-json-viewer:focus-visible {
  outline: 2px solid var(--dh-primary);
  outline-offset: 2px;
}

.dh-admin .dh-json-key { color: #8fc8ff; }
.dh-admin .dh-json-string { color: #91d7b3; }
.dh-admin .dh-json-number { color: #f0bf78; }
.dh-admin .dh-json-literal { color: #d4adf5; }

.dh-admin .dh-json-embedded summary {
  margin-bottom: 0.75rem;
  cursor: pointer;
  color: var(--dh-muted);
}

.dh-recognition-header { flex-wrap: wrap; gap: 0.75rem; }
.dh-recognition-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dh-recognition-users summary { cursor: pointer; color: var(--dh-muted); }


/* AI overview: compare services once, then inspect the detail on demand. */
.dh-ai-period { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.dh-ai-card { overflow: hidden; }
.dh-ai-table { width: 100%; margin: 0; font-variant-numeric: tabular-nums; }
.dh-ai-table th, .dh-ai-table td { padding: 1rem 1.25rem; }
.dh-ai-table thead th { color: var(--dh-muted); font-weight: 500; }
.dh-ai-table tbody th { font-weight: 500; }
.dh-ai-table tbody td { font-size: 1rem; }
.dh-ai-service { color: var(--dh-ink); text-decoration: none; }
.dh-ai-service:hover { color: var(--dh-primary); text-decoration: underline; }
.dh-ai-service-note, .dh-ai-incomplete {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--dh-muted);
}
.dh-ai-incomplete { color: var(--dh-pending); }
.dh-ai-cost { white-space: nowrap; font-weight: 600; }
.dh-ai-table tfoot th, .dh-ai-table tfoot td {
  background: var(--dh-elevated);
  border-top: 1px solid var(--dh-border-strong);
  border-bottom: 0;
}
.dh-ai-total { font-size: 1.2rem; font-weight: 600; white-space: nowrap; }
.dh-ai-note { margin: 0; padding: 0.85rem 1.25rem; color: var(--dh-muted); font-size: 0.8rem; max-width: 80ch; }
.dh-ai-details { border-top: 1px solid var(--dh-border); }
.dh-ai-details > summary {
  padding: 0.9rem 1.25rem;
  color: var(--dh-ink);
  font-size: 0.85rem;
  cursor: pointer;
}
.dh-ai-details > summary:hover { background: var(--dh-elevated); }
.dh-ai-details > summary:focus-visible, .dh-ai-service:focus-visible {
  outline: 2px solid var(--dh-primary);
  outline-offset: -2px;
}
.dh-ai-details-body { padding: 0.5rem 1.25rem 1.25rem; }
.dh-ai-service-details + .dh-ai-service-details { padding-top: 1.25rem; border-top: 1px solid var(--dh-border); }
.dh-ai-service-details:last-child { margin-bottom: 0; }
.dh-ai-service-details .dh-section-title { font-size: 0.95rem; }
@media (max-width: 640px) {
  .dh-ai .dh-section-header { align-items: flex-start; gap: 0.75rem; }
  .dh-ai-table { min-width: 36rem; }
  .dh-ai-table th, .dh-ai-table td { padding: 0.85rem 1rem; }
  .dh-ai-details-body { padding: 0.5rem 1rem 1rem; }
}

/* Keep one block inside SQLAdmin's flex-based .row-deck column. */
.dh-scan-page { width: 100%; min-width: 0; container-type: inline-size; }

/* Package scanner: the reading is primary, another upload is secondary. */
.dh-scan-heading { margin-bottom: 1rem; align-items: center; }
.dh-scan-layout { max-width: 46rem; }
.dh-scan-layout--result {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 1.5rem;
  max-width: none;
}
@container (min-width: 64rem) {
  .dh-scan-layout--result {
    grid-template-columns: minmax(0, 1fr) 22rem;
  }
}
.dh-scan-output, .dh-scan-upload { min-width: 0; }
.dh-scan-upload input[type="file"] { width: 100%; min-width: 0; }
.dh-scan-result { min-width: 0; margin-bottom: 1rem; }
.dh-scan-output .dh-scan-result { margin-bottom: 0; }
.dh-scan-result .card-header { justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.dh-scan-result .card-body { padding: 1.5rem; }
.dh-scan-product-name { margin: 0 0 1rem; font-size: 1.35rem; line-height: 1.4; overflow-wrap: anywhere; }
.dh-scan-product-meta { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 0 0 1.75rem; }
.dh-scan-product-meta > div { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.dh-scan-product-meta dt { font-size: 0.75rem; font-weight: 400; color: var(--dh-muted); }
.dh-scan-product-meta dd { margin: 0.2rem 0 0; }
.dh-scan-basis { color: var(--dh-muted); margin: 0 0 0.75rem; font-size: 0.85rem; }
.dh-scan-basis strong { color: var(--dh-ink); font-weight: 500; }
.dh-scan-nutrients { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-block: 1px solid var(--dh-border); }
.dh-scan-nutrients > div { padding: 1rem 0.75rem; min-width: 0; }
.dh-scan-nutrients > div:first-child { padding-left: 0; }
.dh-scan-nutrients > div + div { border-left: 1px solid var(--dh-border); }
.dh-scan-nutrients dt { color: var(--dh-muted); font-size: 0.8rem; font-weight: 400; }
.dh-scan-nutrients dd { margin: 0.5rem 0 0; font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dh-scan-questions { margin-top: 1.5rem; overflow-wrap: anywhere; }
.dh-scan-questions h4 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.dh-scan-questions ul { margin: 0; padding-left: 1.25rem; color: var(--dh-muted); }
.dh-scan-questions li + li { margin-top: 0.4rem; }
.dh-scan-result-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--dh-border); font-size: 0.85rem; }
.dh-scan-diagnostics { margin-top: 0.75rem; }
.dh-scan-diagnostics summary { color: var(--dh-muted); cursor: pointer; }
.dh-scan-diagnostics .dh-json-viewer { margin: 1rem 0 0; max-height: 24rem; }
.dh-scan-diagnostics summary:focus-visible { outline: 2px solid var(--dh-primary); outline-offset: 4px; }
.dh-scan-instruction { color: var(--dh-muted); line-height: 1.6; margin: 0 0 1.25rem; max-width: 65ch; }
.dh-scan-actions { display: grid; gap: 0.65rem; }
.dh-scan-help { color: var(--dh-muted); font-size: 0.75rem; line-height: 1.6; margin: 1rem 0 0; }
.dh-scan-status:not(:empty) { display: block; color: var(--dh-muted); font-size: 0.85rem; margin-top: 0.75rem; }
@media (max-width: 640px) {
  .dh-scan-result .card-body, .dh-scan-result-footer { padding: 1rem; }
  .dh-scan-nutrients { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dh-scan-nutrients > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .dh-scan-nutrients > div:nth-child(n+3) { border-top: 1px solid var(--dh-border); }
  .dh-scan-nutrients dd { font-size: 1.25rem; }
}

.product-edit-portions > .card { border: 0; box-shadow: none; background: transparent; }
.product-edit-portions .card-header { padding: 0 1rem 20px; }
.product-edit-portions .card-title { font-size: 1.15rem; }
.product-edit-portions .card-footer {
  padding: 16px 1rem 0;
  background: transparent;
}
.product-edit-portions .product-portions td:first-child,
.product-edit-portions .product-portions th:first-child {
  padding-left: 1rem;
}
.product-edit-portions .product-portions td:last-child,
.product-edit-portions .product-portions th:last-child {
  padding-right: 1rem;
}

/* A single full-width block inside SQLAdmin's flex row-deck column. */
.api-explorer { width: 100%; min-width: 0; color: var(--dh-ink); }
.api-intro { margin-bottom: 24px; font-size: 1rem; line-height: 1.5rem; }
.api-intro p { max-width: 76ch; margin-bottom: 12px; }
.api-help { color: var(--dh-muted); font-size: .875rem; line-height: 1.25rem; }
.api-help summary { cursor: pointer; }
.api-help p { margin-top: 12px; }
.api-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.api-tag { width: 100%; min-width: 0; }
.api-tag-heading {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 16px 24px; list-style: none;
}
.api-tag-heading .card-title { margin: 0; font-size: 1.125rem; line-height: 1.75rem; }
.api-count { color: var(--dh-muted); font-size: .875rem; line-height: 1.25rem; }
.api-tag-body { padding: 0 16px 16px; }
.api-operation {
  min-width: 0; border: 1px solid var(--dh-border); border-radius: 8px;
  background: var(--dh-canvas);
}
.api-operation + .api-operation { margin-top: 8px; }
.api-operation-heading {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 16px; padding: 16px;
  cursor: pointer; list-style: none; border-radius: 8px;
}
.api-operation-heading:hover { background: var(--dh-elevated); }
.api-operation-heading:focus-visible, .api-tag-heading:focus-visible,
.api-help summary:focus-visible {
  outline: 2px solid var(--dh-primary); outline-offset: 2px;
}
.api-operation-heading::-webkit-details-marker,
.api-tag-heading::-webkit-details-marker { display: none; }
.api-method {
  padding: 4px 8px; border-radius: 4px; color: var(--dh-primary-hover);
  background: var(--dh-primary-soft); font-family: var(--dh-mono);
  font-size: .875rem; line-height: 1.25rem; font-weight: 600;
}
.api-operation-label { display: grid; min-width: 0; gap: 4px; }
.dh-admin .api-path {
  display: block; padding: 0; background: transparent; color: var(--dh-ink);
  font-size: 1rem; line-height: 1.5rem; overflow-wrap: anywhere;
  white-space: normal; word-break: normal;
}
.api-summary { color: var(--dh-muted); font-size: .875rem; line-height: 1.25rem; }
.api-operation-body { padding: 8px 24px 24px; }
.api-description { max-width: 76ch; white-space: pre-wrap; }
.api-response {
  max-width: 100%; max-height: 40rem; color: var(--dh-ink);
  background: var(--dh-surface); font-size: .875rem; line-height: 1.5rem;
}
.api-operation-heading::after, .api-tag-heading::after {
  content: "›"; margin-left: auto; color: var(--dh-muted);
  font-size: 1.25rem; line-height: 1.75rem;
}
.api-operation[open] > summary::after, .api-tag[open] > summary::after {
  transform: rotate(90deg);
}
@media (max-width: 640px) {
  .api-tag-heading { padding: 16px; }
  .api-tag-body { padding: 0 8px 8px; }
  .api-operation-heading { gap: 8px; padding: 12px; }
  .api-operation-body { padding: 8px 12px 16px; }
  .dh-admin .api-path { font-size: .875rem; line-height: 1.25rem; }
}

.api-search { max-width: 48rem; }
.api-preview-note { color: var(--dh-muted); font-size: .875rem; line-height: 1.25rem; }
.api-tag[hidden], .api-operation[hidden] { display: none !important; }
