/* Driver App — compact mobile ops UI (PROTOTYPE-SAFE) */
:root {
  --font: "Noto Sans Thai", "Noto Sans", "Segoe UI", Arial, sans-serif;
  --primary: #1a5fd4;
  --primary-hover: #1554bd;
  --primary-soft: #e8f1fe;
  --page-bg: #e8ecf1;
  --surface: #ffffff;
  --text-primary: #1f2329;
  --text-secondary: #5c6570;
  --text-muted: #6b7380;
  --border: #e5e9ef;
  --border-strong: #d5dbe5;
  --success: #157a4d;
  --success-bg: #e8f8f0;
  --warning: #b45309;
  --warning-bg: #fff6e8;
  --danger: #c0392b;
  --danger-bg: #fdecee;
  --info: #1d4ed8;
  --info-bg: #eef5ff;
  --neutral-bg: #f3f4f6;
  --radius-md: 10px;
  --shadow-sm: 0 1px 2px rgba(31, 35, 41, 0.06);
  --shadow-md: 0 8px 28px rgba(31, 35, 41, 0.14);
  --touch-min: 44px;
  --app-max: 460px;
  --xfer-in: var(--success);
  --xfer-in-soft: var(--success-bg);
  --xfer-out: var(--danger);
  --xfer-out-soft: var(--danger-bg);
  --xfer-tr: #c2410c;
  --xfer-tr-soft: #fff4ed;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--page-bg);
}

.desktop-canvas {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.mobile-app {
  width: 100%;
  max-width: var(--app-max);
  min-height: 100vh;
  background: #f4f6f9;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

@media (max-width: 480px) {
  .mobile-app { box-shadow: none; }
  body { background: #f4f6f9; }
}

#app-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view.is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* —— Header —— */
.app-header {
  flex-shrink: 0;
  padding: 8px 12px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.identity-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--primary-soft);
  border-radius: var(--radius-md);
}

.lang-toggle {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.lang-btn {
  min-width: 34px;
  min-height: 28px;
  padding: 0 8px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.lang-btn.is-active {
  background: var(--primary);
  color: #fff;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.identity-main { min-width: 0; flex: 1; }

.identity-name {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}

.identity-vehicle {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 1px;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.date-nav-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--primary);
  cursor: pointer;
}

.date-nav-center {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.date-nav-center:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.date-nav-center:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.date-nav-label {
  position: relative;
  z-index: 1;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Input under label; clicks hit center control → showPicker() (AP-proven) */
.date-input-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
  font-size: 16px;
}

/* —— Summary + chips —— */
.list-toolbar {
  flex-shrink: 0;
  padding: 6px 12px 6px;
  background: #f4f6f9;
}

.list-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.list-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
}

.list-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.filter-chips {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 2px 2px;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.chip .chip-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--neutral-bg);
  font-size: 0.6875rem;
  font-weight: 700;
}

.chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.chip.is-active .chip-n {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* —— List scroll —— */
.list-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 10px 72px;
}

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 2px 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.section-label .sec-count {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.section-toggle {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 2px 4px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  min-height: 36px;
  text-align: left;
}

.job-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flow-section-completed {
  margin-top: 8px;
  padding-top: 2px;
  border-top: 1px dashed var(--border-strong);
}

/* —— Compact job card —— */
.job-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 0 8px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px 7px 6px;
  cursor: pointer;
  box-shadow: none;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}

.job-card > .card-rail,
.job-card > .card-body,
.job-card > .card-chevron {
  position: relative;
  z-index: 1;
}

/* Awaiting Acceptance — document-stamp overlay (zero layout height) */
.await-stamp {
  position: absolute;
  left: 52%;
  top: 48%;
  z-index: 0;
  transform: translate(-50%, -50%) rotate(-22deg);
  pointer-events: none;
  user-select: none;
  box-sizing: border-box;
  padding: 5px 12px;
  border: 2.5px solid rgba(180, 83, 9, 0.22);
  border-radius: 3px;
  color: rgba(180, 83, 9, 0.16);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0.14em;
  text-transform: none;
}

.await-stamp.lang-th {
  font-size: 1.375rem;
  letter-spacing: 0.22em;
}

.await-stamp.lang-en {
  font-size: 1.0625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.job-card.is-await-accept {
  border-color: #e8c48a;
}

.job-card:active { background: #f8fafc; }

.job-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.job-card.is-cancelled { opacity: 0.62; }

.job-card.is-attention {
  border-color: #e8b86d;
  background: linear-gradient(90deg, var(--warning-bg) 0%, var(--surface) 32%);
}

.job-card.is-active-job {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary-soft);
}

.job-card.is-completed {
  opacity: 0.78;
  background: #fafbfc;
}

.card-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 1px;
  border-right: 1px solid var(--border);
  padding-right: 6px;
  min-width: 0;
}

.card-time {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.card-time.is-new {
  font-size: 1.125rem;
  color: var(--warning);
}

.card-time-prev {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-decoration: line-through;
  line-height: 1.1;
  margin-bottom: 1px;
}

.card-kind {
  margin-top: 5px;
  width: 100%;
  padding: 3px 2px;
  border-radius: 6px;
  text-align: center;
  line-height: 1.15;
}

.card-kind-code {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.card-kind-th {
  display: block;
  font-weight: 600;
  font-size: 0.5625rem;
  margin-top: 1px;
  opacity: 0.95;
}

.card-kind.kind-in {
  background: var(--xfer-in-soft);
  color: var(--xfer-in);
}
.card-kind.kind-out {
  background: var(--xfer-out-soft);
  color: var(--xfer-out);
}
.card-kind.kind-tr {
  background: var(--xfer-tr-soft);
  color: var(--xfer-tr);
}

.card-pax {
  margin-top: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}

.card-body { min-width: 0; }

.card-body-top {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.route-stack {
  flex: 1;
  min-width: 0;
}

.card-status-col {
  flex-shrink: 0;
  padding-top: 1px;
}

.card-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.card-status-chip.st-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.card-status-chip.st-ack {
  background: #fff1e8;
  color: #c2410c;
}

.job-card.is-ack-required {
  border-color: #f0a060;
  box-shadow: 0 0 0 1px #ffe4cc;
}

.ops-status.st-await { background: var(--neutral-bg); color: var(--text-secondary); }
.ops-status.st-ack { background: #fff1e8; color: #c2410c; }

.accepted-note {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 4px;
}

.proto-demo {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed #c4c9d2;
  border-radius: 8px;
  background: #f8fafc;
}

.proto-demo-title {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.btn-demo {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
}

.ack-layer .confirm-sheet {
  max-height: 85vh;
  overflow-y: auto;
}

.ack-body {
  margin: 8px 0 12px;
}

.ack-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.ack-field {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ack-old {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.ack-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ack-new {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.route-line {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  margin-bottom: 2px;
}

.route-line.is-drop { margin-bottom: 0; }

.route-ico {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin-top: 2px;
  color: var(--text-muted);
}

.route-ico svg { display: block; width: 12px; height: 12px; }

.route-text { min-width: 0; flex: 1; }

.lbl-inline {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.15;
}

.place-name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}

.place-name-th {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.2;
  word-break: break-word;
}

.meta-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
}

.meta-guest {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-flight {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.meta-trj {
  flex: 0 0 auto;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meta-dot {
  flex: 0 0 auto;
  opacity: 0.5;
}

.card-warn {
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-warn.is-nextday {
  background: var(--info-bg);
  color: var(--info);
}

.btn-action.is-disabled,
.btn-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--neutral-bg);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.ops-pickup-date {
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.ops-nextday {
  margin-top: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--info);
}

.card-chevron {
  align-self: center;
  color: var(--border-strong);
  font-size: 1rem;
  line-height: 1;
  padding-left: 0;
}

/* —— Detail (near one-screen) —— */
.bi {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.25;
}

.bi-en {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.bi-th {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.detail-view {
  background: #f4f6f9;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  flex-shrink: 0;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
}

.detail-title {
  flex: 1;
  font-weight: 700;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.detail-body {
  flex: 1;
  min-height: 0;
  padding: 8px 10px 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #f4f6f9;
}

.ops-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.ops-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ops-time-wrap { min-width: 0; }

.ops-time {
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.ops-time-wrap.is-changed .ops-time { color: var(--warning); }

.ops-time-prev {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: line-through;
  line-height: 1.2;
  margin-bottom: 2px;
}

.ops-changed {
  margin-top: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--warning);
}

.ops-kind-badge {
  flex-shrink: 0;
  text-align: center;
  padding: 6px 10px;
  border-radius: 8px;
  min-width: 64px;
}

.ops-kind-code {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.ops-kind-th {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-top: 2px;
}

.ops-kind-badge.kind-in { background: var(--xfer-in-soft); color: var(--xfer-in); }
.ops-kind-badge.kind-out { background: var(--xfer-out-soft); color: var(--xfer-out); }
.ops-kind-badge.kind-tr { background: var(--xfer-tr-soft); color: var(--xfer-tr); }

.ops-kind-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ops-pax {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.ops-status {
  display: inline-flex;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
}

.ops-status.st-active { background: var(--primary-soft); color: var(--primary); }
.ops-status.st-upcoming { background: var(--neutral-bg); color: var(--text-secondary); }
.ops-status.st-done { background: var(--success-bg); color: var(--success); }
.ops-status.st-cancelled { background: var(--danger-bg); color: var(--danger); }

.ops-route {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.ops-place-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.ops-place-head .lbl-inline {
  flex: 1;
  min-width: 0;
}

.btn-navigate {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--touch-min);
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn-navigate:active {
  background: var(--primary-soft);
}

.btn-nav-ico {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

.ops-place-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.ops-place .place-name {
  font-size: 1rem;
  font-weight: 700;
}

.ops-place .place-name-th {
  font-size: 0.75rem;
}

.ops-route-arrow {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1;
  margin: 4px 0 4px 2px;
}

.ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.ops-cell { min-width: 0; }
.ops-cell-full { grid-column: 1 / -1; }

.ops-val {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.ops-guest-full {
  white-space: normal;
}

.ops-note {
  background: var(--warning-bg);
  border: 1px solid #f0d090;
  border-radius: 8px;
  padding: 8px 10px;
}

.ops-note-lbl {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 2px;
}

.ops-note-val {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-primary);
}

.detail-sticky {
  flex-shrink: 0;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(31, 35, 41, 0.06);
}

.detail-sticky.is-readonly { padding-top: 6px; padding-bottom: 10px; }

.action-area-note {
  font-size: 0.625rem;
  color: var(--text-muted);
  margin: 0 0 6px;
  line-height: 1.3;
  text-align: center;
}

.action-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-action.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn-action.success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-action.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-action.primary .bi-en,
.btn-action.primary .bi-th { color: #fff; }

.btn-action .bi { align-items: center; }
.btn-action .bi-en, .btn-action .bi-th { color: inherit; }

.badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
}

.badge-kind-in { background: var(--xfer-in-soft); color: var(--xfer-in); }
.badge-kind-out { background: var(--xfer-out-soft); color: var(--xfer-out); }
.badge-kind-tr { background: var(--xfer-tr-soft); color: var(--xfer-tr); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-upcoming { background: var(--neutral-bg); color: var(--text-secondary); }
.badge-active { background: var(--primary-soft); color: var(--primary); }
.badge-done { background: var(--success-bg); color: var(--success); }
.badge-info { background: var(--info-bg); color: var(--info); }

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.toast-proto {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  max-width: calc(var(--app-max) - 32px);
  width: calc(100% - 32px);
  padding: 10px 14px;
  background: #1f2329;
  color: #f8fafc;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  text-align: center;
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  z-index: 100;
}

.toast-proto.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.empty-state {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.app-footer-note {
  display: none;
}

.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 40;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  min-height: 56px;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bnav-item.is-active {
  color: var(--primary);
}

.bnav-ico {
  width: 22px;
  height: 22px;
  display: block;
}

.bnav-label {
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.draft-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f4f6f9;
}

.draft-header {
  flex-shrink: 0;
  padding: 10px 12px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.draft-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.draft-back-spacer {
  width: 52px;
  flex-shrink: 0;
}

.draft-heading {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  min-width: 0;
}

.draft-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px 72px;
}

.draft-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px 16px;
  text-align: center;
}

.draft-icon-wrap {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.draft-icon-wrap .bnav-ico {
  width: 24px;
  height: 24px;
}

.draft-card h2 {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.draft-lead {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.draft-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.6875rem;
  font-weight: 700;
}

.draft-shell-note {
  margin: 8px 0 0;
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.draft-doc-list {
  text-align: left;
  margin: 0 0 12px;
  padding: 0 0 0 1.1rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.draft-meta {
  text-align: left;
  margin: 0 0 12px;
  display: grid;
  gap: 8px;
}

.draft-meta dt {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 700;
}

.draft-meta dd {
  margin: 2px 0 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.more-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.more-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.more-item:last-child { border-bottom: 0; }

.more-item.is-danger { color: var(--danger); }

.more-chevron {
  color: var(--text-muted);
  font-size: 1.125rem;
  font-weight: 400;
}

.confirm-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 27, 45, 0.45);
}

.confirm-sheet {
  position: relative;
  width: 100%;
  max-width: var(--app-max);
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  padding: 16px 16px 20px;
  box-shadow: var(--shadow-md);
}

.confirm-title {
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 1rem;
}
.confirm-body {
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.4;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.confirm-actions .btn-action.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.confirm-actions .btn-action.primary .bi-en,
.confirm-actions .btn-action.primary .bi-th { color: #fff; }

.accept-prompt-layer {
  z-index: 210;
}

.accept-prompt-sheet {
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.accept-prompt-body {
  margin-bottom: 10px;
}

.accept-prompt-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.accept-prompt-time {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.accept-prompt-kind {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.accept-prompt-kind.kind-in { background: var(--xfer-in-soft); color: var(--xfer-in); }
.accept-prompt-kind.kind-out { background: var(--xfer-out-soft); color: var(--xfer-out); }
.accept-prompt-kind.kind-tr { background: var(--xfer-tr-soft); color: var(--xfer-tr); }

.accept-prompt-route {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: start;
  margin-bottom: 8px;
}

.accept-prompt-place {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.accept-prompt-arrow {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.3;
  padding-top: 1px;
}

.accept-prompt-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.accept-prompt-details {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  text-align: center;
  min-height: var(--touch-min);
}

.accept-prompt-actions {
  margin-top: 0;
}
