:root {
  --navy: #234591;
  --navy-700: #162f60;
  --azure: #0075a8;
  --red: #e2001a;
  --ink: #252c3d;
  --muted: #5c6472;
  --line: #d9dfe6;
  --bg: #eef1f6;
  --ok: #1e6b31;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.muted { color: var(--muted); }

/* ---- Touch / mobile base ---- */
html { -webkit-text-size-adjust: 100%; }
a, button, .card.tappable, .result { -webkit-tap-highlight-color: rgba(35, 69, 145, .12); touch-action: manipulation; }

/* ---- Landing ---- */
body.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1100px 520px at 50% -10%, #2a52a8 0%, var(--navy) 46%, var(--navy-700) 100%);
  padding: 24px;
}
.landing-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(16, 32, 48, .25);
  padding: 40px 36px 34px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.landing-card .logo { height: 40px; margin-bottom: 18px; }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--azure);
}
.landing-card h1 { font-size: 30px; color: var(--navy); margin: 6px 0 10px; }
.landing-card .tag { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0 0 24px; }
.btn {
  display: inline-block; background: var(--navy); color: #fff; text-decoration: none;
  font-weight: 700; font-size: 15px; padding: 12px 26px; border-radius: 10px;
  transition: background .15s;
}
.btn:hover { background: var(--navy-700); }
.landing-ver { margin-top: 18px; font-size: 11px; color: var(--muted); letter-spacing: .3px; }

/* ---- App shell ---- */
.appbar {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 16px; position: sticky; top: 0; z-index: 10;
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}
.appbar .logo-sm { height: 22px; }
.appbar .appname { font-weight: 700; color: var(--navy); }
.appbar .appver { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.appbar .spacer { flex: 1; }
.appbar .who { color: var(--muted); font-size: 13px; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.netstate { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.netstate.off { background: var(--red); color: #fff; }
.netstate.pending { background: #f0a500; color: #3a2b00; }
.appbar .link { color: var(--azure); text-decoration: none; font-size: 13px; font-weight: 600; padding: 6px 2px; }
.appbar .link:hover { text-decoration: underline; }

.app-main {
  max-width: 640px; margin: 0 auto;
  padding: 18px 16px calc(40px + env(safe-area-inset-bottom));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
}
.app-main h1 { font-size: 20px; color: var(--ink); margin: 6px 0 14px; }

.bookings { display: flex; flex-direction: column; gap: 10px; }
.day-header {
  position: sticky; top: calc(43px + env(safe-area-inset-top)); z-index: 4;
  background: var(--bg);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--azure); margin: 6px 0 2px; padding: 6px 2px 5px; border-bottom: 1px solid var(--line);
}
.day-header:first-child { margin-top: 0; }
.card {
  display: flex; gap: 14px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.card .time { font-weight: 700; color: var(--navy); white-space: nowrap; font-size: 15px; }
.card .time span { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.card .klant { font-weight: 700; }
.card .adres { color: var(--muted); font-size: 13.5px; margin-top: 1px; }
.card .meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff;
}
.badge.so { background: var(--azure); }
.badge.proj { background: var(--navy); }

/* ---- Tappable cards ---- */
.card .body { flex: 1; min-width: 0; }
.card.tappable { cursor: pointer; transition: border-color .12s, box-shadow .12s, background .12s; }
.card.tappable:hover { border-color: var(--azure); box-shadow: 0 2px 10px rgba(16, 32, 48, .08); }
.card.tappable:active { background: #f4f7fb; border-color: var(--azure); }
.card .chev { align-self: center; color: var(--muted); font-size: 26px; line-height: 1; }

/* ---- Work order detail ---- */
.back {
  background: none; border: none; color: var(--azure); font: inherit; font-weight: 600;
  cursor: pointer; padding: 8px 0; margin-bottom: 6px; min-height: 40px;
  display: inline-flex; align-items: center;
}
.back:hover { text-decoration: underline; }
.wo-head {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.wo-head .wo-no { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: var(--azure); }
.wo-head h1 { font-size: 20px; margin: 4px 0 8px; }
.wo-head .adres { color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.wo-head .summary { margin: 10px 0 0; font-size: 14px; }
.maplink { color: var(--azure); text-decoration: none; font-weight: 600; white-space: nowrap; }
.maplink:hover { text-decoration: underline; }
.app-main h2 { font-size: 15px; color: var(--ink); margin: 20px 0 10px; }
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  min-height: 56px;
}
.task-name { font-weight: 600; font-size: 14px; }
.task-status { color: var(--muted); font-size: 12px; white-space: nowrap; }
.task-status.done { color: var(--ok); font-weight: 700; }

/* ---- Action buttons & panels ---- */
.btn-sm {
  background: var(--navy); color: #fff; border: none; border-radius: 8px; font: inherit;
  font-weight: 700; font-size: 14px; padding: 10px 16px; min-height: 42px; cursor: pointer;
  white-space: nowrap; touch-action: manipulation;
}
.btn-sm:hover { background: var(--navy-700); }
.btn-sm:active { background: var(--navy-700); transform: translateY(1px); }
.btn-sm:disabled { background: #9aa6bd; cursor: default; transform: none; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.field {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 8px;
}
.field:focus { outline: none; border-color: var(--azure); box-shadow: 0 0 0 3px rgba(0, 117, 168, .12); }
.panel .row { display: flex; gap: 8px; align-items: center; }
.panel .row .qty { width: 92px; margin-bottom: 0; }
.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.lbl .field { margin-top: 3px; }
.results { max-height: 240px; overflow: auto; -webkit-overflow-scrolling: touch; }
.result {
  padding: 12px 12px; min-height: 44px; display: flex; align-items: center;
  border: 1px solid var(--line); border-top: none; cursor: pointer; font-size: 15px;
}
.result:first-child { border-top: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.result:last-child { border-radius: 0 0 8px 8px; }
.result:hover { background: var(--bg); }
.msg { font-size: 13px; margin-top: 8px; min-height: 1px; }
.msg .ok { color: var(--ok); font-weight: 600; }
.msg .err { color: var(--red); font-weight: 600; }

/* ---- Small phones ---- */
@media (max-width: 400px) {
  .appbar { gap: 8px; }
  .appbar .who { display: none; }            /* declutter: name hidden on narrow screens */
  .app-main { padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); }
  .card { padding: 13px 14px; gap: 12px; }
  .panel .row { flex-wrap: wrap; }
  .panel .row .btn-sm { flex: 1; }
}

/* On coarse (touch) pointers, drop hover-only affordances so nothing "sticks" after a tap. */
@media (hover: none) {
  .card.tappable:hover { border-color: var(--line); box-shadow: none; }
}
