/* ============================================================
   Shaafici brand tokens — shared palette/type with the storefront
   (poured concrete, kraft paper, rust/oxide steel, site-safety
   yellow, galvanized sheet). Internal tool, so a small set of
   conventional status colors (success/danger) is layered on top
   for clear pass/fail signaling on the sync dashboard.
   ============================================================ */
:root {
  --sh-concrete: #e4e0d6;
  --sh-paper: #f5f2ea;
  --sh-charcoal: #1e1a16;
  --sh-charcoal-2: #2a241e;
  --sh-cream: #ede9df;
  --sh-oxide: #9e4220;
  --sh-oxide-bright: #d07440;
  --sh-site: #efac00;
  --sh-galvanize: #3d454d;
  --sh-success: #2f7a4a;
  --sh-danger: #b3261e;
  --sh-border: rgba(30, 26, 22, 0.16);

  --bs-body-bg: var(--sh-concrete);
  --bs-body-color: var(--sh-charcoal);
  --bs-border-color: var(--sh-border);
  --bs-border-radius: 2px;
  --bs-border-radius-sm: 2px;
  --bs-border-radius-lg: 2px;

  --bs-primary: var(--sh-oxide);
  --bs-primary-rgb: 158, 66, 32;
  --bs-link-color: var(--sh-oxide);
  --bs-link-color-rgb: 158, 66, 32;
  --bs-link-hover-color: var(--sh-charcoal);
  --bs-link-hover-color-rgb: 30, 26, 22;

  --bs-secondary: var(--sh-galvanize);
  --bs-secondary-rgb: 61, 69, 77;
  --bs-success: var(--sh-success);
  --bs-success-rgb: 47, 122, 74;
  --bs-danger: var(--sh-danger);
  --bs-danger-rgb: 179, 38, 30;
  --bs-warning: var(--sh-site);
  --bs-warning-rgb: 239, 172, 0;

  --bs-font-sans-serif: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--bs-font-sans-serif);
}

/* Headlines / nav / labels use the same bold grotesk as the storefront — no dark mode,
   no stencil face, sized for a normal user to read comfortably. */
.font-display,
h1,
h2,
h3 {
  font-family: "Archivo", var(--bs-font-sans-serif);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.font-label {
  font-family: "Archivo", var(--bs-font-sans-serif);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.font-data,
code,
td.font-data,
th.font-data {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

h1 {
  font-size: 1.875rem;
}

.eyebrow {
  font-family: "Archivo", var(--bs-font-sans-serif);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sh-oxide);
}

/* Signature die-cut corner — same shape as the storefront, used sparingly here on
   primary buttons and callout cards. */
.tag-corner {
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}

.bg-charcoal {
  background-color: var(--sh-charcoal) !important;
}

.bg-charcoal-2 {
  background-color: var(--sh-charcoal-2) !important;
}

.text-cream {
  color: var(--sh-cream) !important;
}

.text-site {
  color: var(--sh-site) !important;
}

.navbar-brand {
  font-family: "Archivo", var(--bs-font-sans-serif);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.admin-nav-link {
  font-family: "Archivo", var(--bs-font-sans-serif);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--sh-cream);
  opacity: 0.85;
  transition: opacity 0.15s, color 0.15s;
}

.admin-nav-link:hover {
  color: var(--sh-site);
  opacity: 1;
}

.admin-nav-link.active {
  color: var(--sh-site);
  opacity: 1;
}

/* Bootstrap 5.3 bakes most component colors (buttons, checkboxes, table/alert variants)
   from Sass variables at build time — they are NOT wired to the root --bs-primary/
   --bs-danger custom properties above, so those components need direct overrides. */
.btn-primary {
  font-family: "Archivo", var(--bs-font-sans-serif);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.9rem;
  --bs-btn-color: var(--sh-cream);
  --bs-btn-bg: var(--sh-oxide);
  --bs-btn-border-color: var(--sh-oxide);
  --bs-btn-hover-color: var(--sh-cream);
  --bs-btn-hover-bg: var(--sh-charcoal);
  --bs-btn-hover-border-color: var(--sh-charcoal);
  --bs-btn-active-bg: var(--sh-charcoal);
  --bs-btn-active-border-color: var(--sh-charcoal);
  --bs-btn-disabled-bg: var(--sh-oxide);
  --bs-btn-disabled-border-color: var(--sh-oxide);
  --bs-btn-focus-shadow-rgb: 158, 66, 32;
}

.btn-outline-primary {
  font-family: "Archivo", var(--bs-font-sans-serif);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.85rem;
  --bs-btn-color: var(--sh-oxide);
  --bs-btn-border-color: var(--sh-oxide);
  --bs-btn-hover-bg: var(--sh-oxide);
  --bs-btn-hover-border-color: var(--sh-oxide);
  --bs-btn-active-bg: var(--sh-oxide);
  --bs-btn-active-border-color: var(--sh-oxide);
  --bs-btn-focus-shadow-rgb: 158, 66, 32;
}

.table-danger {
  --bs-table-bg: #f6dedb;
  --bs-table-border-color: #e0b9b2;
}

.alert-success {
  --bs-alert-color: #163a26;
  --bs-alert-bg: #dcebe1;
  --bs-alert-border-color: #b9d6c4;
}

.alert-danger {
  --bs-alert-color: #4a1410;
  --bs-alert-bg: #f6dedb;
  --bs-alert-border-color: #e0b9b2;
}

.form-control,
.form-select {
  background-color: var(--sh-paper);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--sh-oxide);
  box-shadow: 0 0 0 0.2rem rgba(158, 66, 32, 0.2);
}

.form-check-input:checked {
  background-color: var(--sh-oxide);
  border-color: var(--sh-oxide);
}

.form-check-input:focus {
  border-color: var(--sh-oxide);
  box-shadow: 0 0 0 0.2rem rgba(158, 66, 32, 0.2);
}

.card,
.table {
  background-color: var(--sh-paper);
}

thead {
  font-family: "Archivo", var(--bs-font-sans-serif);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sh-galvanize);
}

.page-footer {
  background-color: var(--sh-charcoal);
  color: var(--sh-cream);
  opacity: 0.7;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
}

/* ── Shared filter bar ─────────────────────────────────────────────────────
   Used by _FilterBar.cshtml on every list and report page. */
.filter-bar {
  background: var(--sh-paper);
  border: 1px solid var(--sh-border);
  border-left: 3px solid var(--sh-galvanize);
  padding: 0.85rem 1rem;
}

.filter-bar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 10rem;
}

.filter-field-grow {
  flex: 1 1 16rem;
}

.filter-field-sm {
  min-width: 5.5rem;
}

.filter-label {
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(30, 26, 22, 0.6);
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-left: auto;
}

.filter-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--sh-border);
}

.preset-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  padding: 0.12rem 0.5rem;
  border: 1px solid var(--sh-border);
  color: var(--sh-charcoal);
  text-decoration: none;
  background: #fff;
}

.preset-chip:hover {
  border-color: var(--sh-oxide);
  color: var(--sh-oxide);
}

.preset-chip.is-active {
  background: var(--sh-charcoal);
  border-color: var(--sh-charcoal);
  color: var(--sh-cream);
}

/* ── Pager ──────────────────────────────────────────────────────────────── */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.pager-summary {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: rgba(30, 26, 22, 0.7);
}

.pager-filtered {
  margin-left: 0.4rem;
  font-family: "Archivo", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--sh-site);
  color: var(--sh-charcoal);
  padding: 0.05rem 0.4rem;
}

/* ── Reports hub cards ──────────────────────────────────────────────────── */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

.report-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem 1.15rem 1.15rem;
  background: #fff;
  border: 1px solid var(--sh-border);
  border-top: 4px solid var(--accent, var(--sh-oxide));
  text-decoration: none;
  color: var(--sh-charcoal);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.report-card:hover,
.report-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 6px 6px 0 0 var(--accent, var(--sh-oxide));
  color: var(--sh-charcoal);
  outline: none;
}

.report-card-icon {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  background: var(--accent, var(--sh-oxide));
  color: #fff;
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.report-card-title {
  font-family: "Archivo", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.2;
}

.report-card-desc {
  font-size: 0.85rem;
  color: rgba(30, 26, 22, 0.68);
  line-height: 1.4;
}

.report-card-go {
  margin-top: auto;
  padding-top: 0.55rem;
  font-family: "Archivo", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent, var(--sh-oxide));
}

.report-card:hover .report-card-go::after {
  content: " →";
}

.report-section-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 1.75rem 0 0.85rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--sh-charcoal);
}

/* ── KPI tiles ──────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.85rem;
}

.kpi {
  background: #fff;
  border: 1px solid var(--sh-border);
  border-left: 3px solid var(--accent, var(--sh-galvanize));
  padding: 0.8rem 0.9rem;
}

.kpi-label {
  font-family: "Archivo", sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(30, 26, 22, 0.6);
}

.kpi-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.25;
}

.kpi-sub {
  font-size: 0.75rem;
  color: rgba(30, 26, 22, 0.6);
}

/* ── Mini bar chart (no JS/chart lib) ───────────────────────────────────── */
.minibar {
  display: block;
  height: 0.55rem;
  background: var(--accent, var(--sh-oxide));
  min-width: 2px;
}

.minibar-track {
  background: rgba(30, 26, 22, 0.07);
  width: 100%;
}

/* ── Nav dropdowns ──────────────────────────────────────────────────────── */
.navbar-nav .dropdown-menu {
  background: var(--sh-charcoal-2);
  border: 1px solid rgba(237, 233, 223, 0.18);
  border-radius: 0;
  padding: 0.3rem;
}

.navbar-nav .dropdown-menu .dropdown-item {
  color: var(--sh-cream);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.42rem 0.7rem;
}

.navbar-nav .dropdown-menu .dropdown-item:hover,
.navbar-nav .dropdown-menu .dropdown-item:focus {
  background: var(--sh-oxide);
  color: #fff;
}

.navbar-nav .dropdown-menu .dropdown-item.active {
  background: var(--sh-oxide);
  color: #fff;
}

.navbar-nav .dropdown-menu .dropdown-header {
  font-family: "Archivo", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(237, 233, 223, 0.55);
  padding: 0.45rem 0.7rem 0.25rem;
}

.navbar-nav .dropdown-menu .dropdown-divider {
  border-top-color: rgba(237, 233, 223, 0.16);
}

/* The nav has enough items to overflow; let it wrap rather than run off-screen. */
#adminNav .navbar-nav {
  flex-wrap: wrap;
}

/* Long menus shouldn't run off the bottom on short screens. */
@media (min-width: 992px) {
  .navbar-nav .dropdown-menu {
    max-height: 78vh;
    overflow-y: auto;
  }
}

/* Collapsed (mobile) nav: keep it scrollable and readable. */
@media (max-width: 991.98px) {
  #adminNav {
    max-height: 78vh;
    overflow-y: auto;
    padding-bottom: 0.5rem;
  }

  .navbar-nav .dropdown-menu {
    background: transparent;
    border: 0;
    border-left: 2px solid rgba(237, 233, 223, 0.2);
    margin-left: 0.75rem;
    padding-left: 0.25rem;
  }
}
