/* Driver Portal — phone-first, on the IQ design system's palette (black / greys). */
:root {
  --ink: #000000;
  --ink-2: #545454;
  --ink-3: #757575;
  --ink-4: #AFAFAF;
  --line: #E2E2E2;
  --fill: #F6F6F6;
  --paper: #FFFFFF;
  --bad: #A3282C;
  --bad-fill: #FCEAEA;
  --bad-line: #F3D4D5;
  --ok: #1F6B3A;
  --ok-fill: #E8F4EC;
  --warn: #8A5A00;
  --warn-fill: #FCF3E4;
  --warn-line: #F0E2C8;
  --tabbar: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--fill);
  color: var(--ink-2);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font-family: inherit; }
.dp-shell { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--paper); display: flex; flex-direction: column; }
.dp-hidden { display: none !important; }

/* Header */
.dp-header {
  position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.dp-brand { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.dp-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dp-who-name { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-signout { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; height: 32px; padding: 0 12px; font-size: 13px; font-weight: 600; cursor: pointer; }

/* Body */
.dp-main { flex: 1; padding: 24px 20px calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px); display: flex; flex-direction: column; gap: 22px; }
.dp-main.dp-no-tabs { padding-bottom: calc(env(safe-area-inset-bottom) + 32px); }
.dp-title { font-size: 28px; font-weight: 700; line-height: 1.16; letter-spacing: -.022em; color: var(--ink); }
.dp-intro { font-size: 16px; line-height: 1.5; }
.dp-section-title { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }

/* Forms */
.dp-form { display: flex; flex-direction: column; gap: 22px; }
.dp-field { display: flex; flex-direction: column; gap: 8px; border: 0; min-width: 0; }
.dp-label { font-size: 16px; font-weight: 600; color: var(--ink); }
.dp-sublabel { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.dp-help { font-size: 13px; line-height: 1.55; color: var(--ink-3); }
.dp-input, .dp-textarea {
  width: 100%; height: 54px; padding: 0 16px; font-size: 17px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; -webkit-appearance: none; appearance: none;
  min-width: 0; max-width: 100%;
}
/* Date inputs carry an intrinsic width (and iOS centres an empty one); keep them in their column. */
input[type="date"].dp-input { display: block; text-align: left; line-height: 52px; }
input[type="date"].dp-input::-webkit-date-and-time-value { text-align: left; }
.dp-input-code { font-size: 28px; font-weight: 700; letter-spacing: .4em; text-align: center; height: 64px; font-variant-numeric: tabular-nums; }
.dp-textarea { height: auto; min-height: 150px; padding: 14px 16px; line-height: 1.5; resize: vertical; background: var(--fill); border-color: transparent; }
.dp-input:focus, .dp-textarea:focus { outline: none; background: var(--paper); border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
::placeholder { color: var(--ink-4); }

/* Radio choices drawn as cards, segments and chips (no script needed to pick). */
.dp-radio { position: absolute; opacity: 0; pointer-events: none; }
.dp-choice {
  display: flex; align-items: center; gap: 14px; padding: 16px; min-height: 72px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--paper); cursor: pointer;
}
.dp-dot { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
.dp-choice-title { display: block; font-size: 16px; font-weight: 600; color: var(--ink); }
.dp-choice-sub { display: block; font-size: 14px; color: var(--ink-3); margin-top: 2px; }
.dp-radio:checked + .dp-choice { border-color: var(--ink); }
.dp-radio:checked + .dp-choice .dp-dot { border: 7px solid var(--ink); }
.dp-radio:focus-visible + .dp-choice, .dp-radio:focus-visible + .dp-seg, .dp-radio:focus-visible + .dp-chip { box-shadow: 0 0 0 3px rgba(0,0,0,.18); }

.dp-row { display: flex; gap: 12px; }
.dp-row > * { flex: 1 1 0; min-width: 0; }
.dp-row > div { display: flex; flex-direction: column; gap: 8px; }
.dp-seg {
  display: flex; align-items: center; justify-content: center; height: 52px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink-2); font-size: 16px; font-weight: 600; cursor: pointer;
}
.dp-radio:checked + .dp-seg { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.dp-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dp-chip {
  display: flex; align-items: center; justify-content: center; height: 52px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); font-size: 15px; font-weight: 500; cursor: pointer;
}
.dp-radio:checked + .dp-chip { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* Buttons */
.dp-btn {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 56px; border: none; border-radius: 10px;
  background: var(--ink); color: var(--paper); font-size: 17px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.dp-btn:disabled { background: var(--fill); color: var(--ink-4); cursor: not-allowed; }
.dp-btn-quiet { background: var(--paper); color: var(--ink); border: 1px solid var(--line); height: 50px; font-size: 16px; }
.dp-link { color: var(--ink); font-weight: 600; font-size: 15px; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Messages */
.dp-alert { font-size: 15px; line-height: 1.5; border-radius: 10px; padding: 13px 15px; border: 1px solid; }
.dp-alert-bad { color: var(--bad); background: var(--bad-fill); border-color: var(--bad-line); }
.dp-alert-ok { color: var(--ok); background: var(--ok-fill); border-color: #CFE6D7; }
.dp-alert-warn { color: var(--warn); background: var(--warn-fill); border-color: var(--warn-line); }
.dp-alert strong { font-weight: 700; }

/* Trips */
.dp-day { display: flex; flex-direction: column; gap: 10px; }
.dp-day-head { display: flex; align-items: baseline; justify-content: space-between; position: sticky; top: calc(env(safe-area-inset-top) + 61px); background: var(--paper); padding: 6px 0; z-index: 2; }
.dp-day-label { font-size: 15px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.dp-day-count { font-size: 13px; color: var(--ink-3); }
.dp-trip { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); overflow: hidden; }
.dp-trip > summary { list-style: none; cursor: pointer; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.dp-trip > summary::-webkit-details-marker { display: none; }
.dp-trip-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dp-trip-time { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.dp-pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--fill); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.dp-route { display: flex; flex-direction: column; gap: 6px; }
.dp-route-line { display: flex; gap: 10px; font-size: 15px; line-height: 1.4; color: var(--ink); }
.dp-route-mark { flex-shrink: 0; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; border: 2px solid var(--ink); }
.dp-route-mark.is-end { background: var(--ink); border-radius: 2px; }
.dp-trip-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--ink-2); }
.dp-trip-meta strong { color: var(--ink); font-weight: 600; }
.dp-trip-more { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.dp-trip[open] .dp-trip-more { display: none; }
.dp-trip-body { border-top: 1px solid var(--line); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.dp-kv { display: grid; grid-template-columns: 112px 1fr; gap: 8px 12px; font-size: 14px; }
.dp-kv dt { color: var(--ink-3); }
.dp-kv dd { color: var(--ink); word-break: break-word; }
.dp-stops { display: flex; flex-direction: column; gap: 12px; }
.dp-stop { display: flex; gap: 12px; }
.dp-stop-num { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--fill); color: var(--ink); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.dp-stop-text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.dp-stop-place { color: var(--ink); font-weight: 600; }
.dp-stop-map { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dp-notes { font-size: 14px; line-height: 1.55; color: var(--ink); white-space: pre-wrap; background: var(--warn-fill); border: 1px solid var(--warn-line); border-radius: 10px; padding: 12px 14px; }
.dp-notes-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); margin-bottom: 4px; }

.dp-empty { text-align: center; padding: 48px 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.dp-empty-title { font-size: 20px; font-weight: 700; color: var(--ink); }
.dp-empty-body { font-size: 15px; line-height: 1.5; color: var(--ink-3); max-width: 300px; }

/* Past requests */
.dp-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dp-list-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.dp-list-row + .dp-list-row { border-top: 1px solid var(--line); }
.dp-list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dp-list-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.dp-list-sub { font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.dp-status[data-status="Approved"] { background: var(--ok-fill); color: var(--ok); }
.dp-status[data-status="Denied"] { background: var(--bad-fill); color: var(--bad); }
.dp-status[data-status="Pending"] { background: var(--warn-fill); color: var(--warn); }

/* Tab bar */
.dp-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.dp-tabs-inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); height: var(--tabbar); }
.dp-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-3); text-decoration: none; font-size: 12px; font-weight: 600; }
.dp-tab svg { width: 24px; height: 24px; }
.dp-tab[aria-current="page"] { color: var(--ink); }
