/* CMMS web app — shared styles (phone + terminal). Brand navy + white.
   Big touch targets: people use this with gloves on. No external fonts/CDNs. */
:root {
  --navy: #123564;
  --navy-2: #0c264a;
  --bg: #f3f5f8;
  --card: #ffffff;
  --fg: #14213a;
  --muted: #5b6b82;
  --line: #d9e0ea;
  --accent: #123564;
  --danger: #c62828;
  --warn: #b26a00;
  --ok: #2e7d32;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.topbar {
  background: var(--navy); color: #fff; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; position: sticky; top: 0; z-index: 5;
}
.topbar .brand { flex: 0 1 200px; min-width: 0; display: block; }
.topbar .brand img { display: block; width: 100%; max-width: 200px; height: auto; }
.topbar .who { margin-left: auto; text-align: right; font-size: 14px; line-height: 1.2; }
.topbar .who small { display: block; opacity: .75; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 14px;
}
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 14px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=tel] {
  width: 100%; font-size: 19px; padding: 13px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; color: var(--fg);
}
input:focus { outline: 3px solid rgba(18, 53, 100, .25); border-color: var(--navy); }
.btn {
  display: block; width: 100%; min-height: 54px; margin-top: 16px; border: 0; border-radius: 12px;
  font-size: 18px; font-weight: 600; cursor: pointer; background: var(--navy); color: #fff;
}
.btn:active { background: var(--navy-2); }
.btn[disabled] { opacity: .6; }
.btn.ghost { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.btn.small { display: inline-block; width: auto; white-space: nowrap; flex: none; min-height: 40px; padding: 0 16px; margin: 0; font-size: 15px; }
.link { background: none; border: 0; color: var(--navy); font-size: 16px; padding: 12px 0; cursor: pointer; text-decoration: underline; }
.msg { min-height: 22px; margin-top: 12px; font-size: 15px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }
.hidden { display: none !important; }
.center { text-align: center; }
.brand-band { background: var(--navy); padding: 22px 16px; text-align: center; }
.brand-band img { width: min(260px, 70%); height: auto; }

/* My Work lists */
.section-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; margin: 18px 0 8px; }
.pill { font-size: 13px; padding: 2px 9px; border-radius: 999px; background: var(--line); color: var(--fg); font-weight: 600; }
.pill.now { background: var(--danger); color: #fff; }
.empty { color: var(--muted); font-size: 15px; padding: 10px 2px; }
.btn.ghost.on-navy { color: #fff; border-color: #fff; }

/* ── App shell: bottom tab bar (thumb-reachable on phones) ── */
body { padding-bottom: 76px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 16px 4px; font-size: 15px; font-weight: 600;
  color: var(--muted); text-decoration: none; min-height: 60px;
}
.tabbar a.active { color: var(--navy); box-shadow: inset 0 3px 0 var(--navy); }

/* ── Lists of items / places ── */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 60px;
  border-top: 1px solid var(--line); color: var(--fg); text-decoration: none; background: #fff;
  width: 100%; text-align: left; font: inherit; border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer;
}
.row:first-child { border-top: 0; }
.row:active { background: #eef2f7; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.row .meta { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.row .chev { color: var(--muted); font-size: 22px; flex: none; }
.tag { font-family: ui-monospace, Consolas, monospace; font-weight: 700; color: var(--navy); }
.count { flex: none; font-size: 13px; font-weight: 700; color: var(--navy); background: #e3e9f2; border-radius: 999px; padding: 3px 10px; }

/* status / condition pills */
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.pill.st-ready { background: #e3f1e4; color: var(--ok); }
.pill.st-missing, .pill.st-quarantined, .pill.st-needs_repair { background: #fbe4e4; color: var(--danger); }
.pill.st-retired { background: #e6e6e6; color: #555; }
.pill.flag { background: #fff1d6; color: var(--warn); }

/* breadcrumb "where it is" */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 16px; }
.crumbs a { color: var(--navy); font-weight: 600; text-decoration: none; padding: 4px 0; }
.crumbs .sep { color: var(--muted); }

/* detail table */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; font-size: 15px; color: var(--fg); overflow-wrap: anywhere; }

/* forms */
select, textarea {
  width: 100%; font-size: 18px; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; color: var(--fg); font-family: inherit;
}
textarea { min-height: 90px; }
input[type=search], input[type=number] {
  width: 100%; font-size: 19px; padding: 13px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; color: var(--fg);
}
.search-big { font-size: 20px !important; padding: 16px !important; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 140px; }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warn); }
.back { display: inline-block; color: var(--navy); font-weight: 600; text-decoration: none; padding: 6px 0 10px; font-size: 16px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 9;
  background: var(--fg); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 16px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast.error { background: var(--danger); }
.link-btn { background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
a.btn { text-decoration: none; display: flex; align-items: center; justify-content: center; text-align: center; }

/* ── Tasks (step 3) ─────────────────────────────────────────────────────── */
input[type=date], input[type=time] {
  width: 100%; font-size: 17px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.pill.st-open, .pill.st-assigned { background: #e3e9f2; color: var(--navy); }
.pill.st-in_progress { background: #e3f1e4; color: var(--ok); }
.pill.st-on_hold, .pill.st-waiting_parts, .pill.st-suggested, .pill.st-pending_review { background: #fff1d6; color: var(--warn); }
.pill.st-rework, .pill.st-rejected { background: #fbe4e4; color: var(--danger); }
.pill.st-closed, .pill.st-cancelled { background: #e6e6e6; color: #555; }
.pill.pr-high, .pill.late { background: #fbe4e4; color: var(--danger); }
.pill.pr-special { background: #ece3f6; color: #5b2d8c; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
.row.now { box-shadow: inset 4px 0 0 var(--danger); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 6px 0 4px; }
.photos a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--line); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-preview { max-width: 100%; max-height: 240px; border-radius: 8px; display: block; margin-top: 8px; }
.req { border-left: 4px solid var(--warn); }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.timeline li { padding: 6px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline .when { color: var(--muted); }
.note-item { padding: 8px 0; border-top: 1px solid var(--line); }
.note-item:first-child { border-top: 0; }
.note-item .by { color: var(--muted); font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chip { border: 2px solid var(--navy); color: var(--navy); background: transparent; border-radius: 999px;
  padding: 6px 14px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--navy); color: #fff; }
.check { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--fg); margin: 14px 0 4px; }
.check input { width: 22px; height: 22px; }
details.card summary { font-weight: 700; cursor: pointer; }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; }
.picked .main { flex: 1; min-width: 0; }
.big-actions .btn { min-height: 56px; font-size: 18px; }
.tabbar a { white-space: nowrap; }
.tabbar .badge { margin-left: 3px; vertical-align: 1px; }
