/* GenPilot: field-tool UI. High contrast for sunlight, 48px+ touch targets for gloves. */
:root {
  --ink: #0f1720;
  --ink-2: #3b4652;
  --ink-3: #6b7683;
  --line: #d9dee4;
  --line-2: #eceff2;
  --bg: #f4f5f7;
  --card: #ffffff;
  --navy: #0e2233;
  --navy-2: #173247;
  --amber: #f2a01d;
  --amber-ink: #6b4300;
  --amber-bg: #fff4de;
  --green: #1f8a4c;
  --green-bg: #e5f5ec;
  --red: #c2352b;
  --red-bg: #fdecea;
  --blue: #1f5fae;
  --blue-bg: #e7f0fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 32, .06), 0 4px 16px rgba(15, 23, 32, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 650; font-size: 16px; text-decoration: none; color: var(--ink); transition: transform .06s ease, background .15s; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #231500; }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { background: var(--card); border-color: var(--red); color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); min-height: 44px; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* inputs */
label.lbl { display: block; font-weight: 650; font-size: 14px; margin-bottom: 6px; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; min-height: 52px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 17px; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: 3px solid rgba(242, 160, 29, .35); border-color: var(--amber); }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.req { color: var(--red); }

/* cards and chips */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.amber { background: var(--amber-bg); color: var(--amber-ink); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.dark { background: var(--navy); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------------------------------------------------------------- phone app */
.stage { min-height: 100vh; display: flex; justify-content: center; }
.phone { width: 100%; max-width: 480px; min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; position: relative; }
@media (min-width: 900px) {
  .stage { gap: 28px; padding: 28px; align-items: flex-start; }
  .phone { min-height: 0; height: calc(100vh - 56px); max-height: 900px; border-radius: 36px; border: 10px solid #0b0f14; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); overflow: hidden; }
}
.appbar { background: var(--navy); color: #fff; padding: 14px 16px 12px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.appbar .brand { font-weight: 800; letter-spacing: .2px; font-size: 18px; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.appbar .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.appbar .brand.long { font-size: 15px; }
.appbar .brand svg { width: 22px; height: 22px; flex-shrink: 0; }
.appbar .sp { display: none; }
.appbar .net, .appbar .lang { flex-shrink: 0; }
.lang { display: inline-flex; background: var(--navy-2); border-radius: 999px; padding: 3px; }
.lang button { border: 0; background: transparent; color: #b8c6d3; font-weight: 750; font-size: 13px; padding: 6px 10px; border-radius: 999px; min-height: 32px; }
.lang button.on { background: #fff; color: var(--navy); }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: var(--navy-2); color: #b8c6d3; border: 0; min-height: 32px; }
.net.on { color: #7fe0a8; }
.net.off { color: #ffcf7a; }
.unitbar { background: var(--navy-2); color: #dbe5ee; padding: 8px 16px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.unitbar b { color: #fff; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px 28px; }
.footer-bar { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); flex-shrink: 0; }
h1.screen { font-size: 24px; margin: 4px 0 4px; letter-spacing: -.2px; }
h2.sec { font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3); margin: 22px 0 10px; }
.lead { color: var(--ink-2); margin: 0 0 16px; }

.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border-radius: var(--radius); padding: 20px; }
.hero h1 { margin: 0 0 6px; font-size: 22px; }
.hero p { margin: 0 0 16px; color: #b8c6d3; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button { min-height: 64px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.seg button small { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.seg button.on { border-color: var(--navy); background: var(--navy); color: #fff; }
.seg button.on small { color: #b8c6d3; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { min-height: 104px; border-radius: var(--radius); border: 1.5px solid var(--line); background: #fff; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 14px; font-weight: 750; font-size: 16px; text-align: left; }
.tile svg { width: 28px; height: 28px; color: var(--navy); }
.tile.alt { background: var(--amber-bg); border-color: #f5d9a6; }

.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 14px 14px; border-bottom: 1px solid var(--line-2); background: #fff; width: 100%; border-left: 0; border-right: 0; border-top: 0; text-align: left; min-height: 60px; }
.list .item:last-child { border-bottom: 0; }
.list .item .t { font-weight: 650; }
.list .item .s { font-size: 13px; color: var(--ink-3); }
.list .item.on { background: var(--amber-bg); }

.cause { border-left: 4px solid var(--line); }
.cause.high { border-left-color: var(--red); }
.cause.medium { border-left-color: var(--amber); }
.cause.low { border-left-color: var(--ink-3); }

.progress { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--amber); border-radius: 99px; transition: width .25s; }

.step-q { font-size: 21px; font-weight: 750; line-height: 1.3; letter-spacing: -.1px; margin: 6px 0 14px; }
.caution { display: flex; gap: 10px; background: var(--red-bg); color: #7a1d16; border: 1px solid #f3c3be; border-radius: 12px; padding: 12px; font-size: 14px; font-weight: 550; }
.caution svg { flex-shrink: 0; width: 20px; height: 20px; color: var(--red); }
.fixbox { background: var(--green-bg); border: 1px solid #bfe3cd; border-radius: 12px; padding: 14px; color: #0f4d2a; }
.fixbox b { display: block; margin-bottom: 4px; }
.notebox { background: var(--blue-bg); border: 1px solid #c6d9f1; border-radius: 12px; padding: 12px; font-size: 14px; color: #173e6e; }
.src { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.src .doc { font-family: var(--mono); font-size: 12px; background: var(--line-2); padding: 2px 6px; border-radius: 6px; color: var(--ink-2); }
.thumb { display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; background: #fff; padding: 0; position: relative; }
.thumb img { display: block; width: 100%; height: 170px; object-fit: cover; object-position: top; }
.thumb span { position: absolute; left: 8px; bottom: 8px; background: rgba(14, 34, 51, .88); color: #fff; font-size: 12px; font-weight: 650; padding: 4px 8px; border-radius: 8px; }
.answer { display: grid; gap: 10px; }
.answer .btn { min-height: 58px; font-size: 17px; }

.viewer { position: fixed; inset: 0; background: rgba(8, 12, 17, .94); z-index: 50; display: flex; flex-direction: column; }
.viewer .vbar { display: flex; align-items: center; gap: 10px; padding: 12px; color: #fff; }
.viewer .vbody { flex: 1; overflow: auto; touch-action: pan-x pan-y pinch-zoom; }
.viewer img { width: 100%; display: block; background: #fff; transform-origin: top left; }
.sheet { position: fixed; inset: auto 0 0 0; max-height: 82vh; background: #fff; border-radius: 20px 20px 0 0; z-index: 40; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); display: flex; flex-direction: column; }
@media (min-width: 900px) { .sheet { left: auto; right: auto; width: 460px; margin: 0 auto; inset-inline: 0; } }
.sheet .sh { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.sheet .sb { padding: 16px; overflow: auto; }
.scrim { position: fixed; inset: 0; background: rgba(8, 12, 17, .45); z-index: 39; }
.passage { white-space: pre-wrap; font-size: 13.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 44vh; overflow: auto; font-family: var(--mono); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); max-width: 92vw; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { min-height: 58px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 22px; font-weight: 700; }
.codebox { font-family: var(--mono); font-size: 34px; font-weight: 800; letter-spacing: 4px; text-align: center; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 12px; min-height: 66px; }

.rec { border-radius: var(--radius); border: 1px solid var(--line); background: #fff; padding: 14px; }
.rec.due { border-left: 5px solid var(--red); }
.rec.job { border-left: 5px solid var(--amber); }
.rec.visual { border-left: 5px solid var(--blue); }
.rec .talk { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; margin: 10px 0; border: 1px dashed var(--line); }
.rec .acts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.rec .acts .btn { min-height: 46px; font-size: 13.5px; padding: 0 6px; }
.rec .acts .btn.on.acc { background: var(--green); border-color: var(--green); color: #fff; }
.rec .acts .btn.on.dec { background: var(--red); border-color: var(--red); color: #fff; }
.rec .acts .btn.on.na { background: var(--ink-3); border-color: var(--ink-3); color: #fff; }

.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; }
.timeline .ev { position: relative; padding: 4px 0 10px; font-size: 14px; }
.timeline .ev::before { content: ""; position: absolute; left: -20px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline .ev.ok::before { background: var(--green); }
.timeline .ev.bad::before { background: var(--red); }
.timeline .ev.na::before { background: var(--ink-3); }

/* demo side panel (desktop only) */
.demo { display: none; }
@media (min-width: 900px) {
  .demo { display: block; width: 340px; flex-shrink: 0; }
  .demo .card + .card { margin-top: 14px; }
  .demo h3 { margin: 0 0 6px; font-size: 15px; }
  .demo p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
}
.switch { position: relative; width: 52px; height: 30px; border-radius: 99px; background: var(--line); border: 0; flex-shrink: 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .15s; }
.switch.on { background: var(--amber); }
.switch.on::after { left: 25px; }

/* ---------------------------------------------------------------- admin console */
.adm { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.adm nav { background: var(--navy); color: #cfdae4; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.adm nav .brand { color: #fff; font-weight: 800; font-size: 18px; padding: 4px 10px 18px; display: flex; gap: 8px; align-items: center; }
.adm nav .brand small { display: block; font-weight: 500; color: #8fa3b5; font-size: 12px; }
.adm nav button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent; color: #cfdae4; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14.5px; text-align: left; }
.adm nav button.on { background: var(--navy-2); color: #fff; }
.adm nav button .n { margin-left: auto; font-size: 12px; background: var(--amber); color: #231500; border-radius: 99px; padding: 1px 8px; }
.adm nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #6f8599; margin: 16px 12px 6px; }
.adm main { padding: 26px 30px 60px; min-width: 0; }
.adm h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.3px; }
.adm .sub { color: var(--ink-3); margin: 0 0 22px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.kpi .l { font-size: 13px; color: var(--ink-3); font-weight: 600; }
table.t { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); background: #fafbfc; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fafbfc; }
.twrap { overflow-x: auto; border-radius: var(--radius); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bar { display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin: 6px 0; }
.bar .lab { width: 150px; flex-shrink: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .trk { flex: 1; height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar .trk i { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.bar .val { width: 60px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { min-height: 42px; font-size: 14.5px; width: auto; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; background: #fff; color: var(--ink-2); }
.drop.over { border-color: var(--amber); background: var(--amber-bg); }
.hit { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.hit + .hit { margin-top: 10px; }
.hit .h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.hit .x { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; max-height: 150px; overflow: hidden; position: relative; }
.hit.open .x { max-height: none; }
@media (max-width: 860px) {
  .adm { grid-template-columns: 1fr; }
  .adm nav { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; }
  .adm nav .grp { display: none; }
  .adm nav button { width: auto; }
  .adm main { padding: 18px 16px 50px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
