/* ============================================================
   GLOBAL STYLES — style.css
   Top nav + light content layout
   Fonts: DM Sans (UI) + DM Mono (data)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

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

html, body {
  margin: 0;
  padding: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: #f4f5f7;
  color: #0f1623;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

/* ── Variables ── */
:root {
  --nav-bg:          #1a2332;
  --nav-border:      rgba(255,255,255,0.10);
  --nav-hover:       rgba(255,255,255,0.08);
  --nav-active:      rgba(255,255,255,0.13);
  --nav-text:        rgba(255,255,255,0.75);
  --nav-text-hi:     #ffffff;
  --nav-accent:      #e8a020;
  --nav-height:      60px;

  --bg:           #f4f5f7;
  --surface:      #ffffff;
  --surface-2:    #f8f9fb;
  --border:       #e4e6ea;
  --border-light: #eef0f3;

  --text-primary:   #0f1623;
  --text-secondary: #2d3748;
  --text-muted:     #4a5568;

  --accent:       #e8a020;
  --accent-light: #fdf3e0;
  --accent-dark:  #c4831a;

  --shadow-sm: 0 1px 3px rgba(15,22,35,0.06), 0 1px 2px rgba(15,22,35,0.04);
  --shadow-md: 0 4px 12px rgba(15,22,35,0.08), 0 2px 4px rgba(15,22,35,0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-ui:   'DM Sans', system-ui, sans-serif;
  --font-data: 'DM Mono', monospace;
}

/* ============================================================
   SITE LAYOUT
   ============================================================ */

.site-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   TOP NAV — flexbox, 3 zones: logo | links | search+user
   ============================================================ */

.topnav {
  height: var(--nav-height);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 0.75rem;
}

/* ── Logo (left) ── */
.topnav-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 1.5rem;
}

.topnav-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  object-fit: contain;
  flex-shrink: 0;
}

.topnav-logo-mark {
  height: 45px;
  width: auto;
  flex-shrink: 0;
}

/* ── Links (centre — grows to fill space) ── */
.topnav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.topnav-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--nav-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-ui);
}

.topnav-link:hover {
  background: var(--nav-hover);
  color: var(--nav-text-hi);
}

.topnav-link.active {
  background: var(--nav-active);
  color: var(--nav-text-hi);
}

.topnav-link .material-symbols-outlined {
  font-size: 16px;
  opacity: 0.8;
}

/* ── Dropdown ── */
.topnav-dropdown {
  position: relative;
  padding-bottom: 8px;
  margin-bottom: -8px;
}

.topnav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: 0.375rem;
  z-index: 200;
}

.topnav-dropdown:hover .topnav-dropdown-menu,
.topnav-dropdown:focus-within .topnav-dropdown-menu {
  display: block;
}

.topnav-dropdown-item {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.1s ease;
  white-space: nowrap;
}

.topnav-dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.topnav-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0.25rem 0;
}

.topnav-dropdown-section {
  padding: 0.375rem 0.875rem 0.125rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nav-text-lo, #9ba3b5);
  pointer-events: none;
}

/* ── Mega nav (NetSuite-style two-panel dropdown) ── */
.topnav-mega { position: relative; }

/* The panel is just a positioning wrapper — no visible styling */
.topnav-mega-panel {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  z-index: 200;
}
.topnav-mega:hover .topnav-mega-panel,
.topnav-mega-panel:hover { display: flex; align-items: flex-start; }

/* Left panel — rounded on the left side only */
.topnav-mega-left {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e6ea);
  border-radius: var(--radius-md, 10px) 0 0 var(--radius-md, 10px);
  box-shadow: 0 8px 32px rgba(15,22,35,0.12);
  padding: 0.5rem 0;
  white-space: nowrap;
}

.topnav-mega-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-ui);
  color: var(--text-secondary, #4a5568);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.topnav-mega-section .material-symbols-outlined { font-size: 18px; opacity: 0.6; }
.topnav-mega-section .topnav-mega-arrow { margin-left: auto; font-size: 16px; opacity: 0.3; }
.topnav-mega-section:hover,
.topnav-mega-section.active {
  background: var(--surface-2, #f8f9fb);
  color: var(--text-primary, #0f1623);
}
.topnav-mega-section.active .material-symbols-outlined { opacity: 1; color: var(--accent); }
.topnav-mega-section.active .topnav-mega-arrow { opacity: 0.6; }

/* Right panel — rounded on the right side only, flush against left */
.topnav-mega-right {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e6ea);
  border-left: none;
  border-radius: 0 var(--radius-md, 10px) var(--radius-md, 10px) 0;
  box-shadow: 0 8px 32px rgba(15,22,35,0.12);
  padding: 0.5rem 0;
  display: none;
  white-space: nowrap;
}
.topnav-mega-right.visible { display: block; }

.topnav-mega-links { display: none; }
.topnav-mega-links.active { display: block; }

.topnav-mega-link {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary, #4a5568);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.topnav-mega-link:hover {
  background: var(--surface-2, #f8f9fb);
  color: var(--text-primary, #0f1623);
}

.topnav-chevron {
  font-size: 14px !important;
  opacity: 0.6;
  transition: transform 0.15s ease;
}

.topnav-dropdown:hover .topnav-chevron {
  transform: rotate(180deg);
}

/* ── Search (right zone, before user) ── */
.topnav-search-form {
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

.topnav-search-icon {
  position: absolute;
  left: 0.625rem;
  font-size: 16px;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

.topnav-search-input {
  width: 210px;
  padding: 0.375rem 0.75rem 0.375rem 2.125rem;
  font-size: 0.8125rem;
  font-family: var(--font-ui);
  color: var(--nav-text-hi);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.topnav-search-input::placeholder { color: rgba(255,255,255,0.35); }

.topnav-search-input:focus {
  border-color: var(--nav-accent);
  background: rgba(255,255,255,0.10);
  box-shadow: 0 0 0 3px rgba(232,160,32,0.15);
  color: #ffffff;
}

/* ── User (far right) ── */
.topnav-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.topnav-user {
  position: relative;
  padding-bottom: 8px;
  margin-bottom: -8px;
}

.topnav-user-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0.5rem 0.3125rem 0.3125rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.12s ease;
  border: 1px solid transparent;
}

.topnav-user-trigger:hover {
  background: var(--nav-hover);
  border-color: var(--nav-border);
}

.topnav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(232,160,32,0.2);
  border: 1px solid rgba(232,160,32,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--nav-accent);
  flex-shrink: 0;
}

.topnav-user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--nav-text-hi);
  white-space: nowrap;
}

.topnav-user-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  padding: 0.375rem;
  z-index: 200;
}

.topnav-user:hover .topnav-user-menu,
.topnav-user:focus-within .topnav-user-menu {
  display: block;
}

.topnav-user-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.1s ease;
  white-space: nowrap;
}

.topnav-user-item:hover { background: var(--surface-2); }

.topnav-user-item .material-symbols-outlined {
  font-size: 16px;
  color: var(--text-muted);
}

.topnav-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0.25rem 0;
}

/* ── Hamburger (mobile only, hidden on desktop) ── */
.topnav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--nav-text);
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
  margin-left: auto;
}

.topnav-hamburger:hover { background: var(--nav-hover); }
.topnav-hamburger .material-symbols-outlined { font-size: 22px; }

/* ============================================================
   IMPERSONATION BANNER
   ============================================================ */

.impersonation-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.25rem;
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  font-size: 0.8125rem;
  color: #92400e;
  z-index: 90;
}

.impersonation-banner strong {
  font-weight: 600;
  color: #78350f;
}

.impersonation-exit {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-sm, 6px);
  background: #fbbf24;
  color: #78350f;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s ease;
}

.impersonation-exit:hover {
  background: #f59e0b;
}

/* ── Role switcher (custom dropdown) ── */
.rs-section {
  padding: 0.25rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-light, #eef0f3);
  margin-bottom: 0.25rem;
}
.rs-label {
  padding: 0.125rem 0.125rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #4a5568);
}
.rs-wrapper { position: relative; }

.rs-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.4rem 0.5rem;
  font: 500 0.8125rem/1.4 var(--font-ui, 'DM Sans', system-ui, sans-serif);
  color: var(--text-primary, #0f1623);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e6ea);
  border-radius: var(--radius-md, 10px);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: left;
  gap: 0.25rem;
}
.rs-trigger:hover { border-color: var(--accent, #e8a020); }
.rs-trigger:focus-visible,
.rs-wrapper.rs-open .rs-trigger {
  outline: none;
  border-color: var(--accent, #e8a020);
  box-shadow: 0 0 0 3px rgba(232, 160, 32, 0.15);
}
.rs-trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-trigger-icon {
  font-size: 18px;
  color: var(--text-muted, #4a5568);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.rs-wrapper.rs-open .rs-trigger-icon { transform: rotate(180deg); }

/* Panel (the flyout) */
.rs-panel {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e6ea);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 8px 24px rgba(15,22,35,0.12), 0 2px 6px rgba(15,22,35,0.06);
  z-index: 200;
  padding: 0.25rem 0;
}
.rs-wrapper.rs-open .rs-panel { display: block; }

/* Scrollbar */
.rs-panel::-webkit-scrollbar { width: 5px; }
.rs-panel::-webkit-scrollbar-track { background: transparent; }
.rs-panel::-webkit-scrollbar-thumb {
  background: var(--border, #e4e6ea);
  border-radius: 3px;
}

/* Group label */
.rs-group-label {
  padding: 0.5rem 0.75rem 0.2rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #4a5568);
}
.rs-group-label:not(:first-child) {
  border-top: 1px solid var(--border-light, #eef0f3);
  margin-top: 0.25rem;
  padding-top: 0.625rem;
}

/* Option row */
.rs-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary, #2d3748);
  text-decoration: none;
  border-radius: 6px;
  margin: 1px 0.25rem;
  transition: background 0.1s ease;
  cursor: pointer;
}
.rs-option:hover {
  background: var(--surface-2, #f8f9fb);
  color: var(--text-primary, #0f1623);
}
.rs-option--active {
  background: var(--accent-light, #fdf3e0);
  color: var(--text-primary, #0f1623);
  font-weight: 500;
}
.rs-option--active:hover {
  background: #fce9c5;
}
.rs-option-icon {
  font-size: 16px;
  color: var(--text-muted, #4a5568);
  flex-shrink: 0;
}
.rs-option--active .rs-option-icon { color: var(--accent, #e8a020); }
.rs-option-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-check {
  font-size: 16px;
  color: var(--accent, #e8a020);
  flex-shrink: 0;
  margin-left: auto;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.site-content {
  flex: 1;
  background: var(--bg);
}

.site-footer {
  padding: 1rem 2rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent, #c47a1f);
  text-decoration: underline;
}

.site-footer-sep {
  margin: 0 0.4rem;
  opacity: 0.5;
}

/* ============================================================
   MATERIAL SYMBOLS BASELINE
   ============================================================ */

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  color: inherit;
}

/* ============================================================
   GLOBAL LINK RESET
   ============================================================ */

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================================
   MOBILE NAV DRAWER
   Full-screen overlay with search + expandable sections
   ============================================================ */

.topnav-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--nav-bg);
  z-index: 99;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.topnav-mobile-menu.open { display: flex; }

/* Mobile search bar at top of drawer */
.topnav-mobile-search {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--nav-border);
  flex-shrink: 0;
}

.topnav-mobile-search-form {
  display: flex;
  align-items: center;
  position: relative;
}

.topnav-mobile-search-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 18px;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

.topnav-mobile-search-input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  font-size: 0.9375rem;
  font-family: var(--font-ui);
  color: var(--nav-text-hi);
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.topnav-mobile-search-input::placeholder { color: rgba(255,255,255,0.35); }
.topnav-mobile-search-input:focus {
  border-color: var(--nav-accent);
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Nav content area (scrollable) */
.topnav-mobile-nav {
  flex: 1;
  padding: 0.5rem 0 1rem;
  overflow-y: auto;
}

/* Simple links */
.topnav-mobile-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--nav-text);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
  min-height: 48px; /* touch target */
}

.topnav-mobile-link:hover,
.topnav-mobile-link:active {
  background: var(--nav-hover);
  color: var(--nav-text-hi);
}

.topnav-mobile-link .material-symbols-outlined {
  font-size: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Expandable section trigger */
.topnav-mobile-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--nav-text);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-ui);
  min-height: 48px;
}

.topnav-mobile-section-toggle:hover,
.topnav-mobile-section-toggle:active {
  background: var(--nav-hover);
  color: var(--nav-text-hi);
}

.topnav-mobile-section-toggle .material-symbols-outlined {
  font-size: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

.topnav-mobile-section-toggle-label {
  flex: 1;
}

.topnav-mobile-section-chevron {
  font-size: 18px !important;
  opacity: 0.5;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.topnav-mobile-section-toggle.open .topnav-mobile-section-chevron {
  transform: rotate(180deg);
}

/* Expandable section children */
.topnav-mobile-section-children {
  display: none;
  background: rgba(0,0,0,0.15);
  border-top: 1px solid var(--nav-border);
  border-bottom: 1px solid var(--nav-border);
}

.topnav-mobile-section-children.open {
  display: block;
}

.topnav-mobile-child-link {
  display: flex;
  align-items: center;
  padding: 0.625rem 1.25rem 0.625rem 3.25rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
  min-height: 44px;
}

.topnav-mobile-child-link:hover,
.topnav-mobile-child-link:active {
  background: var(--nav-hover);
  color: var(--nav-text-hi);
}

.topnav-mobile-child-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0.125rem 1.25rem 0.125rem 3.25rem;
}

/* Divider between top-level sections */
.topnav-mobile-divider {
  height: 1px;
  background: var(--nav-border);
  margin: 0.25rem 0;
}

/* Bottom area: user info + logout */
.topnav-mobile-footer {
  border-top: 1px solid var(--nav-border);
  padding: 0.875rem 1.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.topnav-mobile-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.topnav-mobile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(232,160,32,0.2);
  border: 1px solid rgba(232,160,32,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--nav-accent);
  flex-shrink: 0;
}

.topnav-mobile-username {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nav-text-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topnav-mobile-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-ui);
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.topnav-mobile-logout:hover {
  color: var(--nav-text-hi);
  border-color: rgba(255,255,255,0.3);
  background: var(--nav-hover);
}

.topnav-mobile-logout .material-symbols-outlined { font-size: 16px; }

/* ============================================================
   DESKTOP MEDIA QUERIES
   ============================================================ */

@media (max-width: 768px) {
  .topnav-links       { display: none; }
  .topnav-right       { display: none; }
  .topnav-search-form { display: none; }
  .topnav-hamburger   { display: flex; align-items: center; justify-content: center; }

  .ordering-page, .schedule-page, .config-page { padding: 1rem; }

  .filter-bar-top { flex-direction: column; align-items: flex-start; }
  .search-input   { width: 100%; }

  .schedule-columns { grid-template-columns: 1fr; }

  .config-grid              { grid-template-columns: 1fr; }
  .config-section.full      { grid-column: 1; }
  .config-inner-grid        { grid-template-columns: 1fr; }

  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-panel   { max-width: 100%; width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 90vh; }

  .page-header       { flex-wrap: wrap; gap: 0.75rem; }
  .page-header-right { width: 100%; justify-content: flex-end; }

  /* Hide Sentra AI floating button on mobile (collapsible nav viewport). */
  #sentra-fab,
  #sentra-drawer { display: none !important; }
}

/* Always hide Sentra AI while the document scanner is open. */
body.docscan-lock #sentra-fab,
body.docscan-lock #sentra-drawer { display: none !important; }


/* ============================================================
   RESPONSIVE TABLE → CARD (mobile)
   Tables with class "responsive-table" convert to stacked cards
   on mobile. Cells use data-label attributes for labels.
   ============================================================ */
@media (max-width: 768px) {
  .responsive-table thead { display: none; }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td { display: block; width: 100%; }
  .responsive-table tr {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light, #eef0f3);
  }
  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.8125rem;
    border: none;
  }
  .responsive-table td::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #9ba3b5);
    flex-shrink: 0;
    margin-right: 0.75rem;
  }
  /* Hide empty label cells (action columns) */
  .responsive-table td:empty { display: none; }
  .responsive-table td[data-label=""]::before { display: none; }
}
/* ============================================================
   GLOBAL FLASH MESSAGES
   Rendered by CustomerOrders/base.html for every page so Django
   `messages` get consumed once on landing instead of accumulating
   in cookie/session storage and flushing all at once on the next
   page that bothers to iterate them.
   ============================================================ */
.site-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 22px 4px;
}
.site-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid transparent;
  background: #f3f4f6;
  color: #1f2937;
}
.site-message--success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.site-message--info    { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.site-message--warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.site-message--error,
.site-message--danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.site-message-icon {
  font-size: 20px;
  line-height: 1;
  margin-top: 1px;
  flex-shrink: 0;
}
.site-message-body {
  flex: 1;
  word-break: break-word;
}
.site-message-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  margin: -2px -6px -2px 0;
  color: inherit;
  opacity: 0.65;
  border-radius: 6px;
  flex-shrink: 0;
}
.site-message-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.04); }
.site-message-close .material-symbols-outlined { font-size: 18px; line-height: 1; }

/* ============================================================
   GLOBAL BUTTON BASELINE

   Defines .btn + .btn-primary / .btn-ghost / .btn-danger / .btn-sm at
   the global level so any template that uses them gets consistent
   styling regardless of which app's stylesheet is or isn't loaded.

   Individual apps (Manage, Ordering, InvoiceJournal) still define
   their own variants — those override these defaults due to CSS
   source order (apps load later than the global) and equivalent
   specificity. The intent here is a SAFETY NET so .btn always
   produces a styled button.
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  background: #fff;
  color: #1f2937;
  border-color: #d1d5db;
}
.btn:hover { background: #f9fafb; border-color: #9ca3af; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn .material-symbols-outlined { font-size: 1rem; line-height: 1; }

.btn-primary {
  background: #1a2332;
  color: #fff;
  border-color: #1a2332;
}
.btn-primary:hover {
  background: #2a3548;
  border-color: #2a3548;
}

.btn-ghost {
  background: #fff;
  color: #1f2937;
  border-color: #d1d5db;
}
.btn-ghost:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.btn-danger {
  background: #fef2f2;
  color: #b8281f;
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.btn-sm {
  padding: 0.3125rem 0.625rem;
  font-size: 0.8125rem;
  gap: 0.25rem;
}
.btn-sm .material-symbols-outlined { font-size: 0.9375rem; }

.btn-lg {
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
}

/* ============================================================
   GLOBAL FORM-INPUT BASELINE

   .form-control and .manage-input are used widely across templates
   for "an input that should look like our design system". Defining
   them globally guarantees a consistent baseline even on pages that
   don't load app-specific stylesheets. Per-app stylesheets may
   override visual details (background, accent, etc).
   ============================================================ */

.form-control,
.manage-input,
input.form-control,
input.manage-input,
select.form-control,
select.manage-input,
textarea.form-control,
textarea.manage-input {
  display: inline-block;
  padding: 0.5rem 0.625rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.form-control:focus,
.manage-input:focus {
  outline: none;
  border-color: #e8a020;
  box-shadow: 0 0 0 3px rgba(232, 160, 32, 0.18);
}
.form-control:disabled,
.manage-input:disabled {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}
textarea.form-control,
textarea.manage-input {
  display: block;
  width: 100%;
  min-height: 80px;
  resize: vertical;
}
