/* ==========================================================================
   Butler Plus — Field-to-Contract
   Palette derived from the Butler Plus scope brief:
     headline teal #1F6F78, pale fill #EEF5F6, body #1A1A1A, muted #5F6B73
   Light-first and high contrast: the primary device is a Samsung tablet used
   outdoors on site, where a dark UI washes out in daylight.
   Touch targets are >=44px, 48px at tablet widths.
   ========================================================================== */

:root {
  /* surfaces — taken from the Butler Plus prototype v2 */
  --bg: #E7ECEF;
  --panel: #FBFCFD;
  --panel-2: #FFFFFF;
  --panel-3: #E2EEF2;
  --line: #C6D2D8;
  --line-soft: #DEE6EA;

  /* text */
  --ink: #14232B;
  --ink-2: #3C515B;
  --ink-3: #6E828B;

  /* brand */
  --brand: #14607A;
  --brand-2: #0E4A5F;
  --brand-ink: #ffffff;
  /* the prototype's accent: amber. Used for active rails, gates, marks. */
  --mark: #E9B824;
  --mark-2: #F5D061;
  --mark-soft: #FBF0CB;
  --blue-soft: #E2EEF2;

  /* status */
  --ok: #2C7357;
  --ok-soft: #DEEEE6;
  --warn: #7A5C05;
  --danger: #B8492C;
  --alert-soft: #F8E4DE;
  --violet: #6a4b9e;

  --grid: rgba(20,35,43,.055);

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --sh-1: 0 1px 2px rgba(18,36,42,.06);
  --sh-2: 0 1px 3px rgba(18,36,42,.07), 0 6px 16px -8px rgba(18,36,42,.14);
  --sh-3: 0 18px 44px -16px rgba(18,36,42,.28);

  --tap: 44px;
  /* Prototype typefaces. Loaded from Google Fonts in the shell; the system
     stacks behind each one mean a blocked font request degrades gracefully
     rather than changing metrics. */
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --disp: "Archivo", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  /* Prototype: 26px grid-paper, fixed so panels appear to sit on a drawing. */
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
}

h1,h2,h3,h4 { margin: 0; font-family: var(--disp); letter-spacing: -.015em; line-height: 1.15; color: var(--ink); }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.028em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3d5d9; border-radius: 20px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ shell -- */
/* ------------------------------------------------------------------ shell --
   Prototype structure: a full-width dark topbar, then a three-column grid
   (stage rail / stage / field log). The log rail is not decoration -- it is
   the visible proof that every entry is written to the deal record, so it
   stays present at every stage rather than living behind a tab. */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr) 226px;
  align-items: start;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px 0 40px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 56px; height: calc(100vh - 56px);
  overflow-y: auto;
}

.brand { display: none; }  /* identity now lives in the topbar */

.nav-label {
  font-family: var(--mono);
  font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500; padding: 14px 14px 7px;
}
.nav-label:first-child { padding-top: 4px; }

.nav-item {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 9px;
  padding: 9px 13px 9px 12px;
  border-left: 3px solid transparent;
  color: var(--ink-2); font-weight: 500; font-size: 12.5px;
  cursor: pointer;
  transition: background .13s ease, border-color .13s ease;
  min-height: 38px;
  user-select: none;
}
.nav-item:hover { background: #EFF4F6; color: var(--ink); }
.nav-item.active {
  background: var(--blue-soft);
  border-left-color: var(--mark);
  color: var(--ink); font-weight: 600;
}
.nav-item i { width: 15px; text-align: center; font-size: 12px; color: var(--ink-3); }
.nav-item.active i { color: var(--brand); }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-family: var(--mono);
  font-size: 9.5px; font-weight: 600; padding: 1px 6px; border-radius: 2px;
}

.sidebar-foot {
  margin-top: auto; padding: 12px 14px 0;
  border-top: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------- main area -- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px; height: 56px;
  background: var(--ink); color: #EDF3F5;
  border-bottom: 2px solid var(--mark);
  position: sticky; top: 0; z-index: 60;
}
.topbar .brand { display: flex; align-items: baseline; gap: 9px; padding: 0; flex: none; }
.topbar .brand b {
  font-family: var(--disp); font-weight: 800; font-size: 16px; letter-spacing: .02em;
  color: #fff;
}
.topbar .brand span {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: #8FA6AF;
}

.tb-divide {
  display: flex; align-items: center; gap: 12px;
  padding-left: 18px; border-left: 1px solid rgba(255,255,255,.16);
  min-width: 0; flex: 1;
}
.topbar-title {
  font-family: var(--disp); font-weight: 600; font-size: 13.5px;
  letter-spacing: 0; color: #F2F7F9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-sub {
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
  color: #93A9B2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-spacer { flex: 1; }

/* Buttons sitting on the dark bar need light treatments. */
.topbar .btn { border-color: rgba(255,255,255,.28); background: transparent; color: #E4EDF1; }
.topbar .btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar .btn.mark { background: var(--mark); border-color: var(--mark); color: #2A2105; }
.topbar .btn.mark:hover { background: var(--mark-2); }

.content { padding: 26px 24px 60px; max-width: 1000px; width: 100%; }

/* ------------------------------------------------------------- log rail -- */
.lograil {
  position: sticky; top: 56px; height: calc(100vh - 56px);
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 0 0 30px; overflow-y: auto;
}
.lograil-h {
  padding: 13px 15px 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.lograil-h b {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .15em;
  text-transform: uppercase; font-weight: 600;
}
.lograil-h .cnt { font-family: var(--mono); font-size: 9px; color: var(--ink-3); }
.lograil ul { list-style: none; margin: 0; padding: 4px 0; }
.lograil li {
  display: grid; grid-template-columns: 38px 1fr; gap: 9px;
  padding: 8px 15px; border-bottom: 1px solid var(--line-soft);
  font-size: 11px; line-height: 1.45;
}
.lograil .t { font-family: var(--mono); font-size: 9px; color: var(--ink-3); padding-top: 1px; }
.lograil .m { color: var(--ink-2); }
.lograil .m b { color: var(--ink); font-weight: 600; display: block; font-size: 11.5px; margin-bottom: 1px; }
.lograil .m em {
  font-style: normal; font-family: var(--mono); font-size: 9px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--brand);
}
.lograil-foot {
  padding: 12px 15px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 9px; line-height: 1.6;
  color: var(--ink-3); letter-spacing: .02em;
}
.lograil-empty { padding: 16px 15px; font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); }


/* ------------------------------------------------------------------ cards -- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { font-size: 14px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }

/* --------------------------------------------------------------- stat cards -- */
.stat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 17px; position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--brand);
}
.stat-label {
  font-size: 10px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700;
}
.stat-value { font-size: 27px; font-weight: 780; letter-spacing: -.035em; margin-top: 5px; }
.stat-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.stat.warn::after { background: var(--warn); }
.stat.ok::after { background: var(--ok); }

/* ----------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r);
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 650; font-size: 13.5px; cursor: pointer;
  min-height: var(--tap); min-width: var(--tap);
  transition: background .13s, border-color .13s, opacity .13s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #bcd9dd; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--brand);
  color: #fff; border-color: var(--brand); font-weight: 700;
}
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ok { background: var(--ok); color: #fff; border-color: var(--ok); font-weight: 700; }
.btn-ok:hover { filter: brightness(.93); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 700; }
.btn-danger:hover { filter: brightness(.93); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--panel-3); color: var(--ink); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; min-height: 36px; }
.btn-lg { padding: 14px 24px; font-size: 15.5px; min-height: 52px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------------ forms -- */
.field { margin-bottom: 14px; }
.field label, .lbl {
  display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%; padding: 11px 13px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--ink);
  min-height: var(--tap); font-size: 14.5px;
  transition: border-color .13s, box-shadow .13s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31,111,120,.14);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.55; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hint { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ------------------------------------------------------------------ table -- */
.table-wrap { overflow-x: auto; border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; padding: 9px 11px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 11px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: var(--panel-3); }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .strong { font-weight: 700; }

/* ------------------------------------------------------------------ chips -- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--panel-3); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.ok { background: #e6f4ee; color: var(--ok); border-color: #bfe0d2; }
.chip.warn { background: #fdf3e2; color: var(--warn); border-color: #f0d9b0; }
.chip.danger { background: #fbecea; color: var(--danger); border-color: #f0c9c3; }
.chip.info { background: var(--panel-3); color: var(--brand); border-color: #bcd9dd; }
.chip.violet { background: #f1ecf8; color: var(--violet); border-color: #d8cceb; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* -------------------------------------------------------------- pipeline -- */
.pipeline { display: flex; gap: 8px; flex-wrap: wrap; }
.pipe-step {
  flex: 1; min-width: 112px; padding: 11px 13px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); position: relative;
}
.pipe-step.done { border-color: #bfe0d2; background: #f4faf7; }
.pipe-step.current { border-color: var(--brand); background: var(--panel-3); box-shadow: 0 0 0 3px rgba(31,111,120,.1); }
.pipe-step .n { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 750; }
.pipe-step .t { font-size: 13px; font-weight: 650; margin-top: 3px; }
.pipe-step .c { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ------------------------------------------------------------------- map -- */
.map-shell {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); background: #e8eef0;
  touch-action: none;
}
.map-canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.map-overlay-hint {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(255,255,255,.95); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 12px; font-size: 12px;
  color: var(--ink-2); pointer-events: none;
  max-width: 70%;
}
.map-toolbar {
  position: absolute; top: 12px; left: 12px; display: flex; gap: 6px;
  background: rgba(255,255,255,.97); padding: 6px; border-radius: var(--r);
  border: 1px solid var(--line); flex-wrap: wrap;
  max-width: calc(100% - 24px);
  box-shadow: var(--sh-2);
}
.tool-btn {
  min-width: 40px; height: 40px; padding: 0 10px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 650;
  display: inline-flex; align-items: center; gap: 6px;
}
.tool-btn:hover { background: var(--panel-3); color: var(--ink); }
.tool-btn.active { background: var(--brand); color: #fff; font-weight: 700; }

/* -------------------------------------------------------------- photo grid -- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 9px; }
.photo-tile {
  position: relative; aspect-ratio: 4/3; border-radius: var(--r);
  overflow: hidden; background: var(--panel-3); border: 1px solid var(--line);
  cursor: pointer;
}
.photo-tile img, .photo-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .cap {
  position: absolute; inset: auto 0 0 0; padding: 5px 7px;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
  font-size: 10.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-tile .tagcorner {
  position: absolute; top: 5px; left: 5px; width: 9px; height: 9px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,.9);
}

/* ---------------------------------------------------------------- capture -- */
.capture-drop {
  border: 2px dashed var(--line); border-radius: var(--r-lg);
  padding: 26px; text-align: center; color: var(--ink-3);
  cursor: pointer; transition: border-color .13s, background .13s;
  min-height: 120px; display: grid; place-items: center;
  background: var(--panel-2);
}
.capture-drop:hover, .capture-drop.drag { border-color: var(--brand); background: var(--panel-3); color: var(--ink-2); }

.note-card {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--brand); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 9px;
}
.note-card.internal { border-left-color: var(--warn); }
.note-meta { font-size: 11px; color: var(--ink-3); margin-bottom: 5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note-body { font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }

/* -------------------------------------------------------------- margin bar -- */
.margin-bar {
  height: 8px; border-radius: 999px; background: #dfe9eb; overflow: hidden; position: relative;
}
.margin-bar > i { display: block; height: 100%; border-radius: 999px; transition: width .3s, background .3s; }
.margin-bar .floor-mark {
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .75;
}

/* ------------------------------------------------------------------ modal -- */
.modal-back {
  position: fixed; inset: 0; background: rgba(18,36,42,.42);
  z-index: 100;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--sh-3); width: min(720px, 100%);
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal.wide { width: min(1000px, 100%); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* ------------------------------------------------------------------ toast -- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: var(--r); padding: 12px 16px; box-shadow: var(--sh-3);
  font-size: 13.5px; max-width: 380px; animation: slideIn .22s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------- misc -- */
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-side { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.mt-1{margin-top:6px}.mt-2{margin-top:12px}.mt-3{margin-top:18px}.mt-4{margin-top:26px}
.mb-2{margin-bottom:12px}.mb-3{margin-bottom:18px}
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.empty { padding: 34px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.empty i { display: block; font-size: 24px; margin-bottom: 9px; opacity: .5; }
.spin {
  width: 17px; height: 17px; border: 2px solid var(--line);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 650; font-size: 12.5px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content:''; position:absolute; left:6px; top:4px; bottom:4px; width:1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item::before {
  content:''; position:absolute; left:-19px; top:5px; width:9px; height:9px;
  border-radius:50%; background: var(--panel-3); border: 2px solid var(--line);
}
.tl-item.ok::before { background: var(--ok); border-color: #bfe0d2; }
.tl-item.warn::before { background: var(--warn); border-color: #f0d9b0; }
.tl-item.danger::before { background: var(--danger); border-color: #f0c9c3; }
.tl-msg { font-size: 13px; }
.tl-time { font-size: 11px; color: var(--ink-3); }

/* --------------------------------------------------------------- responsive -- */
@media (max-width: 1180px) {
  .grid-side { grid-template-columns: 1fr; }
  /* Below the three-column breakpoint the log rail would squeeze the stage,
     so it moves under the content instead of disappearing -- the "everything
     is written to the deal" proof should not vanish on a tablet. */
  .shell { grid-template-columns: 200px minmax(0, 1fr); }
  .lograil {
    grid-column: 1 / -1; position: static; height: auto;
    border-left: none; border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 90;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--sh-3);
    height: 100vh; top: 0;
  }
  .sidebar.open { transform: none; }
  .scrim {
    position: fixed; inset: 0; background: rgba(18,36,42,.4); z-index: 80;
  }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
  .topbar .brand span { display: none; }
  .topbar-sub { display: none; }
}

/* Tablet: bigger everything, since this is the on-site device. */
@media (min-width: 768px) and (max-width: 1280px) {
  :root { --tap: 48px; }
  .btn { font-size: 14.5px; padding: 12px 18px; }
  .input, .select, .textarea { font-size: 16px; } /* >=16px stops iOS zoom-on-focus */
  .stat-value { font-size: 30px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (hover: none) {
  .btn:hover { background: var(--panel); }
  .nav-item:hover { background: transparent; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
}

/* ------------------------------------------------------- google maps layer -- */
/* The container needs an explicit height: Google renders into whatever box it
   is given, and a zero-height div shows nothing at all. */
.map-canvas-g {
  width: 100%;
  height: clamp(360px, 56vh, 640px);
  background: #e8eef0;
  border-radius: var(--r-lg);
  touch-action: pan-x pan-y;
}

/* Tablet: give the map more of the screen, since it is the main workspace. */
@media (min-width: 768px) and (max-width: 1280px) {
  .map-canvas-g { height: clamp(420px, 62vh, 760px); }
}

/* Advanced marker pills. */
.gm-pin { pointer-events: auto; }

/* Inline warning banner (e.g. satellite imagery switched off). */
.alert {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--panel);
  font-size: 12.5px; line-height: 1.5;
}
.alert > i { margin-top: 2px; flex: none; }
.alert-warn {
  background: #fdf6e9; border-color: #f0dcb4; color: #6b4200;
}
.alert-warn > i { color: var(--warn); }
.alert-info {
  background: var(--panel-3); border-color: #bcd9dd; color: var(--brand-2);
}
.alert strong { font-weight: 700; }
