/* Flow — stylesheet
 * HydroShield brand palette (navy + sky blue from the Flow logo),
 * modern SaaS polish (soft shadows, generous spacing, system fonts).
 */
:root {
  /* Surfaces — darker gray base so cards + tiles clearly float */
  --bg:         #dde4ee;
  --bg-soft:    #d2dae6;
  --surface:    #ffffff;
  --surface-2:  #f6f9fd;
  --border:     #c7d0dd;
  --border-strong: #a7b3c4;

  /* Text */
  --text:       #0f1b2d;
  --text-soft:  #334155;
  --muted:      #64748b;

  /* HydroShield brand — pulled from the Flow logo */
  --brand-navy:   #0e2d5c;     /* deep navy — "Flow" wordmark */
  --brand-blue:   #1a4480;     /* primary blue — F mark base */
  --brand-sky:    #4a90d9;     /* lighter sky blue — F mark top */
  --brand-mist:   #e8f0fb;     /* tinted background for info sections */

  /* Legacy accent vars kept so existing rules Just Work */
  --accent:       var(--brand-blue);
  --accent-dark:  var(--brand-navy);
  --accent-soft:  var(--brand-mist);

  /* Semantic colors — a shade softer than before so the badges don't shout */
  --good:         #15803d;
  --good-soft:    #e8f5ec;
  --warn:         #b45309;
  --warn-soft:    #fef4e3;
  --bad:          #be3b3b;
  --bad-soft:     #fdeeec;

  /* Shape + depth — richer, layered shadows for a more "lifted" feel */
  --radius:      10px;
  --radius-sm:   6px;
  --radius-lg:   14px;
  --shadow-sm:   0 1px 2px rgba(14, 45, 92, 0.08),
                 0 2px 4px -2px rgba(14, 45, 92, 0.05);
  --shadow:      0 2px 4px -1px rgba(14, 45, 92, 0.10),
                 0 6px 16px -2px rgba(14, 45, 92, 0.08),
                 inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --shadow-md:   0 4px 10px -1px rgba(14, 45, 92, 0.14),
                 0 12px 28px -4px rgba(14, 45, 92, 0.10),
                 inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --shadow-lg:   0 10px 24px -6px rgba(14, 45, 92, 0.18),
                 0 24px 48px -8px rgba(14, 45, 92, 0.14),
                 inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --shadow-inset: inset 0 2px 4px rgba(14, 45, 92, 0.08);

  /* Typography — Jakarta for headings (confident, modern), Inter for
     body (industry-standard readability).  Fallback stack keeps the app
     looking right while Google Fonts is loading. */
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont,
                  "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", -apple-system,
                  BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --font-mono:    "SF Mono", "JetBrains Mono", "Menlo", Consolas, monospace;

  --fs-xs:   12px;
  --fs-sm:   13px;
  --fs-base: 14.5px;
  --fs-lg:   16px;
  --fs-xl:   20px;
  --fs-2xl:  28px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  /* Enable OpenType niceties (contextual alternates, kerning) that
     make Inter + Jakarta really shine */
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
}

a { color: var(--brand-blue); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--brand-navy); text-decoration: underline; }

/* Headings get the display face — gives everything a bit more character */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.2;
  font-weight: 700;
}

/* Numbers that matter — monetary values, counts, dates — look sharper
   with tabular-nums (fixed-width digits so columns of money line up) */
.tile-value,
.totals, .totals td,
table.table td.right,
table.table th.right {
  font-variant-numeric: tabular-nums;
}
.tile-value {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Code / monospace samples — tasteful background chip */
code {
  background: var(--bg-soft);
  color: var(--brand-navy);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: var(--font-mono);
}

.wrap {
  /* Widened — the previous 1180px cap left big empty margins on modern
     displays. 1600px fills a 15"+ laptop/desktop nicely without letting
     tables stretch so wide they're hard to scan. */
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 768px) {
  .wrap { padding: 0 16px; }
}

/* Header — layered shadow + glass-like gradient so it clearly floats
   over the content below as you scroll. */
.site-header {
  background:
    linear-gradient(180deg, #ffffff 0%, #f0f6ff 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(1.1) blur(8px);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  box-shadow:
    0 1px 0 rgba(14, 45, 92, 0.05),
    0 4px 14px rgba(14, 45, 92, 0.06),
    0 12px 28px -8px rgba(14, 45, 92, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.main-nav {
  display: flex;
  gap: 2px;
  flex: 1;
}
.main-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover {
  background: var(--brand-mist);
  color: var(--brand-navy);
  text-decoration: none;
}

.header-actions .btn-primary { font-size: 14px; }

/* ---------- Settings dropdown in the top nav ---------- */
.nav-settings-menu {
  position: relative;
  margin-left: auto;   /* pin to the right end of the nav */
}
.nav-settings-toggle {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.nav-settings-toggle:hover,
.nav-settings-toggle[aria-expanded="true"] {
  background: var(--bg);
  color: var(--text);
}
.nav-settings-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 8px;
}
.nav-settings-menu:hover .nav-settings-dropdown,
.nav-settings-menu:focus-within .nav-settings-dropdown,
.nav-settings-toggle[aria-expanded="true"] + .nav-settings-dropdown {
  display: block;
}
.nav-settings-dropdown a {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.1s;
}
.nav-settings-dropdown a:hover {
  background: var(--brand-mist);
  color: var(--brand-navy);
}
.nav-settings-dropdown a .muted {
  font-weight: 400;
  margin-top: 2px;
}


/* Global header search — slots between the nav and the "+ New Job" button.
   The nav has flex:1 so it gobbles leftover space; we constrain the search
   to a fixed width so the two don't fight over it. */
.header-search {
  flex: 0 0 auto;
  margin: 0;
}
.header-search input[type="search"] {
  width: 260px;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.header-search input[type="search"]:focus {
  border-color: #2f6feb;
  box-shadow: 0 0 0 2px rgba(47, 111, 235, 0.15);
}
.header-search input[type="search"]::placeholder {
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(14, 45, 92, 0.04);
  font-family: inherit;
  line-height: 1.3;
}
.btn:hover {
  background: var(--bg);
  text-decoration: none;
  border-color: #b2bfd1;
  box-shadow: 0 2px 6px rgba(14, 45, 92, 0.08);
}
.btn:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(14, 45, 92, 0.08); }
.btn:focus-visible {
  outline: 2px solid var(--brand-sky);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--brand-blue) 0%, #163c73 100%);
  color: white;
  border-color: var(--brand-navy);
  box-shadow: 0 1px 2px rgba(14, 45, 92, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #163c73 0%, var(--brand-navy) 100%);
  border-color: var(--brand-navy);
  color: white;
  box-shadow: 0 3px 8px rgba(14, 45, 92, 0.22);
}

.btn-danger {
  background: var(--surface);
  color: var(--bad);
  border-color: #e8c9c9;
}
.btn-danger:hover { background: var(--bad-soft); border-color: #d9a8a8; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--brand-mist); color: var(--brand-navy); box-shadow: none; }

.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 5px; }

/* Page heading */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 32px 0 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.035em;
}
.page-header .subtitle {
  color: var(--muted);
  margin-top: 6px;
  font-size: var(--fs-base);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
}
.card-body { padding: 20px; }
.card + .card { margin-top: 18px; }

/* Tile grid (dashboard KPIs) */
.tiles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  min-height: 112px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tile-label {
  color: var(--muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.tile-value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--brand-navy);
  letter-spacing: -0.02em;
}
.tile-hint { color: var(--muted); font-size: var(--fs-xs); margin-top: 6px; }
.tile.attn .tile-value { color: var(--warn); }
.tile.bad .tile-value { color: var(--bad); }
a.tile-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
a.tile-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-sky);
  text-decoration: none;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  color: var(--muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--brand-mist); }
.table-compact th, .table-compact td { padding: 8px 12px; font-size: 13px; }

/* "right-aligned" column class used by invoice/estimate tables */
.table .right, .table th.right { text-align: right; }

/* Sortable column headers */
.sort-link {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.sort-link:hover { color: var(--text); }
.sort-link.sort-active { color: var(--accent); }
.sort-arrow { font-size: 10px; line-height: 1; }
.sort-arrow-dim { opacity: 0.35; }
.sort-link:hover .sort-arrow-dim { opacity: 0.7; }
.table-sortable th { padding-top: 8px; padding-bottom: 8px; }
.table-sortable th.right .sort-link { justify-content: flex-end; }

/* Clickable "Jobs by stage" rows on the dashboard */
.stage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px dashed var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s ease;
}
.stage-row:last-child { border-bottom: none; }
.stage-row:hover { background: #f1f5fb; }
.stage-row:hover .badge { transform: scale(1.05); transition: transform 0.1s ease; }
.stage-row.stage-row-attn { background: #fdf6e3; }
.stage-row.stage-row-attn:hover { background: #fbeecb; }
.badge.badge-attn { background: var(--warn); color: #fff; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #eef2f7;
  color: var(--muted);
  white-space: nowrap;
}
/* Stage badges — one clearly distinct hue per stage. The 1px border in a
 * mid-tone of each pair makes them pop against the white table background. */
.badge.stage-new              { background: #eef0f4; color: #3d4a5d; border: 1px solid #c2cad6; }
.badge.stage-received         { background: #fdf0d1; color: #7a4d06; border: 1px solid #e8b95a; }
.badge.stage-partner_install_upcoming{ background: #f0e7d8; color: #6b5530; border: 1px dashed #b89a68; }
.badge.stage-partner_installed{ background: #ffe0c4; color: #8a3a08; border: 1px solid #e88a3b; }
.badge.stage-scheduled        { background: #d2e8fa; color: #0b4c8a; border: 1px solid #4a9adf; }
.badge.stage-customer_confirmed{ background: #cdf0ec; color: #0a5f5a; border: 1px solid #46b2a9; }
.badge.stage-service_completed{ background: #d0ecc6; color: #24631b; border: 1px solid #67b34f; }
.badge.stage-invoice_sent     { background: #e4dafa; color: #4f1f96; border: 1px solid #9570de; }
.badge.stage-spiff_sent       { background: #f9d6e8; color: #8a1f4d; border: 1px solid #db6ea0; }
.badge.stage-partner_paid     { background: #a8d396; color: #1a4308; border: 1px solid #5fa03f; }
.badge.stage-on_hold          { background: #e9e1d0; color: #5a4a20; border: 1px solid #b09260; }

/* On-hold banner on the job detail page. */
.hold-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #fdf6e3;
  border: 1px solid #e8b95a;
  border-left: 4px solid #b08026;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}
.form-grid.full { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.field input, .field select, .field textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.18);
}
.field input::placeholder, .field textarea::placeholder {
  color: #a0aec0;
}
.field textarea { min-height: 90px; resize: vertical; }

/* Match focus styling for any input/textarea not inside a .field wrapper
   (lots of inline forms do this across the app) */
input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="number"], input[type="search"], input[type="password"],
input[type="url"], textarea, select {
  font-family: inherit;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.18);
}
.field-full { grid-column: 1 / -1; }

/* Line items repeater (inside job form) */
.line-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.line-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfe;
}
.line-item-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.1fr 0.9fr 1fr 1.4fr auto;
  gap: 8px 10px;
  align-items: end;
}
/* Partner pricing rows: Material · Unit · Price · Notes · Remove */
.line-item-grid.pricing-grid {
  grid-template-columns: 1.4fr 1.1fr 0.9fr 1.6fr auto;
}

/* Inline warning when a job has line items but the partner is missing pricing
   for one or more of those materials. */
.pricing-warn {
  display: inline-block;
  font-size: 12px;
  color: #7a4d06;
  background: #fdf0d1;
  border: 1px solid #e8b95a;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1.4;
}
.pricing-warn a { color: #7a4d06; text-decoration: underline; }
.li-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.li-field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.li-field input, .li-field select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  min-width: 0;
}
.li-field input:focus, .li-field select:focus {
  outline: 2px solid rgba(31, 122, 176, 0.25);
  border-color: var(--accent);
}
.li-remove-btn {
  color: var(--bad);
  border-color: var(--border);
}
@media (max-width: 900px) {
  .line-item-grid { grid-template-columns: 1fr 1fr; }
  .li-remove { grid-column: 1 / -1; justify-self: end; }
}

/* Line items on jobs list + detail (display-only) */
.li-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.45;
}
.li-list li { padding: 2px 0; }
.li-list li + li { border-top: 1px dashed var(--border); padding-top: 5px; margin-top: 5px; }
.li-list .li-primary {
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.li-list .li-secondary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
/* Ladder callout — bold everywhere. The color hint keeps it visible even
 * when nested inside cells that are already bold (like customer name). */
.word-ladder {
  font-weight: 800;
  color: var(--warn);
}

/* Legacy selectors kept around so older render paths still style reasonably. */
.li-list .li-area { font-weight: 600; color: var(--text); }
.li-list .li-desc { color: var(--muted); }
.li-list .li-extra { color: var(--muted); font-size: 12px; }

.li-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.li-summary .chip {
  background: #eef3f8;
  color: var(--text);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

/* Notes column on the jobs list — Sarah likes this wide so she can read
   the full context without hovering.  Tooltip still surfaces the full
   text for the long ones that hit the truncation cap. */
.notes-cell {
  display: inline-block;
  max-width: 320px;
  min-width: 200px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Filters bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.filter-bar .field { flex: 1; min-width: 160px; }
.filter-bar .field label { margin-bottom: 2px; }

/* Flashes */
.flashes { margin-top: 14px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid currentColor;
  box-shadow: var(--shadow-sm);
}
.flash-success { background: var(--good-soft); color: var(--good);  border-color: var(--good);  }
.flash-error   { background: var(--bad-soft);  color: var(--bad);   border-color: var(--bad);   }
.flash-warning { background: var(--warn-soft); color: var(--warn);  border-color: var(--warn);  }
.flash-info    { background: var(--brand-mist);color: var(--brand-navy); border-color: var(--brand-blue); }

/* Footer */
.site-footer {
  margin-top: 48px;
  padding: 18px 0;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* Milestone timeline (job detail) */
.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.milestone-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fafbfd;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.milestone-card.done { background: #eaf5ef; border-color: #cae6d6; }
.milestone-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.milestone-card .date { font-size: 15px; font-weight: 600; color: var(--text); }
.milestone-card .muted { color: var(--muted); font-size: 13px; font-weight: 400; }
.milestone-card form { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.milestone-card input[type="date"] { flex: 1; font-size: 12px; padding: 4px 6px; }

/* Layout two-column for job detail */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
@media (max-width: 960px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}

/* Utility */
.muted { color: var(--muted); }
.right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* Small inline forms (delete buttons etc.) */
.inline-form { display: inline; }

/* Raw PDF text preview */
.pdf-preview {
  background: #f4f6f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  color: var(--muted);
}

/* Event log */
.event-log { list-style: none; padding: 0; margin: 0; }
.event-log li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.event-log li:last-child { border-bottom: none; }
.event-log .when { color: var(--muted); font-size: 12px; }


/* ======================================================================
 * HCP-INSPIRED LAYER (Phase 2ff)
 * Builds on the HydroShield brand palette with softer surfaces, pill
 * status chips, left-accent card headers, and friendlier interactions.
 * Everything here is additive — doesn't replace earlier rules, just
 * layers on top where it meets the selector.
 * ================================================================== */

/* Softer, rounder cards + more generous spacing between stacked cards */
.card {
  border-radius: var(--radius-lg);          /* 14px — HCP-ish softness */
  border-color: var(--border);
  overflow: hidden;
}
.card + .card { margin-top: 20px; }

.card-header {
  position: relative;
  padding-left: 24px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}
/* Subtle left accent bar on every card header — HCP's signature touch */
.card-header::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand-blue), var(--brand-sky));
  opacity: 0.9;
}

/* Status badges — repaint as soft pills.  HCP's badges have a tinted
   background + bolder text in a matching hue + a 1px border of the same
   family.  Scoped to .badge so we don't accidentally restyle other pills. */
.badge {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Keep the stage-* overrides from earlier (they already have good
   per-stage hues), but soften them a touch to match the new feel.
   The old rules remain — these just add a tiny shadow + bold weight. */
.badge.stage-new,
.badge.stage-received,
.badge.stage-partner_install_upcoming,
.badge.stage-partner_installed,
.badge.stage-scheduled,
.badge.stage-customer_confirmed,
.badge.stage-service_completed,
.badge.stage-invoice_sent,
.badge.stage-spiff_sent,
.badge.stage-partner_paid,
.badge.stage-on_hold {
  box-shadow: 0 1px 2px rgba(14, 45, 92, 0.05);
  font-weight: 600;
}

/* Dashboard tiles — HCP has a little bit of color on the number tiles.
   We hint at it with a top accent line colored per tile category. */
.tile {
  position: relative;
  border-radius: var(--radius-lg);
  padding-top: 20px;
  overflow: hidden;
}
.tile::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-sky), var(--brand-blue));
  opacity: 0.85;
}
.tile.attn::before { background: linear-gradient(90deg, #e8b85a, var(--warn)); }
.tile.bad::before  { background: linear-gradient(90deg, #e59a9a, var(--bad)); }

a.tile-link:hover .tile-label { color: var(--brand-blue); }

/* Larger table row hover affordance — HCP tables feel very clickable */
.table tbody tr {
  transition: background 0.1s ease;
}
.table tbody tr:hover td {
  background: var(--brand-mist);
}

/* "Soft callout" utility — tinted panels used for inline tips/alerts.
   Not currently used but available for future UI.  Mirrors the look of
   HCP's info banners. */
.callout {
  background: var(--brand-mist);
  border: 1px solid #c6d7ee;
  border-left: 4px solid var(--brand-blue);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--brand-navy);
  font-size: var(--fs-base);
}
.callout.callout-warn {
  background: var(--warn-soft);
  border-color: #ead3a2;
  border-left-color: var(--warn);
  color: #6b3f08;
}
.callout.callout-good {
  background: var(--good-soft);
  border-color: #bddfc6;
  border-left-color: var(--good);
  color: #0c5a2b;
}
.callout.callout-bad {
  background: var(--bad-soft);
  border-color: #e8c5c3;
  border-left-color: var(--bad);
  color: #7a2727;
}

/* Smooth all transforms app-wide so hover micro-interactions feel buttery */
button, .btn, .tile, .card, a.tile-link, .pipeline-card {
  transition: transform 0.12s cubic-bezier(.2,.9,.3,1),
              box-shadow 0.15s ease,
              background 0.15s ease,
              border-color 0.15s ease,
              color 0.15s ease;
}

/* Section dividers inside cards — a thin horizontal rule with brand tint */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, var(--border) 20%, var(--border) 80%, transparent 100%);
  margin: 14px 0;
}

/* Page body — subtle top gradient so the sticky header lifts off
   something, but mostly a solid darker gray so cards clearly float */
body {
  background:
    linear-gradient(180deg, #d2dbe8 0%, var(--bg) 240px);
}

/* Tighten dashboard tile numbers on narrower screens so they don't wrap */
@media (max-width: 1024px) {
  .tile-value { font-size: 24px; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}


/* ======================================================================
 * DEPTH LAYER — richer shadows, elevation on hover, 3D-feeling buttons.
 * Added 2026-10-14 to give the interface more visual weight.
 * ================================================================== */

/* Cards — upgrade to the richer layered shadow and tangible hover lift */
.card {
  box-shadow: var(--shadow);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* Dashboard tiles — significant lift on hover, inset highlight on the
   top edge for a subtle "beveled" feel */
.tile {
  box-shadow:
    0 1px 2px rgba(14, 45, 92, 0.08),
    0 4px 10px -2px rgba(14, 45, 92, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}
a.tile-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-sky);
}

/* Buttons — deeper gradients + more pronounced active-state press */
.btn {
  box-shadow:
    0 1px 2px rgba(14, 45, 92, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 3px 8px rgba(14, 45, 92, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.btn:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 2px rgba(14, 45, 92, 0.1) inset,
    0 1px 1px rgba(14, 45, 92, 0.06);
}

.btn-primary {
  background:
    linear-gradient(180deg, var(--brand-sky) 0%, var(--brand-blue) 50%, var(--brand-navy) 100%);
  box-shadow:
    0 2px 4px rgba(14, 45, 92, 0.25),
    0 6px 14px -3px rgba(14, 45, 92, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border-color: var(--brand-navy);
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(14, 45, 92, 0.3);
}
.btn-primary:hover {
  background:
    linear-gradient(180deg, var(--brand-blue) 0%, var(--brand-navy) 50%, #0a2347 100%);
  box-shadow:
    0 4px 10px rgba(14, 45, 92, 0.32),
    0 10px 22px -4px rgba(14, 45, 92, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #ffffff;
}
.btn-primary:active {
  background: var(--brand-navy);
  box-shadow:
    0 1px 2px rgba(14, 45, 92, 0.3) inset,
    0 1px 1px rgba(14, 45, 92, 0.1);
}

/* Settings dropdown — richer floating-panel shadow + inner highlight */
.nav-settings-dropdown {
  box-shadow:
    0 2px 8px rgba(14, 45, 92, 0.10),
    0 20px 50px -10px rgba(14, 45, 92, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

/* Form inputs — subtle inner shadow gives them "cut into the page" feel */
.field input, .field select, .field textarea,
input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="number"], input[type="search"], input[type="password"],
input[type="url"], textarea, select {
  box-shadow: var(--shadow-inset);
  background: #fdfefe;
}
.field input:focus, .field select:focus, .field textarea:focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
textarea:focus, select:focus {
  background: #ffffff;
  box-shadow:
    inset 0 1px 2px rgba(14, 45, 92, 0.04),
    0 0 0 3px rgba(74, 144, 217, 0.22);
}

/* Pipeline cards — the kanban cards get more presence */
.pipeline-card {
  box-shadow:
    0 1px 2px rgba(14, 45, 92, 0.08),
    0 2px 6px -2px rgba(14, 45, 92, 0.05);
}
.pipeline-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 10px rgba(14, 45, 92, 0.14),
    0 10px 20px -4px rgba(14, 45, 92, 0.10);
}

/* Flash messages — give them a bit more weight too */
.flash {
  box-shadow:
    0 2px 4px rgba(14, 45, 92, 0.08),
    0 6px 12px -4px rgba(14, 45, 92, 0.06);
}

/* Wide tables (jobs list, partner pricing, etc.) — wrap in this
   container so the whole table scrolls horizontally when it exceeds
   the card width.  Preserves the rounded card corners by hiding scroll
   on y-axis only. */
.table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  /* Taste: a subtle inset shadow on the right edge hints "there's more"
     when the table has scroll content hidden. */
  background:
    linear-gradient(90deg, var(--surface) 30%, transparent),
    linear-gradient(90deg, transparent, var(--surface) 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%,
      rgba(14, 45, 92, 0.12), transparent),
    radial-gradient(farthest-side at 100% 50%,
      rgba(14, 45, 92, 0.12), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 24px 100%, 24px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.table-scroll .table { margin-bottom: 0; }
