:root {
  --paper: #0b0d0c;
  --panel: #111611;
  --banner: #0f1411;
  --ink: #f7f4ea;
  --muted: #a5afa5;
  --lime: #a7e35a;
  --lime-dark: #6da832;
  --gold: #f4c74d;
  --green: #2a6b32;
  --green-2: #3d8f45;
  --pale: #1b2418;
  --line: #243024;
  --white: #f7f4ea;
  --red: #e04f3e;
  --orange: #dc7b2f;
  --radius: 8px;
  --admin-bg: #0b0d0c;
  --admin-ink: #f7f4ea;
  --admin-panel: #111611;
  --admin-lime: #a7e35a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
button, select, input, textarea { font: inherit; color: inherit; }

.masthead {
  background: var(--banner);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 12px;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 20;
}
.masthead img { width: 52px; height: 52px; object-fit: contain; }
.masthead h1 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.04em;
  font-weight: 800;
}
.masthead .sub {
  color: var(--lime);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.banner-note {
  background: #3a2208;
  color: var(--gold);
  font-size: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid #5a3a10;
}

.wrap { padding: 12px 12px 96px; max-width: 720px; margin: 0 auto; }
.wrap.wide { max-width: 1100px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label.tiny { display: block; margin: 10px 0 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
p.tiny { font-size: 13px; color: var(--muted); }

select.attestor, select.filter {
  flex: 1;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--panel);
  color: var(--ink);
}

.job {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 10px;
}
.job.other { border-color: var(--gold); }
.job h2 { margin: 0 0 4px; font-size: 18px; }

.day-calendar-shell {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 8px 8px 18px;
  margin: 0 0 8px;
}

.day-calendar-grid {
  position: relative;
  height: var(--day-height, 1020px);
  border-radius: 6px;
}

.day-track {
  position: relative;
  height: var(--day-height, 1020px);
  margin-left: 54px;
}

.day-hour-line {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 1px;
  background: var(--line);
  z-index: 1;
}

.day-hour-label {
  position: absolute;
  left: -56px;
  top: -9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.day-event {
  position: absolute;
  border: 1px solid var(--line);
  border-left: 6px solid var(--lime);
  border-radius: 8px;
  background: var(--pale);
  color: var(--ink);
  padding: 8px 8px;
  text-align: left;
  min-height: 44px;
  overflow: hidden;
  box-sizing: border-box;
}

.day-event:active { opacity: 0.95; }

.day-event .day-time {
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.day-event .day-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

.day-event .day-chip {
  background: #1b261a;
  border: 1px solid #294d2c;
  color: var(--lime);
}

.day-event .chip-row { margin-top: 4px; }

.day-event.type-production { border-left-color: var(--lime); }
.day-event.type-service { border-left-color: #58c7d0; }
.day-event.type-pickup { border-left-color: var(--gold); }
.day-event.type-dump { border-left-color: #ff9f2f; }
.day-event.type-other { border-left-color: #9aa39d; }

.day-chip.type-production { color: var(--lime); border-color: #294d2c; }
.day-chip.type-service { color: #58c7d0; border-color: #2f6672; }
.day-chip.type-pickup { color: #f4c74d; border-color: #6a4a18; }
.day-chip.type-dump { color: #ff9f2f; border-color: #7c4f1c; }
.day-chip.type-other { color: #9aa39d; border-color: #445044; }

.day-event .day-chip,
.day-event .day-chip:hover {
  cursor: default;
}

.meta { color: var(--muted); font-size: 13px; line-height: 1.35; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--pale);
  border: 1px solid #355028;
  color: var(--lime);
}
.chip.hollow { background: transparent; border-style: dashed; color: var(--muted); }
.chip.lunch { background: #3a2a10; border-color: #6a4a18; color: var(--gold); }
.chip.bad { background: #3a1410; border-color: #6a2a22; color: #f0b4ad; }
.chip.loan { background: #102030; border-color: #2a4a68; color: #68a8d8; }
.chip.gold { color: var(--gold); border-color: #6a4a18; }
.chip.pending { background: #3a2a10; border-color: #8a6a20; color: var(--gold); }

.run-card .run-stop {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  margin-top: 10px;
  padding: 12px;
  min-height: 56px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #0d100e;
  color: inherit;
  cursor: pointer;
}
.run-pending {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #8a6a20;
  border-radius: var(--radius);
  background: #1a1408;
}
.run-unread {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
  padding: 0 16px;
  cursor: pointer;
}
.btn.primary { background: var(--lime); color: #101312; width: 100%; margin-top: 10px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.warn { background: var(--gold); color: #101312; }
.btn.danger { background: var(--red); color: #fff; }
.btn.green { background: var(--lime-dark); color: #101312; }

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(8,10,9,0.72);
  z-index: 40;
  display: none;
  align-items: flex-end;
}
.sheet.open { display: flex; }
.sheet .panel {
  background: var(--panel);
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  border-top: 3px solid var(--gold);
}
.people {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}
.people label {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 48px;
  background: #0d100e;
}
.people label.on { border-color: var(--lime-dark); background: var(--pale); }
.people input { width: 18px; height: 18px; }
.borrow { margin: 8px 0 12px; }
.borrow summary { min-height: 44px; color: var(--gold); font-weight: 700; }

.gps {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}
.gps.off { color: var(--orange); font-weight: 700; }

.photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

.hub-section { margin: 18px 0 8px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.hub-card { cursor: pointer; }
.hub-card h2 { pointer-events: none; }
.workspace-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.workspace-link:after { content: " →"; }
.phase-strip { margin-top: 8px; }
.phase-label {
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.phase-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: hidden;
}
.phase-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #8de252, var(--lime));
  border-radius: 999px;
}
.spend-bar {
  background: var(--pale);
  border: 1px solid #355028;
  color: var(--lime);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-weight: 800;
  margin-bottom: 10px;
}
.wall-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}
.wall-item.wall-click { cursor: pointer; }
.wall-item.wall-click:active { border-color: var(--lime-dark); }
.wall-top { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.wall-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #1f2a1c; color: var(--lime);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.wall-head { flex: 1; min-width: 0; }
.wall-who { font-weight: 700; font-size: 14px; }
.wall-kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 8px; white-space: nowrap;
}
.wall-item .when { font-size: 11px; color: var(--muted); }
.wall-item h3 { margin: 4px 0 6px; font-size: 16px; }
.wall-body { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.35; }
.wall-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.wall-photo {
  width: 112px;
  height: 112px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--pale);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wall-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wall-photo-pending { font-size: 10px; color: var(--muted); text-align: center; padding: 6px; }
.composer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.composer textarea, #job-note-text, #sheet-panel textarea {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--pale);
  color: var(--ink);
  padding: 10px;
  resize: vertical;
}
.meta.pay { color: var(--gold); font-weight: 700; }
.admin-feed { display: flex; flex-direction: column; gap: 8px; }
.admin-feed-card {
  text-align: left;
  width: 100%;
  background: var(--pale);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  padding: 10px 12px;
  cursor: pointer;
}
.admin-feed-card:hover { border-color: var(--lime-dark); }
.admin-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0e130f;
  color: var(--ink);
  padding: 6px 8px;
}
.crew-toggle {
  display: flex;
  gap: 8px;
  margin: 10px 0 14px;
}
.crew-toggle-btn {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--lime);
  background: transparent;
  color: var(--ink);
  border-radius: var(--radius);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
}
.crew-toggle-btn.on {
  background: var(--lime);
  color: #101312;
}
.crew-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  align-items: start;
}
.crew-board[hidden] { display: none; }

.crew-column {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

.crew-column h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.crew-cards {
  display: grid;
  gap: 8px;
}

.crew-card {
  background: #0d100e;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 14px;
}

.crew-card-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.crew-card strong {
  display: block;
  margin-bottom: 0;
  font-size: 17px;
}

.crew-card-role {
  color: var(--muted);
  font-size: 13px;
  margin: 2px 0 0;
}

.crew-card-site {
  color: var(--ink);
  font-size: 13px;
  margin: 6px 0 0;
}

.crew-card .chip.dirt {
  border-color: var(--lime);
  color: #101312;
  background: var(--lime);
}

.crew-card .chip.free {
  color: var(--muted);
  background: transparent;
}

.who-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.who-row .on-site { color: var(--lime); font-weight: 700; }
.who-row .off { color: var(--muted); }

body.locked .dock,
body.locked .masthead,
body.locked .banner-note { display: none; }
body.locked .wrap { padding-top: 24px; padding-bottom: 24px; }
body.locked .wrap a { color: var(--lime); }

.dock {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--banner);
  color: #fff;
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr 1fr 1fr;
  align-items: end;
  z-index: 15;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
}
.dock button {
  background: none;
  border: 0;
  color: #cfd4cf;
  min-height: 56px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dock button.on { color: var(--lime); }
.dock-stream {
  background: var(--lime) !important;
  color: #101312 !important;
  min-height: 64px !important;
  border-radius: 18px 18px 0 0;
  font-size: 12px !important;
  margin: 0 4px;
}
.dock-stream.on { color: #101312 !important; }

body.admin { background: var(--admin-bg); color: var(--admin-ink); }
body.admin .wrap { max-width: 980px; }
.admin-card {
  background: var(--admin-panel);
  border: 1px solid #243024;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.admin-card h3 { margin: 0 0 8px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #243024; }
.ok { color: var(--admin-lime); }
.warn { color: #f4c74d; }
.bad { color: #e04f3e; }

input[type="text"], input[type="password"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 48px;
  background: #0d100e;
  color: var(--ink);
}
a.btn.ghost { display: flex; align-items: center; justify-content: center; text-decoration: none; }

#signup-pin {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--lime-dark);
  border-radius: var(--radius);
  background: #152010;
}
#signup-pin strong { letter-spacing: 0.12em; font-size: 22px; }
.emp-list { display: grid; gap: 8px; }
.emp-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d100e;
}
.emp-head {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  padding: 10px 12px;
}
.emp-head strong { display: block; }
.emp-body { padding: 0 12px 12px; }
.emp-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.emp-tabs button {
  background: #0e130f;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.emp-tabs button.on { color: var(--ink); border-color: var(--lime-dark); }
.emp-activity { margin: 0; padding-left: 18px; color: var(--muted); }
.crew-card[data-emp] { cursor: pointer; }

.job-facts { margin: 10px 0 0; }
.job-facts .fact {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.job-facts dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.job-facts dd { margin: 0; font-size: 14px; }
.bad-note { color: #f0b4ad; }

.snapshot {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 12px;
}
.snapshot h2 { margin: 0 0 6px; font-size: 16px; }
.snap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 10px 0;
}
.snap-stat {
  background: #0d100e;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  min-height: 64px;
  text-align: left;
  padding: 10px;
}
.snap-stat strong { display: block; font-size: 20px; color: var(--lime); }
.snap-stat span { color: var(--muted); font-size: 12px; }
.snap-person {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.snap-person span { color: var(--muted); }

.me-list { display: grid; gap: 8px; }
.me-list .btn { width: 100%; margin: 0; }

.gantt {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.gantt-row {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr;
  min-width: 640px;
  border-bottom: 1px solid var(--line);
}
.gantt-head { background: #0d100e; }
.gantt-label { padding: 10px 8px; }
.gantt-label strong { display: block; font-size: 13px; }
.gantt-label span { color: var(--muted); font-size: 12px; }
.gantt-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
}
.gantt-day, .gantt-cell {
  min-height: 56px;
  padding: 6px 4px;
  border-left: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.gantt-bar {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #101312;
  background: var(--lime);
}
.gantt-bar.kind-last_sealed { background: #8a8f86; }
.gantt-bar.kind-forward { background: transparent; border: 1px dashed var(--gold); color: var(--gold); }
.gantt-bar.kind-today { background: var(--lime); }
