/* CRM styles. Loads AFTER site.css, which supplies the colour tokens and fonts.
   This is a tool, not a document: denser type, tighter spacing, state encoded in
   shape as well as colour so status reads at a glance. */

body.app { background: var(--paper); }
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* top bar */
.appbar { display: flex; align-items: center; gap: 14px; padding: 0 18px; height: 56px;
  border-bottom: 1px solid var(--line); background: var(--surface); position: sticky;
  top: 0; z-index: 30; }
.appbar .brand { font-family: Archivo, sans-serif; font-weight: 700; font-size: 15px;
  letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; }
.appbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-2); }
.role { font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 2px;
  background: var(--signal-soft); color: var(--signal); }
.linkbtn { background: none; border: 0; color: var(--ink-3); font: inherit; font-size: 13px;
  cursor: pointer; padding: 4px; }
.linkbtn:hover { color: var(--ink); }

/* nav */
.appnav { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line);
  background: var(--surface); overflow-x: auto; }
.appnav button { background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 12px 14px; font: inherit; font-size: 14px; color: var(--ink-2);
  cursor: pointer; white-space: nowrap; }
.appnav button:hover { color: var(--ink); }
.appnav button.on { color: var(--ink); border-bottom-color: var(--signal); font-weight: 600; }
.appnav .count { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; margin-left: 6px;
  background: var(--signal); color: var(--signal-on); border-radius: 8px; padding: 1px 6px; }

main.appmain { flex: 1; padding: 22px 18px 70px; max-width: 1180px; width: 100%;
  margin: 0 auto; }
.vhead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.vhead h2 { font-family: Archivo, sans-serif; font-size: 20px; font-weight: 700;
  letter-spacing: -.02em; margin: 0; }
.vhead .sub { color: var(--ink-3); font-size: 13.5px; }
.vhead .right { margin-left: auto; display: flex; gap: 8px; }

/* stat tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 26px; }
.tile { border: 1px solid var(--line); background: var(--surface); border-radius: 3px;
  padding: 15px 16px; }
.tile .k { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.tile .v { font-family: Archivo, sans-serif; font-size: 28px; font-weight: 700;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 3px; }
.tile.alert .v { color: var(--signal); }

/* cards / rows */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { border: 1px solid var(--line); background: var(--surface); border-radius: 3px;
  padding: 13px 15px; display: flex; gap: 13px; align-items: flex-start; }
.row .stripe { width: 3px; align-self: stretch; border-radius: 2px; background: var(--line-2);
  flex: none; }
.row .body { flex: 1; min-width: 0; }
.row .t { font-weight: 600; font-size: 14.5px; }
.row .m { color: var(--ink-2); font-size: 13.5px; margin-top: 3px;
  overflow-wrap: anywhere; }
.row .meta { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-3);
  margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.row .acts { display: flex; gap: 6px; align-items: center; flex: none; flex-wrap: wrap;
  justify-content: flex-end; max-width: 320px; }

/* One status colour system, used everywhere a quote/invoice/document/job
   shows its state, so the same meaning always reads the same colour - see
   console-redesign-and-documents-sept-2026. Shape still carries meaning too
   (line-through, dashed) so colour is never the only signal. */
:root {
  --success-soft: #EAF3EC;
  --money: #B54708;      /* payment needed - warmer/more urgent than --warn */
  --money-soft: #FDF1E8;
  --danger: #B42318;     /* stopped: declined, void-for-cause, failed, lost */
  --danger-soft: #FDEDEB;
}
.st { font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; padding: 3px 8px; border-radius: 2px;
  white-space: nowrap; border: 1px solid transparent; }
.st-new { background: var(--signal); color: var(--signal-on); }
.st-open { background: var(--signal-soft); color: var(--signal); }
.st-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.st-money { background: var(--money-soft); color: var(--money); border-color: var(--money); }
.st-success { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.st-done { background: var(--surface-2); color: var(--ink-3); }
.st-lost { background: var(--surface-2); color: var(--ink-3); text-decoration: line-through; }
.st-danger { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }

/* forms */
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: 3px;
  padding: 18px; margin-bottom: 18px; }
.panel h3 { font-family: Archivo, sans-serif; font-size: 15.5px; margin: 0 0 14px;
  font-weight: 600; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.f { display: grid; gap: 5px; }
.f label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.f input, .f select, .f textarea { font: inherit; font-size: 14px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-2); border-radius: 3px;
  padding: 9px 10px; width: 100%; }
.f textarea { min-height: 78px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: 0; border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-soft); }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn.tiny { padding: 5px 10px; font-size: 12px; }

/* login */
.login { max-width: 380px; margin: 12vh auto; }
.login .panel { padding: 26px; }
.login h1 { font-family: Archivo, sans-serif; font-size: 22px; margin: 0 0 6px;
  letter-spacing: -.02em; }
.login p.sub { color: var(--ink-3); font-size: 13.5px; margin: 0 0 18px; }

.empty { color: var(--ink-3); font-size: 14px; padding: 26px; text-align: center;
  border: 1px dashed var(--line-2); border-radius: 3px; }
.err { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn);
  padding: 11px 14px; border-radius: 3px; font-size: 13.5px; margin-bottom: 14px; }
.ok { background: var(--signal-soft); color: var(--signal); border: 1px solid var(--signal);
  padding: 11px 14px; border-radius: 3px; font-size: 13.5px; margin-bottom: 14px; }
.hide { display: none !important; }
@media (max-width: 600px) { .row .acts { max-width: none; width: 100%; } }


/* job workflow stepper - "where is this job right now", at a glance, across
   the top of every job card (job list, contact's Jobs section). Six steps in
   fixed pipeline order; a lost job replaces the whole thing with a plain red
   banner instead of a broken-looking partial stepper. */
.jobcard { flex-direction: column; align-items: stretch; gap: 10px; }
.jobcard .jobcard-main { display: flex; gap: 13px; align-items: flex-start; }
.stepper { display: flex; align-items: center; padding: 2px 2px 0; }
.stepper .step { display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: none; width: 74px; }
.stepper .step .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2);
  border: 2px solid var(--line-2); box-sizing: content-box; transition: background-color .15s, border-color .15s; }
.stepper .step .lbl { font-family: "IBM Plex Mono", monospace; font-size: 9.5px;
  letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); text-align: center;
  line-height: 1.25; }
.stepper .step-done .dot { background: var(--signal); border-color: var(--signal); }
.stepper .step-done .lbl { color: var(--ink-2); }
.stepper .step-current .dot { background: var(--surface); border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-soft); animation: step-pulse 2s ease-in-out infinite; }
.stepper .step-current .lbl { color: var(--ink); font-weight: 600; }
.stepper .step-money .dot { background: var(--surface); border-color: var(--money);
  box-shadow: 0 0 0 3px var(--money-soft); animation: step-pulse-money 2s ease-in-out infinite; }
.stepper .step-money .lbl { color: var(--money); font-weight: 600; }
.stepper .step-line { flex: 1 1 auto; height: 2px; background: var(--line-2); margin: 0 -1px 17px;
  min-width: 8px; transition: background-color .15s; }
.stepper .step-line-done { background: var(--signal); }
@keyframes step-pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--signal-soft); } 50% { box-shadow: 0 0 0 5px var(--signal-soft); } }
@keyframes step-pulse-money { 0%, 100% { box-shadow: 0 0 0 3px var(--money-soft); } 50% { box-shadow: 0 0 0 5px var(--money-soft); } }
.stepper-lost { font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--danger); background: var(--danger-soft);
  border-radius: 2px; padding: 6px 10px; text-align: center; }
@media (max-width: 760px) {
  .stepper .step { width: 15vw; min-width: 44px; }
  .stepper .step .lbl { font-size: 8.5px; }
}

/* small entrance for freshly-rendered rows/panels - subtle, not distracting */
@keyframes row-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.row, .panel, .tile { animation: row-in .18s ease-out; }
.btn, .st, .linkbtn { transition: background-color .12s, color .12s, border-color .12s, transform .08s; }
.btn:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .row, .panel, .tile { animation: none; }
  .stepper .step-current .dot, .stepper .step-money .dot { animation: none; }
  .btn, .st, .linkbtn, .stepper .step .dot, .stepper .step-line { transition: none; }
}

/* Letterhead on a customer document (the public quote and document pages).
   Values come from the site_settings record, edited in the console under
   Settings -> Site settings, with a hardcoded fallback in the page's own JS
   so a failed lookup never blanks the top of a quote. */
.letterhead { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line); }
.letterhead .lh-logo { max-width: 220px; max-height: 74px; }
.letterhead .lh-name { font-family: Archivo, sans-serif; font-weight: 700; font-size: 17px;
  letter-spacing: -.01em; }
.letterhead .lh-meta { text-align: right; font-size: 12.5px; color: var(--ink-3);
  line-height: 1.5; }
.letterhead .lh-meta a { color: inherit; }
@media (max-width: 520px) {
  .letterhead .lh-meta { text-align: left; }
}
