/* DatumForms Modern Premium CSS Design System */

:root {
  /* DatumForms brand tokens (BRANDING.md, assets/brand/tokens.css). The older names below are kept as aliases
     so every screen and the admin pages' shadow roots pick the brand up without renaming. */
  --df-brand: #0057ff;
  --df-brand-hover: #0046d1;
  --df-ink: #0f172a;
  --df-muted: #475569;
  --df-surface: #f8fafc;
  --df-rule: #dbe1e9;
  --df-input-border: #8493a7;
  --df-paper: #f0eee8;
  --df-success: #067647;
  --df-error: #b42318;
  --df-radius: 4px;
  --df-card-radius: 6px;
  --df-font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --bg-app: var(--df-surface);
  --bg-surface: #ffffff;
  --bg-surface-solid: #ffffff;
  --border-color: var(--df-rule);
  --input-border: var(--df-input-border);
  --text-primary: var(--df-ink);
  --text-main: var(--df-ink);
  --text-secondary: var(--df-muted);
  /* #64748b keeps 4.7:1 contrast on white; the older #94a3b8 did not */
  --text-muted: #64748b;
  --text-subtle: #64748b;

  --primary: var(--df-brand);
  --primary-hover: var(--df-brand-hover);
  --primary-light: var(--df-brand);
  --primary-glow: rgba(0, 87, 255, 0.18);
  --accent: var(--df-brand);

  --brand-blue: var(--df-brand);
  --brand-blue-hover: var(--df-brand-hover);
  --brand-blue-soft: #eef4ff;
  --brand-blue-glow: rgba(0, 87, 255, 0.18);

  --success: var(--df-success);
  --success-soft: #ecfdf3;
  --danger: var(--df-error);
  --danger-soft: #fef3f2;
  /* Waiting and pending states are neutral (owner decision, 4 November 2026): only success and errors carry colour */
  --pending: var(--df-muted);
  --pending-soft: #f1f5f9;
  --pending-rule: var(--df-rule);

  --radius: var(--df-radius);
  --card-radius: var(--df-card-radius);
  --glass-blur: none;
  --shadow-premium: none;
  --shadow-glass: none;
  --transition-smooth: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;

  /* Spacing scale (4px steps) - use these for padding / margin / gap instead of one-off pixel values */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* The distance from the window / Project Console edge to page content, and inside a card. Narrowed on small
     screens below. Custom properties reach into the admin pages' shadow roots too (logType3/shared/bs3.js). */
  --page-gutter: var(--space-6);
  --card-padding: var(--space-6);
}

@media (max-width: 900px) {
  :root {
    --page-gutter: var(--space-3);
    --card-padding: var(--space-4);
  }
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--df-font-body);
  font-size: 15px;
  line-height: 1.5;
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  /* Matches real production's own body rule in unique.css - a project's
     Edit Page Branding background image (nominee/judge views only, see
     header.php's projectPage('background') usage) is applied inline via
     backgroundImage in app.js's updateDOMBranding; this just makes it
     cover the viewport the same way production's does. */
  background-size: cover;
}

/* Glassmorphism utility */
.glassmorphism {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color);
}

/* Keyboard focus is always visible */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--df-brand);
  outline-offset: 2px;
}

a {
  color: var(--df-brand);
}

/* App structure */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header style */
.app-header {
  height: 64px;
  background: #ffffff;
  color: var(--df-ink);
  border-bottom: 1px solid var(--df-rule);
  padding: 0 var(--page-gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  margin-bottom: var(--space-6);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.5px;
  cursor: pointer;
}

.logo-icon {
  color: var(--primary);
}

.logo-highlight {
  color: var(--primary);
}

.header-nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--df-surface);
}

.nav-link.active {
  color: #fff;
  background: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--border-color);
}

.profile-name {
  /* Hidden per request - the header only needs the Logout button, not the
     logged-in user's own name/label displayed beside it. */
  display: none;
}

/* Main layouts */
.app-main {
  flex: 1;
  padding: 0 var(--page-gutter) var(--space-10);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.view-container {
  display: none;
  width: 100%;
}

.view-container.active {
  display: block;
}

/* Buttons style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-primary:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-outline {
  background: transparent;
  border: 1px solid currentColor;
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--df-surface);
}

/* Secondary actions: outlined on white */
.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--input-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--df-surface);
  border-color: var(--text-secondary);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-success:hover,
.btn-danger:hover {
  filter: brightness(0.92);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 14px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background: var(--df-surface);
  color: var(--text-primary);
}

.btn-icon-round {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.btn-text:hover {
  color: var(--text-primary);
}

.btn-text.highlight {
  color: var(--primary);
  font-weight: 600;
}

/* Forms input style */
.form-group {
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: #ffffff;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  min-height: 44px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Auth Cards */
.auth-section {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 150px);
  width: 100%;
}

.auth-section.active {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 32px;
  border-radius: var(--card-radius);
  margin: 0 auto;
}

.signup-card {
  max-width: 580px;
}

.auth-header {
  text-align: left;
  margin-bottom: 28px;
}

.auth-header h2 {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Dashboard views styling */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  border-radius: var(--card-radius);
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
}

.span-3 {
  grid-column: span 3;
}

.banner-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 40px;
}

.banner-content h1 {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin-bottom: 12px;
}

.banner-content p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 600px;
  line-height: 1.6;
}

.banner-stats {
  display: flex;
  gap: 32px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

.card-header {
  margin-bottom: var(--space-5);
}

.card-header h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.border-bottom {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-4);
}

.border-top {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-4);
}

/* Lists styling */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  transition: var(--transition-smooth);
}

.list-item.clickable:hover {
  cursor: pointer;
  background: var(--df-surface);
  border-color: var(--primary);
}

.item-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--brand-blue-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.item-details h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.item-details p {
  font-size: 13px;
  color: var(--text-secondary);
}

.arrow-icon {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  transition: var(--transition-smooth);
}

.list-item:hover .arrow-icon {
  color: var(--primary);
}

.scrollable-list {
  max-height: 280px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 40px 20px;
}

.progress-container {
  margin-top: 12px;
}

.progress-bar-track {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-page-header-card {
  text-align: center;
  padding: 32px 24px;
}

.form-page-title {
  margin: 0 0 20px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.5px;
  line-height: 1.25;
}

/* Edge-to-edge grid of bordered tab buttons, matching real production
   (nav-tabs style, not the rounded/pill chips this used to be) - each
   button's own border forms the grid lines between cells. */
.form-pages-list {
  list-style: none;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--df-rule);
  border-left: 1px solid var(--df-rule);
}

.form-page-tab {
  flex: 0 0 auto;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border-right: 1px solid var(--df-rule);
  border-bottom: 1px solid var(--df-rule);
  transition: var(--transition-smooth);
}

.form-page-tab:hover {
  background: var(--df-surface);
  color: var(--text-primary);
}

.form-page-tab.active {
  background: var(--primary);
  color: #ffffff;
}

/* "Display type for multipage" Theme 3 (Edit Page Branding's design=2) -
   ported directly from real production's own .progressbar rules in
   assets/css/unique.css, applied there via navGator(buttons, 1, design) in
   data_pro.js: a numbered circular step per page joined by a connecting
   line, current page in blue ("veryactive"). Completed-page coloring
   ("active" = green in real production) isn't wired here yet - it needs a
   per-page completion flag that the app's get-all-questions endpoint
   doesn't currently return. */
.form-pages-list.pages-progressbar {
  counter-reset: step;
  border-top: none;
  border-left: none;
  justify-content: space-between;
  padding: 10px 24px 0 24px;
}

.form-pages-list.pages-progressbar .form-page-tab {
  flex: 1 1 0;
  position: relative;
  text-align: center;
  text-transform: uppercase;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
}

.form-pages-list.pages-progressbar .form-page-tab::before {
  content: counter(step);
  counter-increment: step;
  width: 30px;
  height: 30px;
  line-height: 26px;
  display: block;
  margin: 0 auto 10px auto;
  border: 2px solid var(--df-input-border);
  border-radius: 50%;
  background-color: #ffffff;
}

.form-pages-list.pages-progressbar .form-page-tab::after {
  content: "";
  width: 100%;
  height: 2px;
  position: absolute;
  top: 15px;
  left: -50%;
  z-index: -1;
  background-color: var(--text-secondary);
}

.form-pages-list.pages-progressbar .form-page-tab:first-child::after {
  content: none;
}

.form-pages-list.pages-progressbar .form-page-tab.active {
  color: var(--success);
  background: transparent;
}

.form-pages-list.pages-progressbar .form-page-tab.active::before {
  border-color: var(--success);
}

.form-pages-list.pages-progressbar .form-page-tab.active + .form-page-tab::after {
  background-color: var(--success);
}

.form-pages-list.pages-progressbar .form-page-tab.veryactive {
  color: var(--primary);
  background: transparent;
}

.form-pages-list.pages-progressbar .form-page-tab.veryactive::before {
  border-color: var(--primary);
}

.form-content-card {
  min-height: 480px;
}

/* Barcode camera scanner modal */
.barcode-scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.barcode-scanner-box {
  background: #ffffff;
  border-radius: var(--card-radius);
  padding: 24px;
  width: min(420px, 90vw);
}

.barcode-scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.barcode-scanner-header h3 {
  margin: 0;
  color: var(--text-primary);
}

#reader {
  width: 100%;
}

/* Success alert - matches the real production's own Bootstrap 3
   .alert.alert-success styling and position (navbar.php), reused by that
   project's Custom JS/CSS for every showAlert() notice during form use. */
.success-alert-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 90vw);
  z-index: 10001;
  background: var(--success-soft);
  border: 1px solid #abefc6;
  color: var(--success);
  border-radius: var(--radius);
  padding: 15px 35px 15px 15px;
  font-size: 15px;
}

.success-alert-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--success);
  opacity: 0.6;
  cursor: pointer;
}

.success-alert-close:hover {
  opacity: 1;
}

/* Store List modal - matches the real production "view-all-stores"
   Custom JS/CSS's own injected styles exactly. */
.storeListItem {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 182, 193, 0.35);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.storeListItem:last-child {
  border-bottom: none;
}

.storeListItem label {
  cursor: pointer;
}

.storeListItem label.checked-text {
  color: hotpink;
  font-weight: 600;
}

.storeListItem label.checked-text small {
  color: hotpink !important;
}

.storeListItem .done-label {
  color: hotpink;
  font-weight: 700;
  margin-left: 12px;
  display: none;
}

.storeListItem.done .done-label {
  display: inline;
}

/* Retail Audit-Ghana (SumsureIQ) sub-nav */
.sumsureiq-subnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
  gap: 12px;
}

.subnav-breadcrumb {
  font-size: 14px;
  color: #1a1a1a;
  font-weight: 500;
}

.subnav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.subnav-link {
  background: none;
  border: none;
  font-size: 14px;
  color: #1a1a1a;
  cursor: pointer;
  padding: 6px 4px;
}

.subnav-link:hover {
  color: var(--primary);
}

/* links a project's Custom JS adds next to #support_button (Store List, OCR, ...) look like the others */
.subnav-links > li > a {
  font-size: 14px;
  color: #1a1a1a;
  cursor: pointer;
  padding: 6px 4px;
  text-decoration: none;
}

.subnav-links > li > a:hover {
  color: var(--primary);
}

/* Print / Payout are shown and hidden through their button, so hide the empty list item with it */
.subnav-links > li:has(> .subnav-link[style*="display: none"]) {
  display: none;
}

.subnav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid var(--df-rule);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  z-index: 100;
  overflow: hidden;
}

.subnav-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  background: none;
  border: none;
  font-size: 14px;
  color: #1a1a1a;
  cursor: pointer;
}

.subnav-dropdown-item:hover {
  background: #f3f4f6;
}

/* Retail Audit-Ghana (SumsureIQ) form pages use a plain white/light card
   look with dark text, matching that project's real UI, rather than this
   app's default glassmorphism dark-card styling used everywhere else. */
.sumsureiq-theme .form-page-header-card,
.sumsureiq-theme .form-content-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.sumsureiq-theme .form-page-title,
.sumsureiq-theme .question-title,
.sumsureiq-theme .form-instruction-text {
  color: #1a1a1a;
}

.sumsureiq-theme .question-block input,
.sumsureiq-theme .question-block select,
.sumsureiq-theme .question-block textarea {
  color: #1a1a1a;
}

/* Real production styles readonly fields (Date of Previous Audit, the
   previous-cycle stock/purchase/price figures) with a grey fill and a
   not-allowed cursor, rather than leaving them looking like normal editable
   inputs - readonly (not disabled) so their values still submit. */
.sumsureiq-theme .question-block input:read-only {
  background: #e9ecef;
  cursor: not-allowed;
}

/* SumsureIQ's Retail Audit form only ever has a couple of page tabs
   ("Product details" / "Product Audit"), so the edge-to-edge left-aligned
   tab grid built for CIMG's much longer tab row (which stretches the full
   card width) just leaves them stranded at the left with empty space next
   to them - centered instead, matching how few tabs are meant to look. */
.sumsureiq-theme .form-pages-list {
  justify-content: center;
  border-left: none;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
}

/* Question Fields inside the Survey */
.question-block {
  margin-bottom: 28px;
  animation: fadeInQuestion 0.3s ease;
}

@keyframes fadeInQuestion {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-instruction-heading {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-primary, #1a1a1a);
}

/* "Application information" (see renderDashboardIntro in app.js) - the real
   production's own version is left-aligned, not centered like the rest of
   .form-page-header-card's content, and sits in its OWN narrower card
   below the full-width title bar (confirmed against a real CIMG 2026
   login recording: the title bar spans the full row, the actual notice
   text sits in a separate ~half-width card directly under it, not
   stretched to match). */
.dashboard-intro-content-card {
  max-width: 600px;
  margin-top: 20px;
}

#dashboardIntroContent {
  text-align: left;
}

.intro-category-link {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.intro-category-link:hover {
  text-decoration: underline;
}

.required-star {
  color: var(--danger);
}

.question-options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-choice-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
  transition: var(--transition-smooth);
}

.option-choice-label:hover {
  background: var(--df-surface);
}

.option-choice-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--brand-blue-soft);
}

.option-choice-label input[type="radio"],
.option-choice-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

/* OCR scanner layout */
.ocr-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
}

.upload-dropzone {
  border: 2px dashed var(--input-border);
  border-radius: var(--card-radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transition: var(--transition-smooth);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--primary);
  background: var(--brand-blue-soft);
}

.cloud-upload-icon {
  font-size: 40px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.upload-dropzone:hover .cloud-upload-icon {
  color: var(--primary);
}

.upload-dropzone p {
  font-size: 14px;
  color: var(--text-secondary);
}

.upload-dropzone p span {
  color: var(--primary);
  font-weight: 600;
}

.image-preview-container {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.image-preview-container img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #000;
  display: block;
}

.clear-image-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* OCR results output styling */
.ocr-result {
  min-height: 380px;
}

.magic-icon {
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 12px;
}

@keyframes floatMagic {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.ocr-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--df-rule);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.product-result-card {
  background: var(--bg-surface-solid);
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  animation: slideInResults 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes slideInResults {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-banner {
  background: var(--df-ink);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}

.product-banner h4 {
  font-size: 18px;
  font-weight: 700;
}

.product-price {
  font-size: 24px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: var(--radius);
}

.product-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 24px;
  gap: 16px;
}

.detail-tile {
  background: var(--df-surface);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tile-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tile-label i {
  color: var(--primary);
}

.tile-value {
  font-size: 14px;
  font-weight: 600;
}

/* Micro-animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease;
}

.animate-slide-up {
  animation: slideUp 0.5s ease both;
}

/* Responsive grid adjustments */
@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .span-3,
  .span-2 {
    grid-column: span 1;
  }
  .banner-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  .banner-stats {
    align-self: flex-end;
  }
  .ocr-layout {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Role-Based Badge & Dashboard Layouts (Nominee, Judge, Admin, Enterprise)
   ========================================================================== */

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 650;
  background: var(--brand-blue-soft);
  color: var(--primary);
  border: 1px solid #c7d7fe;
}

.role-badge.role-judge {
  background: var(--pending-soft);
  color: var(--pending);
  border-color: var(--pending-rule);
}

.role-badge.role-admin {
  background: var(--success-soft);
  color: var(--success);
  border-color: #abefc6;
}

.role-badge.role-enterprise {
  background: #f8fafc;
  color: var(--text-primary);
  border-color: var(--df-rule);
}

/* Layout Helpers */
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.padding-0 {
  padding: 0 !important;
}
.padding-lg {
  padding: var(--space-6) !important;
}
.margin-top-md {
  margin-top: var(--space-4) !important;
}
.text-subtle {
  color: var(--text-subtle);
  font-size: 14px;
}

/* Judge Evaluation Screen */
.judge-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

.score-summary-badge {
  background: var(--brand-blue-soft);
  border: 1px solid var(--primary);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
}

.score-summary-badge .score-val {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}

.scoring-rubric {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rubric-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 18px;
  transition: var(--transition-smooth);
}

.rubric-card:hover {
  border-color: var(--df-input-border);
}

.rubric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.rubric-header h4 {
  font-size: 16px;
  font-weight: 700;
}

.rubric-score-display {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  color: var(--primary);
}

.score-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
  height: 6px;
}

/* Admin Console & Data Tables */
.admin-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  background: var(--df-surface);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--df-surface);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 650;
}

.status-pill.status-completed {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.status-pending {
  background: var(--pending-soft);
  color: var(--pending);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-select,
.form-input-sm {
  background: var(--bg-surface-solid);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
}

/* Super Admin Sidebar Layout (video1.mp4 reference) */
.super-admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-6);
  align-items: start;
}

.admin-sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

.admin-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}

.admin-menu-item i {
  font-size: 14px;
  width: 18px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.admin-menu-item:hover {
  background: var(--df-surface);
  color: var(--text-main);
}

.admin-menu-item:hover i {
  color: var(--primary-light);
}

.admin-menu-item.active {
  background: var(--primary);
  color: #ffffff;
}

.admin-menu-item.active i {
  color: #ffffff;
}

.admin-main-panel {
  width: 100%;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.active {
  display: block;
}

@media (max-width: 992px) {
  .super-admin-layout {
    grid-template-columns: 1fr;
  }
}

/* Animation & Opacity Safety Overrides */
.animate-slide-up,
.animate-fade-in {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

/* Explicit Admin Console Visibility & High-Contrast Styling (video1.mp4 reference) */
#adminView {
  width: 100%;
}

#adminView.active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  min-height: 500px;
}

#adminView .card {
  background: #ffffff !important;
  color: var(--df-ink) !important;
  border: 1px solid var(--df-rule) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#adminView .card h3,
#adminView .card h2,
#adminView .card h1,
#adminView .card span,
#adminView .card p,
#adminView .card label {
  color: var(--df-ink) !important;
}

#adminView .admin-sidebar {
  background: #ffffff !important;
  border-radius: var(--card-radius);
}

#adminView .admin-menu-item {
  color: var(--df-muted) !important;
}

#adminView .admin-menu-item i {
  color: #64748b !important;
}

#adminView .admin-menu-item:hover {
  background: var(--df-surface) !important;
  color: var(--df-ink) !important;
}

#adminView .admin-menu-item.active {
  background: var(--df-brand) !important;
  color: #ffffff !important;
}

#adminView .admin-menu-item.active i {
  color: #ffffff !important;
}

#adminView .admin-tab-panel.active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.pc-layout {
  display: flex;

  height: 100vh;

  background: var(--df-surface);
}

#pc-sidebar {
  width: 240px;

  flex-shrink: 0;

  background: white;

  overflow-y: auto;

  border-right: 1px solid var(--df-rule);
}

.pc-main {
  flex: 1;

  min-width: 0;

  display: flex;

  flex-direction: column;
}

#pc-content {
  padding: var(--page-gutter);

  overflow: auto;

  flex: 1;
}

.stats {
  display: grid;

  grid-template-columns: repeat(5, 1fr);

  gap: 20px;
}

.dashboard-grid {
  display: grid;

  grid-template-columns: 3fr 1fr;

  gap: 20px;

  margin-top: 25px;
}

/* Custom JS/CSS console editor (see renderJsCssEdit in projectconsole.js) -
   CodeMirror's own default wrapper has no rounding/border, so match the
   app's card-input look here. */
.CodeMirror {
  border: 1px solid var(--df-input-border);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  height: 320px;
}

/* The respondent form (audit/) fills the window and brings its own navbar */
body.audit-open .app-header,
body.audit-open #sumsureiqSubNav,
body.audit-open #standardSubNav {
  display: none !important;
}

#auditFrame {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  z-index: 50;
}

/* ======================================================================
   Responsive layout - phones, tablets and desktops
   ====================================================================== */
img,
video,
canvas {
  max-width: 100%;
}

.grid-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-form > * {
  min-width: 0;
}

.pc-mobilebar,
.pc-backdrop {
  display: none;
}

/* Project console: the sidebar becomes a slide-in menu below 900px */
@media (max-width: 900px) {
  .pc-layout {
    height: auto;
    min-height: 100vh;
    flex-direction: column;
  }

  body #pc-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 82vw);
    height: 100% !important;
    z-index: 1100;
    transform: translateX(-102%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .pc-layout.pc-menu-open #pc-sidebar {
    transform: none;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.18);
  }

  .pc-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1090;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .pc-layout.pc-menu-open .pc-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .pc-mobilebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #ffffff;
    border-bottom: 1px solid var(--df-rule);
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .pc-menu-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--df-input-border);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--df-ink);
    font-size: 16px;
    cursor: pointer;
  }

  .pc-mobile-title {
    font-size: 16px;
    font-weight: 650;
    color: var(--df-ink);
  }
}

@media (max-width: 576px) {
  .grid-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-form .span-2,
  .grid-form .span-3 {
    grid-column: auto;
  }
}

/* Home dashboard: the five tiles wrap instead of squeezing, and the two cards stack */
@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .stat-row {
    flex-wrap: wrap;
    row-gap: 16px;
  }
  .stat-row > div {
    flex: 1 1 140px !important;
    border-left: 0 !important;
    padding: 0 12px !important;
  }
}

/* less side padding around every view on small screens - the Project Console inside adds its own gutter */
@media (max-width: 900px) {
  .app-main {
    padding: var(--space-3);
  }
}
@media (max-width: 576px) {
  .app-main {
    padding: var(--space-2);
  }
}

/* New Forms builder: its column classes stack on tablets and phones */
@media (max-width: 991px) {
  .nf-builder-scope [class*="sfb-col-md-"],
  .nf-builder-scope [class*="sfb-col-lg-"] {
    width: 100% !important;
    float: none !important;
  }
}
@media (max-width: 767px) {
  .nf-builder-scope [class*="sfb-col-sm-"] {
    width: 100% !important;
    float: none !important;
  }
}

/* Import Panel: the estimate card drops under the options, tiles and split rows stack */
@media (max-width: 992px) {
  .panel-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
@media (max-width: 700px) {
  .panel-tiers {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .panel-split {
    flex-direction: column;
  }
  .panel-split > div {
    flex: 1 1 auto !important;
  }
  .panel-range-row {
    flex-wrap: wrap;
  }
}

/* View Applications: the file list drops under the answers on narrow screens */
@media (max-width: 768px) {
  .app-detail-layout {
    flex-direction: column;
  }
  .app-detail-files {
    width: 100% !important;
    border-left: 0 !important;
    border-top: 1px dashed var(--df-rule);
    padding-left: 0 !important;
    padding-top: 16px;
  }
}

/* Judge evaluation: nominee list above the scoring card on tablets and phones */
@media (max-width: 992px) {
  .judge-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .judge-layout > * {
    min-width: 0;
  }
}
@media (max-width: 576px) {
  .card-header.flex-between,
  .card-footer.flex-between {
    flex-wrap: wrap;
  }
  .card-footer {
    flex-wrap: wrap;
    gap: 10px;
  }
  .card-footer .btn {
    flex: 1 1 100%;
  }
  .scoring-rubric,
  .scoring-form {
    min-width: 0;
  }
}

/* Tables inside cards scroll sideways rather than widening the page */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* The sign-in pages (auth/) are the real login / sign-up / reset pages: full window, with their own navbar */
body.auth-open .app-header,
body.auth-open #sumsureiqSubNav,
body.auth-open #standardSubNav {
  display: none !important;
}

#authFrame {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  z-index: 50;
}

/* ---------------------------------------------------------------- admin navbar: Respondents + Account
   (navbar.php, for a project's admins). Styled like the header's own Log out button: the header's text
   colour, a light outline, so a project's own header colours carry over. */
.admin-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-nav-btn {
  color: inherit;
  background: transparent;
  border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
  border-radius: var(--radius);
  min-height: 36px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.admin-nav-btn:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.admin-nav-dropdown {
  position: relative;
}

.admin-nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  color: var(--df-ink);
  border: 1px solid var(--df-rule);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 200;
  padding: 10px;
}

.admin-nav-search {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--df-input-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  color: var(--df-ink);
  background: #fff;
}

.admin-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 55vh;
  overflow-y: auto;
}

/* a group's name over its respondents (navGator's disabled btn-info row) */
.admin-nav-group {
  padding: 7px 10px;
  margin-top: 4px;
  background: var(--brand-blue-soft);
  color: var(--df-ink);
  font-size: 13px;
  font-weight: 700;
  border-radius: 4px;
}

.admin-nav-item {
  padding: 7px 10px;
  font-size: 15px;
  color: var(--df-ink);
  cursor: pointer;
  border-radius: var(--radius);
}

.admin-nav-item:hover {
  background: var(--df-surface);
}

/* completed respondents (navGator's btn-success) */
.admin-nav-item.done {
  border-left: 3px solid var(--success);
  padding-left: 7px;
}

.admin-nav-note {
  padding: 8px 10px;
  font-size: 14px;
  color: var(--df-muted);
}

@media (max-width: 600px) {
  .admin-nav {
    gap: 4px;
  }
  .admin-nav-btn {
    padding: 5px 10px;
    font-size: 13px;
  }
  .admin-nav-menu {
    position: fixed;
    left: 16px;
    right: 16px;
    top: 76px;
    width: auto;
    max-width: none;
  }
}

/* phones: the header carries Respondents / Account / Log out too, so it wraps onto a second row */
@media (max-width: 600px) {
  .app-header {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding: 8px 12px;
    row-gap: 8px;
  }
  .app-header .header-logo {
    font-size: 17px;
    min-width: 0;
    flex: 1 1 100%;
  }
  .app-header .header-logo .logo-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .app-header .header-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* navbar.php #selectedDrop: the respondent the page is about, left of the Respondents list */
.admin-selected {
  font-size: 14px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.df-publication-review::backdrop {
  background: #0f172a80;
}
