/* Fieldwork portal — same palette and type scale as the phone app. */
:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --ink: #222d29;
  --muted: #68736b;
  --line: #e1e5dd;
  --green: #315744;
  --green-light: #eaf0e7;
  --orange: #b45b30;
  --orange-light: #f9ede2;
  --red: #a43e32;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
}
a {
  color: var(--green);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid #7aa38c;
  outline-offset: 2px;
  border-radius: 6px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Layout */
.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}
.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  padding: 4px 10px 18px;
}
.brand svg {
  width: 26px;
  height: 26px;
  color: var(--green);
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  min-height: 44px;
}
.nav a:hover {
  background: var(--bg);
  color: var(--ink);
}
.nav a[aria-current='page'] {
  background: var(--green-light);
  color: var(--green);
  font-weight: 600;
}
.nav svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.side .who {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.side .who strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.main {
  padding: 28px clamp(16px, 4vw, 44px) 60px;
  max-width: 1240px;
  width: 100%;
  min-width: 0;
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}
h1 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
h2 {
  font-size: 18px;
  margin: 0 0 12px;
}
h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
.lede {
  color: var(--muted);
  margin: 0 0 22px;
}
.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.head .lede {
  margin-bottom: 0;
}

/* Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stack {
  display: grid;
  gap: 16px;
}
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.two {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: inherit;
}
.stat .value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat .label {
  color: var(--muted);
  font-size: 13px;
}
a.stat:hover {
  border-color: #c9d3c5;
}
.stat.alert .value {
  color: var(--orange);
}

/* Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn.secondary {
  background: var(--green-light);
  color: var(--green);
}
.btn.danger {
  background: #fbece9;
  color: var(--red);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
.btn svg {
  width: 17px;
  height: 17px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
label.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
input,
select {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 0 12px;
}
input[type='search'] {
  min-width: 240px;
}
.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
}
.chip-toggle[aria-pressed='true'] {
  background: var(--orange-light);
  border-color: var(--orange);
  color: #93451f;
}
input[type='checkbox'] {
  width: 22px;
  height: 22px;
  min-height: 0;
  accent-color: var(--green);
  cursor: pointer;
  margin: 0;
}
td:has(> input[type='checkbox']) {
  padding-top: 10px;
}
.legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
  margin: -4px 0 12px;
}
.legend span::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  background: var(--green);
  vertical-align: -1px;
}
.legend span.extra::before {
  background: #8fb39c;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table {
  border-collapse: collapse;
  width: 100%;
}
th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  background: #fafbf8;
  position: sticky;
  top: 0;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr.link {
  cursor: pointer;
}
tbody tr.link:hover td {
  background: #f8faf6;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
td .sub {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.empty {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--green-light);
  color: var(--green);
  white-space: nowrap;
}
.badge.warn {
  background: var(--orange-light);
  color: #93451f;
}
.badge.off {
  background: #eef0eb;
  color: var(--muted);
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Detail */
dl.kv {
  display: grid;
  grid-template-columns: minmax(140px, 34%) 1fr;
  margin: 0;
}
dl.kv dt,
dl.kv dd {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
dl.kv dt {
  color: var(--muted);
  font-size: 14px;
  padding-right: 12px;
}
dl.kv dd {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
dl.kv > :nth-last-child(-n + 2) {
  border-bottom: 0;
}
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.tabs button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
.tabs button[aria-selected='true'] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.photos {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.photos figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--green-light);
}
.photos figcaption {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
}
.signature {
  max-height: 48px;
  max-width: 180px;
}
.notice {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--green-light);
  color: var(--green);
  margin: 0 0 14px;
}
.notice.error {
  background: #fbece9;
  color: var(--red);
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  font-weight: 600;
  text-decoration: none;
}

/* Sign in */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.auth .card {
  width: min(420px, 100%);
  padding: 32px;
  display: grid;
  gap: 14px;
}
.auth .brand {
  padding: 0 0 8px;
}

/* Bar chart for hours */
.bars {
  display: grid;
  gap: 8px;
}
.bar {
  display: grid;
  grid-template-columns: minmax(120px, 30%) 1fr 64px;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}
.bar .track {
  display: flex;
  height: 12px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
}
.bar .fill {
  height: 100%;
  background: var(--green);
}
.section-gap {
  margin-top: 28px;
}
.gap {
  margin-top: 16px;
}
.bar .fill.extra {
  background: #8fb39c;
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 8px 10px;
    z-index: 5;
    overflow-x: auto;
    gap: 2px;
  }
  .brand {
    padding: 0 8px 0 4px;
    font-size: 17px;
  }
  .brand span {
    display: none;
  }
  .nav {
    display: flex;
    gap: 2px;
  }
  .nav a {
    padding: 8px 10px;
    white-space: nowrap;
  }
  .nav a span {
    display: none;
  }
  .side .who {
    display: none;
  }
  dl.kv {
    grid-template-columns: 1fr;
  }
  table {
    min-width: 640px;
  }
  .main {
    padding-top: 18px;
  }
  h1 {
    font-size: 25px;
  }
  input[type='search'] {
    min-width: 0;
    width: 100%;
  }
  .filters > * {
    flex: 1 1 140px;
  }
  dl.kv dt {
    border-bottom: 0;
    padding-bottom: 0;
  }
}
@media print {
  .side,
  .no-print,
  .tabs {
    display: none !important;
  }
  .shell {
    display: block;
  }
  .main {
    padding: 0;
  }
  .card,
  .table-wrap {
    border: 0;
    padding: 0;
  }
  [hidden-print] {
    display: none;
  }
  .print-all [role='tabpanel'] {
    display: block !important;
  }
}

/* Form editor */
textarea {
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  resize: vertical;
}
label.field input,
label.field textarea {
  width: 100%;
}
.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}
.list-row {
  display: grid;
  grid-template-columns: 1fr repeat(3, 44px);
  gap: 6px;
  align-items: end;
}
.icon-btn {
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  color: var(--ink);
}
.icon-btn[disabled] {
  opacity: 0.35;
  cursor: default;
}
.icon-btn.danger {
  color: var(--red);
}
fieldset.check-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  margin: 0;
}
fieldset.check-card legend {
  font-weight: 700;
  padding: 0 6px;
}
.row-actions,
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.publish-bar {
  position: sticky;
  bottom: 0;
  margin-top: 18px;
  padding: 12px 0 14px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  z-index: 2;
}
.publish-bar ul {
  margin: 6px 0 0;
  padding-left: 20px;
}
