/* Costro Site: plain, fast, phone-first.
   System fonts. Gold (#8A692E) only as a thin accent on light surfaces, dark
   panel (#23262C) for the page's key block, hairlines #E7E4DB. */

:root {
  --ink: #23262C;
  --paper: #FAF9F6;
  --card: #FFFFFF;
  --line: #E7E4DB;
  --gold: #8A692E;
  --dark: #23262C;
  --muted: #5F636B;
  --bad: #9B2C2C;
  --bad-bg: #FBEDED;
  --ok: #2F6B3A;
  --ok-bg: #EDF6EF;
  --warn: #7A5A10;
  --warn-bg: #FBF4E2;
  --radius: 6px;
  --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.plain { justify-content: center; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; margin-top: 1.25rem; }
h3 { font-size: 1rem; margin-top: 1rem; }
.card h2:first-child, .panel h2:first-child { margin-top: 0; }
p { margin: 0 0 .75rem; }
a { color: var(--ink); text-decoration-color: var(--gold); text-underline-offset: 2px; }
a:hover { color: var(--gold); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--paper); border: 1px solid var(--line); padding: .5rem; border-radius: var(--radius); margin: 0 0 .5rem; }
ul { margin: 0; padding-left: 1.2rem; }

.muted { color: var(--muted); }
.strong { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }
.prewrap { white-space: pre-wrap; }
.hint { color: var(--muted); font-size: .875rem; margin: .25rem 0 .75rem; }
.empty { color: var(--muted); padding: .5rem 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header and navigation */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .5rem 1rem; padding-top: max(.5rem, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; flex: 0 0 auto; }
.brand img { display: block; height: 29px; width: auto; }
.brand-site { font-weight: 650; letter-spacing: .04em; text-transform: uppercase; font-size: .75rem; color: var(--gold); border-left: 1px solid var(--line); padding-left: .5rem; }
.who { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; font-size: .875rem; min-width: 0; flex: 0 1 auto; }
.who-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9rem; min-width: 0; }
.who form { flex: 0 0 auto; }
.who-role { color: var(--muted); display: none; }
.who form { margin: 0; }
.linklike { background: none; border: 0; padding: .5rem; margin: -.5rem; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 2px; cursor: pointer; min-height: var(--tap); }

.nav, .tabs {
  display: flex; gap: .25rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border-bottom: 1px solid var(--line); padding: 0 .5rem;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.nav a, .tabs a {
  flex: 0 0 auto; display: inline-flex; align-items: center; min-height: var(--tap);
  padding: 0 .75rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent;
  font-weight: 550; white-space: nowrap;
}
.nav a.on, .tabs a.on { color: var(--ink); border-bottom-color: var(--gold); }
.tabs { margin: 0 -1rem 1rem; }

.wrap { width: 100%; max-width: 64rem; margin: 0 auto; padding: 1rem; flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: .75rem; padding: 1rem; }

/* cards and panels */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.card.narrow { max-width: 34rem; }
.panel { border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.panel.dark { background: var(--dark); color: #fff; }
.panel.dark h1, .panel.dark h2 { color: #fff; margin-bottom: .25rem; }
.panel.dark p { color: #D9DBDF; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 650; margin-bottom: .25rem; }
.panel.dark .kicker { color: #D8B878; }

.titlebar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.titlebar h1 { margin: 0; }

/* project list */
.proj-list { display: grid; gap: .75rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
.proj { display: grid; grid-template-columns: 1fr auto; gap: .125rem .5rem; align-items: center; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .875rem 1rem; position: relative; min-height: var(--tap); }
.proj:hover { border-color: var(--gold); color: var(--ink); }
.proj-code { font-weight: 700; color: var(--gold); font-size: .8125rem; letter-spacing: .05em; }
.proj-name { font-weight: 650; }
.proj-meta { color: var(--muted); font-size: .875rem; }
.proj-code { grid-column: 1; grid-row: 1; }
.proj .badge { grid-column: 2; grid-row: 1; justify-self: end; }
.proj-name, .proj-meta { grid-column: 1 / -1; }

.badge { display: inline-block; font-size: .75rem; font-weight: 650; padding: .125rem .5rem; border-radius: 99px; background: #EFEDE6; color: var(--ink); border: 1px solid var(--line); }
.badge-mobilising { background: var(--warn-bg); color: var(--warn); border-color: #EAD9A8; }
.badge-active { background: var(--ok-bg); color: var(--ok); border-color: #BFDCC5; }
.badge-complete, .badge-archived, .badge-on_hold { background: #EFEDE6; color: var(--muted); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: #EAD9A8; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: #BFDCC5; }
.badge-bad { background: var(--bad-bg); color: var(--bad); border-color: #E3BBBB; }
.badge-pay-raised, .badge-req-raised { background: var(--warn-bg); color: var(--warn); border-color: #EAD9A8; }
.badge-pay-approved, .badge-req-ordered { background: #E8EEF7; color: #2D4A75; border-color: #C6D3E8; }
.badge-pay-paid, .badge-req-delivered { background: #EAE6F3; color: #4A3B75; border-color: #D3CBE6; }
.badge-pay-settled, .badge-pay-closed, .badge-req-confirmed { background: var(--ok-bg); color: var(--ok); border-color: #BFDCC5; }
.badge-pay-rejected, .badge-req-cancelled { background: var(--bad-bg); color: var(--bad); border-color: #E3BBBB; }
.panel.dark .badge { background: transparent; color: #fff; border-color: #6B6F77; }

/* work queues on Home */
.queues { display: grid; gap: .5rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
.queue { display: flex; align-items: center; gap: .75rem; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: .625rem .875rem; min-height: var(--tap); }
.queue:hover { border-color: var(--gold); color: var(--ink); }
.queue-n { font-weight: 700; font-size: 1.25rem; min-width: 1.75rem; }
.queue-label { color: var(--muted); }
.panel-sub { color: #C9CCD2; font-size: .875rem; font-weight: 400; }
.panel-warn { color: #F2C66D; font-weight: 600; }
.panel.dark a { color: #fff; }
.panel.dark .btn { color: var(--ink); }

/* facts */
.facts { display: grid; grid-template-columns: 9rem 1fr; gap: .375rem .75rem; margin: 0 0 .75rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.proj-name, .proj-meta { overflow-wrap: anywhere; }

.list { list-style: none; padding: 0; margin: 0 0 .75rem; }
.list li { padding: .5rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.list li:last-child { border-bottom: 0; }
.list .between, .between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.list form { margin: 0; }

/* forms */
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; min-height: var(--tap); }
input, select, textarea {
  width: 100%; min-height: var(--tap); font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid #C9C5B8; border-radius: var(--radius); padding: .5rem .75rem;
}
input[type="checkbox"], input[type="radio"] { width: 1.25rem; min-height: 1.25rem; height: 1.25rem; padding: 0; flex: none; accent-color: var(--ink); }
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px;
}
.row2, .row3 { display: grid; gap: 0 .75rem; grid-template-columns: 1fr; }
form.inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
form.inline input { flex: 1 1 9rem; min-width: 0; width: auto; }
form.inline select { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap);
  padding: 0 1rem; font: inherit; font-weight: 600; color: var(--ink); background: #fff;
  border: 1px solid #B9B4A4; border-radius: var(--radius); text-decoration: none; cursor: pointer; margin: .25rem .25rem .25rem 0;
}
.btn:hover { border-color: var(--gold); color: var(--ink); }
.btn.primary { background: var(--dark); color: #fff; border-color: var(--dark); }
.btn.primary:hover { background: #000; color: #fff; }
.btn.danger { color: var(--bad); border-color: #D9B0B0; }
.btn.small { min-height: 36px; padding: 0 .75rem; font-size: .875rem; }
.btn.block { width: 100%; margin-left: 0; margin-top: 1rem; }
.btn[disabled] { opacity: .6; cursor: progress; }
.links { display: flex; flex-wrap: wrap; }

/* photo field */
.photo-field { margin: .5rem 0 .75rem; }
.photo-preview[hidden] { display: none; }
.photo-preview { display: block; max-width: 100%; max-height: 14rem; margin-top: .5rem; border: 1px solid var(--line); border-radius: var(--radius); }
.photo-note { color: var(--muted); font-size: .875rem; margin: .25rem 0 0; }
input[type="file"] { padding: .5rem; }

/* notices */
.notice { border-radius: var(--radius); padding: .625rem .875rem; margin: 0 0 1rem; border: 1px solid; }
.notice ul { padding-left: 1.1rem; }
.notice-ok { background: var(--ok-bg); color: var(--ok); border-color: #BFDCC5; }
.notice-err { background: var(--bad-bg); color: var(--bad); border-color: #E3BBBB; }
.notice-warn { background: var(--warn-bg); color: var(--warn); border-color: #EAD9A8; }

.secret { background: var(--paper); border: 1px dashed var(--gold); border-radius: var(--radius); padding: .75rem; font-size: 1.15rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.secret code { font-size: 1.15rem; letter-spacing: .04em; user-select: all; word-break: break-all; }

/* sign in */
.login-wrap { width: 100%; max-width: 26rem; margin: 0 auto; padding: 1rem; }
.login { text-align: left; }
.login-logo { display: block; margin: 0 auto 1rem; height: 50px; width: auto; }
.login h1 { text-align: center; }

/* tables: a real table on wide screens, stacked rows on a phone */
.tablewrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8125rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.table tr.inactive td { color: var(--muted); }
.table tr.total td { border-top: 2px solid var(--line); background: var(--paper); }
.table summary { cursor: pointer; color: var(--gold); }
.pager { margin-top: 1rem; }

@media (max-width: 30rem) {
  .brand-site { display: none; }
  .who-name { max-width: 6.5rem; }
}

@media (max-width: 40rem) {
  .table:not(.table-num) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table:not(.table-num), .table:not(.table-num) tbody, .table:not(.table-num) tr, .table:not(.table-num) td { display: block; width: 100%; }
  .table:not(.table-num) tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  .table:not(.table-num) td { border: 0; padding: .125rem .75rem; }
  .table:not(.table-num) td::before { content: attr(data-th); display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
}

/* numeric tables (money, forecast, milestones) keep their columns on a phone and scroll sideways */
.table-num th, .table-num td { padding: .4rem .5rem; font-size: .875rem; }
.table-num td.num, .table-num th:not(:first-child) { white-space: nowrap; }
.table-num td:first-child { min-width: 7rem; }

@media (min-width: 40.01rem) {
  .who-role { display: inline; }
  .proj-list { grid-template-columns: repeat(2, 1fr); }
  .row2 { grid-template-columns: 1fr 1fr; }
  .row3 { grid-template-columns: 1fr 1fr 1fr; }
  .tabs { margin: 0 0 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
}

@media (min-width: 60rem) {
  .proj-list { grid-template-columns: repeat(3, 1fr); }
}

/* scope of work */
ul.scope { margin: 0 0 .75rem; padding-left: 1.25rem; }
ul.scope li { margin: .15rem 0; }
.scope-head { margin: .75rem 0 .25rem; }

/* shift report form */
details.help { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .875rem; margin: 0 0 1rem; }
details.help summary { cursor: pointer; font-weight: 600; color: var(--gold); min-height: 36px; display: flex; align-items: center; }
details.help ol { margin: .25rem 0 .25rem; padding-left: 1.25rem; }
details.help li { margin: .25rem 0; }
fieldset.choices { border: 0; padding: 0; margin: 0 0 .5rem; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.routine li { display: grid; grid-template-columns: 1fr 6.5rem; gap: .5rem; align-items: center; }
.routine .tick-time { min-height: 40px; }
.qa { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.qa:last-of-type { border-bottom: 0; }
.qa p { margin: 0; }
.stickybar { position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--line); padding: .5rem 0 calc(.5rem + env(safe-area-inset-bottom)); display: flex; gap: .5rem; z-index: 5; }
.stickybar .btn { flex: 1; margin: 0; }
.photo-kind { padding: .25rem 0 .75rem; border-bottom: 1px solid var(--line); }
.photo-kind:last-of-type { border-bottom: 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 .5rem; }
.thumb { margin: 0; display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.photoq li { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.photoq .q-state { font-size: .875rem; color: var(--muted); }
.photoq .q-failed { color: var(--bad); }
.save-status { color: var(--muted); font-size: .875rem; }
.light { display: inline-block; width: .9rem; height: .9rem; border-radius: 50%; border: 1px solid #0003; vertical-align: -.1rem; margin-right: .35rem; }
.light.green { background: #3C8D4E; }
.light.amber { background: #D9A21B; }
.light.red { background: #B93A3A; }
.light.none { background: #fff; }
progress.meter { width: 100%; height: .9rem; accent-color: var(--gold); margin-top: .25rem; }
.stats { display: grid; gap: .5rem .75rem; grid-template-columns: 1fr 1fr; margin: 0 0 .75rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .75rem; }
.stat .big { font-size: 1.4rem; font-weight: 650; line-height: 1.2; }
.stat .cap { color: var(--muted); font-size: .8125rem; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
