/* Contractor Import Dashboard — Westwood District Services
   Palette and type per the westwood-brand skill. Token names match builder/builder.css so the two
   surfaces stay recognisably the same product.

   Layout target is a phone in a truck cab: single column, big tap targets, nothing that needs a
   horizontal scroll. The desktop view is the same column, wider. */

:root {
  --red: #EE3124; --red-hover: #D62C20; --red-active: #BE271D;
  --red-light: #FDEAE9; --red-light-hover: #FCE0DE; --red-dark: #B3251B;
  --maroon: #5E2A2B; --maroon-dark: #472020; --maroon-light: #EFEAEA;
  --gray: #A7A8A9; --gray-light: #F6F6F6; --gray-line: #E4E4E4; --gray-dark: #7D7E7F; --gray-darker: #3A3B3B;
  --brass: #D6D1C4; --brass-light: #FBFAF9; --brass-active: #F2F1ED; --brass-darker: #4B4945;
  --font-sans: 'Roboto', Calibri, sans-serif;
  --font-slab: 'Roboto Slab', Georgia, serif;
  --hairline: 1px solid var(--gray-line);
  --shadow: 0 1px 2px rgba(33,15,15,.06), 0 4px 16px rgba(33,15,15,.05);
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: #000;
  background: var(--brass-light);
}

/* ---------- app bar ---------- */
/* The contour lines are the brand's "topographic map" motif — the land we work on — at a weight
   that reads as texture rather than decoration. Inline SVG so the bar costs no extra request. */
.appbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: 60px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="420" height="60" viewBox="0 0 420 60"><g fill="none" stroke="%23ffffff" stroke-opacity="0.07" stroke-width="1.2"><path d="M-10 48 C 60 14, 130 66, 200 32 S 340 12, 430 42"/><path d="M-10 54 C 60 24, 130 72, 200 40 S 340 22, 430 50"/><path d="M-10 42 C 60 6, 130 58, 200 24 S 340 4, 430 34"/></g></svg>') repeat-x, var(--maroon);
  color: #fff;
}
.wordmark { height: 17px; width: auto; display: block; }
.appbar-divider { width: 1px; height: 22px; background: rgba(255,255,255,.28); }
.appbar-title { font-family: var(--font-slab); font-size: 14px; letter-spacing: .02em; }

/* ---------- shell ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 28px 20px 60px; }

/* ---------- auth + contract-list views ---------- */
/* These four views (view-login, view-forgot, view-set-password, view-contracts) are not wrapped in
   .wrap — they get their own narrower column, since a sign-in form or a list of contract names
   reads better tighter than the 720px upload page. */
#view-login, #view-forgot, #view-set-password { max-width: 380px; margin: 0 auto; padding: 48px 20px 60px; }
#view-contracts { max-width: 560px; margin: 0 auto; padding: 28px 20px 60px; }

#view-login h1, #view-forgot h1, #view-set-password h1, #view-contracts h1 {
  font-family: var(--font-slab); font-size: 24px; color: var(--maroon-dark); margin-bottom: 20px;
}

#form-login label, #form-forgot label, #form-set-password label { margin-top: 14px; }
#form-login label:first-child, #form-forgot label:first-child, #form-set-password label:first-child { margin-top: 0; }
#form-login input, #form-forgot input, #form-set-password input { display: block; width: 100%; margin-bottom: 2px; }
#form-login .btn-primary, #form-forgot .btn-primary, #form-set-password .btn-primary { margin-top: 18px; }

.hint { font-size: 13px; color: var(--gray-dark); margin-top: 14px; }
.hint a { color: var(--red); text-decoration: none; }
.hint a:hover { text-decoration: underline; }

.form-error {
  background: var(--red-light); border: 1px solid var(--red); border-radius: 6px;
  padding: 10px 14px; margin: 10px 0 0; font-size: 14px; color: var(--red-dark);
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
#who { font-size: 14px; color: var(--gray-darker); }

.contract-list { list-style: none; padding: 0; margin-top: 10px; }
.contract-list li { border-top: var(--hairline); }
.contract-list li:first-child { border-top: 0; }
.contract-list a {
  display: block; padding: 14px 2px; font-size: 15px; font-weight: 500;
  color: var(--maroon-dark); text-decoration: none;
}
.contract-list a:hover { color: var(--red); }

.loading {
  max-width: 720px; margin: 0 auto; padding: 80px 20px;
  color: var(--gray-dark); font-size: 15px; text-align: center;
}

.project { margin-bottom: 22px; }
.project h1 {
  font-family: var(--font-slab); font-size: 26px; line-height: 1.2;
  color: var(--maroon-dark); font-weight: 700;
}
.project-sub { margin-top: 6px; color: var(--gray-darker); font-size: 15px; }

/* ---------- payment counter ---------- */
.counter {
  background: var(--maroon); color: #fff;
  border-radius: 10px; padding: 26px 24px; margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.counter-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .09em;
  color: rgba(255,255,255,.72);
}
.counter-value {
  font-family: var(--font-slab); font-weight: 700;
  font-size: clamp(34px, 9vw, 52px); line-height: 1.05; margin-top: 6px;
  font-variant-numeric: tabular-nums;   /* digits keep their columns while the value counts up */
}

.counter-bar {
  margin-top: 18px; height: 8px; border-radius: 4px;
  background: rgba(255,255,255,.18); overflow: hidden;
}
.counter-bar-fill {
  height: 100%; background: var(--red); border-radius: 4px;
  transition: width .9s cubic-bezier(.22,.61,.36,1);
}
.counter-bar-note { margin-top: 8px; font-size: 13px; color: rgba(255,255,255,.78); }

.counter-detail {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.16);
}
.counter-detail dt {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: rgba(255,255,255,.66);
}
.counter-detail dd {
  font-family: var(--font-slab); font-size: 17px; font-weight: 500; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.counter-source { margin-top: 18px; font-size: 12px; color: rgba(255,255,255,.55); }

/* ---------- panels ---------- */
.panel {
  background: #fff; border: var(--hairline); border-radius: 10px;
  padding: 24px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.panel-title {
  font-family: var(--font-slab); font-size: 17px; color: var(--maroon-dark);
  margin-bottom: 16px;
}

/* ---------- status list ---------- */
.status-list { list-style: none; padding: 0; }
.status-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 0; border-top: var(--hairline);
}
.status-item:first-child { border-top: 0; padding-top: 0; }

.status-n {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--brass-active); color: var(--brass-darker);
  font-family: var(--font-slab); font-weight: 700; font-size: 15px;
}
.status-main { flex: 1 1 auto; min-width: 0; }
.status-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-amount {
  font-family: var(--font-slab); font-weight: 700; font-size: 16px;
  color: var(--maroon-dark); font-variant-numeric: tabular-nums;
}
.status-amount.is-unknown { color: var(--gray-dark); font-weight: 400; font-size: 14px; font-family: var(--font-sans); }
.status-meta { font-size: 13px; color: var(--gray-dark); margin-top: 3px; }
.status-note { font-size: 14px; color: var(--gray-darker); margin-top: 7px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
/* Approved is maroon, not green: this palette has no green, and maroon is the app's colour for
   data that must stand out without reading as fault. Red stays reserved for "you must act". */
.badge-approved { background: var(--maroon); color: #fff; }
.badge-pending  { background: var(--brass); color: var(--brass-darker); }
.badge-resubmit { background: var(--red); color: #fff; }

/* A resubmit is the one row the contractor has to do something about, so it gets the tinted
   surface and the rule. */
.status-item.is-resubmit {
  background: var(--red-light); border-left: 3px solid var(--red);
  margin: 4px -12px; padding: 15px 12px 15px 15px; border-radius: 6px; border-top: 0;
}
.status-item.is-resubmit .status-n { background: #fff; color: var(--red-dark); }

.status-empty { color: var(--gray-dark); font-size: 15px; }

/* ---------- submitted-document receipt ---------- */
.docs { margin-top: 10px; }
.docs-summary {
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--maroon);
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 0;
}
.docs-summary::-webkit-details-marker { display: none; }
.docs-summary::before {
  content: '▸'; font-size: 11px; transition: transform .15s;
}
.docs[open] .docs-summary::before { transform: rotate(90deg); }
.docs-summary:hover { color: var(--red); }

.docs-list {
  list-style: none; padding: 0; margin: 8px 0 0;
  border-left: 2px solid var(--gray-line); padding-left: 12px;
}
.docs-list li { padding: 6px 0; }
.docs-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.docs-name { font-size: 13px; font-weight: 500; color: var(--gray-darker); word-break: break-all; }
.docs-link { font-size: 12px; font-weight: 700; color: var(--red); text-decoration: none; white-space: nowrap; }
.docs-link:hover { text-decoration: underline; }
/* The fingerprint is a checkable fact, so it is set in a mono face and never wrapped mid-hash. */
.docs-meta {
  font-size: 11px; color: var(--gray-dark); margin-top: 2px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
.docs-note { font-size: 12px; color: var(--gray-dark); margin-top: 8px; padding-left: 12px; }

/* ---------- callout ---------- */
.callout {
  background: var(--brass-active); border-radius: 8px;
  padding: 16px 18px; margin-bottom: 22px;
}
.callout-title {
  font-family: var(--font-slab); font-weight: 700; font-size: 14px;
  color: var(--brass-darker); margin-bottom: 8px;
}
.callout-list { margin: 0; padding-left: 20px; font-size: 14px; color: var(--gray-darker); }
.callout-list li { margin-bottom: 4px; }

/* ---------- form ---------- */
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field { flex: 1 1 240px; margin-bottom: 18px; }
.field-narrow { flex: 0 1 160px; }

label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--gray-darker); margin-bottom: 6px;
}
input[type="text"], input[type="number"], input[type="email"], input[type="password"] {
  width: 100%; padding: 11px 12px; font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  border: 1px solid var(--gray); border-radius: 6px; background: #fff; color: #000;
}
input:focus-visible, .file-drop:focus-within, button:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="password"]:focus { border-color: var(--red); outline: none; }
input.is-invalid { border-color: var(--red); background: var(--red-light); }

.field-hint { font-size: 12px; color: var(--gray-dark); margin-top: 5px; }

/* File slots. The native input is visually hidden but still the thing that gets focused and
   clicked — the label wraps it, so keyboard and screen-reader behaviour is the browser's. */
.file-doc { margin-bottom: 14px; }
.file-drop {
  display: block; position: relative;
  border: 1.5px dashed var(--gray); border-radius: 8px;
  padding: 14px 16px; cursor: pointer; background: var(--gray-light);
  transition: border-color .15s, background .15s;
}
.file-drop:hover { border-color: var(--red); background: var(--red-light); }
.file-drop.has-file { border-style: solid; border-color: var(--maroon); background: var(--maroon-light); }
.file-drop.is-invalid { border-color: var(--red); background: var(--red-light); }
.file-drop input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.file-label { font-size: 14px; font-weight: 500; color: var(--gray-darker); }
.file-label .req { color: var(--red); }
.file-hint { font-size: 12px; color: var(--gray-dark); margin-top: 3px; }
.file-chosen {
  display: none; font-size: 13px; color: var(--maroon-dark); margin-top: 7px;
  font-weight: 500; word-break: break-all;
}
.file-drop.has-file .file-chosen { display: block; }
.file-drop.has-file .file-hint { display: none; }

.form-errors {
  background: var(--red-light); border: 1px solid var(--red); border-radius: 6px;
  padding: 14px 16px; margin-bottom: 18px; font-size: 14px; color: var(--red-dark);
}
.form-errors strong { display: block; margin-bottom: 6px; color: var(--red-dark); }
.form-errors ul { margin: 0; padding-left: 20px; }

.btn-primary {
  width: 100%; padding: 14px 20px; font: inherit; font-size: 16px; font-weight: 700;
  background: var(--red); color: #fff; border: 0; border-radius: 6px; cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover:not(:disabled) { background: var(--red-hover); }
.btn-primary:active:not(:disabled) { background: var(--red-active); }
.btn-primary:disabled { background: var(--gray); cursor: default; }

.btn-ghost {
  padding: 11px 20px; font: inherit; font-size: 15px; font-weight: 500;
  background: var(--red-light); color: var(--red); border: 0; border-radius: 6px; cursor: pointer;
}
.btn-ghost:hover { background: var(--red-light-hover); }

.form-foot { margin-top: 14px; font-size: 12px; color: var(--gray-dark); text-align: center; }

/* ---------- confirmation ---------- */
.confirm { text-align: center; padding: 36px 24px; }
.confirm-mark { color: var(--maroon); margin-bottom: 14px; }
.confirm-title {
  font-family: var(--font-slab); font-size: 24px; color: var(--maroon-dark); margin-bottom: 10px;
}
.confirm-detail { font-size: 15px; color: var(--gray-darker); max-width: 460px; margin: 0 auto; }
.confirm-docs {
  list-style: none; padding: 0; margin: 20px auto 0; max-width: 460px;
  text-align: left; font-size: 14px; color: var(--gray-darker);
}
.confirm-docs li { padding: 7px 0; border-top: var(--hairline); word-break: break-all; }
.confirm-next { margin: 20px auto 22px; font-size: 14px; color: var(--gray-dark); max-width: 460px; }

/* ---------- problem page ---------- */
.problem-panel { text-align: center; padding: 44px 24px; }
.problem-title { font-family: var(--font-slab); font-size: 22px; color: var(--maroon-dark); margin-bottom: 12px; }
.problem-body { font-size: 15px; color: var(--gray-darker); margin-bottom: 10px; }

/* ---------- footer ---------- */
.foot { text-align: center; font-size: 13px; color: var(--gray-dark); padding-top: 8px; }
.foot p { margin-bottom: 6px; }
.foot-brand { font-size: 12px; color: var(--gray); }
.foot a { color: var(--red); }

/* ---------- narrow screens ---------- */
@media (max-width: 560px) {
  .wrap { padding: 20px 14px 44px; }
  .appbar { padding: 0 14px; gap: 10px; }
  .appbar-title { font-size: 12px; }
  .counter { padding: 22px 18px; }
  .counter-detail { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 18px 16px; }
  .field-narrow { flex: 1 1 100%; }
}

/* Honour a reduced-motion preference: the counter jumps straight to its value instead of ticking,
   and the progress bar stops sliding. */
@media (prefers-reduced-motion: reduce) {
  .counter-bar-fill { transition: none; }
  * { animation-duration: .001ms !important; }
}
