body {
  margin: 0;
  background: #f1f5f9;
  color: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

header {
  background: #0f172a;
  color: white;
  padding: 30px 20px;
}

header h1 {
  margin: 0;
  font-size: 32px;
}

header p {
  margin-top: 10px;
  color: #cbd5e1;
  line-height: 1.5;
}

main {
  padding: 18px;
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: white;
  padding: 24px;
  border-radius: 22px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
}

.card h2 {
  margin-top: 0;
  font-size: 28px;
}

.card p {
  color: #475569;
  line-height: 1.5;
  margin-bottom: 0;
}

.plumbing {
  border-left: 8px solid #0f766e;
}

.personal {
  border-left: 8px solid #2563eb;
}

/* Mobile form cleanup */
form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input, textarea, select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 18px;
  padding: 14px 16px;
  border-radius: 12px;
}

.field-label,
.auto-field-label {
  display: block;
  margin: 2px 0 -6px;
  color: #334155;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

label.field-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

label.field-label-wrap input,
label.field-label-wrap textarea,
label.field-label-wrap select {
  margin-top: 0;
  font-weight: 400;
}

/* Compact intake layout: three columns on wide screens, one on phones. */
.inquiry-entry-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 13px 16px;
}

.inquiry-entry-form > label {
  min-width: 0;
  margin: 0;
}

.inquiry-entry-form input,
.inquiry-entry-form select {
  min-height: 44px;
  padding: 9px 12px;
  font-size: 16px;
  border-radius: 9px;
}

.inquiry-entry-form textarea {
  min-height: 78px;
  padding: 10px 12px;
  font-size: 16px;
  border-radius: 9px;
}

.inquiry-entry-form .span-2 { grid-column: span 2; }
.inquiry-entry-form .span-3 { grid-column: 1 / -1; }

.inquiry-entry-form .address-validation-status,
.inquiry-entry-form .address-suggestions {
  font-weight: 400;
}

@media (max-width: 1100px) {
  .inquiry-entry-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inquiry-entry-form .span-3 { grid-column: 1 / -1; }
}

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

textarea {
  min-height: 110px;
  resize: vertical;
}

button, .button {
  width: 100%;
  max-width: 100%;
  font-size: 18px;
  padding: 15px;
  border-radius: 14px;
}

.card {
  overflow: hidden;
}

@media (min-width: 700px) {
  form.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Tech Job completion: keep labels, controls, and checkboxes together. */
form.tech-completion-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

form.tech-completion-form > .field-block,
form.tech-completion-form > details,
form.tech-completion-form > button {
  margin: 0;
}

form.tech-completion-form > details,
form.tech-completion-form > .field-block-wide {
  grid-column: 1 / -1;
}

form.tech-completion-form textarea {
  min-height: 112px;
}

form.tech-completion-form .checkbox-line {
  box-sizing: border-box;
  width: 100%;
}

form.tech-completion-form .checkbox-line input[type="checkbox"] {
  margin: 0;
  width: 18px;
}

.customer-signoff { display:grid; gap:12px; padding:16px; border:1px solid #cbd5e1; border-radius:12px; background:#f8fafc; }
.signature-canvas-wrap { position:relative; overflow:hidden; width:100%; min-height:150px; border:2px dashed #64748b; border-radius:10px; background:#fff; touch-action:none; }
.signature-canvas-wrap canvas { display:block; width:100%; height:180px; cursor:crosshair; touch-action:none; }
.signature-placeholder { position:absolute; inset:auto 16px 14px; color:#64748b; pointer-events:none; }
.signature-actions { margin-top:8px; }
.signature-acknowledgment { align-items:flex-start; }
.saved-signature img { display:block; width:min(100%,520px); max-height:180px; object-fit:contain; object-position:left center; margin-top:6px; padding:8px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; }

.tech-labor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 12px;
}

@media (max-width: 700px) {
  form.tech-completion-form,
  .tech-labor-grid {
    grid-template-columns: 1fr;
  }

  form.tech-completion-form > .field-block,
  .tech-labor-grid > .field-block,
  .tech-labor-grid > .field-block-wide {
    grid-column: 1;
  }
}

/* Status and action helpers */
.low {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: bold;
  margin: 10px 0;
}

.danger {
  background: #991b1b !important;
  color: white !important;
}

.card p + p {
  margin-top: 8px;
}


/* Targeted estimate details cleanup */
details {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0;
}

summary {
  cursor: pointer;
  font-weight: bold;
}


/* Quote notes details */
details {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0;
}

summary {
  cursor: pointer;
  font-weight: bold;
}


/* Owner menu highlight on private operations dashboard */
.owner-menu {
  border: 2px solid rgba(255,255,255,0.35);
}


details.card summary {
  cursor: pointer;
  list-style: none;
}

details.card summary h2 {
  display: inline-block;
  margin: 0;
}


details.card details.card {
  margin-top: 12px;
  border-left: 3px solid rgba(255,255,255,0.25);
}

details.card summary h3 {
  display: inline-block;
  margin: 0;
}


details.line-item summary {
  cursor: pointer;
  font-weight: 700;
}

details.card summary {
  cursor: pointer;
  list-style: none;
}

details.card summary h2,
details.card summary h3 {
  display: inline-block;
  margin: 0;
}


/* Operational layout upgrade: wider, less linear, easier scanning */
:root {
  --ops-bg: #eef3f8;
  --ops-card: #ffffff;
  --ops-border: #dbe4ee;
  --ops-muted: #64748b;
  --ops-ink: #0f172a;
  --ops-primary: #0f766e;
  --ops-primary-soft: #ccfbf1;
  --ops-warning-soft: #fef3c7;
  --ops-danger-soft: #fee2e2;
}

body { background: var(--ops-bg); }

/* Public customer experience */
.public-site {
  --public-navy: #09243c;
  --public-blue: #1479a8;
  --public-aqua: #dff5f4;
  --public-cream: #f7f5ee;
  background: var(--public-cream);
  color: var(--public-navy);
  font-family: "Segoe UI", Arial, sans-serif;
}

.public-site .public-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 72px);
  background: #fff;
  border-bottom: 1px solid #dce6ea;
}

.public-nav a { color: var(--public-navy); text-decoration: none; font-weight: 700; margin-left: 24px; }
.public-brand { display: inline-flex; align-items: center; margin-left: 0 !important; font-size: 19px; }
.public-brand-mark { display: inline-grid; flex: 0 0 38px; place-items: center; width: 38px; height: 38px; margin-right: 10px; overflow: hidden; border-radius: 50%; background: var(--public-navy); color: #fff; }
.public-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.public-brand-name {
  display: inline;
  flex: 0 1 auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--public-navy);
  white-space: nowrap;
}
.public-nav .public-nav-cta { padding: 11px 16px; border-radius: 999px; background: var(--public-navy); color: #fff; }
.public-main { width: min(1180px, calc(100% - 40px)); padding: 0; }
.public-hero { display: grid; grid-template-columns: 1.3fr .7fr; gap: clamp(36px, 7vw, 90px); align-items: center; min-height: 650px; padding: 70px 0; }
.public-hero h1 { max-width: 760px; margin: 10px 0 22px; font-family: Georgia, serif; font-size: clamp(48px, 7vw, 92px); line-height: .96; letter-spacing: -.045em; }
.eyebrow { color: var(--public-blue); font-size: 13px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.public-lead { max-width: 650px; color: #36536a; font-size: clamp(18px, 2vw, 22px); line-height: 1.65; }
.public-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 22px; }
.public-primary, .public-secondary { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 800; text-decoration: none; }
.public-primary { background: var(--public-blue); color: #fff; box-shadow: 0 12px 25px rgba(20,121,168,.2); }
.public-secondary { border: 1px solid #a9bbc5; color: var(--public-navy); }
.public-note { max-width: 650px; padding-left: 15px; border-left: 3px solid #e9a23b; color: #5f4a2c; line-height: 1.5; }
.public-callout { padding: 32px; border-radius: 28px; background: var(--public-navy); color: #fff; box-shadow: 22px 24px 0 var(--public-aqua); }
.public-callout h2 { margin-top: 0; font: 700 30px Georgia, serif; }
.public-callout ol { margin: 26px 0 0; padding: 0; list-style: none; counter-reset: steps; }
.public-callout li { display: grid; gap: 5px; padding: 18px 0 18px 42px; border-top: 1px solid rgba(255,255,255,.18); counter-increment: steps; position: relative; }
.public-callout li::before { content: counter(steps); position: absolute; left: 0; color: #72d2d0; font-weight: 800; }
.public-callout li span { color: #bdd0dc; line-height: 1.45; }
.public-section { padding: 90px 0; border-top: 1px solid #d5dfdf; }
.public-section > h2 { max-width: 720px; margin: 12px 0 42px; font: 700 clamp(36px, 5vw, 58px)/1.05 Georgia, serif; }
.public-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.public-grid article { min-height: 235px; padding: 25px; border-radius: 20px; background: #fff; border: 1px solid #dce6e7; }
.public-grid article span { color: var(--public-blue); font-weight: 800; }
.public-grid h3 { margin: 38px 0 12px; font-size: 21px; }
.public-grid p, .public-trust > p { color: #526b7a; line-height: 1.6; }
.public-trust { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; padding: 65px; border-radius: 32px; background: var(--public-aqua); }
.public-trust h2 { margin: 8px 0 0; font: 700 42px Georgia, serif; }
.public-trust > p { margin: 0; font-size: 19px; }
.public-final { padding: 110px 20px; text-align: center; }
.public-final h2 { margin: 0; font: 700 clamp(38px, 5vw, 62px) Georgia, serif; }
.public-final p { margin-bottom: 28px; color: #526b7a; font-size: 19px; }
.public-footer { display: flex; justify-content: space-between; gap: 24px; padding: 30px clamp(20px, 5vw, 72px); background: var(--public-navy); color: #d9e8ef; }
.public-footer a { color: #fff; }

@media (max-width: 820px) {
  .public-site .public-nav { align-items: flex-start; }
  .public-nav div a:not(.public-nav-cta) { display: none; }
  .public-hero { grid-template-columns: 1fr; min-height: auto; padding-top: 50px; }
  .public-grid { grid-template-columns: 1fr 1fr; }
  .public-trust { grid-template-columns: 1fr; padding: 35px; gap: 25px; }
}

@media (max-width: 520px) {
  .public-brand { font-size: 15px; }
  .public-brand-mark { flex-basis: 34px; width: 34px; height: 34px; font-size: 14px; }
  .public-nav .public-nav-cta { margin-left: 0; }
  .public-main { width: min(100% - 28px, 1180px); }
  .public-hero h1 { font-size: 48px; }
  .public-grid { grid-template-columns: 1fr; }
  .public-actions a { width: 100%; box-sizing: border-box; }
  .public-footer { flex-direction: column; }
}

/* Business profile: compact on desktop, simple and readable on phones. */
.business-profile-form {
  display: block;
}

.business-profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 18px;
}

.business-profile-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.business-profile-grid input,
.business-profile-grid textarea {
  margin: 0;
}

.business-profile-grid .full-width,
.business-profile-actions {
  grid-column: 1 / -1;
}

.business-profile-actions {
  margin-top: 16px;
}

@media (min-width: 900px) {
  .business-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  form.business-profile-form .business-profile-grid > label {
    grid-column: auto;
  }

  form.business-profile-form .business-profile-grid > label.full-width {
    grid-column: 1 / -1;
  }
}

header {
  padding: 28px clamp(18px, 4vw, 48px);
  background: linear-gradient(135deg, #0f172a 0%, #12343b 58%, #0f766e 100%);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .22);
}

main {
  width: min(1540px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 12px 44px;
}

.card,
details.card {
  border: 1px solid var(--ops-border);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

.card h2 { font-size: clamp(22px, 2vw, 28px); }

.ops-hero {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(280px, 1.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.ops-grid,
.record-grid,
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(315px, 1fr));
  gap: 18px;
  align-items: start;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.module-grid .card,
.record-grid .card,
.portal-grid .card { margin-bottom: 0; }

.module-card {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 7px solid var(--ops-primary);
}

.module-card h2,
.kpi-card h3 { margin-bottom: 8px; }

.kpi-grid,
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 12px;
}

.kpi-card,
.summary > div,
.line-item {
  background: #f8fafc;
  border: 1px solid var(--ops-border);
  border-radius: 16px;
  padding: 14px;
}

.kpi-card b,
.summary b {
  display: block;
  font-size: 1.55rem;
  color: var(--ops-primary);
}

.kpi-card span,
.summary span,
.muted { color: var(--ops-muted); }

.section-title {
  margin: 28px 0 12px;
  color: var(--ops-ink);
  font-size: 1.2rem;
  letter-spacing: .01em;
}

.action-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.action-bar h3 { grid-column: 1 / -1; margin: 0 0 4px; }
.action-bar form { margin: 0; }

.button, button {
  border: 0;
  background: var(--ops-primary);
  color: white;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover, button:hover { filter: brightness(.96); }

input, textarea, select {
  border: 1px solid #cbd5e1;
  background: #fff;
}

label { font-weight: 700; color: #334155; }

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-block label {
  font-size: 0.82rem;
  line-height: 1.2;
}

.field-label {
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.field-block input,
.field-block textarea,
.field-block select {
  width: 100%;
}

.checkbox-field {
  justify-content: end;
}

.checkbox-line {
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
}

.checkbox-line input[type="checkbox"] {
  flex: 0 0 auto;
  height: 16px;
  width: 16px;
}

.field-block-wide {
  grid-column: 1 / -1;
}

.w4-payroll-setup {
  margin-top: 16px;
  min-width: 0;
  padding: 16px;
}

.w4-payroll-intro {
  margin-bottom: 14px;
}

.w4-payroll-intro p {
  margin: 0 0 8px;
}

.w4-payroll-grid {
  align-items: end;
  display: grid;
  gap: 14px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.w4-electronic-form fieldset {
  margin: 18px 0;
  padding: 16px;
}

.w4-electronic-form legend {
  font-size: 1.05rem;
  font-weight: 800;
}

.w4-electronic-form .checkbox-line {
  margin: 10px 0;
}

.w4-record code {
  overflow-wrap: anywhere;
}

@media print {
  .w4-record button,
  .w4-record .button {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .w4-payroll-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .w4-payroll-setup {
    break-inside: auto;
    padding: 12px;
  }

  .w4-payroll-intro,
  .w4-payroll-grid .field-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .w4-payroll-grid {
    display: grid !important;
    gap: 10px 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .w4-payroll-grid label,
  .w4-payroll-grid .field-label {
    display: block;
    margin: 0 0 4px;
  }

  .w4-payroll-grid input,
  .w4-payroll-grid select,
  .w4-payroll-grid .checkbox-line {
    margin: 0;
  }

  .w4-payroll-grid .checkbox-line {
    display: flex !important;
  }
}

@media (min-width: 900px) {
  form:not(.single-column) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
  }
  form:not(.single-column) textarea,
  form:not(.single-column) details,
  form:not(.single-column) label,
  form:not(.single-column) button,
  form:not(.single-column) .button {
    grid-column: 1 / -1;
  }
  .compact-form button { grid-column: auto; }
}

@media (min-width: 1200px) {
  .record-grid.jobs-grid { grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); }
  .record-grid.quotes-grid { grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); }
}

@media (max-width: 820px) {
  .ops-hero { grid-template-columns: 1fr; }
  main { width: min(100% - 14px, 1540px); padding: 14px 7px 34px; }
  .ops-grid, .record-grid, .module-grid { grid-template-columns: 1fr; }
}

/* Button polish upgrade: actions should size to their words, not stretch across cards */
form {
  align-items: flex-start;
}

button,
.button,
input[type="submit"] {
  width: auto;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  min-height: 44px;
  line-height: 1.1;
  white-space: nowrap;
  border-radius: 12px;
  box-sizing: border-box;
}

a.button {
  width: fit-content;
}

form button,
form input[type="submit"] {
  align-self: flex-start;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.action-bar form {
  display: inline-flex;
  width: auto;
  margin: 0;
}

.action-bar h3 {
  flex: 0 0 100%;
}

/* Keep fields full-size even though forms no longer stretch all children */
form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
form textarea,
form select,
form label,
form details {
  align-self: stretch;
}

/* Login is one of the few forms that still feels better with a full-width primary button */
form.login-form button,
button.full-width,
.button.full-width {
  width: 100%;
}

/* This form owns an inner responsive grid; keep the outer form full width. */
main form.business-profile-form {
  display: block;
  width: 100%;
}

@media (min-width: 900px) {
  form:not(.single-column) button,
  form:not(.single-column) input[type="submit"],
  form:not(.single-column) .button {
    grid-column: auto;
    justify-self: start;
  }

  form:not(.single-column) textarea,
  form:not(.single-column) details,
  form:not(.single-column) label {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .action-bar {
    align-items: stretch;
  }

  .action-bar .button,
  .action-bar button,
  .action-bar form {
    width: 100%;
  }
}


/* Action layout polish pass: page-specific button systems */
.card,
details.card,
.line-item {
  overflow: visible;
}

.action-row,
.card-actions,
.workflow-actions,
.sidebar-actions,
.utility-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  margin-top: 12px;
}

.action-row form,
.card-actions form,
.workflow-actions form,
.sidebar-actions form,
.utility-actions form {
  display: inline-flex;
  width: auto;
  margin: 0;
  gap: 0;
}

/* Customer change-order review: readable totals and one shared response field. */
.change-order-totals {
  max-width: 620px;
  margin: 20px 0;
  overflow: hidden;
  border: 1px solid var(--ops-border, #cbd5e1);
  border-radius: 14px;
  background: #f8fafc;
}

.change-order-totals p {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ops-border, #cbd5e1);
}

.change-order-totals p:last-child { border-bottom: 0; }
.change-order-totals strong { color: #0f172a; white-space: nowrap; }
.change-order-totals .change-order-new-total {
  background: #ecfdf5;
  font-size: 1.05rem;
}

.change-order-response {
  max-width: 620px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--ops-border, #cbd5e1);
  border-radius: 14px;
  background: #fff;
}

.change-order-response h3 { margin: 0 0 6px; }
.change-order-response > p { margin: 0 0 14px; }
.change-order-response-form { display: block; width: 100%; }
.change-order-response-form label {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 750;
}
.change-order-response-form input { margin: 0; }
.change-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .change-order-totals p { gap: 12px; padding: 11px 12px; }
  .change-order-response { padding: 14px; }
  .change-order-actions { display: grid; grid-template-columns: 1fr; }
  .change-order-actions button { width: 100%; }
}

.action-row details,
.card-actions details,
.workflow-actions details,
.sidebar-actions details,
.utility-actions details {
  margin: 0;
}

.card-actions {
  padding-top: 14px;
  border-top: 1px solid var(--ops-border);
}

.card-actions.no-border {
  border-top: 0;
  padding-top: 0;
}

.workflow-actions {
  align-items: flex-start;
}

.sidebar-actions {
  flex-direction: column;
  align-items: stretch;
  background: #f8fafc;
  border: 1px solid var(--ops-border);
  border-radius: 16px;
  padding: 12px;
}

.sidebar-actions .button,
.sidebar-actions button,
.sidebar-actions form {
  width: 100%;
}

.sidebar-actions .button,
.sidebar-actions button {
  justify-content: center;
  text-align: center;
  white-space: normal;
}

.button.compact,
button.compact,
.action-row .button,
.action-row button,
.card-actions .button,
.card-actions button {
  padding: 10px 14px;
  min-height: 40px;
  font-size: 16px;
  border-radius: 11px;
}

.button.secondary,
button.secondary {
  background: #334155;
}

.button.danger,
button.danger {
  background: #991b1b !important;
}

.action-panel {
  background: #f8fafc;
}

.action-panel h3 {
  margin-top: 0;
}

.action-panel details {
  width: 100%;
}

.action-panel textarea[readonly] {
  min-height: 150px;
}

.job-command-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.job-command-strip p {
  margin: 0 0 6px;
}

.job-primary-actions,
.job-bottom-actions {
  margin: 12px 0;
}

.job-schedule-form {
  max-width: 720px;
}

.workflow-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.workflow-pill.ready {
  border-color: rgba(18, 106, 100, .25);
  background: rgba(18, 106, 100, .1);
  color: var(--primary);
}

.workflow-pill.open {
  border-color: rgba(52, 66, 86, .2);
  background: rgba(52, 66, 86, .08);
  color: #344256;
}

@media (max-width: 640px) {
  .job-command-strip {
    grid-template-columns: 1fr;
  }

  .workflow-pill {
    justify-self: start;
  }
}

.dispatch-actions .button,
.dispatch-actions button {
  min-width: 72px;
}

.dispatch-card h2 {
  margin-bottom: 12px;
}

.invoice-actions {
  margin-top: 14px;
}

.invoice-card-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.invoice-card-title {
  min-width: 220px;
}

.invoice-card-title h2 {
  margin-top: 0;
}

.invoice-top-actions {
  align-items: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 560px;
}

.invoice-top-actions .button,
.invoice-top-actions button {
  min-height: 42px;
}

.invoice-details {
  margin-top: 14px;
}

.customer-card {
  min-height: 205px;
}

.customer-card summary h2 {
  line-height: 1.05;
}

.customer-card .card-actions {
  margin-top: 16px;
}

@media (min-width: 1000px) {
  .record-grid.invoices-grid {
    grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
  }

  .record-grid.customers-grid {
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  }
}

@media (max-width: 520px) {
  .invoice-card-header {
    display: block;
  }

  .invoice-top-actions {
    justify-content: stretch;
    max-width: none;
  }

  .card-actions,
  .workflow-actions,
  .utility-actions {
    align-items: stretch;
  }

  .card-actions .button,
  .card-actions button,
  .card-actions form,
  .workflow-actions .button,
  .workflow-actions button,
  .workflow-actions form,
  .utility-actions .button,
  .utility-actions button,
  .utility-actions form {
    width: 100%;
  }
}

/* Owner/settings organization polish */
.owner-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.data-tools-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.data-tools-grid .action-panel,
.payment-settings-card,
.restore-panel {
  overflow: visible;
}

.utility-actions {
  align-items: center;
}

.utility-actions .button,
.utility-actions button,
.utility-actions form {
  width: auto;
}

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

.backup-row p {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.backup-list {
  display: grid;
  gap: 10px;
}

.payment-settings-card form.single-column,
.payment-settings-form {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.settings-section {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--ops-border);
  border-radius: 16px;
  background: #f8fafc;
}

.settings-section h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.status-grid .kpi-card b {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.payment-settings-form .workflow-actions {
  margin-top: 0;
}

@media (max-width: 620px) {
  .backup-row {
    align-items: stretch;
    flex-direction: column;
  }
  .backup-row .card-actions,
  .backup-row .button {
    width: 100%;
  }
}

/* Inquiry address lookup polish: no duplicate full-address field, no blank popup */
.address-validation-status {
  margin: -2px 0 10px;
  color: var(--ops-muted, #64748b);
}
.address-suggestions {
  display: grid;
  gap: 6px;
  margin: 8px 0 12px;
  padding: 8px;
  border: 1px solid var(--ops-border, #dbe4ee);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}
.address-suggestions[hidden] {
  display: none !important;
}
.address-suggestion-option {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--ops-border, #dbe4ee);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--ops-ink, #0f172a);
  font-weight: 700;
  cursor: pointer;
}
.address-suggestion-option:hover,
.address-suggestion-option:focus {
  background: var(--ops-primary-soft, #ccfbf1);
  border-color: rgba(15, 118, 110, .35);
}
.address-suggestion-option small {
  display: inline-block;
  margin-top: 4px;
  color: var(--ops-muted, #64748b);
  font-weight: 500;
}
.address-suggestion-note {
  padding: 4px 6px 2px;
  color: var(--ops-muted, #64748b);
  font-size: .92rem;
}

/* Action Center automation polish */
.action-center-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 12px 0 22px;
}
.action-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
}
.action-card h3 { margin: 4px 0 8px; }
.action-card p { margin-bottom: 0; }
.workflow-next-card {
  margin: 18px 0 24px;
  padding: 24px;
  border: 2px solid var(--ops-primary, #0f766e);
  background: linear-gradient(135deg, rgba(15, 118, 110, .10), rgba(255, 255, 255, .98));
}
.workflow-next-card h2 { margin: 6px 0 8px; }
.workflow-next-card .button { display: inline-block; margin-top: 8px; }
.workflow-next-card.all-clear { border-color: #4f7668; }
.ghost-button {
  align-self: flex-start;
  opacity: .92;
}


/* Customer Message Center: collapsible records and cleaner printed/PDF pages */
.customer-message-center-page .collapsible-item summary {
  cursor: pointer;
  list-style: none;
}

.customer-message-center-page .collapsible-item summary::-webkit-details-marker {
  display: none;
}

.customer-message-center-page .collapsible-item summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--ops-primary, #0f766e);
  font-weight: 900;
}

.customer-message-center-page .collapsible-item[open] summary::before {
  content: "▾";
}

.customer-message-center-page .collapsible-item .collapsible-body {
  margin-top: 12px;
}

@media print {
  .customer-message-center-page .no-print,
  .customer-message-center-page .action-row,
  .customer-message-center-page .card-actions,
  .customer-message-center-page .workflow-actions,
  .customer-message-center-page .utility-actions,
  .customer-message-center-page button,
  .customer-message-center-page .button,
  .customer-message-center-page form {
    display: none !important;
  }

  .customer-message-center-page .card,
  .customer-message-center-page details.card,
  .customer-message-center-page .line-item {
    box-shadow: none !important;
    break-inside: avoid;
  }
}

/* Professional rebuild pass
   These overrides keep the existing Flask workflows intact while giving the app
   a cleaner operations-product feel. */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --border: #d9e0e8;
  --border-strong: #b9c5d2;
  --text: #17202a;
  --muted-text: #627084;
  --primary: #126a64;
  --primary-hover: #0d5752;
  --primary-soft: #e3f4f1;
  --accent: #315f8f;
  --warning: #a15c00;
  --danger: #a13b3b;
  --success: #2f7d4f;
  --radius: 8px;
  --shadow: 0 10px 22px rgba(23, 32, 42, .07);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.page-hero {
  background: #17202a;
  border-bottom: 1px solid rgba(255,255,255,.12);
  box-shadow: none;
  padding: 26px clamp(18px, 4vw, 44px) 24px;
}

.page-hero h1 {
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.page-hero p {
  max-width: 940px;
  color: #d7dde5;
  font-size: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #8fd0c7 !important;
  font-size: 12px !important;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

main {
  width: min(1500px, calc(100% - 32px));
  padding: 18px 0 42px;
}

.app-shell-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: -18px 0 18px;
  padding: 12px 0;
  background: rgba(246, 247, 249, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 205px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 900;
}

.app-brand b,
.app-brand small {
  display: block;
}

.app-brand small {
  color: var(--muted-text);
  font-size: 12px;
}

.app-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px;
}

.app-nav-link {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: white;
  padding: 8px 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.app-nav-link:hover,
.app-nav-link:focus {
  background: var(--primary-soft);
  border-color: rgba(18, 106, 100, .4);
}

.logout-form {
  display: inline-flex;
  margin: 0;
}

.card,
details.card,
.line-item,
.kpi-card,
.summary > div,
.settings-section,
.sidebar-actions {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card,
details.card {
  padding: 18px;
  margin-bottom: 14px;
}

.card h2,
details.card h2 {
  color: var(--text);
  font-size: 21px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.card h3,
details.card h3 {
  font-size: 17px;
  line-height: 1.25;
}

.card p,
.muted {
  color: var(--muted-text);
}

.ops-hero {
  grid-template-columns: minmax(280px, .95fr) minmax(320px, 1.35fr);
  gap: 14px;
}

.module-grid,
.record-grid,
.portal-grid,
.owner-menu-grid,
.action-center-grid {
  gap: 12px;
}

.module-card {
  min-height: 132px;
  border-left: 4px solid var(--primary);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.module-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 14px 28px rgba(23, 32, 42, .11);
}

.section-title {
  margin: 24px 0 10px;
  font-size: 15px;
  font-weight: 900;
  color: #344256;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.kpi-grid,
.summary,
.status-grid {
  gap: 10px;
}

.kpi-card,
.summary > div,
.line-item {
  border-radius: var(--radius);
  box-shadow: none;
  background: var(--panel-soft);
}

.kpi-card b,
.summary b {
  color: var(--primary);
  font-size: 1.35rem;
}

input,
textarea,
select {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  padding: 11px 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 106, 100, .14);
  outline: none;
}

button,
.button,
input[type="submit"] {
  background: var(--primary);
  border: 1px solid transparent;
  border-radius: 8px;
  color: white;
  font-size: 15px;
  min-height: 40px;
  padding: 10px 14px;
  white-space: normal;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
  background: var(--primary-hover);
  filter: none;
}

.button.secondary,
button.secondary {
  background: #344256;
}

.button.danger,
button.danger,
.danger {
  background: var(--danger) !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf2f7;
  color: #344256;
  font-size: 13px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

details {
  border-radius: var(--radius);
}

summary {
  color: var(--text);
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f4f6f8;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.low {
  background: #fff1f1;
  color: var(--danger);
  border-radius: 8px;
}

@media (max-width: 900px) {
  main {
    width: min(100% - 18px, 1500px);
    padding-top: 12px;
  }

  .app-shell-bar {
    position: static;
    grid-template-columns: 1fr;
    margin-top: -12px;
  }

  .app-brand {
    min-width: 0;
  }

  .ops-hero {
    grid-template-columns: 1fr;
  }
}

/* Keep the private inquiry form dense after the general form rules above. */
@media (min-width: 1101px) {
  form.inquiry-entry-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 13px 16px;
  }
  form.inquiry-entry-form > label { grid-column: auto; }
  form.inquiry-entry-form > .span-2 { grid-column: span 2; }
  form.inquiry-entry-form > .span-3 { grid-column: 1 / -1; }
}

@media (min-width: 701px) and (max-width: 1100px) {
  form.inquiry-entry-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  form.inquiry-entry-form > label { grid-column: auto; }
  form.inquiry-entry-form > .span-2,
  form.inquiry-entry-form > .span-3 { grid-column: 1 / -1; }
}

/* Keep quote revision controls aligned without crowding adjacent actions. */
.quote-utility-actions {
  align-items: flex-end;
}

.quote-utility-actions .quote-revision-form {
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto;
  gap: 8px 12px;
  align-items: end;
}

.quote-revision-form label {
  grid-column: 1 / -1;
  margin: 0;
}

.quote-revision-form input,
.quote-revision-form button {
  margin: 0;
}

@media (max-width: 700px) {
  .quote-utility-actions .quote-revision-form {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .quote-revision-form label {
    grid-column: auto;
  }
}
