:root {
  --bg: #121311;
  --card: #1b1c19;
  --raised: #262822;
  --text: #efeee9;
  --muted: #a7a69e;
  --faint: #7a796f;
  --hair: #33352e;
  --accent: #e7e4db;
  --accent-ink: #161714;
  --green: #8eae8a;
  --gold: #c6a15a;
  --red: #d16b5e;
  --blue: #7a9bb8;
  --paper: #f3f0e8;
  --ink: #1a1b17;
  --side: 88px;
  --header: 64px;
  --radius: 8px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 18px; line-height: 1.4; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
img { max-width: 100%; }
a { color: var(--accent); }
#app { display: flex; height: 100%; min-height: 100dvh; }
.side-nav {
  width: var(--side); flex-shrink: 0; background: var(--card); border-right: 1px solid var(--hair);
  display: flex; flex-direction: column; align-items: stretch; padding: calc(12px + var(--safe-t)) 8px 12px;
  gap: 6px; z-index: 20;
}
.side-nav .brand {
  text-align: center; padding: 10px 4px 16px; letter-spacing: 0.18em;
  font-family: var(--mono); font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--hair); margin-bottom: 8px;
}
.side-nav .brand strong { display: block; color: var(--accent); font-size: 16px; letter-spacing: 0.22em; margin-bottom: 2px; }
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--muted); padding: 14px 6px; min-height: 72px; font-size: 13px;
}
.nav-btn .ico { font-size: 22px; line-height: 1; }
.nav-btn.active { background: var(--raised); color: var(--accent); border-color: var(--hair); }
.nav-btn:hover { color: var(--text); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: var(--header); flex-shrink: 0; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid var(--hair); background: var(--bg);
}
.topbar h1 { margin: 0; font-size: 22px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .meta { color: var(--muted); font-size: 15px; white-space: nowrap; }
.content { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px 28px; }
.phone-dock { display: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: var(--radius);
  border: 1px solid var(--hair); background: var(--raised); color: var(--text);
  font-weight: 600; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 40px; padding: 6px 12px; font-size: 16px; }
.btn.block { width: 100%; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--hair);
  background: var(--card); color: var(--muted); font-size: 15px;
}
.chip.active { background: var(--raised); color: var(--accent); border-color: var(--faint); }
.chip .n { opacity: 0.7; margin-left: 4px; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end;
  margin-bottom: 14px; width: 100%;
}
.toolbar .spacer { flex: 1 1 12px; min-width: 8px; height: 1px; }
.toolbar > * { position: relative; z-index: 0; }
.toolbar > .btn { flex: 0 0 auto; }
.toolbar > .field,
.toolbar > .tb-search,
.toolbar > .tb-control {
  flex: 0 1 auto;
  margin: 0;
  min-width: 0; /* allow shrink inside wrap row */
  max-width: 100%;
}
.toolbar .field { margin-bottom: 0; }
.tb-search {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1 1 180px;
  min-width: min(100%, 180px);
  max-width: 280px;
}
.tb-search input[type="search"] {
  width: 100%; max-width: 100%;
}
.tb-date {
  flex: 0 1 auto !important;
  width: auto;
  /* iOS Safari shows “Oct 31, 2026” + calendar — needs ~240px */
  min-width: min(100%, 15rem);
  max-width: 100%;
  overflow: hidden; /* clip native overflow so it never paints over neighbors */
}
.tb-date input[type="date"],
.tb-date input[type="time"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.tb-shift { flex: 0 0 auto !important; }
.field {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
}
.field label { font-size: 14px; color: var(--muted); letter-spacing: 0.02em; }
.field input, .field select, .field textarea,
input[type="text"], input[type="date"], input[type="time"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--hair); background: var(--card); color: var(--text);
  -webkit-user-select: text; user-select: text;
  box-sizing: border-box;
  max-width: 100%;
}
/* iOS Safari date/time: native control is wider than Chromium — contain overflow */
input[type="date"],
input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  min-width: 0;
  line-height: 1.25;
}
input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.2em;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  margin-left: 4px;
  opacity: 0.7;
}
select {
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.field.inline { flex-direction: row; align-items: center; gap: 12px; }
.field.inline label { min-width: 110px; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .tb-search { flex: 1 1 100%; max-width: 100%; }
}
/* Detail toolbars with date + selects side by side */
.form-row-dates {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end;
}
.form-row-dates > .field {
  flex: 1 1 160px;
  min-width: min(100%, 150px);
  max-width: 100%;
  margin-bottom: 0;
}
.form-row-dates > .field.tb-date {
  flex: 0 1 15rem;
  min-width: min(100%, 15rem);
}
.card {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius); padding: 14px 16px;
}
.card + .card { margin-top: 10px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.pill {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; border: 1px solid var(--hair); color: var(--muted); background: var(--raised);
}
.pill.green { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--hair)); }
.pill.red { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--hair)); }
.pill.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, var(--hair)); }
.pill.blue { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 40%, var(--hair)); }
.split {
  display: grid; grid-template-columns: minmax(320px, 42%) 1fr; gap: 0;
  height: calc(100dvh - var(--header) - 32px); min-height: 480px;
  border: 1px solid var(--hair); border-radius: var(--radius); overflow: hidden; background: var(--card);
}
.split .list-pane { overflow: auto; border-right: 1px solid var(--hair); background: var(--bg); }
.split .detail-pane { overflow: auto; padding: 18px 20px; background: var(--card); }
.list-item {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  border-bottom: 1px solid var(--hair); padding: 14px 16px; color: var(--text);
}
.list-item:hover { background: var(--card); }
.list-item.active { background: var(--raised); border-left: 3px solid var(--accent); }
.list-item .row1 { display: flex; gap: 10px; align-items: baseline; }
.list-item .title { font-weight: 600; flex: 1; min-width: 0; }
.list-item .sub { color: var(--muted); font-size: 15px; margin-top: 4px; }

/* Manpower */
.crew-block { margin-bottom: 18px; }
.crew-head {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--hair);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.crew-head h2 { margin: 0; font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase; flex: 1; }
.crew-head .counts { color: var(--muted); font-size: 15px; font-family: var(--mono); }
.person-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; padding: 10px 0;
}
.person {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px;
  border-radius: var(--radius); border: 1px solid var(--hair); background: var(--card); text-align: left;
}
.person.present { border-color: color-mix(in srgb, var(--green) 45%, var(--hair)); }
.person.absent { border-color: color-mix(in srgb, var(--red) 45%, var(--hair)); opacity: 0.85; }
.person .dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; background: var(--faint); }
.person.present .dot { background: var(--green); }
.person.absent .dot { background: var(--red); }
.person .who { flex: 1; min-width: 0; }
.person .who .name { font-weight: 600; font-size: 17px; }
.person .who .craft { color: var(--muted); font-size: 14px; font-family: var(--mono); }
.person .equip { color: var(--gold); font-size: 13px; font-family: var(--mono); }
.totals-bar {
  display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 16px; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius); font-family: var(--mono);
}
.totals-bar strong { color: var(--accent); }

/* Status buttons for orders */
.status-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.status-steps .btn.active-step { outline: 2px solid var(--accent); outline-offset: 1px; }
.quote-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quote-card { padding: 14px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--raised); }
.quote-card.winner { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.quote-card h3 { margin: 0 0 8px; font-size: 16px; }

/* Weld checkpoints */
.check-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.check-btn {
  min-height: 44px; padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--hair); background: var(--raised); color: var(--muted); font-size: 14px;
}
.check-btn.done { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, var(--hair)); background: color-mix(in srgb, var(--green) 12%, var(--raised)); }

/* Modal / drawers */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: min(920px, 100%); max-height: min(90dvh, 900px); overflow: auto;
  background: var(--card); border: 1px solid var(--hair); border-radius: 12px; padding: 20px;
}
.modal h2 { margin: 0 0 14px; font-size: 22px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; justify-content: flex-end; }

/* Markup */
.markup-wrap { position: relative; background: #0a0a09; border-radius: var(--radius); overflow: hidden; touch-action: none; }
.markup-wrap canvas { display: block; width: 100%; height: auto; touch-action: none; }
.markup-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--hair); padding: 0; }
.swatch.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch.red { background: #d11; }
.swatch.yellow { background: #e6c200; }
.swatch.black { background: #111; }
.photo-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--hair); }

.empty {
  padding: 48px 24px; text-align: center; color: var(--muted); border: 1px dashed var(--hair); border-radius: var(--radius);
}
.hidden { display: none !important; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink); padding: 12px 18px; border-radius: 999px;
  z-index: 200; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.print-only { display: none; }

@media print {
  .side-nav, .phone-dock, .topbar, .toolbar, .no-print { display: none !important; }
  body { background: var(--paper); color: var(--ink); }
  .content { padding: 0; overflow: visible; }
  .print-only { display: block; }
}

/* iPad landscape: roomier side nav labels stay, content uses width */
@media (min-width: 1100px) {
  :root { --side: 108px; }
  .side-nav .nav-btn { font-size: 14px; min-height: 78px; }
  .person-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

/* Phone / narrow: bottom dock, single column */
@media (max-width: 820px) {
  #app { flex-direction: column; }
  .side-nav { display: none; }
  .phone-dock {
    display: flex; position: sticky; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--hair);
    padding: 6px 4px calc(6px + var(--safe-b)); gap: 2px;
  }
  .phone-dock .nav-btn { flex: 1; min-height: 56px; padding: 8px 2px; font-size: 11px; }
  .phone-dock .nav-btn .ico { font-size: 18px; }
  .topbar { height: 56px; padding: 0 12px; }
  .topbar h1 { font-size: 18px; }
  .content { padding: 12px 12px 18px; }
  .split { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .split .list-pane { max-height: 42dvh; }
  .split .detail-pane { padding: 14px; }
  .grid-2, .grid-3, .quote-pair { grid-template-columns: 1fr; }
  .person-grid { grid-template-columns: 1fr; }
}

/* RFI archive photos */
.rfi-list-row { display: flex; gap: 12px; align-items: flex-start; }
.rfi-list-thumb {
  width: 64px; height: 64px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--hair); flex-shrink: 0; background: var(--raised);
}
.rfi-list-thumb.placeholder { background: var(--raised); }
.rfi-list-body { flex: 1; min-width: 0; }
.photo-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.gallery-thumb {
  display: flex; flex-direction: column; gap: 6px; padding: 0; border: 1px solid var(--hair);
  border-radius: var(--radius); overflow: hidden; background: var(--raised); color: var(--muted);
  font-size: 13px; text-align: left;
}
.gallery-thumb img { width: 100%; height: 110px; object-fit: cover; display: block; }
.gallery-thumb span { padding: 0 8px 8px; }
.photo-viewer { background: #0a0a09; border-radius: var(--radius); overflow: auto; max-height: 70dvh; }
.photo-viewer img { width: 100%; height: auto; display: block; }
.readonly-text {
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--hair);
  background: var(--raised); color: var(--text); white-space: pre-wrap; line-height: 1.45;
}
.archive-readonly { margin-bottom: 14px; }
.doc-list { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* Employment status cards */
.person-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border-radius: var(--radius); border: 1px solid var(--hair);
  background: var(--card);
}
.person-card.present { border-color: color-mix(in srgb, var(--green) 45%, var(--hair)); }
.person-card.absent { border-color: color-mix(in srgb, var(--red) 45%, var(--hair)); }
.person-card.inactive { opacity: 0.95; border-style: dashed; }
.person-main {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: 0; color: inherit; padding: 4px; min-height: 52px;
}
.person-card.present .dot { background: var(--green); }
.person-card.absent .dot { background: var(--red); }
.person-card.inactive .dot { background: var(--faint); }
.person-main .dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; background: var(--faint); }
.person-main .who { flex: 1; min-width: 0; }
.person-main .name { font-weight: 600; font-size: 17px; }
.person-main .craft { color: var(--muted); font-size: 14px; font-family: var(--mono); }
.person-main .equip { color: var(--gold); font-size: 13px; font-family: var(--mono); }
.person-main .hist { font-size: 12px; margin-top: 2px; }
.emp-status-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.emp-btn {
  min-height: 48px; padding: 8px 6px; border-radius: var(--radius);
  border: 1px solid var(--hair); background: var(--raised); color: var(--muted);
  font-weight: 600; font-size: 14px;
}
.emp-btn.on[data-emp="active"], .emp-btn.on[data-pe="active"] {
  background: color-mix(in srgb, var(--green) 22%, var(--raised));
  color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, var(--hair));
}
.emp-btn.on[data-emp="transferred"], .emp-btn.on[data-pe="transferred"] {
  background: color-mix(in srgb, var(--gold) 22%, var(--raised));
  color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, var(--hair));
}
.emp-btn.on[data-emp="laid_off"], .emp-btn.on[data-pe="laid_off"] {
  background: color-mix(in srgb, var(--red) 22%, var(--raised));
  color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, var(--hair));
}
.person-edit { align-self: flex-start; }

/* ===== Teams meeting mode ===== */
body.teams-on {
  --teams-bg: #f4f2ea;
  --teams-card: #ffffff;
  --teams-text: #1a1b17;
  --teams-muted: #5c5b55;
  --teams-hair: #d7d4c8;
  --teams-accent: #1f4e79;
  --teams-pill: #e8f0f7;
}
body.teams-on.teams-dark {
  --teams-bg: #121311;
  --teams-card: #1b1c19;
  --teams-text: #efeee9;
  --teams-muted: #a7a69e;
  --teams-hair: #33352e;
  --teams-accent: #e7e4db;
  --teams-pill: #262822;
}
body.teams-on {
  background: var(--teams-bg);
  color: var(--teams-text);
}
body.teams-on .side-nav,
body.teams-on .phone-dock,
body.teams-on #btn-settings { display: none !important; }
body.teams-on .topbar { display: none !important; }
body.teams-on .main { width: 100%; }
body.teams-on .content { padding: 0; overflow: hidden; height: calc(100dvh - 0px); }
body.teams-on .toast { display: none !important; }

.teams-shell {
  display: flex; flex-direction: column; height: 100dvh; background: var(--teams-bg); color: var(--teams-text);
}
.teams-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--teams-hair); background: var(--teams-card);
  min-height: 64px;
}
.teams-bar .brand {
  font-family: var(--mono); letter-spacing: 0.14em; font-size: 13px; color: var(--teams-muted);
}
.teams-bar .brand strong { color: var(--teams-accent); display: block; font-size: 16px; letter-spacing: 0.18em; }
.teams-bar h1 { margin: 0; font-size: 20px; flex: 1; min-width: 120px; }
.teams-btn {
  min-height: 44px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--teams-hair);
  background: var(--teams-card); color: var(--teams-text); font-weight: 600; font-size: 15px;
}
.teams-btn.primary { background: var(--teams-accent); color: #fff; border-color: var(--teams-accent); }
body.teams-on.teams-dark .teams-btn.primary { color: #161714; }
.teams-btn.danger-outline { border-color: #b44; color: #b44; }
.teams-btn.on { outline: 2px solid var(--teams-accent); outline-offset: 1px; }
.teams-preload {
  padding: 8px 14px; background: var(--teams-pill); border-bottom: 1px solid var(--teams-hair);
  font-size: 14px; color: var(--teams-muted);
}
.teams-preload meter { width: min(420px, 60vw); height: 12px; vertical-align: middle; margin-left: 8px; }
.teams-body {
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 34%) 1fr; gap: 0;
}
.teams-list {
  overflow: auto; border-right: 1px solid var(--teams-hair); background: var(--teams-card);
}
.teams-list-tools { padding: 10px; border-bottom: 1px solid var(--teams-hair); position: sticky; top: 0; background: var(--teams-card); z-index: 2; }
.teams-list-tools input[type="search"] {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--teams-hair); background: var(--teams-bg); color: var(--teams-text); font-size: 18px;
}
.teams-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.teams-chip {
  min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--teams-hair);
  background: var(--teams-bg); color: var(--teams-muted); font-size: 14px;
}
.teams-chip.on { background: var(--teams-pill); color: var(--teams-accent); border-color: var(--teams-accent); }
.teams-item {
  display: block; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--teams-hair);
  background: transparent; color: var(--teams-text); cursor: pointer;
}
.teams-item.on { background: var(--teams-pill); box-shadow: inset 4px 0 0 var(--teams-accent); }
.teams-item .t-num { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.teams-item .t-sub { color: var(--teams-muted); font-size: 14px; margin-top: 2px; }
.teams-detail { overflow: auto; padding: 18px 22px 28px; background: var(--teams-bg); }
.teams-detail .hero-num {
  font-family: var(--mono); font-size: clamp(36px, 5vw, 56px); font-weight: 700; line-height: 1.05; margin: 0 0 8px;
  color: var(--teams-accent);
}
.teams-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; color: var(--teams-muted); font-size: 16px; }
.teams-pill {
  display: inline-flex; padding: 6px 12px; border-radius: 999px; background: var(--teams-pill);
  color: var(--teams-accent); font-weight: 600; font-size: 14px; border: 1px solid var(--teams-hair);
}
.teams-section { margin: 0 0 16px; }
.teams-section h3 {
  margin: 0 0 6px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--teams-muted); font-weight: 600;
}
.teams-section .body {
  font-size: 22px; line-height: 1.45; background: var(--teams-card); border: 1px solid var(--teams-hair);
  border-radius: 10px; padding: 14px 16px; white-space: pre-wrap;
}
.teams-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 8px;
}
.teams-gallery button {
  border: 1px solid var(--teams-hair); border-radius: 10px; overflow: hidden; padding: 0;
  background: var(--teams-card); color: var(--teams-muted); text-align: left;
}
.teams-gallery .teams-img-wrap img { width: 100%; height: 140px; object-fit: cover; display: block; }
.teams-gallery span { display: block; padding: 8px 10px; font-size: 13px; }
.teams-img-wrap.img-error, .img-fallback {
  display: flex; align-items: center; justify-content: center; min-height: 100px;
  background: var(--teams-pill); color: var(--teams-muted); font-size: 14px;
}

.teams-viewer {
  position: fixed; inset: 0; z-index: 500; background: #0b0b0a; color: #fff;
  display: flex; flex-direction: column;
}
.teams-viewer-bar {
  display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: rgba(0,0,0,0.85);
}
.teams-viewer-cap { flex: 1; text-align: center; font-size: 16px; color: #ddd; }
.teams-viewer-stage {
  flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none;
}
.teams-viewer-zoom {
  width: 100%; height: 100%; transform-origin: center center; display: flex; align-items: center; justify-content: center;
}
.teams-viewer-imgslot { max-width: 100%; max-height: 100%; }
.teams-viewer-imgslot img { max-width: 100vw; max-height: calc(100dvh - 100px); object-fit: contain; display: block; }
.teams-laser { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; touch-action: none; }
.teams-viewer-hint {
  padding: 8px 12px; font-size: 13px; color: #aaa; text-align: center; background: rgba(0,0,0,0.85);
}

@media (max-width: 900px) {
  .teams-body { grid-template-columns: 1fr; }
  .teams-list { max-height: 38dvh; }
}

/* When Teams button sits in normal RFIs toolbar */
.btn.teams-toggle.on {
  background: #1f4e79; color: #fff; border-color: #1f4e79;
}

.wait-banner {
  margin: 0 0 14px; padding: 14px 16px; border-radius: 10px; font-weight: 700;
  font-size: 18px; letter-spacing: 0.02em; border: 2px solid;
}
.wait-banner.wait-ext { background: #3a2a12; color: #f0c674; border-color: #c6a15a; }
.wait-banner.wait-us { background: #1c2a22; color: #8eae8a; border-color: #8eae8a; }
.wait-banner.wait-fab { background: #1a2430; color: #7a9bb8; border-color: #7a9bb8; }
.wait-banner.wait-other { background: #2a1c1c; color: #d16b5e; border-color: #d16b5e; }
.pill.wait-pill.wait-ext { color: #c6a15a; }
.pill.wait-pill.wait-us { color: #8eae8a; }
.pill.wait-pill.wait-fab { color: #7a9bb8; }
.pill.wait-pill.wait-other { color: #d16b5e; }
body.teams-on .wait-banner.wait-ext { background: #fff4d6; color: #7a4e00; border-color: #e0b84e; }
body.teams-on .wait-banner.wait-us { background: #e5f2e4; color: #2d5a2a; border-color: #8eae8a; }
body.teams-on .wait-banner.wait-fab { background: #e4eef6; color: #1f4e79; border-color: #7a9bb8; }
body.teams-on .wait-banner.wait-other { background: #fde8e5; color: #8a2e24; border-color: #d16b5e; }
body.teams-on.teams-dark .wait-banner.wait-ext { background: #3a2a12; color: #f0c674; border-color: #c6a15a; }
body.teams-on.teams-dark .wait-banner.wait-us { background: #1c2a22; color: #8eae8a; border-color: #8eae8a; }
body.teams-on.teams-dark .wait-banner.wait-fab { background: #1a2430; color: #7a9bb8; border-color: #7a9bb8; }
body.teams-on.teams-dark .wait-banner.wait-other { background: #2a1c1c; color: #d16b5e; border-color: #d16b5e; }
.teams-pill.wait-ext { color: inherit; }

/* ---- Hours / shift ---- */
.shift-toggle { display: flex; gap: 6px; }
.shift-btn {
  min-height: 44px; min-width: 56px; padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--hair); background: var(--raised); color: var(--muted); font-weight: 700; font-size: 15px;
}
.shift-btn.on {
  background: color-mix(in srgb, var(--accent, #3d6ea8) 22%, var(--raised));
  color: var(--text); border-color: color-mix(in srgb, var(--accent, #3d6ea8) 50%, var(--hair));
}
.shift-btn.sm { min-height: 36px; min-width: 40px; padding: 4px 8px; font-size: 13px; }
.crew-shift { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.crew-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hrs-badge {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; font-family: var(--mono);
  background: var(--raised); color: var(--muted); vertical-align: middle;
}
.hrs-badge.diff {
  background: color-mix(in srgb, var(--gold) 28%, var(--raised));
  color: var(--gold);
}
.hrs-badge.zero {
  background: color-mix(in srgb, var(--red) 18%, var(--raised));
  color: var(--red);
}
.hrs-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.hrs-btn {
  min-height: 44px; padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--hair); background: var(--raised); color: var(--text);
  font-weight: 600; font-size: 13px;
}
.hrs-btn.ghost { color: var(--muted); }
.week-panel { margin-top: 8px; }
.week-table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--card); }
.week-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
.week-table th, .week-table td { padding: 10px 12px; border-bottom: 1px solid var(--hair); text-align: left; white-space: nowrap; }
.week-table th { background: var(--raised); font-size: 12px; color: var(--muted); position: sticky; top: 0; }
.week-table td.num { font-family: var(--mono); text-align: right; }
.week-table td.ot { color: var(--gold); font-weight: 700; }
.week-table .mono { font-family: var(--mono); font-size: 12px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* Sync status */
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--hair);
  background: var(--raised); color: var(--muted); white-space: nowrap;
}
.sync-pill.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--hair)); }
.sync-pill.warn { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, var(--hair)); }
.sync-pill.err { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--hair)); }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.activity-feed { max-height: 180px; overflow: auto; font-size: 13px; }
.activity-feed div { padding: 6px 0; border-bottom: 1px solid var(--hair); color: var(--muted); }
.activity-feed strong { color: var(--text); }
