:root {
  --navy: #0E2841;
  --teal: #156082;
  --bg: #f4f6f8;
  --ok: #196B24;
  --err: #b3261e;
  --line: #d7dde3;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--navy);
}

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.brand { font-weight: 700; letter-spacing: .3px; }
.who { font-size: .85rem; opacity: .85; }

main { max-width: 520px; margin: 0 auto; padding: 16px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
h1 { font-size: 1.25rem; margin: 0 0 12px; }

label { display: block; margin: 12px 0; font-weight: 600; font-size: .9rem; }
input, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 400;
}

.methods { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.methods legend { font-size: .8rem; padding: 0 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-weight: 600; }
.pill input { width: auto; margin: 0; }

.preview { max-width: 100%; margin-top: 10px; border-radius: 8px; border: 1px solid var(--line); }

button.primary {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--teal);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button.primary:disabled { opacity: .6; }
button.link {
  margin-top: 14px;
  background: none;
  border: 0;
  color: var(--teal);
  text-decoration: underline;
  cursor: pointer;
}

.status { margin-top: 14px; font-weight: 600; min-height: 1.2em; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

.hidden { display: none !important; }

/* ---- route + stop UI ---- */
.routebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px; }
.routebar h1 { flex: 1; font-size: 1.25rem; margin: 0; }
.routebar input[type=date] { width: auto; margin: 0; padding: 8px; }

#stopList { margin: 0 16px; }
.stop { display: flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; cursor: pointer; }
.stop-main { flex: 1; }
.stop-name { font-weight: 700; }
.stop-go { font-size: 1.6rem; color: var(--teal); padding-left: 8px; }
.muted { color: #667; font-size: .88rem; }
.chips { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .75rem; background: #eef2f5; border-radius: 999px; padding: 2px 10px; }
.chip.due { background: #fde8e6; color: var(--err); font-weight: 600; }
.chip.done { background: #eef6ef; color: var(--ok); font-weight: 700; }
.stop-done { border-color: #cfe6d2; background: #f6fbf6; }

h2 { font-size: 1rem; margin: 18px 0 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.inv { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.inv-subhead { margin: 14px 0 4px; font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; color: #667; }
.overdue-tag { display: inline-block; background: #fde8e6; color: var(--err); font-weight: 600; border-radius: 999px; padding: 1px 8px; font-size: .72rem; }

/* ---- menu / navigation ---- */
.brandwrap { display: flex; align-items: center; gap: 10px; }
.menubtn { background: transparent; border: 1px solid rgba(255,255,255,.45); color: #fff; border-radius: 6px; padding: 2px 9px; font-size: 1rem; cursor: pointer; }
.backlink { display: inline-block; margin: 14px 16px 0; }
.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 16px 16px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer; }
.tile:active { background: #f4f8fa; }
.tile-ic { font-size: 1.7rem; line-height: 1; }
.tile-t { font-weight: 700; color: var(--navy); }
.tile-d { font-size: .78rem; color: #667; }
.row { display: flex; gap: 10px; margin-top: 12px; }
button.secondary { flex: 1; padding: 12px; font-weight: 600; color: var(--navy); background: #eef2f5; border: 0; border-radius: 8px; cursor: pointer; }
button.primary.small, button.small { width: auto; margin: 0; padding: 8px 16px; font-size: .9rem; }
.row button.primary { margin-top: 0; }

.sigwrap { border: 1px dashed var(--teal); border-radius: 8px; background: #fbfdff; margin-top: 6px; }
#sigPad { width: 100%; height: 220px; touch-action: none; display: block; }

.summary { margin: 0 16px 8px; padding: 10px 12px; background: #eef6ef; border: 1px solid #cfe6d2; border-radius: 10px; font-size: .9rem; }
.summary .sumchip { display: inline-block; margin-left: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-weight: 600; }

/* ---- Powered by TalosCo footer ---- */
.powered {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 18px 12px 28px; color: #8a94a0; font-size: .8rem;
}
.tc-logo { height: 22px; width: auto; vertical-align: middle; }
.tc-wordmark { font-weight: 800; letter-spacing: .3px; color: var(--navy); }

/* greeting + handover */
.greeting { margin: 16px 16px 0; font-size: 1.15rem; font-weight: 700; color: var(--navy); }
#handoverBtn { margin: 0 16px 10px; width: calc(100% - 32px); }

/* navigate + review */
#navBtn { width: 100%; margin: 0 0 6px; }
#reviewToggle { display: block; margin: 0 16px 8px; }
#reviewList { margin: 0 16px 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; }
#callBtn { width: 100%; margin: 0 0 6px; }

/* language selector + scanner overlay */
.topright { display: flex; align-items: center; gap: 8px; }
.lang { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 6px; padding: 2px 6px; font-size: .8rem; }
#scanOverlay { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
#reader { width: min(92vw, 420px); }
#scanOverlay button { width: min(92vw, 420px); }
.routebar #scanInvoiceBtn { flex: 0 0 auto; }

/* Invoice preview shown when the customer signs a posted invoice */
.invpreview { border: 1px solid var(--line, #d9dee3); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: #fafbfc; }
.invpreview .invhead { margin-bottom: 6px; }
.invpreview .inv.total { border-top: 1px solid var(--line, #d9dee3); margin-top: 6px; padding-top: 6px; }
