/* Tango Auditoría. Used outdoors in direct sun on a phone held in one hand: always light, high contrast,
   48px targets, color never alone (priority and status always carry their word). */
:root {
  --brand: #17405b;
  --brand-2: #0e2e43;
  --accent: #0f766e;
  --accent-press: #0b5b55;
  --accent-soft: #e3f4f2;
  --bg: #eef3f6;
  --surface: #ffffff;
  --sunk: #f5f8fa;
  --ink: #0f1d26;
  --muted: #4a5b66;
  --line: #c6d3dc;
  --line-strong: #8fa3b1;
  --high: #9b1c1c;      --high-bg: #fde4e4;
  --medium: #6b4500;    --medium-bg: #fff0c2;
  --low: #14532d;       --low-bg: #d9f1df;
  --pending: #6b4500;   --pending-bg: #fff0c2;
  --done: #14532d;      --done-bg: #d9f1df;
  --error: #9b1c1c;     --error-bg: #fde4e4;
  --focus: #f59e0b;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgb(15 29 38 / 8%), 0 6px 18px rgb(15 29 38 / 8%);
  --t: 160ms cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
  accent-color: var(--accent);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: 140px; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
::selection { background: #b9e3de; color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; line-height: 1.25; }
.i { width: 22px; height: 22px; flex: none; }
.i.sm { width: 16px; height: 16px; }
.flip .i { transform: scaleX(-1); }
.muted { color: var(--muted); font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 650;
  transition: background-color var(--t), transform var(--t);
}
.btn:active { background: var(--accent-press); transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--surface); color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.btn.secondary:active { background: var(--accent-soft); }
.btn.ghost-dark { min-height: 48px; background: var(--sunk); color: var(--brand); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; padding: 0 14px; }
.iconbtn {
  display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; border: 0;
  background: transparent; color: inherit; cursor: pointer; flex: none;
}
.iconbtn:active { background: rgb(255 255 255 / 14%); }
.iconbtn[disabled] { opacity: 0.35; cursor: default; }

/* ---------- fields ---------- */
.field { display: grid; gap: 6px; margin-bottom: 18px; min-width: 0; }
.field > label, .label { font-weight: 650; font-size: 15px; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select, textarea:focus { border-color: var(--accent); }
::placeholder { color: #6b7c87; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.field-error { margin: 0; color: var(--error); font-size: 14px; font-weight: 600; }
.field-error:empty { display: none; }
.invalid > input, .invalid .tiles, .invalid .chips, .invalid .typelist, .invalid .prio { box-shadow: 0 0 0 2px var(--error); border-radius: 12px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; }
.row2, .row3 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
/* Peso on its own short line, then Fecha | Hora: native date/time inputs need their room on a phone. */
.row3 > :first-child { grid-column: 1 / -1; max-width: 11rem; }
.fsec .row3 > .field:first-child { margin-bottom: 14px; }
.row2 input, .row3 input { padding-left: 10px; padding-right: 8px; min-width: 0; }
.row2.tight { align-items: end; grid-template-columns: 1fr auto; }
.now { margin-bottom: 18px; }

.alert { border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; font-size: 15px; }
.alert:empty { display: none; }
.alert.error { background: var(--error-bg); color: var(--error); }
.alert.warn { background: var(--medium-bg); color: var(--medium); }
.banner { border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; background: var(--medium-bg); color: var(--medium); font-size: 15px; }

/* segmented control: one choice among few */
.seg { display: flex; gap: 6px; background: var(--sunk); padding: 4px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.seg-btn {
  flex: 1; min-height: 48px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  font-weight: 650; color: var(--muted); display: grid; place-items: center; line-height: 1.1; padding: 4px 6px;
  transition: background-color var(--t), color var(--t), box-shadow var(--t);
}
.seg-btn small { font-size: 11px; font-weight: 600; opacity: 0.85; }
.seg-btn[aria-checked=true], .seg-btn[aria-selected=true] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.seg-btn[disabled] { cursor: not-allowed; }
.seg-btn[disabled]:not([aria-checked=true]) { opacity: 0.45; }
.prio .prio-high[aria-checked=true] { background: var(--high-bg); color: var(--high); box-shadow: inset 0 0 0 2px var(--high); }
.prio .prio-medium[aria-checked=true] { background: var(--medium-bg); color: var(--medium); box-shadow: inset 0 0 0 2px var(--medium); }
.prio .prio-low[aria-checked=true] { background: var(--low-bg); color: var(--low); box-shadow: inset 0 0 0 2px var(--low); }
.status .status-pending[aria-checked=true] { background: var(--pending-bg); color: var(--pending); box-shadow: inset 0 0 0 2px var(--pending); }
.status .status-done[aria-checked=true] { background: var(--done-bg); color: var(--done); box-shadow: inset 0 0 0 2px var(--done); }
.kinds { margin-bottom: 10px; flex-wrap: wrap; gap: 4px; }
.kinds .seg-btn { flex: 1 1 auto; min-height: 44px; padding: 4px 10px; font-size: 15px; }

/* chips: categories and notified roles */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: 15px; text-align: left;
  transition: background-color var(--t), border-color var(--t), color var(--t);
}
.chip[aria-checked=true], .chip[aria-pressed=true] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.login-hero { background: var(--brand); color: #fff; padding: calc(28px + env(safe-area-inset-top)) 20px 60px; }
.login-hero img { width: 56px; height: 56px; border-radius: 14px; display: block; margin-bottom: 14px; }
.login-hero h1 { margin: 0; font-size: 28px; }
.login-hero p { margin: 6px 0 0; color: #d3e2ec; }
.login-card {
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow);
  margin: -36px 16px 24px; padding: 22px 18px; align-self: start; width: calc(100% - 32px); max-width: 440px; justify-self: center;
}
.login-card h2 { margin: 0 0 16px; font-size: 21px; }
.login-card .hint { margin-top: 14px; }
.who-is { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--sunk); }
.who-is strong { display: block; font-size: 18px; }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 650; cursor: pointer; min-height: 44px; padding: 0 4px; text-decoration: underline; text-underline-offset: 3px; }
.offline-note { margin: 12px 0 0; font-size: 14px; color: var(--medium); background: var(--medium-bg); border-radius: 10px; padding: 10px 12px; }
.pw { position: relative; }
.pw input { padding-right: 72px; }
.pw button { position: absolute; right: 4px; top: 4px; bottom: 4px; min-width: 64px; border: 0; border-radius: 10px; background: transparent; color: var(--accent); font-weight: 650; cursor: pointer; }

/* ---------- app shell ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; padding: env(safe-area-inset-top) 8px 0; box-shadow: 0 2px 10px rgb(15 29 38 / 18%); }
.appbar-row { display: flex; align-items: center; gap: 6px; min-height: 60px; }
.logo { width: 36px; height: 36px; border-radius: 9px; margin: 0 6px; flex: none; }
.appbar-title { flex: 1; min-width: 0; }
.appbar-title h1 { margin: 0; font-size: 17px; font-weight: 700; }
.appbar-title select {
  min-height: 34px; padding: 2px 30px 2px 0; border: 0; border-radius: 6px; background: transparent; color: #d3e2ec; font-size: 14px; font-weight: 600;
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, #d3e2ec 50%), linear-gradient(135deg, #d3e2ec 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; background-size: 5px 5px; background-repeat: no-repeat; max-width: 100%;
}
.appbar-title select option { color: var(--ink); }
.company-name { margin: 0; color: #d3e2ec; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.syncstate {
  display: flex; align-items: center; gap: 8px; width: calc(100% + 16px); margin: 0 -8px; min-height: 40px; padding: 0 16px;
  border: 0; font-size: 14px; font-weight: 650; cursor: pointer; text-align: left;
}
.syncstate.ok { background: var(--brand-2); color: #bfe6d5; }
.syncstate.busy { background: #134b52; color: #d7f5ef; }
.syncstate.off { background: var(--medium-bg); color: var(--medium); }
.syncstate.warn { background: var(--error-bg); color: var(--error); }
main { padding: 16px 16px calc(120px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; outline: none; }
.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 19px; }
.empty p { margin: 0 auto; max-width: 34ch; }

/* ---------- home: the day's walk ---------- */
.daynav { display: flex; align-items: center; gap: 4px; margin: 0 -8px 4px; color: var(--brand); }
.daynav-label { flex: 1; text-align: center; }
.daynav-label h2 { margin: 0; font-size: 22px; text-transform: capitalize; }
.daynav-label p { margin: 0; color: var(--muted); font-size: 14px; text-transform: capitalize; }
.daynav-label p:empty { display: none; }
.summary { text-align: center; margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.summary strong { color: var(--ink); }
.summary-high { color: var(--high); font-weight: 650; }
.place { margin-bottom: 16px; }
.place-head { display: flex; align-items: center; gap: 6px; margin: 0 4px 8px; font-size: 16px; color: var(--brand); }
.place-weight { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.findings { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.findings li + li { border-top: 1px solid var(--line); }
.finding { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 14px; color: inherit; text-decoration: none; }
.finding:active { background: var(--sunk); }
.finding.just-saved { animation: saved 1.6s var(--t); }
@keyframes saved { from { background: var(--accent-soft); } to { background: transparent; } }
.finding-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand); padding-top: 1px; }
.finding-main { display: grid; gap: 4px; min-width: 0; }
.finding-title { font-weight: 650; }
.finding-detail { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.finding-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.finding-to { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.finding-error { margin: 0; padding: 0 14px 14px 64px; color: var(--error); font-size: 14px; }
.tag { font-weight: 700; font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.tag.prio-high { background: var(--high-bg); color: var(--high); }
.tag.prio-medium { background: var(--medium-bg); color: var(--medium); }
.tag.prio-low { background: var(--low-bg); color: var(--low); }
.tag.status-pending { background: var(--pending-bg); color: var(--pending); }
.tag.status-done { background: var(--done-bg); color: var(--done); }
.syncdot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }
.syncdot.synced { background: var(--done-bg); color: var(--done); }
.syncdot.pending { background: var(--sunk); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.syncdot.error { background: var(--error-bg); color: var(--error); }
.fab {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 15;
  max-width: 688px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; border-radius: 16px; background: var(--accent); color: #fff; font-weight: 700; font-size: 18px; text-decoration: none;
  box-shadow: 0 6px 18px rgb(15 29 38 / 22%), 0 2px 6px rgb(15 29 38 / 18%);
}
.fab:active { background: var(--accent-press); }
.fab[aria-disabled=true] { opacity: 0.5; }

/* ---------- finding form ---------- */
.fsec { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 16px; margin-bottom: 16px; }
/* the card's own padding closes it: no extra gap from the last field */
.fsec > :last-child, .fsec > :last-child > .field:last-child, .fsec .row3 > .field, .fsec .report > :last-child { margin-bottom: 0; }
.fsec > .hint:last-child { margin-top: 10px; }
.fsec h2 { margin: 0 0 14px; font-size: 19px; color: var(--brand); }
.fsec h2 .muted { font-size: 14px; }
.recent { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.recent .tile { min-width: 56px; padding: 4px 12px; }
.recent .muted { font-size: 14px; margin-right: 2px; }
.search { position: relative; margin-bottom: 10px; color: var(--muted); }
.search .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.search input[type=search] { padding-left: 42px; min-height: 48px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; max-height: 236px; overflow-y: auto; padding: 2px; overscroll-behavior: contain; }
.tile {
  min-height: 52px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer;
  font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; padding: 4px; overflow-wrap: anywhere; line-height: 1.1;
  transition: background-color var(--t), color var(--t), border-color var(--t);
}
.tile[aria-checked=true] { background: var(--brand); color: #fff; border-color: var(--brand); }
.place-picked { margin-top: 10px; }
.place-picked p { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 15px; }
.typelist { display: grid; gap: 6px; }
.typeopt {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; min-height: 52px; padding: 8px 12px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font-size: 16px;
  transition: background-color var(--t), border-color var(--t);
}
.typeopt .code { font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.typeopt[aria-checked=true] { border-color: var(--brand); background: var(--accent-soft); font-weight: 650; box-shadow: inset 0 0 0 1px var(--brand); }
.guide { background: var(--accent-soft); color: #0b4a45; border-radius: 12px; padding: 10px 12px; font-size: 15px; }
.algae { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px 0; margin: 0 0 18px; }
.algae legend { font-weight: 650; padding: 0 6px; }
.who { border-top: 1px solid var(--line); padding: 12px 0 4px; margin-top: 12px; }
.who-role { margin: 0 0 4px; font-weight: 700; color: var(--brand); }
.addname { display: flex; gap: 8px; margin: 6px 0 8px; }
.addname input { min-height: 48px; }
.report .row2 { margin-top: 12px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 10px; }
.shot { position: relative; margin: 0; }
.shot img, .shot-link { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: grid; place-items: center; background: var(--sunk); font-size: 13px; font-weight: 600; text-align: center; }
.shot figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 2px; }
.shot-x { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgb(15 29 38 / 75%); color: #fff; display: grid; place-items: center; cursor: pointer; }
.shot-add { aspect-ratio: 1; border-radius: 12px; border: 2px dashed var(--line-strong); background: var(--sunk); color: var(--brand); display: grid; place-content: center; justify-items: center; gap: 4px; font-weight: 650; font-size: 14px; cursor: pointer; }
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: rgb(255 255 255 / 96%);
  border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgb(15 29 38 / 8%);
}
.actionbar-row { display: flex; gap: 10px; max-width: 688px; margin: 0 auto; }
.actionbar-row .btn { flex: 1; min-height: 56px; }
.actionbar-row .btn.primary { flex: 1.15; }
.bar-msg { margin: 0 auto 8px; max-width: 688px; color: var(--error); font-weight: 650; font-size: 15px; }
.bar-msg:empty { display: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 30; max-width: 560px; margin: 0 auto;
  padding: 14px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: var(--shadow);
  animation: rise 220ms var(--t);
}
.toast.error { background: var(--error); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

@media (min-width: 720px) {
  main { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.hit-cat { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.record { display: grid; gap: 10px; margin: 0 0 14px; }
.record div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 10px; }
.record dt { color: var(--muted); font-size: 14px; font-weight: 600; }
.record dd { margin: 0; overflow-wrap: anywhere; }
.shot.error img, .shot.error .shot-link { box-shadow: 0 0 0 2px var(--error); }
.shot.error figcaption { color: var(--error); font-weight: 600; }
.shot-actions { display: flex; justify-content: center; gap: 4px; }
.linkbtn.danger { color: var(--error); }
.finding-to.warn { color: var(--error); font-weight: 650; }
.typeopt .change { grid-column: 2; font-size: 14px; font-weight: 650; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
