/* app/assets/stylesheets/application.css */

/* =========================================
   1. GLOBAL SAFETY SHIELD & THEME
   (Prevents horizontal scrolling and forces Dark Mode)
   ========================================= */
html, body {
  max-width: 100%;
  overflow-x: hidden; /* CRITICAL: Stops the page from drifting right */
  margin: 0;
  padding: 0;
  background-color: #0f172a !important; /* Forces the dark background globally */
  color: #f8fafc !important; /* Forces default text to be light */
  color-scheme: dark; /* Tells the browser to use dark scrollbars and native inputs */
}

/* =========================================
   GLOBAL HEADINGS (site-wide, 2026-07-16)
   Pico ships light-theme heading colors (near-black), which vanish on our
   forced-dark background — e.g. the "Quote for:" header on quotes#show.
   Set them once here instead of per page.
   ========================================= */
h1, h2, h3, h4, h5, h6 {
  color: #f8fafc;
}
h1 a, h2 a, h3 a { color: #60a5fa; }
h1 a:hover, h2 a:hover, h3 a:hover { color: #93c5fd; }

/* =========================================
   GLOBAL TEXT SELECTION (2026-07-16)
   The browser's default selection color is nearly invisible on the dark
   theme (highlighting text to edit it was hard to see).
   ========================================= */
::selection {
  background: #3b82f6;
  color: #ffffff;
}

/* =========================================
   2. LAYOUT OVERRIDES (The "Nuclear Option")
   ========================================= */

/* Reset the Main Container */
.app-main {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
}

/* The Centering Wrapper */
.app-shell {
  width: 100%;
  display: flex;       
  justify-content: center; /* Center children horizontally */
  padding-top: 20px; 
  box-sizing: border-box;
}

/* Ensure the inner content can take full width */
.app-shell > * {
  width: 100%;
}

/* =========================================
   GLOBAL CONTENT WIDTH (85% of screen — James Jones, 2026-07-02)
   Page content should occupy 85% of the viewport on desktop.
   ========================================= */
:root {
  --content-width: 85vw;
}

/* On phones/small tablets, use the full width instead of 85% */
@media (max-width: 768px) {
  :root {
    --content-width: 100%;
  }
}

/* PAGE CONTAINER (The Master Definition) */
.page-container {
  width: min(var(--content-width), 100%);
  margin-inline: auto; /* Standard centering */
  padding-inline: 20px;
  box-sizing: border-box;
}

/* GLOBAL CONTENT WRAPPER: the layout wraps every signed-in page's content in
   .page-content, so all pages get the 85% width without per-page styling.
   Also used by the franchise-switcher bar and flash messages in the layout.
   (Declared AFTER .app-shell > * so this width wins the specificity tie.) */
.page-content {
  width: min(var(--content-width), 100%);
  margin-inline: auto;
  padding-inline: 20px;
  box-sizing: border-box;
}

/* NOTE: per-page hardcoded max-width wrappers (1000px/1040px/1100px/1200px,
   inline and in view <style> blocks) were removed at the source 2026-07-02 —
   every page now inherits its width from .page-content / main.container. */

/* =========================================
   3. RESPONSIVE NAVIGATION BAR
   ========================================= */

.main-nav {
  display: flex;
  flex-wrap: wrap; 
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: #f8f9fa; /* Kept light to contrast the dark app body */
  border-bottom: 1px solid #e1e4e8;
  position: relative;
  width: 100%; 
  box-sizing: border-box;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap; 
  gap: 0.5rem;
}

/* --- Logo styling --- */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #111827; /* Forced dark so it shows on the light navbar */
  font-weight: bold;
  margin-right: 1rem;
}

.nav-logo img {
  height: 40px;
}

/* --- UNIFORM LINK STYLES --- */
.nav-link {
  color: #57606a; 
  text-decoration: none;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: #24292f;
  background-color: #f6f8fa;
  text-decoration: none;
}

.nav-link.active {
  color: #3B82F6; 
  background-color: #eff6ff;
  font-weight: 800;
}

/* --- Dropdown Button Styling --- */
.dropbtn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #57606a;
  font-weight: 600;
  padding: 8px 12px;
  font-family: inherit;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin: 0;
  line-height: inherit;
  display: flex;
  align-items: center;
}

.dropbtn:hover {
  color: #24292f;
  background-color: #f6f8fa;
}

.dropbtn.active {
  color: #3B82F6;
  background-color: #eff6ff;
  font-weight: 800;
}

/* --- MOBILE-FIRST STYLES --- */
.desktop-links,
.desktop-only {
  display: none;
}

/* --- CSS Hover Dropdown Logic --- */
.mobile-dropdown {
  position: relative;
  display: block;
}

.hamburger-button {
  background: none;
  border: none;
  font-size: 2.5rem;
  cursor: pointer;
  padding: 0;
  color: #374151;
}

.mobile-dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: white;
  min-width: 220px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 100;
  padding: 1rem;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
}

.mobile-dropdown-content a,
.mobile-dropdown-content form {
  display: block;
  padding: 0.5rem;
  white-space: nowrap;
  text-align: left;
  color: #57606a;
  text-decoration: none;
}

.mobile-dropdown-content a:hover {
  background-color: #f6f8fa;
  color: #24292f;
}

.mobile-dropdown-content hr {
  margin: 0.5rem 0;
}

.mobile-dropdown:hover .mobile-dropdown-content {
  display: block;
}

/* Show desktop links on large screens */
@media (min-width: 1200px) {
  .desktop-links,
  .desktop-only {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  .mobile-dropdown {
    display: none;
  }
}

/* --- Google Maps Styling --- */
.gm-style img {
  max-width: none !important;
  height: auto !important;
}

.gm-style,
.gm-style * {
  box-sizing: content-box;
}

.gm-style div,
.gm-style svg {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.gm-style .gm-style-iw-c {
  background-color: #374151 !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  padding: 12px !important;
}

.gm-style .gm-style-iw-d {
  overflow: auto !important;
  color: #ffffff !important;
}

.gm-style .gm-style-iw-d a {
  color: #60a5fa !important;
  text-decoration: none !important;
  font-weight: bold !important;
}

.gm-style .gm-style-iw-tc::after {
  background: #374151 !important;
}

/* Navbar Dropdown (Desktop) */
.dropdown {
  position: relative;
  display: flex;       
  align-items: center; 
  height: 100%;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #ffffff;
  min-width: 200px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
  z-index: 100;
  border-radius: 6px;
  border: 1px solid #e1e4e8;
  top: 100%; 
  right: 0;
  margin-top: 4px;
}

.dropdown-content a {
  color: #57606a;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-size: 0.9rem;
}

.dropdown-content a:hover {
  background-color: #f6f8fa;
  color: #24292f;
}

.dropdown:hover .dropdown-content {
  display: block;
}


/* =========================================
   4. DASHBOARD COMPONENTS
   ========================================= */

.dashboard-header {
  margin-bottom: 32px;
}

.dashboard-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff; /* Updated for Dark Mode */
  margin-bottom: 4px;
}

.dashboard-subtitle {
  font-size: 0.95rem;
  color: #9ca3af; /* Updated for Dark Mode */
}

.dashboard-alert {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #92400e;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
}

.dashboard-alert strong {
  color: #b45309;
}

/* --- KPI GRID & CARDS (Updated for Icons) --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

a.kpi-card {
  display: flex; /* Aligns content side-by-side */
  justify-content: space-between; /* Pushes text left, icon right */
  align-items: center; /* Vertically centers them */
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 24px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

a.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.06);
  border-color: #d1d5db;
}

/* Helper to stack text vertically inside the card */
.kpi-content {
  display: flex;
  flex-direction: column;
}

/* Icon Styling */
.kpi-icon {
  height: 64px;
  width: auto;
  opacity: 0.9;
  margin-left: 16px;
}

/* Color Accents */
.kpi-card.blue   { border-top: 4px solid #3b82f6; }
.kpi-card.green  { border-top: 4px solid #10b981; }
.kpi-card.orange { border-top: 4px solid #f59e0b; }

/* Text Styling */
.kpi-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: #111827;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-subtext {
  font-size: 0.9rem;
  color: #9ca3af;
  font-weight: 500;
}

/* --- Insight Grid --- */
/* 2026-07-16: use the same 3-column tracks as .kpi-grid (with the left panel
   spanning 2 of them) so the column boundary lines up exactly with the KPI
   cards above. The old `2fr 1fr` boundary sat 8px to the left of the KPI
   boundary (2fr of (W-24px) vs 2 cols + gap of (W-48px)). */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
  align-items: stretch;
}

.insight-grid > .dashboard-panel:first-child {
  grid-column: span 2;
}

@media (max-width: 900px) {
  .insight-grid { grid-template-columns: 1fr; }
  .insight-grid > .dashboard-panel:first-child { grid-column: auto; }
}

.dashboard-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 0; 
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.panel-hint {
  font-size: 0.8rem;
  font-weight: 600;
  color: #9ca3af;
  background: #f9fafb;
  padding: 4px 8px;
  border-radius: 6px;
}

.panel-body {
  padding: 24px;
  flex-grow: 1; 
}

.map-container {
  height: 650px; /* 2026-07-16: enlarged from 450px per James (900px test-drove as too tall) */
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}

/* =========================================
   PAGINATION (pagy 9.x, site-wide, 2026-07-16)
   Default pagy_nav renders bare <a> tags that sit flush together
   (e.g. "<12345>" on customers) — too small to click reliably.
   ========================================= */
nav.pagy {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
}

nav.pagy a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  margin: 0; /* Pico gives nav links NEGATIVE margins — without this the buttons overlap */
  border: 1px solid #334155;
  border-radius: 8px;
  background: #1e293b;
  color: #cbd5e0;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

nav.pagy a:hover:not(.current):not([aria-disabled="true"]) {
  border-color: #60a5fa;
  color: #f8fafc;
  background: #334155;
}

nav.pagy a.current {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  cursor: default;
}

nav.pagy a[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

nav.pagy a.gap {
  border: none;
  background: transparent;
  pointer-events: none;
}

/* =========================================
   GLOBAL FORM ACTIONS + BUTTON NORMALIZATION (2026-07-16)
   One shared definition for the Save/Cancel row at the bottom of every
   form. Pico makes submit inputs 100%-wide with their own margins, so
   without this each page's Save and Cancel render at different sizes.
   Use <div class="form-actions"> around form.submit + Cancel link.
   ========================================= */
.form-actions {
  margin-top: 2rem;
  display: flex;
  gap: 15px;
  align-items: stretch;
}

.form-actions input[type="submit"],
.form-actions button,
.form-actions a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto;
  margin: 0;
  padding: 12px 24px;
  font-size: 1rem;
  line-height: 1.2;
  box-sizing: border-box;
  white-space: nowrap;
}

/* The primary action stretches; secondary actions hug their label */
.form-actions input[type="submit"],
.form-actions .btn-primary {
  flex: 1;
  border: 1px solid transparent;
}

/* Buttons anywhere should never wrap their label mid-word, and Pico's
   default margin-bottom on buttons throws off vertical centering in flex
   rows — zero it (2026-07-16) */
a.btn-primary, a.btn-secondary, a.btn-info,
button.btn-primary, button.btn-secondary, button.btn-info {
  white-space: nowrap;
  margin-bottom: 0;
}

/* =========================================
   GLOBAL PAGE-HEADER BUTTONS (2026-07-16)
   One size for action buttons that sit in a page header (Saved Estimates,
   Tasks/Workflows/Create Estimate, saved-estimate Print, etc.). Pages were
   each hardcoding 42px inline.
   ========================================= */
.header-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: 50px; /* matches the standard .btn-primary height (10px padding + ~1.5 line-height) */
  padding: 0 20px;
  margin: 0;
  white-space: nowrap;
  box-sizing: border-box;
}

/* =========================================
   GLOBAL CHECKBOXES (2026-07-16)
   One size everywhere (matches the jobs-form equipment picker). Pages
   previously each defined their own (.modern-checkbox 24px on jobs,
   .fixed-checkbox 20px on machines) and drifted.
   ========================================= */
input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  cursor: pointer;
  accent-color: #3b82f6;
}

/* =========================================
   GLOBAL CARD NORMALIZATION (2026-07-16)
   Pico gives <article> large default margins AND padding, which
   double-spaces our .dashboard-card articles (cards manage their own
   inner padding). This was blowing out the prospect page's card gaps.
   ========================================= */
article.dashboard-card {
  margin: 0;
  padding: 0;
}

/* Pico also gives article > header/footer NEGATIVE margins (to bleed into
   the article padding we just removed) — with overflow:hidden cards that
   pulled the .card-header clean out of view. Pin them in place. */
article.dashboard-card > header,
article.dashboard-card > footer {
  margin: 0;
  border-radius: 0;
}

/* =========================================
   GLOBAL PRINT HYGIENE (2026-07-16)
   When any page is printed, drop the app chrome: sticky nav, test-env
   banner, flash messages, footer, pagination. Pages with their own
   @media print rules (saved estimates, quote print) build on this.
   ========================================= */
@media print {
  #sticky-nav-wrapper,
  .main-nav,
  .test-env-banner,
  .flash-message,
  .app-footer,
  nav.pagy {
    display: none !important;
  }

  html, body {
    background: #ffffff !important;
    color: #111827 !important;
    padding-top: 0 !important;
  }
}

/* --- Charts --- */
.chart-bar-container {
  display: flex; 
  justify-content: space-between; 
  height: 180px; 
  width: 100%;
  align-items: stretch; 
}

.chart-column {
  text-align: center; 
  width: 100%; 
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; 
  height: 100%; 
}

/* NEW: Style for the number above the bar */
.chart-value {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
  line-height: 1;
}

.chart-bar {
  background-color: #3b82f6; 
  width: 60%; 
  margin: 0 auto; 
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
  opacity: 0.8;
}

.chart-bar:hover {
  opacity: 1;
  background-color: #2563eb;
}

.chart-label {
  font-size: 0.75rem; 
  color: #9ca3af; 
  margin-top: 8px;
  font-weight: 500;
  flex-shrink: 0;
}

.stat-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.stat-label {
  width: 120px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-bar-bg {
  flex-grow: 1;
  background: #f3f4f6;
  height: 8px;
  border-radius: 99px;
  margin: 0 12px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background-color: #3b82f6;
  border-radius: 99px;
}

.stat-value {
  width: 30px;
  text-align: right;
  font-weight: 700;
  color: #111827;
  font-size: 0.9rem;
}


/* =========================================
   5. ORDER SUMMARY (Legacy Component)
   ========================================= */
.order-summary-container {
  background: #ffffff;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 2rem;
}

.order-summary-header {
  background: #1e293b; /* Unified with Slate 800 */
  padding: 12px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-summary-header h4 {
  margin: 0;
  color: #e6edf3;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
  gap: 16px;
  padding: 20px;
  background: #ffffff;
}

.summary-card {
  position: relative; 
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: #d1d5db;
}

/* Subtle Tinting */
.card-type-machine { background: linear-gradient(180deg, #ffffff, #f0f9ff); border-color: #bae6fd; }
.card-type-bin     { background: linear-gradient(180deg, #ffffff, #f0fdf4); border-color: #bbf7d0; }
.card-type-filter  { background: linear-gradient(180deg, #ffffff, #fefce8); border-color: #fde68a; }
.card-type-part    { background: linear-gradient(180deg, #ffffff, #f3f4f6); border-color: #e5e7eb; }

.qty-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 99px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  line-height: 1;
}

.card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-model {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}

.order-summary-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 10px 20px;
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  justify-content: space-between;
}


/* =========================================
   6. FULFILLMENT ITEM CARD
   ========================================= */
.item-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

.item-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.item-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 16px;
}

.item-card__title-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.item-card__icon {
  font-size: 1.5rem;
  background: #f9fafb;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.item-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.2;
}

.item-card__model {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 2px;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.status-badge.pending { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.status-badge.active { background: #def7ec; color: #03543f; border: 1px solid #bcf0da; }
.status-badge.neutral { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }

.item-card__note {
  background: #fffbeb; 
  border: 1px solid #fef3c7;
  color: #b45309;
  font-size: 0.85rem;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-card__section {
  margin-bottom: 16px;
}

.item-card__label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
}

.checkbox-label {
  font-size: 0.8rem;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
  background: #ffffff;
  color: #111827;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-input[readonly] {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

.shipping-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
}


/* =========================================
   7. INFO PANELS (Dark Theme)
   ========================================= */
.panel {
  background: #1e293b; /* Unified with Slate 800 */
  border-radius: 14px;
  border: 1px solid #334155; /* Unified Border */
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.panel__header {
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e6edf3;
  border-bottom: 1px solid #334155; /* Unified Border */
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__body {
  padding: 18px;
}

.panel__meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.meta-row--stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-size: 0.9rem;
  color: #e5e7eb; 
  text-align: right;
  font-feature-settings: "tnum"; 
}

.meta-value.muted {
  color: #9ca3af;
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.5;
}

.meta-divider {
  height: 1px;
  background: #334155; /* Unified Border */
  margin: 8px 0;
}

.workflow-status {
  margin-bottom: 16px;
}

.select-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0f172a; /* Unified Inset Dark Slate */
  border: 1px solid #475569;
  color: #e5e7eb;
  font-size: 0.9rem;
  appearance: none; 
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.select-input:focus, .text-area:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.text-area {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0f172a; /* Unified Inset Dark Slate */
  border: 1px solid #475569;
  color: #e5e7eb;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}


/* =========================================
   8. INDEX PAGE SYSTEM
   ========================================= */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center; 
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff; /* Updated for Dark Mode */
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.9rem;
  color: #9ca3af; /* Updated for Dark Mode */
  margin-top: 4px;
}

.control-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.search-panel {
  flex-grow: 1;
  background: #0f172a; /* Unified Inset Dark Slate */
  border: 1px solid #475569;
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-panel:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-icon {
  color: #9ca3af;
  font-size: 1.1rem;
}

.search-input-field {
  background: transparent;
  border: none;
  color: #e5e7eb;
  width: 100%;
  font-size: 0.95rem;
  padding: 8px 0;
}

.search-input-field:focus {
  outline: none;
}

.search-input-field::placeholder {
  color: #6b7280;
}

.data-table-panel {
  background: #1e293b; /* Unified with Slate 800 */
  border-radius: 14px;
  border: 1px solid #334155; /* Unified Border */
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.data-table-header {
  padding: 16px 20px;
  border-bottom: 1px solid #334155; /* Unified Border */
  font-size: 0.95rem;
  font-weight: 600;
  color: #e6edf3;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
}

table.admin-table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: #9ca3af;
  border-bottom: 1px solid #334155; /* Unified Border */
}

table.admin-table td {
  padding: 16px 20px;
  font-size: 0.9rem;
  color: #e5e7eb;
  border-bottom: 1px solid #334155; /* Unified Border */
  vertical-align: middle;
}

table.admin-table tr:last-child td {
  border-bottom: none;
}

table.admin-table tr:hover {
  background: rgba(255,255,255,0.03); 
}

.text-primary { color: #e5e7eb; font-weight: 600; }
.text-muted { color: #9ca3af; font-size: 0.85rem; }
.text-link { color: #38bdf8; text-decoration: none; font-weight: 500; }
.text-link:hover { text-decoration: underline; }

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-pill.active { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.status-pill.inactive { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.2); }
/* 2026-07-23: pending/neutral variants were referenced by views (customer
   quotes/jobs lists, prospect pages) but never defined, so those pills
   rendered as bare text. Amber for pending, slate for neutral. */
.status-pill.pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.status-pill.neutral { background: rgba(148, 163, 184, 0.12); color: #cbd5e0; border: 1px solid rgba(148, 163, 184, 0.2); }


/* =========================================
   9. RESOURCE SHOW PAGES (BLOWOUT PREVENTION)
   ========================================= */

/* Force layout containers to allow children to shrink */
.resource-layout > div {
  min-width: 0;
}

.resource-panel,
.list-group,
.list-item {
  min-width: 0;
}

/* Force safety wrapping on all text within panels */
.resource-panel * {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Subject line truncation logic */
.comm-subject {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Layout Grid */
.resource-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 1024px) {
  .resource-layout { grid-template-columns: 1fr; }
}

.identity-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  border-bottom: 1px solid #334155; /* Unified Border */
  padding-bottom: 24px;
}

.identity-title {
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff; 
  line-height: 1.1;
  margin-bottom: 8px;
}

.identity-subtitle {
  font-size: 1rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Monthly-revenue figure leading the identity subtitle (customers/show):
   money-green, reads as data, underlines on hover to signal the lease link. */
.revenue-link {
  color: #34d399;
  font-weight: 700;
  text-decoration: none;
}
.revenue-link:hover {
  text-decoration: underline;
}

.resource-panel {
  background: #1e293b; /* Unified with Slate 800 */
  border: 1px solid #334155; /* Unified Border */
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.resource-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #334155; /* Unified Border */
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b; /* Unified with Slate 800 */
}

.panel-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e5e7eb; 
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-action {
  font-size: 0.85rem;
  font-weight: 600;
  color: #60a5fa; 
  text-decoration: none;
}
.panel-action:hover { text-decoration: underline; }

.list-group {
  display: flex;
  flex-direction: column;
}

.list-item {
  padding: 16px 20px;
  border-bottom: 1px solid #334155; /* Unified Border */
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: rgba(255, 255, 255, 0.05); }

.item-main { font-weight: 600; color: #f3f4f6; font-size: 0.95rem; } 
.item-sub  { font-size: 0.85rem; color: #9ca3af; margin-top: 2px; } 

.empty-panel {
  padding: 32px;
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
  font-style: italic;
}

.danger-zone {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #334155; /* Unified Border */
}


/* --- Fix for Checkboxes --- */
input[type="checkbox"] {
  width: auto !important;
  display: inline-block !important;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* =========================================
   10. JOB CHECKLIST FIXES
   ========================================= */

/* Force the checkboxes to have a standard size and appearance */
.task-checkbox {
  appearance: auto !important;
  -webkit-appearance: auto !important; /* For Safari/Chrome */
  
  /* Set a nice clickable size (20px) */
  width: 1.25rem !important;
  height: 1.25rem !important;
  min-width: 1.25rem;
  min-height: 1.25rem;
  
  /* Spacing and Pointer */
  margin-right: 0.75rem;
  cursor: pointer;
  
  /* Color the checkmark with your brand blue */
  accent-color: #0ea5e9; 
  
  /* Ensure it sits vertically centered with the text */
  vertical-align: middle;
}

/* Ensure the label text is clickable and aligned */
.task-row label {
  cursor: pointer;
  line-height: 1.4;
  margin-bottom: 0 !important; /* Override global label margins */
  padding-top: 2px;
}

/* =========================================
   11. MOBILE HEADER FIXES
   ========================================= */

@media (max-width: 768px) {
  /* 1. Force the header to stack vertically instead of side-by-side */
  .identity-header {
    flex-direction: column;
    align-items: stretch !important; /* Stretch children to full width */
    gap: 16px;
  }

  /* 2. Make the buttons container full width */
  .identity-header > div:last-child {
    display: flex;
    flex-direction: column; /* Stack buttons on top of each other */
    width: 100%;
    gap: 12px !important;
  }

  /* 3. Make the actual buttons full width for easy tapping */
  .identity-header .btn {
    width: 100%;
    justify-content: center; /* Center the text inside the button */
    padding: 12px; /* A bit more padding for touch targets */
  }
}
/* =========================================
   SHARED MODAL (James, 2026-09-02): one standard for every modal in the app,
   lifted from the estimate page's machine picker (.mp-modal): 760 px wide,
   max-width 100%, max-height 82vh, #1e293b on a #334155 border, 12 px radius,
   head / body split, X in the head.
     <dialog class="app-modal">            native <dialog> shell (Pico paints a
                                           bare <dialog> as a full-screen flex
                                           overlay; this strips its padding /
                                           border / background and keeps the
                                           centering)
       <div class="app-modal__box">        the visible box
         <div class="app-modal__head">     title + .app-modal__close
         <div class="app-modal__body">     content (scrolls inside 82vh)
   The estimate picker keeps its own <div class="mp-overlay"> shell and uses
   the same __box / __head / __body / __close classes.
   ========================================= */
dialog.app-modal { padding: 0; border: none; background: transparent; margin: auto; overflow: visible; max-width: 100vw; }
dialog.app-modal::backdrop { background: rgba(15, 23, 42, 0.75); backdrop-filter: blur(4px); }
.app-modal__box {
  background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 12px;
  width: 760px; max-width: 100%; max-height: 82vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); box-sizing: border-box; text-align: left;
}
/* Pico's <dialog> is already a centring flex container; the picker's overlay is top-aligned on purpose, so the box carries no margin: auto */
.app-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid #334155; flex: 0 0 auto; }
.app-modal__head h3, .app-modal__head strong.app-modal__title { margin: 0; font-size: 0.95rem; font-weight: 600; color: #f8fafc; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.app-modal__close {
  background: none !important; border: none !important; color: #64748b !important; box-shadow: none !important;
  font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 2px 6px !important; margin: 0 !important; width: auto !important;
  height: auto !important; flex: 0 0 auto; text-decoration: none; font-family: inherit;
}
.app-modal__close:hover { color: #f8fafc !important; }
.app-modal__body { padding: 1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 10px; overflow: auto; min-height: 0; }
