/* Protect My Jobsite Suite — design system.
   Ported from the approved suite mockup (mockup/pmjs-suite-mockup.html):
   navy + orange identity, card-based layout, pill status badges.
   Dependency-free vanilla CSS, like the rest of the shell. */

:root {
  --navy: #10263d;
  --navy2: #173450;
  --ink: #1c2b3a;
  --muted: #64748b;
  --orange: #f07316;
  --orange-d: #d95f0b;
  --teal: #0e8a7b;
  --teal-d: #0b6e62;
  --bg: #eef1f5;
  --card: #ffffff;
  --line: #dbe2ea;
  --red: #c0392b;
  --amber: #b7791f;
  --green-bg: #e6f4ea;
  --red-bg: #fdecea;
  --amber-bg: #fdf3e0;
  --blue-bg: #e8f0fe;
  --radius: 10px;
  /* Height of the demo ribbon. The ribbon is a fixed-height strip; the
     sticky sidebar/topbar offset themselves by this variable so the
     ribbon's space is always reserved and it can never overlay them
     (click-test defect 2026-11-12: brand + header clipped under it). */
  --ribbon-h: 0px;
}

body.demo { --ribbon-h: 34px; }

* { box-sizing: border-box; }

/* The shell switches screens with the `hidden` attribute. Any component
   rule that sets `display` (e.g. .auth's grid) silently outranks the
   browser's built-in [hidden] rule — the GUI sprint's .auth did exactly
   that, so the sign-in card never left the screen and every signed-in
   page stacked underneath it (launch morning, 2026-11-11: the "dead
   Sign in button"). This guard is load-bearing: never remove it. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.sub, .note { color: var(--muted); font-size: 12.5px; }
.error { color: var(--red); min-height: 1em; margin: 8px 0 0; }

/* ------------------------------ controls ------------------------------ */

button {
  font: inherit;
  font-weight: 600;
  background: var(--orange);
  color: #fff;
  border: 1px solid var(--orange);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
}
button:hover { background: var(--orange-d); border-color: var(--orange-d); }
button:disabled { opacity: .45; cursor: default; }
button.secondary { background: #fff; color: var(--ink); border-color: var(--line); padding: 6px 12px; font-size: 13px; }
button.secondary:hover { background: #f1f5f9; border-color: var(--line); }
button.danger { background: #fff; color: var(--red); border-color: var(--red); }
button.danger:hover { background: var(--red-bg); }

label { display: block; font-size: 12.5px; font-weight: 600; color: #43536a; }
input, select, textarea {
  font: inherit;
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(240, 115, 22, .35);
  border-color: var(--orange);
}
form.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: end; margin-top: 10px; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; word-break: break-all; }

/* ------------------------------- tables ------------------------------- */

table { width: 100%; border-collapse: collapse; margin: 6px 0 4px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line);
}
td { padding: 9px 10px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f6f9fc; }

/* ------------------------------- badges ------------------------------- */

.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.b-paid { background: var(--green-bg); color: #1e7d32; }
.b-sent { background: var(--blue-bg); color: #1a56c4; }
.b-draft { background: #eef1f5; color: #5b6b7c; }
.b-overdue { background: var(--red-bg); color: var(--red); }
.b-active { background: var(--green-bg); color: #1e7d32; }
.b-bid { background: var(--amber-bg); color: var(--amber); }
.b-hold { background: var(--amber-bg); color: var(--amber); }
.b-done { background: #eef1f5; color: #5b6b7c; }

/* ------------------------------ auth screens --------------------------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  width: min(420px, 100%); padding: 34px 34px 28px;
  box-shadow: 0 12px 32px rgba(16, 38, 61, .10);
}
.auth-card .brand { justify-content: center; margin-bottom: 12px; }
.auth-card h1 { text-align: center; }
.auth-card .sub { text-align: center; margin-bottom: 18px; }
.auth-card form label { margin-bottom: 12px; }
.auth-card form button { width: 100%; margin-top: 4px; padding: 11px 16px; }
.auth-card .note { text-align: center; margin-top: 16px; }

.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--orange);
  display: grid; place-items: center; flex: none;
}
.logo svg { display: block; }
.brand-name { font-weight: 800; font-size: 16.5px; line-height: 1.15; }
.brand-name small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--orange); }

/* ------------------------------ app layout ----------------------------- */

#demo-ribbon {
  position: sticky; top: 0; z-index: 60;
  height: var(--ribbon-h); padding: 0 12px;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: repeating-linear-gradient(45deg, #9a4a08, #9a4a08 16px, #7e3c06 16px, #7e3c06 32px);
  color: #fff; font-weight: 800; letter-spacing: .08em;
  font-size: 12.5px;
}

.layout { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 224px; flex: none; color: #cfe0ef;
  background: linear-gradient(180deg, var(--navy), var(--navy2));
  padding: 18px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: var(--ribbon-h); height: calc(100vh - var(--ribbon-h));
}
.sidebar .brand { padding: 2px 8px 16px; color: #fff; }
.sidebar .brand-name small { color: #ffb37a; }
.navbtn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; color: #cfe0ef; font-weight: 600;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.navbtn:hover { background: rgba(255, 255, 255, .08); }
.navbtn.active { background: var(--orange); color: #fff; }
.navbtn .ico { width: 18px; text-align: center; flex: none; }
.sidefoot { margin-top: auto; padding: 12px 8px 2px; font-size: 12px; color: #9db4c9; border-top: 1px solid rgba(255, 255, 255, .14); }
.sidefoot strong { color: #fff; display: block; font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 26px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: var(--ribbon-h); z-index: 40;
}
.tb-title { font-size: 17px; font-weight: 700; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.tb-user { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.tb-user strong { color: var(--ink); display: block; font-size: 13px; }

.content { padding: 24px 26px 60px; width: 100%; max-width: 1240px; margin: 0 auto; }
.page-head { margin-bottom: 16px; }

/* --------------------------- command center ---------------------------- */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.k-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.k-value { font-size: 25px; font-weight: 800; margin: 5px 0 2px; }
.k-value.neg { color: var(--red); }
.k-sub { font-size: 12px; color: var(--muted); }
/* Ported from the mockup for the Change Orders KPI strip parity pass:
   .k-note is the KPI card's third line; .kpi.warn reddens the value;
   .pill carries the mockup's inline-colored pills (type badges). */
.k-note { font-size: 12px; color: var(--muted); }
.kpi.warn .k-value { color: var(--red); }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
/* Balance-sheet two-column layout, ported from the mockup. */
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv span { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
td.num, th.num { text-align: right; }
.num.pos { color: #166534; }
.num.neg { color: #b42318; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.card > h3 { margin-top: 0; }

.cc-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; align-items: start; }
.cc-grid .card { margin-bottom: 0; }
.cc-below { margin-top: 18px; }

.today-list { list-style: none; margin: 0; padding: 0; }
.today-list li { padding: 9px 0; border-bottom: 1px dashed #e6ebf1; }
.today-list li:last-child { border-bottom: none; }
.today-list .t-label { font-weight: 600; }
.today-list .t-detail { display: block; color: var(--muted); font-size: 12.5px; }
.today-list .t-ico { margin-right: 7px; }

.att-row {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); border-left: 4px solid var(--amber);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff;
}
.att-row.red { border-left-color: var(--red); }
.att-row.clickable { cursor: pointer; }
.att-row.clickable:hover { background: #f6f9fc; }
.att-row .a-label { font-weight: 700; }
.att-row .a-detail { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.att-row .a-ico { flex: none; }

/* ------------------------------ books bits ----------------------------- */

.btabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin: 14px 0 6px; flex-wrap: wrap; }
.btab {
  background: transparent; border: none; border-bottom: 3px solid transparent;
  color: var(--muted); font-weight: 600; padding: 9px 14px; margin-bottom: -2px;
  border-radius: 6px 6px 0 0; cursor: pointer;
}
.btab:hover { background: #f1f5f9; color: var(--ink); border-color: transparent; }
.btab.active { color: var(--ink); border-bottom-color: var(--orange); }

.callout {
  background: #eef4fb; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 10px 0;
}
.line-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-end; }
.line-row input, .line-row select { margin-top: 0; }
.line-row .l-desc { flex: 3; }
.line-row .l-qty, .line-row .l-retail, .line-row .l-disc { flex: 1; }
.line-row .l-acct { flex: 2; }

dl { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 12px 0; }
dt { font-weight: 700; color: #43536a; }
dd { margin: 0; }

/* ------------------------- demo mode (cosmetic) ------------------------ */
/* The API already refuses demo-tenant mutations; these rules close the
   cosmetic gap so a demo visitor never sees a form that cannot save. */

body.demo #form-customer, body.demo #form-job, body.demo #form-invoice,
body.demo #form-expense, body.demo #form-account, body.demo #form-payment,
body.demo #form-retention-payment, body.demo #btn-add-line,
body.demo #mfa-enroll-box, body.demo #password-change-box,
body.demo [data-archive-customer], body.demo [data-toggle-account],
body.demo [data-toggle-expense], body.demo #btn-inv-send,
body.demo #btn-inv-void, body.demo #btn-inv-release, body.demo .l-del,
body.demo #form-import, body.demo #form-bank-item, body.demo #form-rule,
body.demo #form-proposal, body.demo #btn-approve-all,
body.demo #form-saved-view, body.demo #form-1099-threshold,
body.demo .rev-act, body.demo .prop-act, body.demo .sv-act,
body.demo .pack-act, body.demo .f1099-toggle,
body.demo #form-recurring, body.demo #form-rep, body.demo #form-creditline,
body.demo .fc-act, body.demo .cm-act, body.demo .cm-assign-sel,
body.demo .rd-act, body.demo .svc-act,
body.demo [data-rec-toggle] {
  display: none !important;
}

/* Daily Reports (migration 025): same cosmetic rule — the demo tenant
   cannot save, so its write controls never render. */
body.demo #form-dailyreport, body.demo #form-drsign, body.demo #form-drreturn,
body.demo #form-drrow, body.demo #form-drnote, body.demo .dr-act,
body.demo [data-dr-trform], body.demo [data-dr-photo] {
  display: none !important;
}

/* --------------------------- doc 21 additions -------------------------- */
/* Bank review queue, proposals, reports. Same visual language as the
   rest of the shell: cards, badges, plain tables. */

.checkline { flex-direction: row; align-items: center; gap: 6px; }
.checkline input { width: auto; }
.buttonlink { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; }
.group-title { margin: 18px 0 6px; font-size: 14px; }
.sugg { color: var(--muted, #5b6470); font-size: 12px; }
table td .sugg { display: block; }
.money-in { color: #14663a; font-weight: 600; }
.money-out { font-weight: 600; }
.prop-card { border: 1px solid var(--line, #e3e6ea); border-radius: 8px; padding: 12px 14px; margin: 10px 0; }
.prop-card h4 { margin: 0 0 6px; font-size: 14px; }
.clickable { cursor: pointer; }
.clickable:hover td { background: #f2f5f8; }

/* --------------------------- project controls -------------------------- */

.sidefoot .powered { display: block; margin-top: 8px; font-size: 11px; color: #7e97ad; }

.pipeline { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.pipeline .stage {
  flex: 1; min-width: 110px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: #fff; text-align: center;
}
.pipeline .stage .s-name { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.pipeline .stage .s-count { font-size: 20px; font-weight: 800; }
.pipeline .stage.done { border-color: var(--teal); background: #eefaf7; }
.pipeline .stage.now { border-color: var(--orange); background: #fff5ec; box-shadow: inset 0 0 0 1px var(--orange); }
.pipeline .stage .s-sub { font-size: 11.5px; color: var(--muted); }

.ctl-filter { max-width: 640px; }
.ctl-lines { margin-top: 10px; }
.ctl-lines .line-row input { min-width: 0; }
.ctl-lines .cl-code, .ctl-lines .el-code { flex: 1; }
.ctl-lines .cl-desc, .ctl-lines .el-desc { flex: 3; }
.ctl-lines .cl-co, .ctl-lines .el-section { flex: 2; }
.ctl-lines .cl-amt, .ctl-lines .el-amt { flex: 1; }
.ctl-lines .el-qty, .ctl-lines .el-unit { flex: 1; }
.neg { color: var(--red); }
tr.total-row td { font-weight: 700; border-top: 2px solid var(--line); }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.actions-row form { display: flex; gap: 8px; align-items: end; }
.actions-row label { font-size: 12px; }
.actions-row input { margin-top: 2px; padding: 6px 8px; }

/* Demo mode: hide every Project Controls mutation control (the API
   refuses demo mutations regardless — this closes the cosmetic gap). */
body.demo .ctl-form, body.demo .ctl-act, body.demo .ctl-lines,
body.demo .ctl-editbox { display: none !important; }

/* ------------------------------ responsive ----------------------------- */

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar .brand { padding-bottom: 2px; }
  .navbtn { width: auto; }
  .sidefoot { display: none; }
  .content { padding: 18px 14px 48px; }
  .topbar { padding: 10px 14px; }
}

/* --------------------------- service module --------------------------- */
/* Dispatch board: one column per tech, cards are the jobs. Same card /
   badge language as the rest of the shell. */
.svc-board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 6px; }
.svc-col { flex: 1 1 0; min-width: 230px; background: #f6f9fc; border: 1px solid #dde3ea; border-radius: 10px; padding: 10px; }
.svc-col.dragover { outline: 2px dashed #9a4a08; outline-offset: -4px; }
.svc-col h4 { margin: 2px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #43536a; }
.svc-jobcard { background: #fff; border: 1px solid #dde3ea; border-left: 4px solid #9a4a08; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; }
.svc-jobcard:hover { border-color: #9a4a08; }
.svc-jobcard .t { font-weight: 600; }
.svc-jobcard .m { color: #5b6b7c; font-size: 12px; }
.svc-photos { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.svc-photos figure { margin: 0; text-align: center; }
.svc-photos img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid #dde3ea; }
.svc-photos figcaption { font-size: 11px; color: #5b6b7c; }
