/* =========================================================================
   MAA Donor Care - visual theme
   One palette, one type scale, consistent surfaces. Class names are the
   hooks used by the pages and site.js; keep them when restyling.
   ========================================================================= */
:root {
  --brand: #0f766e;
  --brand-600: #0d6560;
  --brand-700: #0b5450;
  --brand-50: #ecf7f5;
  --brand-100: #d3eeea;

  --page-bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --nav-bg: #0c2f33;
  --nav-text: #cfe3e2;
  --nav-muted: #7fa6a5;
  /* Header / menu: light MAA green, black labels and a black MAA logo. */
  --header-bg: #eaf5db;
  --header-line: #d3e6bb;
  --header-text: #000000;
  --header-text-strong: #000000;
  --header-hover: rgba(0, 0, 0, .06);
  --header-active: #000000;
  --header-active-line: #6aa531;
  --header-active-bg: rgba(141, 198, 63, .28);
  --border: #e1e6ea;
  --border-strong: #cdd5db;
  --text: #1d2a32;
  --text-2: #3c4a53;
  --muted: #66747c;

  --success: #15803d;
  --danger: #c0262d;
  --warning: #b45309;
  --boy: #1d4ed8;
  --girl: #be185d;
  --match: #15803d;
  --mismatch: #c0262d;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --ring: 0 0 0 3px rgba(15, 118, 110, .22);

  --header-h: 56px;
}

html { font-size: 14px; }
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.busy, body.busy * { cursor: progress !important; }
body.page-dashboard { background: #ffffff; }
a { color: var(--brand); }
a:hover { color: var(--brand-700); }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- buttons (Bootstrap re-themed) ---------- */
.btn { --bs-btn-font-weight: 500; --bs-btn-border-radius: var(--radius-sm); --bs-btn-focus-box-shadow: var(--ring); }
.btn-sm { --bs-btn-padding-y: .32rem; --bs-btn-padding-x: .75rem; --bs-btn-font-size: .9rem; }
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
  --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-success {
  --bs-btn-bg: var(--success); --bs-btn-border-color: var(--success);
  --bs-btn-hover-bg: #116632; --bs-btn-hover-border-color: #116632;
  --bs-btn-active-bg: #0e5229; --bs-btn-disabled-bg: var(--success); --bs-btn-disabled-border-color: var(--success);
}
.btn-danger {
  --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger);
  --bs-btn-hover-bg: #a11f25; --bs-btn-hover-border-color: #a11f25;
  --bs-btn-active-bg: #8a1a1f; --bs-btn-disabled-bg: var(--danger); --bs-btn-disabled-border-color: var(--danger);
}
/* Every secondary action (Go Back, Rotate, Open, Refresh, Close, ...) uses one highlighted teal style:
   light teal fill + teal border, solid teal with white text on hover. */
.btn-light, .btn-outline-secondary, .btn-outline-primary {
  --bs-btn-color: var(--brand-700); --bs-btn-bg: var(--brand-50); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
  --bs-btn-disabled-color: var(--muted); --bs-btn-disabled-bg: var(--surface-2); --bs-btn-disabled-border-color: var(--border);
  --bs-btn-font-weight: 600; box-shadow: var(--shadow-sm);
}
.btn-outline-success { --bs-btn-color: var(--success); --bs-btn-bg: #e8f5ec; --bs-btn-border-color: var(--success); --bs-btn-hover-bg: var(--success); --bs-btn-hover-border-color: var(--success); --bs-btn-font-weight: 600; }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-bg: #fdecec; --bs-btn-border-color: var(--danger); --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger); --bs-btn-font-weight: 600; }
/* Buttons with an icon */
.btn > svg { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; }
.btn:disabled, .btn.disabled { opacity: .5; }

.alert { border-radius: var(--radius-sm); padding: .6rem .9rem; margin-bottom: .6rem; font-size: .95rem; }
/* Record warnings (e.g. "number of beneficiaries is less than 1") must stand out. */
#alerts .alert-warning { color: var(--danger); font-weight: 600; background: #fdecec; border-color: #f3b8bb; }
/* "Please wait" while an action (Generate PDF, Approve, Send Email, uploads...) runs */
.busy-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(243, 245, 247, .65); backdrop-filter: blur(1px); cursor: progress; }
.busy-box { display: flex; align-items: center; gap: 14px; padding: 16px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; color: var(--text); }
.spinner-lg { width: 26px; height: 26px; border-width: 3px; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.55); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn-light.is-busy::after, .btn-outline-secondary.is-busy::after, .btn-outline-primary.is-busy::after { border-color: var(--brand-100); border-top-color: var(--brand); }
/* Buttons locked while a record loads */
.app-main.is-loading .btn:disabled { cursor: progress; }

/* ---------- header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  height: var(--header-h); padding: 0 18px;
  background: var(--header-bg); border-bottom: 1px solid var(--header-line); box-shadow: 0 1px 4px rgba(63,83,93,.12);
}
.app-brand { display: flex; align-items: center; gap: 10px; padding-right: 18px; margin-right: 4px; border-right: 1px solid var(--header-line); color: var(--header-text); text-decoration: none; }
.app-brand:hover { color: var(--header-text-strong); }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #14a394, var(--brand-700)); color: #fff; font-weight: 700; font-size: 1rem;
}
.brand-logo { display: block; height: 30px; width: auto; }
.login-logo { display: block; height: 44px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-weight: 700; font-size: 1rem; }
.brand-text small { font-weight: 500; font-size: .78rem; color: var(--nav-muted); letter-spacing: .02em; }
.header-spacer { flex: 1; }
.env-badge { font-weight: 700; font-size: .72rem; letter-spacing: .06em; padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; }
.env-live { background: #fdecec; color: #a3191f; border-color: #f6c5c7; }
.env-uat { background: #fff6dd; color: #8a5a00; border-color: #f3dd9c; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--header-text); white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); font-weight: 700; font-size: .8rem; }
.app-signout { color: var(--header-text); text-decoration: none; font-weight: 500; padding: 6px 10px; border-radius: var(--radius-sm); }
.app-signout:hover { background: var(--header-hover); color: var(--header-text-strong); }
@media (max-width: 700px) { .user-name { display: none; } }

/* ---------- shell + navigation (horizontal tabs in the header) ---------- */
.app-shell { min-height: calc(100vh - var(--header-h)); }
.app-nav { display: flex; align-items: stretch; align-self: stretch; gap: 2px; margin-left: 18px; min-width: 0; }
.app-nav a {
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  color: var(--header-text); text-decoration: none; font-weight: 500; white-space: nowrap;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
.app-nav a:hover { color: var(--header-text-strong); background: var(--header-hover); }
.app-nav a.active { color: var(--header-active); font-weight: 700; border-bottom-color: var(--header-active-line); background: var(--header-active-bg); }
.nav-icon { flex: none; width: 18px; height: 18px; fill: currentColor; opacity: .9; }
.nav-text { white-space: nowrap; }

.app-main { min-width: 0; padding: 18px 22px 36px; }
.page-head { margin-bottom: 14px; }
/* Title with the detail buttons on the same line */
.page-head.with-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.page-head.with-actions .detail-topbar { margin-bottom: 0; flex: 1; }
.detail-topbar .push-right { margin-left: auto; }
/* Same width as the Profile & actions column below it */
.detail-topbar .approve-head { width: 280px; padding: 8px 12px; font-size: 1rem; font-weight: 600; }
@media (max-width: 1200px) { .detail-topbar .approve-head { width: auto; } }
.page-title { margin: 0; font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.page-subtitle { margin: 2px 0 0; color: var(--muted); }

/* Narrow screens: icons only (names show as tooltips). 1400px: the seven menu items with names need about that much room. */
@media (max-width: 1400px) {
  .app-nav .nav-text { display: none; }
  .app-nav a { padding: 0 12px; }
}
@media (max-width: 560px) { .brand-logo { height: 24px; } .app-brand { padding-right: 10px; } .app-nav { margin-left: 4px; } }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.panel.narrow { max-width: 620px; }
.panel-title { margin: 0 0 10px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

/* ---------- Overview dashboard ---------- */
.dash-head { justify-content: flex-end; }
/* One light colour scheme per screen so tiles and panels are easy to tell apart.
   accent = bars/stripe, strong = hover/pill text, soft = icon/hover fill, tint = card background. */
.theme-orphan    { --accent: #14857c; --accent-strong: #0b5450; --accent-soft: #dcf1ee; --accent-tint: #f4fbfa; }
.theme-aqeeqah   { --accent: #e08a12; --accent-strong: #8a4f05; --accent-soft: #fcebd2; --accent-tint: #fffaf2; }
.theme-inventory { --accent: #3b78e7; --accent-strong: #1d4ea8; --accent-soft: #e0eafc; --accent-tint: #f6f9ff; }
.theme-shelters  { --accent: #c2410c; --accent-strong: #7c2d12; --accent-soft: #fde4d6; --accent-tint: #fff7f2; }
.theme-foodpack  { --accent: #8b5cf6; --accent-strong: #5b2fb8; --accent-soft: #ece4fd; --accent-tint: #faf8ff; }
.kpi-tile[class*="theme-"], .dash-panel[class*="theme-"] { background: var(--accent-tint); border-top: 4px solid var(--accent); }
.dash-panel[class*="theme-"] .dash-panel-tools .btn { border-color: var(--accent); color: var(--accent-strong); }
.dash-panel[class*="theme-"] .dash-panel-tools .btn:hover { background: var(--accent-soft); }
/* KPI tiles: records waiting for action on each screen */
.kpi-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi-tile {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kpi-tile:hover { border-color: var(--accent, #9fd3cc); box-shadow: 0 6px 18px rgba(16,24,40,.10); transform: translateY(-1px); color: var(--text); }
.kpi-name { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 1.1rem; font-weight: 600; color: var(--text-2); }
.kpi-name svg { flex: none; width: 34px; height: 34px; padding: 7px; border-radius: 8px; background: var(--accent-soft, var(--brand-50)); fill: var(--accent, var(--brand)); }
.kpi-value { font-size: 2.8rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi-caption { font-size: 1.15rem; font-weight: 600; color: var(--text-2); }
.kpi-sub { font-size: 1rem; color: var(--muted); }
.kpi-tile.is-loading .kpi-value, .kpi-tile.is-loading .kpi-caption { width: 60%; border-radius: 4px; background: linear-gradient(90deg, #eef1f4 25%, #f6f8f9 50%, #eef1f4 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; color: transparent; }
.kpi-tile.is-loading .kpi-caption { width: 80%; }
.kpi-tile.is-error .kpi-value { color: var(--muted); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Status panels: one horizontal bar chart per screen */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dash-panel-title { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.dash-scope { font-size: .95rem; }
.dash-panel-tools { display: flex; gap: 6px; flex: none; }
.dash-panel-tools .btn.active { background: var(--accent-soft, var(--brand-50)); border-color: var(--accent, var(--brand)); color: var(--accent-strong, var(--brand-700)); }
.bar-chart { display: flex; flex-direction: column; }
.bar-row {
  display: grid; grid-template-columns: minmax(160px, 40%) minmax(0, 1fr) 72px; align-items: center; gap: 12px;
  padding: 8px 6px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none;
}
.bar-row:hover, .bar-row:focus-visible { background: var(--accent-soft, var(--brand-50)); color: var(--text); }
.bar-label { display: flex; align-items: center; gap: 6px; font-size: 1.05rem; line-height: 1.25; }
.bar-row.is-action .bar-label { font-weight: 700; color: var(--text); }
.bar-track { display: block; height: 20px; border-left: 1px solid var(--border-strong); }
/* Square at the baseline, 4px rounded at the data end */
.bar { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--accent, var(--brand)); transition: width .35s ease-out; }
.bar-row:hover .bar { background: var(--accent-strong, var(--brand-700)); }
.bar-value { font-size: 1.1rem; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.dash-table { width: 100%; font-size: 1.05rem; border-collapse: collapse; }
.dash-table th, .dash-table td { padding: 8px 10px; border-bottom: 1px solid #eef1f4; }
.dash-table th { color: var(--muted); font-weight: 600; text-align: left; }
.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table tfoot td { font-weight: 700; border-bottom: 0; }
.dash-skeleton { display: flex; flex-direction: column; gap: 12px; padding: 6px 4px; }
.dash-skeleton span { height: 20px; border-radius: 4px; background: linear-gradient(90deg, #eef1f4 25%, #f6f8f9 50%, #eef1f4 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.dash-skeleton span:nth-child(2) { width: 75%; }
.dash-skeleton span:nth-child(3) { width: 55%; }
.dash-skeleton span:nth-child(4) { width: 35%; }
.dash-error { padding: 12px 14px; border: 1px dashed #e8b4b6; border-radius: var(--radius); background: #fdf3f3; color: var(--text-2); }
.dash-tip {
  position: fixed; z-index: 50; max-width: 280px; padding: 8px 10px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  color: var(--text); font-size: .85rem; line-height: 1.4;
}
@media (max-width: 1200px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Reports (sent to donors) ---------- */
/* Series colours: validated pair (Manual = slot 1 blue, Automation = slot 2 orange). Text never uses them. */
.rpt { --c-manual: #2a78d6; --c-auto: #eb6834; font-size: 1.15rem; }
body.page-reports { background: #ffffff; }
body.page-reports .page-title { font-size: 1.75rem; }
.rpt .panel { padding: 20px 22px; border-radius: 12px; }

.period-tabs { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.period-tab {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 12px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-sm);
  color: #000; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.period-tab:hover { border-color: var(--brand); color: #000; transform: translateY(-1px); box-shadow: var(--shadow); }
.period-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(15,118,110,.28); }
.period-name { font-size: 1.1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.period-count { font-size: 2.1rem; font-weight: 700; line-height: 1.1; }
.period-split { font-size: .9rem; font-variant-numeric: tabular-nums; }
.period-range { margin: 0 0 18px; font-size: 1.2rem; color: var(--text-2); }

.rpt-hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.rpt-total { display: flex; align-items: center; gap: 24px; }
.rpt-total-main { flex: 1; min-width: 0; }
.rpt-pie { flex: none; width: 180px; display: flex; justify-content: center; }
.rpt-pie svg { display: block; }
.rpt-pie .pie-slice { cursor: default; transition: filter .15s; }
.rpt-pie .pie-slice:hover, .rpt-pie .pie-slice:focus { filter: brightness(1.1); outline: none; }
@media (max-width: 640px) { .rpt-total { flex-direction: column; align-items: stretch; } .rpt-pie { width: auto; } }
.rpt-label { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: 600; color: var(--text-2); }
.rpt-hero-value { display: block; margin: 2px 0 12px; font-size: 4rem; font-weight: 700; line-height: 1; color: var(--text); }
.rpt-kpi { display: flex; flex-direction: column; gap: 6px; }
.rpt-kpi-value { font-size: 3rem; font-weight: 700; line-height: 1.05; color: var(--text); }
.rpt-kpi-sub { font-size: 1.05rem; color: var(--muted); }
/* Share / user count under the manual and automation totals. Tinted chips, dark text (never the series colour as text). */
.rpt-kpi-stats { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 6px; }
.stat-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 1.1rem; font-weight: 500; }
.stat-chip b { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-chip.chip-manual { background: #eaf2fc; border-color: #9ec5f4; }
.stat-chip.chip-manual b { color: #184f95; }
.stat-chip.chip-auto { background: #fdefe8; border-color: #f5b99f; }
.stat-chip.chip-auto b { color: #9a3a10; }

/* Tall segmented bar: one whole split into parts, share printed inside. */
.seg-bar { display: flex; gap: 2px; height: 28px; margin-bottom: 10px; }
.seg { display: flex; align-items: center; min-width: 4px; padding: 0 10px; border-radius: 4px; color: #fff; font-size: .95rem; overflow: hidden; white-space: nowrap; cursor: default; }
.seg b { font-weight: 700; }
.seg-manual { background: var(--c-manual); }
.seg-auto { background: var(--c-auto); }
.seg:hover, .seg:focus-visible { filter: brightness(1.08); outline: none; }
.seg-empty { display: flex; align-items: center; width: 100%; padding: 0 12px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-size: 1rem; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 1.05rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend-row { margin: 0 0 6px; }
/* Legend under the hero total: larger, as tinted chips with each part's count. */
.legend-strong { gap: 10px 12px; }
.legend-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 1.2rem; font-weight: 600; color: var(--text); }
.legend-chip b { font-size: 1.3rem; font-weight: 700; }
.legend-chip .key { width: 16px; height: 16px; }
.legend-chip.chip-manual { background: #eaf2fc; border-color: #9ec5f4; }
.legend-chip.chip-auto { background: #fdefe8; border-color: #f5b99f; }
.key { display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex: none; }
.key-manual { background: var(--c-manual); }
.key-auto { background: var(--c-auto); }

.rpt-panel { margin-bottom: 16px; }
.rpt-panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.rpt-title { margin: 0; font-size: 1.45rem; font-weight: 700; color: var(--text); }
.rpt-sub { font-size: 1.05rem; color: var(--muted); }
.rpt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.rpt-tools .btn.active { background: var(--brand-50); border-color: var(--brand); color: var(--brand-700); }
.rpt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rpt-grid .rpt-panel { margin-bottom: 16px; }
.rpt-empty { margin: 8px 0; font-size: 1.1rem; color: var(--muted); }
.rpt .dash-table { font-size: 1.1rem; }
.rpt .dash-table th, .rpt .dash-table td { padding: 10px 12px; }
.sent-table-scroll { overflow-x: auto; }

.chart { width: 100%; min-height: 60px; }
.chart svg { display: block; overflow: visible; font-family: inherit; }
.chart .tick { font-size: 14px; fill: #6b6a66; font-variant-numeric: tabular-nums; }
/* Days outside the selected period step back a little; the period's band and labels carry the emphasis. */
.chart .col.off path { opacity: .55; }
.chart .col.hover path { opacity: 1; }
.chart .col.hover path, .chart .hb .seg:hover, .chart .hb .seg:focus { filter: brightness(1.12); }
.chart .hit:focus, .chart .hb .seg:focus { outline: none; }
.chart .col .hit:focus-visible { stroke: var(--brand); stroke-width: 2; }

.dash-tip .tip-title { margin-bottom: 4px; font-weight: 600; color: var(--text-2); }
.dash-tip .tip-row { display: flex; align-items: center; gap: 8px; }
.dash-tip .tip-row strong { min-width: 2.5em; font-size: 1.05rem; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-tip .tip-row span { color: var(--muted); }
.dash-tip .tip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.page-reports .dash-tip { font-size: 1rem; max-width: 320px; }


@media (max-width: 1200px) { .period-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); } .rpt-hero { grid-template-columns: 1fr 1fr; } .rpt-total { grid-column: 1 / -1; } }
@media (max-width: 1000px) { .rpt-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .period-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rpt-hero { grid-template-columns: 1fr; } .rpt-hero-value { font-size: 3.2rem; } }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .kpi-row { grid-template-columns: 1fr; } .bar-row { grid-template-columns: minmax(120px, 45%) minmax(0, 1fr) 60px; } }

/* ---------- list screens ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end;
  margin-bottom: 16px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.filters label:not(.inline), .filters .filter-field { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: .9rem; font-weight: 600; color: #000; }
.filters label.inline { color: #000; }
.filters select, .filters input[type=text], .filters input:not([type]) {
  min-width: 160px; height: 34px; padding: 4px 10px;
  font-size: .95rem; font-weight: 400; color: var(--text);
  background-color: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.filters select:hover, .filters input:hover { border-color: #b7c1c8; }
.filters select:focus, .filters input:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
.filters input:disabled { background: var(--surface-2); color: var(--muted); }
/* Wide text boxes, e.g. full Report IDs like "R2005220015-5034 -ORP-BGD01-23-100-36196". */
.filters input.filter-wide { width: 340px; max-width: calc(100vw - 80px); }
.filter-actions { display: flex; gap: 8px; }
/* Multi-select dropdown (a <details> of checkboxes) that looks like the filter selects. */
.multi-select { position: relative; }
.multi-select > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center;
  width: 180px; height: 34px; padding: 4px 30px 4px 10px;
  font-size: .95rem; font-weight: 400; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 12px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.multi-select > summary::-webkit-details-marker { display: none; }
.multi-select > summary:hover { border-color: #b7c1c8; }
.multi-select > summary:focus-visible, .multi-select[open] > summary { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
.multi-select-panel {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(360px, calc(100vw - 32px));
  max-height: 320px; overflow-y: auto; padding: 6px 0;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.multi-select-panel label.inline { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: .92rem; font-weight: 400; cursor: pointer; }
.multi-select-panel label.inline:hover { background: var(--surface-2); }
.multi-select-head { display: flex; align-items: center; gap: 12px; padding-right: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.multi-select-panel .multi-select-all { flex: 1; font-weight: 600; }
.multi-select-head .btn { padding: 2px 14px; }
/* Forces the filters after it onto a new row. */
.filter-row-break { flex-basis: 100%; height: 0; margin-bottom: -12px; } /* cancels the extra row gap */
.filter-actions .btn-sm { height: 34px; }
/* Food Pack Month / Year: previous and next buttons on either side of the drop-down. */
.select-step { display: flex; align-items: center; gap: 4px; }
.select-step .btn-sm { height: 34px; min-width: 30px; padding: 0 8px; font-size: 1.1rem; line-height: 1; }
.local-drive { display: flex; flex-basis: 100%; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 1rem; }
.local-drive input[type=text] { flex: 0 1 440px; }
/* Orphan Quarter list: on the same row as Search / Refresh / Reset instead of its own row. */
.local-drive.beside-actions { flex: 1 1 520px; min-height: 34px; padding-top: 0; border-top: 0; margin-left: 12px; }

.status-cards { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.status-card {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  width: 200px; min-height: 86px; padding: 12px 16px 12px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--accent); text-decoration: none; overflow: hidden; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.status-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.status-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16,24,40,.10); color: var(--accent); }
.status-card .count { font-size: 2.1rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.status-card .caption { font-size: 1.05rem; font-weight: 500; color: var(--text-2); line-height: 1.25; }
.status-card.filled { background: var(--accent); border-color: var(--accent); color: #fff; }
.status-card.filled::before { background: rgba(255,255,255,.35); }
.status-card.filled .caption { color: #fff; }
.status-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow); }

.grid-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 8px; font-size: 1.05rem; }
.grid-toolbar strong { font-weight: 700; color: var(--brand-700); }
.grid-toolbar select { height: 30px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.table-wrap {
  /* site.js sets max-height to exactly 15 rows; this is the fallback before it runs. */
  overflow: auto; max-height: 620px; min-height: 300px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* Pager: on the right of the toolbar row above every list grid */
.grid-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 10px; color: var(--text-2); font-size: 1rem; }
.grid-pager.in-toolbar { margin: 0 0 0 auto; gap: 8px 14px; }
.grid-pager.in-toolbar .pager-pages { margin-left: 0; }
.grid-pager-bottom > .grid-pager { margin: 0 0 0 auto; }
.pager-size { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.pager-size select { height: 32px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.pager-info { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.pager-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
.pager-pages[hidden] { display: none; }
.pager-btn { min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.pager-btn:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.pager-btn.current { background: var(--brand); border-color: var(--brand); color: #fff; cursor: default; }
.pager-btn:disabled { opacity: .4; cursor: default; }
.pager-btn:focus-visible { outline: 3px solid var(--brand-100); outline-offset: 1px; }
.pager-gap { padding: 0 4px; color: var(--muted); }
@media (max-width: 700px) { .pager-pages { margin-left: 0; } .grid-pager.in-toolbar { margin-left: 0; } }
.report-grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .95rem; }
.report-grid th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 10px; text-align: left; white-space: nowrap; user-select: none; cursor: pointer;
  background: var(--nav-bg); color: #fff; font-weight: 600; border-bottom: 1px solid var(--nav-bg);
}
.report-grid th:hover { color: #fff; background: #134047; }
.report-grid th.view-col:hover, .report-grid th.no-sort:hover { background: var(--nav-bg); }
.report-grid th[data-dir=asc]::after { content: " ▲"; font-size: .7em; color: #2dd4bf; }
.report-grid th[data-dir=desc]::after { content: " ▼"; font-size: .7em; color: #2dd4bf; }
.report-grid td { padding: 8px 10px; white-space: nowrap; border-bottom: 1px solid #eef1f4; color: var(--text); }
.report-grid tbody tr[data-key]:nth-child(even) { background: #fbfcfd; }
.report-grid tbody tr[data-key]:hover { background: var(--brand-50); }
.report-grid tbody tr.selected, .report-grid tbody tr.selected:hover { background: var(--brand-100); }
/* Wash list: completed 30+ days ago - work on these first. */
.report-grid tbody tr.row-overdue, .report-grid tbody tr.row-overdue:nth-child(even) { background: #fdeceb; }
.report-grid tbody tr.row-overdue:hover { background: #fbdcda; }
.report-grid tbody tr.row-overdue td:first-child { box-shadow: inset 4px 0 0 #c62828; }
.report-grid tbody tr.row-overdue.selected { background: var(--brand-100); }
.overdue-badge { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: #c62828; color: #fff; font-size: .78em; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.overdue-note { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: #fdeceb; color: #8e1c1c; font-size: .9em; }
.overdue-key { width: 12px; height: 12px; border-radius: 3px; background: #fdeceb; box-shadow: inset 3px 0 0 #c62828, 0 0 0 1px #e9a5a3; }
.report-grid tr.group-row td { background: #eef3f5; font-weight: 700; color: var(--text-2); border-bottom-color: var(--border); }
.report-grid th.view-col { width: 44px; cursor: default; }
.report-grid td.view-col { padding: 4px 6px; text-align: center; }
.report-grid th.center, .report-grid td.center { text-align: center; }
.view-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--brand); cursor: pointer;
}
.view-btn:hover, .view-btn:focus-visible { background: var(--brand-100); border-color: #9fd3cc; }

/* ---------- detail screens ---------- */
.detail-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.detail-topbar > a:not(.btn) { font-weight: 500; }
/* Previous / Next Record buttons, pushed to the right of the top bar. */
.record-nav { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.record-nav .muted { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Loading banner above the pictures on the detail pages */
.images-loading { position: sticky; top: 8px; z-index: 3; display: flex; align-items: center; gap: 16px; margin: 0 0 12px; padding: 16px 20px; border: 1px solid var(--brand-100); border-left: 4px solid var(--brand); border-radius: var(--radius); background: var(--brand-50); color: var(--brand-700); box-shadow: var(--shadow); }
.images-loading[hidden] { display: none; }
.images-loading .spinner-lg { flex: none; width: 34px; height: 34px; border-width: 4px; }
.il-body { flex: 1; min-width: 0; }
.il-text { display: block; font-size: 1.1rem; font-weight: 700; }
.il-bar { height: 8px; margin-top: 10px; max-width: 480px; border-radius: 999px; background: var(--brand-100); overflow: hidden; }
.il-bar span { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .3s ease-out; }
.il-bar.indeterminate span { width: 35%; animation: il-slide 1.2s ease-in-out infinite; }
@keyframes il-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.spinner { width: 14px; height: 14px; border: 2px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.face-summary { font-weight: 700; }
.face-summary.red { color: var(--mismatch); }
.face-summary.green { color: var(--match); }
.face-summary.gray { color: var(--muted); }
.next-record-banner { margin-bottom: 10px; padding: 10px 14px; border: 1px solid #f3dd9c; border-radius: var(--radius-sm); background: #fff6dd; color: #6b4600; font-weight: 600; }

.detail-layout { display: grid; gap: 16px; align-items: start; }
/* Highlighted block of rows inside a .fields list (Quarterly detail: the orphan's details).
   subgrid keeps its label/value columns aligned with the rest of the list. */
.fields .fields-highlight {
  grid-column: 1 / -1; display: grid; grid-template-columns: subgrid;
  margin: 4px -10px; padding: 0 10px;
  background: #e6f4f1; border-left: 4px solid #14857c; border-radius: var(--radius-sm);
}
.fields .fields-highlight dt, .fields .fields-highlight dd { border-bottom-color: #c7e6e0; }
.fields .fields-highlight dt { color: #3c5a57; }
.fields .fields-highlight > :nth-last-child(-n+2) { border-bottom: 0; }
/* Orphan Quarterly: details (fixed) | pictures (takes the rest, 3 per row) | profile + actions. */
.detail-layout.three { grid-template-columns: 400px minmax(0, 1fr) 280px; }
.detail-layout.two { grid-template-columns: minmax(320px, 400px) 1fr; }
@media (max-width: 1200px) { .detail-layout.three { grid-template-columns: 1fr 1fr; } .detail-layout.three .images-panel { grid-column: 1 / -1; order: 3; } }
@media (max-width: 900px) { .detail-layout.two, .detail-layout.three { grid-template-columns: 1fr; } }

.fields { display: grid; grid-template-columns: minmax(130px, auto) 1fr; margin: 0 0 10px; font-size: .92rem; }
.fields dt, .fields dd { padding: 6px 0; border-bottom: 1px solid #eef1f4; }
.fields dt { padding-right: 12px; color: var(--muted); font-weight: 500; }
.fields dd { margin: 0; font-weight: 600; color: var(--text); word-break: break-word; }
.field-label { display: block; margin: 12px 0 4px; font-size: .85rem; font-weight: 600; color: var(--text-2); }
.panel textarea, .group input[type=email] {
  width: 100%; padding: 6px 10px; font-size: .95rem; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.panel textarea:focus, .group input[type=email]:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }

.profile { margin: 0 0 12px; text-align: center; }
.profile img { width: 100%; max-height: 270px; object-fit: contain; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.profile figcaption { margin-top: 8px; font-weight: 700; font-size: 28px; line-height: 1.2; }
.boy { color: var(--boy); }
.girl { color: var(--girl); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
/* Icon-only buttons (name shows as a tooltip) */
.icon-btn-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.btn-icon { display: inline-grid; place-items: center; width: 38px; height: 34px; padding: 0; }
.btn-icon svg { width: 18px; height: 18px; fill: currentColor; }

.group {
  display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
/* float makes the legend an ordinary child, so it sits inside the box instead of on its border */
.group legend {
  float: left; width: 100%; margin: 0 0 2px; padding: 0;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.group.inline-group { flex-direction: row; flex-wrap: wrap; align-items: center; }
.group.inline-group legend { width: 100%; }
.group.inline-group input[type=email] { width: 280px; }
.group.test-mode { flex-direction: row; align-items: center; }
.group.test-mode label { white-space: nowrap; font-weight: 500; }

.images-panel { min-width: 0; }
.image-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.image-toolbar #reportName { font-weight: 600; }
.image-toolbar select { height: 32px; padding: 2px 8px; font-size: .95rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.image-toolbar select:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
#imageSource { font-size: .85rem; }
/* Inventory detail: image source beside Force Refresh */
.source-badge:empty { display: none; }
.source-badge { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 500; }
/* Inventory detail: details | pictures | actions section (selection, template, actions, remarks) */
.detail-layout.inventory { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) 300px; }
.picture-actions { position: sticky; top: 12px; }
.picture-actions .image-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
.picture-actions .image-toolbar .field-label { margin: 4px 0 0; }
.picture-actions .group { margin: 12px 0 0; }
.picture-actions .group.inline-group input[type=email] { width: 100%; }
.picture-actions .group .btn-danger { align-self: flex-start; }
.picture-actions .approve-send-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: 100%; padding-top: 8px; border-top: 1px solid var(--border, #e3e6ea); }
.picture-actions .approve-send-row input[type=email] { flex: 1 1 220px; width: auto; }
.picture-actions .action-blocked { width: 100%; margin: 0; padding: 8px 12px; border: 1px solid #f3b8bb; border-left: 4px solid #c62828; border-radius: 6px; background: #fdecec; color: #a3191f; font-weight: 600; font-size: .9rem; }
.picture-actions .action-blocked[hidden] { display: none; }
@media (max-width: 1200px) { .detail-layout.inventory { grid-template-columns: 1fr 1fr; } .detail-layout.inventory .images-panel { grid-column: 1 / -1; order: 3; } .picture-actions { position: static; } }
@media (max-width: 900px) { .detail-layout.inventory { grid-template-columns: 1fr; } }
/* Orphan detail: select-all + selection totals in the Pictures header */
.selection-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.selection-bar label.inline { font-weight: 600; }
.selection-bar #lblTotalImageSelected, .selection-bar #lblTotalImageSize { color: var(--text-2); }
.image-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
/* Shown when a loaded record has no distribution pictures */
.images-empty { display: flex; gap: 14px; align-items: flex-start; margin-top: 12px; padding: 18px 20px; border: 1px dashed #e8b4b6; border-radius: var(--radius); background: #fdf3f3; color: var(--text-2); }
.images-empty svg { flex: none; width: 34px; height: 34px; fill: var(--danger); opacity: .85; }
.images-empty strong { display: block; margin-bottom: 4px; color: var(--danger); font-size: 1.02rem; }
.images-empty span { display: block; line-height: 1.45; }
.img-card {
  overflow: hidden; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: box-shadow .15s, border-color .15s, transform .15s;
}
.img-card:hover { box-shadow: 0 6px 16px rgba(16,24,40,.12); }
.image-grid.quarterly { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.image-grid.quarterly .img-card { width: auto; min-width: 0; }
.image-grid.quarterly .img-card img { height: 220px; }
/* Aqeeqah / Inventory: "Images per row" dropdown sets --per-row; cards share the width and images stay square. */
.image-grid.inventory, .image-grid.aqeeqah { display: grid; grid-template-columns: repeat(var(--per-row, 2), minmax(0, 1fr)); }
.image-grid.inventory .img-card, .image-grid.aqeeqah .img-card { width: auto; min-width: 0; }
.image-grid.inventory .img-card img, .image-grid.aqeeqah .img-card img { height: auto; aspect-ratio: 1 / 1; }
.images-panel > .image-grid:first-child, .images-panel > .images-loading:first-child + .image-grid { margin-top: 0; }
.picture-actions .per-row { display: flex; align-items: center; gap: 8px; }
.picture-actions .per-row select { width: 70px; }
.image-grid.foodpack { margin-bottom: 12px; }
/* Food pack: the single beneficiary picture fills the whole section. */
.image-grid.foodpack .img-card { width: 100%; }
.image-grid.foodpack .img-card img { height: auto; max-height: 80vh; }
.image-grid.foodpack .img-card-head { display: none; }
/* Food packs do not save which pictures are included, so the Show / Include controls are hidden. */
.image-grid.foodpack .img-card-head label, .foodpack-detail #includeButtons, .foodpack-detail .include-state { display: none; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.img-card.included { background: #f1efff; border-color: #c9c2f2; }
/* Last picture moved by drag-and-drop: strong amber highlight + "Moved" tag. */
.img-card.dragged { background: #fff3c4; border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .45), 0 6px 16px rgba(16,24,40,.12); }
.img-card.dragged .img-card-head { background: #fde68a; border-bottom-color: #f59e0b; }
.img-card.dragged .img-card-head::after { content: "Moved"; margin-left: auto; padding: 1px 8px; border-radius: 999px; background: #b45309; color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .03em; }
.img-card.dragging { opacity: .45; transform: scale(.97); }
/* Card under the pointer while dragging: where the picture will be dropped. */
.img-card.drop-target { border-color: var(--brand); border-style: dashed; box-shadow: 0 0 0 3px rgba(15, 118, 110, .3); }
.img-card[draggable=true] { cursor: grab; }
.img-card.face-Match { border-color: var(--match); }
.img-card.face-Mismatch, .img-card.face-NoFaceDetected, .img-card.face-VerificationError { border-color: var(--mismatch); }
.img-card-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: .88rem; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.6); }
.img-card-head label { font-size: .95rem; font-weight: 500; }
.img-card-head input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }
/* Date on the right of the card head; the Show checkbox stays on the left. */
.img-date { margin-left: auto; text-align: right; white-space: nowrap; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.badge-face { font-weight: 700; font-size: .8rem; }
.face-Match .badge-face { color: var(--match); }
.face-Mismatch .badge-face, .face-NoFaceDetected .badge-face, .face-VerificationError .badge-face { color: var(--mismatch); }
/* Thumbnails fill their card (cropping the edges if needed); the viewer still shows the whole picture. */
.img-card img { display: block; width: 100%; object-fit: cover; object-position: center; background: #f1f4f6; cursor: zoom-in; }
input[type=checkbox] { accent-color: var(--brand); }

/* ---------- timings (panel removed from pages; styles kept for the shared script) ---------- */
.timing-table { border-collapse: collapse; width: 100%; font-size: .8rem; }
.timing-table th, .timing-table td { padding: 3px 6px; border-bottom: 1px solid #eef1f2; vertical-align: top; }

/* ---------- dialogs ---------- */
.image-viewer, .message-box { padding: 0; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.image-viewer::backdrop, .message-box::backdrop { background: rgba(15, 23, 30, .55); backdrop-filter: blur(2px); }
.image-viewer { width: min(1200px, 96vw); }
.viewer-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.viewer-head strong { font-size: 1.05rem; }
.viewer-body { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 12px 16px; background: var(--surface-2); }
.viewer-body.with-profile { grid-template-columns: 220px 1fr; }
.viewer-body figure { margin: 0; text-align: center; }
.viewer-body figcaption { margin-top: 4px; color: var(--muted); font-size: .85rem; }
.viewer-body img { width: 100%; max-height: 68vh; object-fit: contain; background: #e9edf0; border-radius: var(--radius); }
.viewer-meta, .viewer-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 10px 16px; }
.viewer-meta { border-top: 1px solid var(--border); color: var(--text-2); }
.viewer-actions { padding-top: 0; padding-bottom: 14px; }

/* Picture viewer: large modal, actions stacked in the right column */
.picture-viewer { width: min(1600px, 97vw); max-height: 96vh; }
.viewer-body.with-side { grid-template-columns: minmax(0, 1fr) 250px; align-items: start; }
.picture-viewer .viewer-main img { max-height: 82vh; }
.viewer-side { display: flex; flex-direction: column; gap: 12px; }
.viewer-side figure img { max-height: 260px; }
.viewer-info { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2); font-size: .9rem; word-break: break-all; }
.viewer-info #lblImgNumber { font-weight: 700; color: var(--text); }
.viewer-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* Two buttons side by side (Include / Exclude, Rotate / Open) */
.viewer-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.viewer-side .btn svg { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; }
.viewer-side .btn:disabled { opacity: .45; }
/* Included / Excluded state under the picture details */
.include-state { display: inline-flex; align-self: flex-start; margin-top: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 1.5rem; line-height: 1.3; }
.include-state.is-included { background: #e3f4e8; color: #146c2e; border: 1px solid #9fd5b0; }
.include-state.is-excluded { background: #fdecec; color: #a3191f; border: 1px solid #f6c5c7; }
.viewer-side .btn { width: 100%; padding-top: 7px; padding-bottom: 7px; font-weight: 600; }
@media (max-width: 800px) { .viewer-body.with-side { grid-template-columns: 1fr; } .viewer-side { order: 2; } }
/* Zoom: the picture scales inside its frame; drag to move around while zoomed in. */
.viewer-zoom { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.viewer-zoom .btn { font-size: 1rem; }
.viewer-main { overflow: hidden; border-radius: var(--radius); }
.viewer-main img { transform-origin: center; transition: transform .12s ease-out; touch-action: none; user-select: none; }
.viewer-main img.zoomed { cursor: grab; }
.viewer-main img.panning { cursor: grabbing; transition: none; }

.zoomable { cursor: zoom-in; transition: box-shadow .15s; }
.zoomable:hover { box-shadow: 0 0 0 3px var(--brand-100); }
.profile-viewer { width: min(720px, 94vw); }
.profile-viewer .viewer-body img { max-height: 72vh; }
.message-box { min-width: 360px; max-width: 560px; }
.message-box .mb-title { display: flex; align-items: center; gap: 8px; padding: 14px 18px 4px; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.message-box .mb-title::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.message-box[data-severity=error] .mb-title::before { background: var(--danger); }
.message-box[data-severity=warning] .mb-title::before { background: #e8a10e; }
.message-box[data-severity=question] .mb-title::before { background: #2563eb; }
.message-box .mb-text { padding: 6px 18px 16px 36px; color: var(--text-2); white-space: pre-line; line-height: 1.5; }
.message-box .mb-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Login page ---------- */
.login-body { margin: 0; min-height: 100vh; background: var(--page-bg); }
.login-body *, .login-body *::before, .login-body *::after { box-sizing: border-box; }
.login { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); min-height: 100vh; }
/* Left: light brand panel */
.login-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 18px;
  padding: 48px clamp(24px, 6vw, 88px);
  background: radial-gradient(circle at 15% 10%, #d3eeea 0, transparent 45%), radial-gradient(circle at 90% 90%, #e0eafc 0, transparent 40%), linear-gradient(160deg, #f4fbfa, #eef4f8);
}
.login-brand { position: absolute; top: 32px; left: clamp(24px, 6vw, 88px); display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark { width: 40px; height: 40px; font-size: 1.2rem; }
.login-brand-text { display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.login-brand-text small { font-weight: 500; font-size: .85rem; color: var(--muted); }
.login-headline { margin: 0; max-width: 560px; font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.2; font-weight: 700; color: var(--text); }
.login-lead { margin: 0; max-width: 520px; font-size: 1.1rem; color: var(--text-2); }
.login-foot { position: absolute; bottom: 24px; left: clamp(24px, 6vw, 88px); margin: 0; font-size: .85rem; color: var(--muted); }
/* Right: sign-in card */
.login-panel { display: grid; place-items: center; padding: 32px 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; animation: login-rise .45s ease-out both; }
.login-card .env-badge { display: inline-block; margin-bottom: 18px; }
.login-title { margin: 0 0 6px; font-size: 2rem; font-weight: 700; color: var(--text); }
.login-text { margin: 0 0 24px; font-size: 1.05rem; color: var(--text-2); }
.login-note { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700); font-weight: 600; }
.login-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 52px; padding: 12px 18px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--text); font-size: 1.05rem; font-weight: 600; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, background .15s, transform .1s;
}
.login-btn:hover { border-color: var(--brand); background: var(--brand-50); color: var(--text); box-shadow: 0 4px 14px rgba(15,118,110,.15); }
.login-btn:active { transform: translateY(1px); }
.login-btn:focus-visible { outline: 3px solid var(--brand-100); outline-offset: 2px; border-color: var(--brand); }
.ms-logo { width: 21px; height: 21px; flex: none; }
.login-spinner { display: none; width: 18px; height: 18px; border: 2px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: login-spin .7s linear infinite; }
.login-btn.is-busy { pointer-events: none; background: var(--surface-2); color: var(--muted); }
.login-btn.is-busy .login-spinner { display: inline-block; }
.login-help { margin: 18px 0 0; font-size: .92rem; color: var(--muted); line-height: 1.5; }
@keyframes login-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes login-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .login-card { animation: none; } .login-spinner { animation-duration: 2s; } }
@media (max-width: 900px) {
  .login { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .login-hero { padding: 96px 24px 32px; }
  .login-brand { left: 24px; top: 24px; }
  .login-foot { display: none; }
  .login-panel { padding: 32px 16px 48px; }
}
@media (max-width: 560px) { .login-headline { font-size: 1.6rem; } }

/* ---------- Detail screens: collapsible Record details (site.js collapsibleDetails) ---------- */
.record-panel > .panel-title { display: flex; align-items: center; gap: 8px; }
.collapse-btn { margin-left: auto; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--border, #dfe3e8); border-radius: 6px; background: #fff; color: var(--text-2, #4b5563); cursor: pointer; }
.collapse-btn:hover, .record-strip:hover { border-color: var(--brand); color: var(--brand); }
.collapse-btn svg, .record-strip svg { width: 18px; height: 18px; fill: currentColor; }
.record-strip { display: none; }
.record-panel.collapsed { padding: 0; overflow: hidden; }
.record-panel.collapsed > :not(.record-strip) { display: none !important; }
.record-panel.collapsed > .record-strip {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; background: transparent;
    color: var(--text-2, #4b5563); font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; border-radius: inherit;
}
@media (min-width: 1201px) {
    .detail-layout.three.details-collapsed { grid-template-columns: 48px minmax(0, 1fr) 280px; }
    .detail-layout.inventory.details-collapsed { grid-template-columns: 48px minmax(0, 1fr) 300px; }
    .record-panel.collapsed { position: sticky; top: 12px; }
    .record-panel.collapsed > .record-strip { flex-direction: column; justify-content: flex-start; min-height: 260px; padding: 14px 0; }
    .record-panel.collapsed > .record-strip span { writing-mode: vertical-rl; transform: rotate(180deg); }
}
