:root {
  --bg: #0c1219;
  --surface: #172433;
  --surface-2: #1e2e40;
  --border: #3a5570;
  --text: #eef4fa;
  --muted: #96a8bb;
  --accent: #3d9cf0;
  --accent-dim: #2a6fa8;
  --brand: #7ee8b5;
  --money: #8eecc4;
  --select-text: #fff;
  --select-from: #4aa6f4;
  --select-to: #2b7fd0;
  --select-border: #2a78c0;
  --action-from: #5eb3f8;
  --action-to: #2d86d6;
  --action-border: #1e6aaf;
  --action-shadow: rgba(45, 134, 214, 0.34);
  --wash-a: rgba(61, 156, 240, 0.18);
  --wash-b: rgba(126, 232, 181, 0.1);
  --wash-c: rgba(61, 156, 240, 0.08);
  --hatch: rgba(140, 196, 240, 0.045);
  --hatch-2: rgba(126, 232, 181, 0.03);
  --bg-from: #121a26;
  --bg-mid: #10161c;
  --bg-to: #101a18;
  --success: #7ee8b5;
  --danger: #f07178;
  --warning: #e6c07b;
  --radius: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 16px 40px rgba(0, 0, 0, 0.38);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --tap-min: 44px;
  --page-pad-x: 1rem;
  --card-pad-x: 1.2rem;
  --card-pad-y: 1.25rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-height: calc(4.55rem + var(--safe-bottom));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  scroll-padding-bottom: var(--tabbar-height);
}

body.keyboard-open {
  --tabbar-height: 0px;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 95% 72% at 0% 0%, var(--wash-a), transparent 72%),
    radial-gradient(ellipse 85% 68% at 100% 0%, var(--wash-b), transparent 70%),
    radial-gradient(ellipse 90% 60% at 60% 100%, var(--wash-c), transparent 72%),
    repeating-linear-gradient(
      135deg,
      transparent 0 22px,
      var(--hatch) 22px 23px
    ),
    repeating-linear-gradient(
      45deg,
      transparent 0 34px,
      var(--hatch-2) 34px 35px
    ),
    linear-gradient(120deg, var(--bg-from) 0%, var(--bg) 40%, var(--bg-mid) 70%, var(--bg-to) 100%);
  background-attachment: fixed;
  color: var(--text);
  color-scheme: dark;
  line-height: 1.5;
  overflow-x: clip;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem var(--page-pad-x) calc(1.25rem + var(--tabbar-height));
  width: 100%;
}

.header {
  margin-bottom: 1.5rem;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.header-top .brand {
  flex: 1 1 auto;
  min-width: 0;
}

.role-switch {
  flex: 0 0 auto;
  width: min(11.5rem, 46%);
  margin-top: 0.1rem;
}

.role-switch label {
  display: block;
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.role-switch select {
  width: 100%;
  min-height: var(--tap-min);
}

.role-switch .form-message {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
}

#app-notice {
  margin: 0.75rem 0 0;
}

#app-notice.hidden {
  display: none;
}

.session-warning {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--warning) 65%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
  color: var(--warning);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}

.session-warning.hidden {
  display: none;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  min-width: 0;
  position: relative;
  padding-bottom: 0.8rem;
}

.brand::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 62%, transparent 100%);
}

.brand > div {
  min-width: 0;
}

.brand-logo {
  display: block;
  /* vw so a phone (~390px) draws a smaller seal; rem cap keeps desktop steady.
     height: auto + min-width: 0 stops the 1950px PNG from forcing flex overflow. */
  width: clamp(1.65rem, 7.5vw, 2.75rem);
  max-width: 100%;
  height: auto;
  min-width: 0;
  flex: 0 1 auto;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

h2 {
  margin: 0 0 1.15rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  position: relative;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2.75rem;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 5.75rem),
    var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--card-pad-y) var(--card-pad-x) 1.35rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    var(--shadow);
  margin-bottom: 1rem;
  overflow: visible;
}

.field {
  margin-bottom: 1rem;
  min-width: 0;
}

.field-row {
  display: grid;
  gap: 0;
}

@media (min-width: 560px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #c5d5e4;
  margin-bottom: 0.35rem;
}

.optional {
  font-weight: 400;
  opacity: 0.8;
}

input[type="date"],
input[type="text"],
input[type="search"],
input[type="month"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-height: var(--tap-min);
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #101820;
  border: 1px solid #3a5570;
  border-radius: 8px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #6d8eab;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent), inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.4;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23b7aea6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}

/* Location value is stored on a select that must never be shown.
   A visible <select> opens the phone OS picker in front of the in-page list. */
.loc-native {
  display: none !important;
}

.other-wrap {
  margin-top: 0.65rem;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.other-wrap.hidden,
.hidden {
  display: none !important;
}

.hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  min-height: 1.1em;
  overflow-wrap: anywhere;
}

.hint.ok {
  color: var(--success);
}

.hint.err {
  color: var(--danger);
}

.route-mode {
  margin: 0 0 1rem;
  padding: 0.85rem 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  min-width: 0;
  max-width: 100%;
}

.route-mode-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.route-mode-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.route-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.route-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--tap-min);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  min-width: 0;
  touch-action: manipulation;
}

.route-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.route-option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.route-option input {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--accent);
}

.route-option-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.route-option-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.route-option-detail {
  font-size: 0.75rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.route-option-miles {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.distance-panel {
  margin: 1.15rem 0 1.25rem;
  padding: 1rem 1.1rem;
  background:
    linear-gradient(180deg, rgba(62, 207, 142, 0.08), transparent 72%),
    var(--surface-2);
  border: 1px solid #3e6b58;
  border-radius: 10px;
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.distance-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.distance-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.distance-error {
  color: var(--danger);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.distance-result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem 0.5rem;
}

/* New Trip miles box: the figure and the source line are each centered. */
#distance-result {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  gap: 0.35rem;
}

#distance-result .miles-figure {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  text-align: center;
}

.miles-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--success);
  line-height: 1;
}

/* The New Trip miles figure is the large box itself, not a second field above it. */
#miles-input.miles-value {
  width: 8ch;
  min-width: 3ch;
  max-width: 9rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--success);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  text-align: center;
  field-sizing: content;
  -moz-appearance: textfield;
  appearance: textfield;
}

#miles-input.miles-value::-webkit-outer-spin-button,
#miles-input.miles-value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#miles-input.miles-value:hover,
#miles-input.miles-value:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--success);
}

#miles-input.miles-value[readonly] {
  color: var(--success);
}

.distance-result .miles-changed {
  width: 100%;
  text-align: center;
}

.miles-unit {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}

.miles-meta {
  width: 100%;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.btn {
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  min-height: var(--tap-min);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn.primary {
  background: linear-gradient(180deg, var(--action-from) 0%, var(--action-to) 100%);
  color: #fff;
  border-color: var(--action-border);
  flex: 1;
  min-width: 8rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 18px var(--action-shadow);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--action-from) 82%, white) 0%,
    color-mix(in srgb, var(--action-to) 88%, white) 100%
  );
}

.btn.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.ghost {
  background: rgba(16, 24, 34, 0.35);
  color: #c9d8e6;
  border-color: #3a5570;
}

.btn.ghost:hover {
  color: #fff;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.btn.secondary {
  background: linear-gradient(180deg, #1e2e40 0%, #172433 100%);
  color: #eef4fa;
  border-color: #3a5570;
  flex: 1 1 12rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn.secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: #fff;
  background: #3a322c;
}

.btn.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-message {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  min-height: 1.25em;
  overflow-wrap: anywhere;
}

.form-message.ok {
  color: var(--success);
}

.form-message.err {
  color: var(--danger);
}

/* Status line lives in the sticky action row so a phone save acknowledgement
   stays on screen. Empty state takes no space; text uses its own full row. */
.actions-sticky .form-message {
  flex: 1 0 100%;
  width: 100%;
  margin: 0;
  min-height: 0;
}

.actions-sticky .form-message:not(:empty) {
  margin-top: 0.15rem;
  min-height: 1.25em;
}

.actions-sticky .form-message:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  flex: none;
}

.trips-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.trips-header h2 {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--money) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--money) 50%, transparent);
  border-radius: 999px;
  color: var(--money);
}

.trips-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.trips-sync {
  margin: 0 0 0.75rem;
}

.trips-sync:empty {
  display: none;
  margin: 0;
}

.trips-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.trip-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
  align-items: start;
  min-width: 0;
}

.trips-card .trip-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
}

.trip-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.75rem;
  align-items: start;
  min-width: 0;
  width: 100%;
}

.trip-item:first-of-type {
  border-top: none;
  padding-top: 0.25rem;
}

.trip-route {
  font-weight: 550;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  min-width: 0;
}

.trip-meta {
  font-size: 0.78rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.trip-miles {
  font-weight: 700;
  color: var(--success);
  font-size: 0.95rem;
  align-self: start;
  white-space: nowrap;
}

.trip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
}

.trip-actions .trip-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.trip-actions .trip-action svg {
  width: 1rem;
  height: 1rem;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trip-del {
  align-self: center;
}

.trip-edited {
  grid-column: 1 / -1;
  margin-top: 0.1rem;
}

.trip-edited summary {
  width: fit-content;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}

.trip-edited p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

body.trip-edit-open {
  overflow: hidden;
}

.trip-edit-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.trip-edit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.55);
}

.trip-edit-panel {
  position: relative;
  width: min(100%, 36rem);
  max-height: min(92dvh, 46rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 1rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
}

.trip-edit-panel h2 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
}

.trip-edit-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  background: linear-gradient(to top, var(--surface) 70%, rgba(23, 36, 51, 0));
}

@media (min-width: 560px) {
  .trip-edit-sheet {
    align-items: center;
    padding: 1.25rem;
  }

  .trip-edit-panel {
    border-bottom: 1px solid var(--border);
    border-radius: 16px;
    max-height: min(88dvh, 46rem);
  }
}

.footer {
  margin-top: 1.5rem;
  text-align: center;
  padding-inline: 0.25rem;
}

.footer p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.footer code {
  font-size: 0.7rem;
  color: #d7e7f5;
  background: #121c28;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid #3a5570;
  word-break: break-all;
}

.footer-version {
  color: var(--money);
  font-variant-numeric: tabular-nums;
}

.footer-dev {
  margin-top: 0.35rem;
}

.loc-picker {
  position: relative;
}

.loc-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-height: var(--tap-min);
  appearance: none;
  -webkit-appearance: none;
  padding: 0.7rem 2.25rem 0.7rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  color: var(--text);
  background-color: #101820;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23b7aea6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  border: 1px solid #3a5570;
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: manipulation;
}

.loc-trigger.is-placeholder {
  color: var(--muted);
}

.loc-trigger:hover {
  border-color: #6d8eab;
}

.loc-trigger:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent), inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

.loc-trigger-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loc-picker.is-open .loc-trigger {
  border-color: var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 34%, transparent);
}

.loc-panel {
  position: relative;
  z-index: 3;
  padding: 0.45rem;
  background: #101820;
  border: 1px solid var(--accent);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.48);
}

.loc-filter {
  margin-bottom: 0.35rem;
}

.loc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(14rem, 42dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.loc-option {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  appearance: none;
  -webkit-appearance: none;
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
}

.loc-option + .loc-option {
  margin-top: 1px;
}

.loc-option.is-selected {
  background: rgba(62, 207, 142, 0.14);
  box-shadow: inset 3px 0 0 var(--success);
}

.loc-option:hover,
.loc-option:focus {
  outline: none;
  background: var(--surface-2);
}

.loc-option.is-selected:hover,
.loc-option.is-selected:focus {
  background: rgba(62, 207, 142, 0.22);
}

.loc-empty {
  margin: 0;
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* —— Accounts + export —— */
.account-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.85rem;
}

.account-bar .google-signin-wrap,
.account-bar .session-chip,
.account-bar #account-select,
.account-bar .role-menu {
  grid-column: 1 / -1;
}

.account-bar select {
  width: 100%;
  min-width: 0;
}

.account-bar .btn {
  width: 100%;
  justify-self: stretch;
}

.btn.small {
  padding: 0.65rem 0.75rem;
  font-size: 0.875rem;
  flex: 0;
  min-width: 0;
  min-height: var(--tap-min);
}

/* Row Edit/Delete stay content-sized. .btn.small would otherwise collapse them. */
.trips-card .trip-actions .btn.trip-action {
  flex: none;
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 0.15rem 0.7rem;
  font-size: 0.8125rem;
  line-height: 1.2;
  white-space: nowrap;
}

.hint-block {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.hint-block strong {
  color: var(--text);
}

.export-oneline {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text);
}

.how-this-works {
  margin: 0 0 0.85rem;
  border: 1px solid #3a5570;
  border-radius: 8px;
  background: #121c28;
  padding: 0 0.75rem;
}

.how-this-works summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
}

.how-this-works .hint-block {
  margin: 0;
  padding-bottom: 0.75rem;
}

.hint.is-reason {
  color: var(--warning);
}

.hint.is-block {
  color: var(--danger);
}

.save-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(62, 207, 142, 0.45);
  background: rgba(62, 207, 142, 0.1);
  border-radius: 10px;
}

.save-banner-text {
  margin: 0 0 0.65rem;
  font-weight: 700;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.save-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.save-banner-actions .btn {
  flex: 1 1 8rem;
}

.role-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.role-menu .role-link {
  background: #172433;
  border-color: #3a5570;
  color: #eef4fa;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.role-menu .role-link:hover {
  color: #fff;
  border-color: var(--accent);
  background: #1e2e40;
}

.role-link[aria-current="page"],
.role-link[aria-current="page"]:hover {
  color: var(--select-text);
  border-color: var(--select-border);
  background: linear-gradient(180deg, var(--select-from) 0%, var(--select-to) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 16px color-mix(in srgb, var(--select-to) 45%, transparent);
}

.tabbar {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #1a2838 0%, #101820 100%);
  border-top: 1px solid #3a5570;
  box-shadow:
    0 -10px 28px rgba(0, 0, 0, 0.35),
    inset 0 2px 0 color-mix(in srgb, var(--accent) 45%, transparent);
  padding-bottom: var(--safe-bottom);
}

body.keyboard-open .tabbar {
  display: none;
}

.tabbar-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-wrap: nowrap;
}

.tab {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  line-height: 1.15;
  min-height: 4.15rem;
  padding: 0.35rem 0.15rem 0.4rem;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  cursor: pointer;
  touch-action: manipulation;
}

.tab[hidden] {
  display: none !important;
}

.tab svg {
  width: 1.3rem;
  height: 1.3rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-label {
  display: block;
  max-width: 100%;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.68rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

@media (max-width: 560px) {
  .tab {
    padding-left: 0.08rem;
    padding-right: 0.08rem;
  }

  .tab svg {
    width: 1.15rem;
    height: 1.15rem;
  }

  .tab-label {
    font-size: 0.62rem;
    letter-spacing: -0.02em;
  }
}

/* Wider than a phone: keep the visible section buttons on one row.
   The max-width: 560px block above is the phone bar and stays a flex row. */
@media (min-width: 561px) {
  .tabbar-inner {
    display: flex;
  }

  .tab-label {
    white-space: nowrap;
    font-size: 0.75rem;
  }
}

.tab[aria-current="page"] {
  color: var(--accent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 26%, transparent),
    color-mix(in srgb, var(--accent) 5%, transparent)
  );
  box-shadow: inset 0 3px 0 var(--accent);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.export-row {
  align-items: end;
}

.export-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.chip {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #3a5570;
  background: #121c28;
  color: #f0e6d8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.chip:hover {
  color: #fff;
  border-color: var(--accent);
  background: #182636;
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip[aria-pressed="true"],
.chip[aria-pressed="true"]:hover,
.chip[aria-selected="true"],
.chip[aria-selected="true"]:hover {
  color: var(--select-text);
  border-color: var(--select-border);
  background: linear-gradient(180deg, var(--select-from) 0%, var(--select-to) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 14px color-mix(in srgb, var(--select-to) 42%, transparent);
}

.export-summary {
  margin: 0 0 1rem;
}

.export-meta {
  display: flex;
  align-items: center;
  min-height: var(--tap-min);
  margin-bottom: 1rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.google-signin-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  min-width: 0;
}

#google-signin-btn {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

#google-signin-btn > div,
#google-signin-btn iframe {
  max-width: 100% !important;
}

.google-status {
  margin: 0;
}

.session-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 0.85rem;
  background: linear-gradient(180deg, #1e2e40 0%, #172433 100%);
  border: 1px solid #3a5570;
  border-radius: 8px;
  box-shadow:
    inset 3px 0 0 var(--accent),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 20px rgba(0, 0, 0, 0.22);
  font-size: 0.85rem;
  min-width: 0;
}

.session-chip.hidden {
  display: none !important;
}

#session-label {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

#session-label::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.45rem;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.16);
  transform: translateY(1px);
}

#session-label strong {
  color: var(--text);
}

/* Sticky primary actions (trip + account forms) on phone widths */
@media (max-width: 559px) {
  :root {
    --page-pad-x: 0.75rem;
    --card-pad-x: 1rem;
  }

  .app {
    padding-top: 1rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  .subtitle {
    font-size: 0.8rem;
  }

  .card:has(.actions-sticky) {
    padding-bottom: 0;
  }

  .actions-sticky {
    position: sticky;
    bottom: var(--tabbar-height);
    z-index: 20;
    /* Side bleed only. A negative bottom margin pulled the save acknowledgement
       up under this bar (and past the viewport when stuck), clipping the text. */
    margin: 0.25rem calc(var(--card-pad-x) * -1) 0;
    padding: 0.75rem var(--card-pad-x) calc(0.85rem + var(--safe-bottom));
    overflow: visible;
    background: linear-gradient(
      to top,
      var(--surface) 65%,
      rgba(23, 36, 51, 0.92) 85%,
      rgba(23, 36, 51, 0.75)
    );
    border-top: 1px solid var(--border);
    border-bottom-left-radius: calc(var(--radius) - 1px);
    border-bottom-right-radius: calc(var(--radius) - 1px);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .actions-sticky .btn.primary {
    flex: 1 1 auto;
    min-width: 0;
  }

  .actions-sticky .btn.ghost {
    flex: 0 0 auto;
    min-width: 5.5rem;
  }

  .export-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .export-meta {
    margin-top: -0.35rem;
    margin-bottom: 0.85rem;
    min-height: 0;
  }

  #export-btn,
  #email-pdf-btn {
    width: 100%;
    flex: 1 1 100%;
  }

  #view-admin-user .export-actions .btn {
    width: 100%;
    flex: 1 1 100%;
  }

  .trip-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .trip-item > div:first-child {
    min-width: 0;
  }

  .trips-card .trip-actions .trip-action {
    padding-inline: 0.55rem;
  }

  /* Portrait (~390px): a long "Signed in as …" line was shrinking Sign out
     to a zero flex-basis, so the label clipped. Stack the chip instead. */
  .session-chip {
    flex-direction: column;
    align-items: stretch;
  }

  #session-label {
    flex: 0 1 auto;
    width: 100%;
  }

  #btn-sign-out {
    flex: none;
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
  }

  /* Admin/Finance sit in the same account bar as Sign out, so they inherited
     .btn.small's flex-basis: 0 and min-width: 0. On a phone the two labels
     collapsed onto each other. Give each a real tap size and let the row
     share leftover width; wrap only if the labels cannot fit. */
  .account-bar .role-menu .role-link {
    flex: 1 1 0;
    width: auto;
    min-width: max-content;
    max-width: 100%;
    white-space: nowrap;
    padding-inline: 1rem;
  }
}

/* Desktop / wider: account bar can sit in a compact row */
@media (min-width: 560px) {
  .account-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .account-bar .google-signin-wrap,
  .account-bar .session-chip {
    flex: 1 1 100%;
  }

  .account-bar #account-select {
    flex: 1 1 12rem;
    width: auto;
    max-width: 18rem;
    grid-column: auto;
  }

  .account-bar .role-menu {
    flex: 1 1 100%;
  }

  .account-bar .btn {
    width: auto;
    flex: 0 0 auto;
  }

  #google-signin-btn {
    width: auto;
  }

  .login-card #google-signin-btn {
    width: 100%;
  }
}

/* Admin and Finance portals */
.portal-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.portal-card {
  border: 1px solid #3a5570;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 2.75rem),
    var(--surface-2);
  border-radius: 10px;
  padding: 0.85rem 0.9rem 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.portal-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.portal-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.adobe-sign-card,
.google-drive-card {
  position: relative;
  margin: 0 0 1.25rem;
  min-width: 0;
  max-width: 100%;
}

.adobe-sign-card h3,
.google-drive-card h3 {
  margin-bottom: 0.65rem;
}

.adobe-sign-card .actions,
.google-drive-card .actions {
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.adobe-sign-card .connect-actions,
.google-drive-card .actions {
  flex-wrap: wrap;
  align-items: stretch;
}

.adobe-sign-card .connect-actions .btn.primary,
.google-drive-card .actions .btn.primary {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
}

.adobe-sign-card .hint-block {
  margin: 0.65rem 0 0;
}

.google-drive-card .hint-block {
  margin: 0 0 0.75rem;
}

.adobe-sign-card .hint-block:empty,
.adobe-sign-card .form-message:empty,
.google-drive-card .hint-block:empty,
.google-drive-card .form-message:empty,
.drive-status:empty {
  display: none;
}

.google-drive-card .form-message {
  overflow-wrap: anywhere;
}

.drive-status {
  margin: 0 0 0.85rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.drive-status.is-connected {
  color: var(--success);
}

.drive-status.is-unconfigured {
  color: var(--warning);
}

.drive-sync {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid #3a5570;
  min-width: 0;
}

.drive-sync > h4 {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.drive-sync .drive-backfill {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.drive-backfill {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid #3a5570;
  min-width: 0;
}

.drive-backfill h4 {
  margin: 0 0 0.4rem;
  font-size: 0.98rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.drive-backfill .hint-block {
  margin: 0 0 0.75rem;
}

.drive-backfill-note {
  margin: 0 0 0.75rem;
  color: var(--warning);
  font-size: 0.85rem;
}

.drive-backfill-actions {
  flex-direction: column;
  align-items: stretch;
}

.google-drive-card .drive-backfill-actions .btn.primary,
.google-drive-card .drive-backfill-actions .btn.secondary {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
}

.drive-backfill-counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0.85rem 0 0;
}

.drive-backfill-counts:empty {
  display: none;
}

.drive-backfill-count {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid #3a5570;
  border-radius: 8px;
  background: rgba(16, 24, 34, 0.35);
}

.drive-backfill-count-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.drive-backfill-count-value {
  color: var(--brand);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.drive-backfill-count.is-skipped .drive-backfill-count-value {
  color: var(--muted);
}

.drive-backfill-count.is-failed .drive-backfill-count-value {
  color: var(--danger);
}

.drive-backfill-count.is-remaining .drive-backfill-count-value {
  color: var(--accent);
}

.drive-backfill-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 32rem;
  margin-top: 0.75rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.drive-backfill-list:empty {
  display: none;
  margin-top: 0;
}

.drive-backfill-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
  border: 1px solid #3a5570;
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  background: linear-gradient(180deg, #1e2e40, #172433);
}

.drive-backfill-name,
.drive-backfill-meta,
.drive-backfill-reason {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.drive-backfill-name {
  font-weight: 650;
}

.drive-backfill-meta {
  font-size: 0.85rem;
}

.drive-backfill-month {
  color: var(--muted);
}

.drive-backfill-status {
  font-weight: 650;
}

.drive-backfill-status[data-status="filed"],
.drive-backfill-status[data-status="would_file"] {
  color: var(--brand);
}

.drive-backfill-status[data-status="skipped"] {
  color: var(--muted);
}

.drive-backfill-status[data-status="failed"] {
  color: var(--danger);
}

.drive-backfill-reason {
  font-size: 0.85rem;
  color: var(--text);
}

.drive-backfill-open {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  margin-top: 0.1rem;
  color: var(--accent);
  font-weight: 650;
}

.settings-screen {
  min-width: 0;
}

.settings-back {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.15rem;
  width: auto;
  margin: 0 0 0.85rem;
  padding-left: 0.55rem;
  padding-right: 0.9rem;
}

.settings-back-icon {
  width: 1.05rem;
  height: 1.05rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-card-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.account-hub,
.account-row {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}

.account-hub {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: var(--tap-min);
  margin: 0 0 1.25rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid #3a5570;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 2.75rem),
    var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-hub-copy,
.account-row-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.account-hub-title,
.account-row-name {
  display: block;
  font-size: 1rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.account-hub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.account-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.account-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #5c7084;
  box-shadow: 0 0 0 3px rgba(92, 112, 132, 0.18);
}

.account-dot.is-connected {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(126, 232, 181, 0.18);
}

.account-chevron {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-hub:hover,
.account-row:hover {
  border-color: var(--accent);
}

.account-hub:focus-visible,
.account-row:focus-visible,
.settings-back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.account-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.account-list li {
  margin: 0;
  min-width: 0;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: var(--tap-min);
  padding: 0.75rem 0.8rem;
  border: 1px solid #3a5570;
  border-radius: 10px;
  background: linear-gradient(180deg, #1e2e40, #172433);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.account-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: #d7ebff;
  font-size: 0.95rem;
  font-weight: 700;
}

.account-row-status {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.account-row-status.is-connected {
  color: var(--brand);
}

.account-row-status.is-unconfigured {
  color: var(--warning);
}

.user-row.drive-access-entry {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
}

.drive-access-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.12rem;
  margin: 0;
  min-width: 0;
}

.drive-access-key {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.drive-access-value {
  display: block;
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.35;
  overflow-wrap: normal;
  word-break: normal;
}

.drive-access-email,
.drive-access-opened {
  white-space: nowrap;
}

#drive-access-message:empty {
  display: none;
}

.reports-drive-audit {
  margin-top: 1.15rem;
  margin-bottom: 0;
}

.reports-drive-audit > h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.reports-drive-audit .form-message:empty {
  display: none;
}

.archive-root-actions {
  margin: 0 0 0.85rem;
}

.archive-root-actions .btn {
  flex: 1 1 100%;
  width: 100%;
}

#archive-message:empty {
  display: none;
  margin: 0;
}

#archive-retry,
.archive-files-retry {
  width: 100%;
  margin-top: 0.65rem;
}

.archive-files .form-message {
  margin-top: 0;
}

.archive-unavailable {
  margin: 0 0 0.35rem;
  padding: 0.95rem 1rem;
  border: 1px solid #3a5570;
  border-radius: 10px;
  background: #121c28;
}

.archive-unavailable h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 650;
}

.archive-unavailable p {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.archive-folder {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  border: 1px solid #3a5570;
  background: linear-gradient(180deg, #1e2e40, #172433);
  border-radius: 10px;
  padding: 0.8rem 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.archive-folder h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.archive-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.archive-filed {
  margin: 0.28rem 0 0;
  color: var(--text);
  font-size: 0.9rem;
}

.archive-folder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.archive-folder-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
  white-space: nowrap;
}

.archive-folder-actions .archive-files-btn[aria-expanded="true"] {
  color: var(--select-text);
  border-color: var(--select-border);
  background: linear-gradient(180deg, var(--select-from) 0%, var(--select-to) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 14px color-mix(in srgb, var(--select-to) 42%, transparent);
}

.archive-files {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding-top: 0.7rem;
  border-top: 1px solid #3a5570;
}

.archive-file {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #2c4258;
  background: #121c28;
}

.archive-file-month {
  margin: 0;
  font-weight: 700;
  font-size: 0.92rem;
}

.archive-file-name {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.archive-file .btn {
  flex: 1 1 auto;
  width: 100%;
}

.archive-files-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (min-width: 480px) {
  .archive-file {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .archive-file .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 5.5rem;
  }
}

.mileage-rate-card {
  margin: 0 0 1.25rem;
}

.mileage-rate-card h3 {
  margin-bottom: 0.45rem;
}

.mileage-rate-card .hint-block {
  margin-bottom: 0.75rem;
}

.mileage-rate-current {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
}

.mileage-rate-current strong {
  color: var(--money);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.mileage-rate-card {
  box-shadow: inset 3px 0 0 var(--brand), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mileage-rate-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.mileage-rate-form .field {
  flex: 1 1 11rem;
  max-width: 16rem;
  margin-bottom: 0;
}

.mileage-rate-card .portal-meta {
  margin: 0.75rem 0 0;
}

.mileage-rate-card .form-message:empty {
  min-height: 0;
  margin-top: 0;
}

.create-user-card {
  margin: 0 0 1.25rem;
}

.create-user-card h3 {
  margin-bottom: 0.45rem;
}

.create-user-card .hint-block {
  margin-bottom: 0.75rem;
}

.create-user-card .form-message:empty {
  min-height: 0;
  margin-top: 0;
}

.create-user-profile {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem 0.15rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.create-user-profile legend {
  padding: 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.create-user-profile .field:last-child {
  margin-bottom: 0.7rem;
}

.portal-meta {
  margin: 0.15rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.role-checks {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0 0 0.75rem;
}

.role-checks label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: var(--tap-min);
  font-size: 0.95rem;
}

.role-checks input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
}

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.portal-actions .btn {
  flex: 1 1 8.5rem;
}

.admin-count {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.85rem;
}

.admin-count:empty {
  display: none;
  margin: 0;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  align-items: start;
  border: 1px solid #3a5570;
  background: linear-gradient(180deg, #1e2e40, #172433);
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.users-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.users-head h2 {
  margin: 0;
}

.users-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  flex: 0 0 auto;
  border: 1px solid var(--action-border);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--action-from) 0%, var(--action-to) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 6px 14px var(--action-shadow);
}

.users-add svg {
  width: 1.35rem;
  height: 1.35rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
}

.users-add:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.user-row-main {
  min-width: 0;
}

.user-row h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.presence-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.45rem;
  border-radius: 999px;
  transform: translateY(1px);
}

.presence-dot.is-online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.16);
}

.presence-dot.is-offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(240, 113, 120, 0.16);
}

.user-row .portal-meta {
  margin: 0.1rem 0 0;
}

.supervisor-line {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.user-editor {
  grid-column: 1 / -1;
  min-width: 0;
}

.user-editor.hidden {
  display: none;
}

.user-row-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: max-content;
  max-width: 100%;
  gap: 0.35rem;
}

.user-row-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: auto;
  min-width: 4.75rem;
  max-width: 100%;
  align-self: flex-end;
  min-height: 36px;
  padding: 0.15rem 0.7rem;
  font-size: 0.8125rem;
  line-height: 1.2;
}

.user-test-mode {
  grid-column: 1 / -1;
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.user-test-mode .switch-row {
  margin-bottom: 0.25rem;
}

.user-test-mode .hint {
  margin: 0;
}

.user-test-mode .form-message:empty {
  display: none;
}

.user-access {
  grid-column: 1 / -1;
  margin-top: 0.55rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.access-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: var(--tap-min);
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.access-toggle.is-enabled {
  color: #073322;
  background: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 70%, #fff);
}

.access-toggle.is-disabled {
  color: #3b1014;
  background: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 75%, #fff);
}

.access-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.access-toggle:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.user-access .form-message:empty {
  display: none;
}

.disabled-by {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.role-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.role-pills:empty {
  display: none;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--money) 50%, transparent);
  background: color-mix(in srgb, var(--money) 14%, transparent);
  color: var(--money);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.auth-method-editor {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem 0.15rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.auth-method-editor legend {
  padding: 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.auth-password.is-locked input,
.auth-password input:disabled {
  background: #6a7888;
  color: #e4ebf2;
  border-color: #8494a6;
  opacity: 1;
  cursor: not-allowed;
  box-shadow: none;
}

.auth-password .hint {
  margin-top: 0.4rem;
}

.change-password-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.change-password-card .form-message:empty,
.change-password-card .hint:empty {
  display: none;
}

.change-password-card.is-locked .btn.primary:disabled {
  background: #6a7888;
  color: #e4ebf2;
  border-color: #8494a6;
  opacity: 1;
  box-shadow: none;
  cursor: not-allowed;
}

.role-editor {
  margin: 0.35rem 0 0;
  padding: 0.65rem 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.supervisor-editor {
  margin: 0.35rem 0 0;
  padding: 0.75rem 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.supervisor-editor legend {
  padding: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.supervisor-editor .field {
  margin: 0.35rem 0 0.75rem;
}

.supervisor-editor select {
  background-color: var(--bg);
}

.supervisor-editor .hint {
  margin-top: 0.45rem;
}

.supervisees-editor {
  margin: 0.35rem 0 0;
  padding: 0.75rem 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.supervisees-editor legend {
  padding: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.supervisees-editor .field {
  margin: 0.75rem 0 0.35rem;
}

.supervisees-editor select {
  background-color: var(--bg);
}

.supervisees-editor .hint.is-reassign {
  color: var(--warning);
}

.supervisee-list {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.supervisee-list li {
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.supervisee-name {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.supervisee-list .portal-meta {
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
}

.supervisee-empty {
  margin: 0.65rem 0 0;
}

#users-edit-supervisees-pending {
  margin: 0.75rem 0 0;
}

.role-editor legend {
  padding: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.admin-back {
  margin: 0 0 0.85rem;
}

#view-admin-user .portal-meta {
  margin: -0.55rem 0 0;
}

.trip-item.readonly {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-source-edit {
  grid-column: 1 / -1;
  margin-top: 0.35rem;
  min-width: 0;
}

.admin-source-edit .field {
  margin-bottom: 0.65rem;
}

.admin-source-caption {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #c5d5e4;
  margin-bottom: 0.35rem;
}

.admin-source-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.85rem;
}

.admin-source-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--tap-min);
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.admin-source-choice input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--accent);
}

.admin-source-edit .btn {
  width: 100%;
}

.admin-source-edit .form-message {
  margin: 0.45rem 0 0;
}

.admin-source-edit .form-message:empty {
  display: none;
  margin: 0;
}

.reports-viewer {
  margin: -0.35rem 0 0.75rem;
  font-weight: 600;
  color: var(--money);
  letter-spacing: 0.01em;
}

.reports-subject h3 {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.reports-subject h3:empty,
.reports-subject .portal-meta:empty {
  display: none;
}

.reports-picker {
  position: relative;
  margin: 0 0 1rem;
  min-width: 0;
}

.reports-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-height: var(--tap-min);
  appearance: none;
  -webkit-appearance: none;
  padding: 0.55rem 2.25rem 0.55rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.3;
  text-align: left;
  color: var(--text);
  background-color: #101820;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23b7aea6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  border: 1px solid #3a5570;
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: manipulation;
}

.reports-trigger.is-placeholder {
  color: var(--muted);
}

.reports-trigger:hover {
  border-color: #6d8eab;
}

.reports-trigger:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent), inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

.reports-picker.is-open .reports-trigger {
  border-color: var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 34%, transparent);
}

.reports-trigger-value {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.05rem;
}

.reports-trigger-name {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.reports-trigger.is-placeholder .reports-trigger-name {
  font-weight: 400;
}

.reports-trigger-email {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.reports-trigger-email:empty {
  display: none;
}

.reports-panel {
  position: relative;
  z-index: 4;
  padding: 0.45rem;
  background: #101820;
  border: 1px solid var(--accent);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.48);
}

.reports-filter {
  margin-bottom: 0.35rem;
}

.reports-people {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  max-height: min(14rem, 42dvh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.reports-person {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  width: 100%;
  min-height: var(--tap-min);
  padding: 0.55rem 0.7rem;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
}

.reports-person[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.reports-person:hover,
.reports-person:focus {
  outline: none;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.reports-person[aria-selected="true"]:hover,
.reports-person[aria-selected="true"]:focus {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

.reports-person-name {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.reports-person-email {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.reports-empty {
  margin: 0;
  padding: 0.55rem 0.7rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.reports-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  color: var(--muted);
}

.reports-loading.hidden {
  display: none;
}

.reports-data {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.reports-data h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.reports-data > .hint {
  margin-top: 0;
}

.reports-sheet-link a {
  color: var(--accent);
  font-weight: 650;
}

.report-columns {
  border: 0;
  margin: 0.75rem 0 0.35rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
}

.report-columns legend {
  width: 100%;
  padding: 0;
  margin: 0 0 0.15rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
}

.report-column {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--tap-min);
  font-size: 0.92rem;
  cursor: pointer;
}

.report-column input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
}

#view-reports .export-actions {
  flex-direction: column;
}

#view-reports .export-actions .btn {
  width: 100%;
  flex: 1 1 auto;
}

#reports-retry {
  width: 100%;
  margin-top: 0.65rem;
}

.report-trip {
  display: block;
}

.report-trip-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  grid-template-columns: 6.6rem minmax(0, 1fr) auto;
  gap: 0.25rem 0.55rem;
  align-items: baseline;
  width: 100%;
  margin: 0;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: var(--tap-min);
  touch-action: manipulation;
}

.report-trip-toggle .trip-date {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.report-trip-detail {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.report-trip-detail p {
  margin: 0.15rem 0;
}

.report-trip-edit {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 1.6rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  background: var(--surface);
}

.status-badge.pending {
  color: var(--warning);
  border-color: rgba(230, 192, 123, 0.45);
}

.status-badge.received {
  color: var(--success);
  border-color: rgba(62, 207, 142, 0.45);
}

.inbox-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.2rem 0.65rem;
  align-items: start;
  border: 1px solid #3a5570;
  background: linear-gradient(180deg, #1e2e40, #172433);
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.inbox-row.is-unread {
  border-color: rgba(230, 192, 123, 0.5);
  box-shadow: inset 3px 0 0 var(--warning);
}

.inbox-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.4rem;
  border-radius: 999px;
  background: var(--warning);
}

.inbox-row.is-read {
  grid-template-columns: minmax(0, 1fr) auto;
}

.inbox-main {
  min-width: 0;
}

.inbox-main h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.inbox-row.is-read h3 {
  font-weight: 550;
}

.inbox-subject {
  margin: 0.1rem 0 0;
  font-size: 0.92rem;
}

.inbox-row .portal-meta {
  margin: 0.15rem 0 0;
}

.inbox-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.inbox-actions .btn {
  flex: 0 0 auto;
  width: 100%;
  min-width: 5.5rem;
  white-space: nowrap;
}

/* —— Login gate —— */
.login-screen {
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Center when the card fits. On a short phone, start at the top and scroll
     so Sign in with Google is reachable instead of clipped. */
  justify-content: safe center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding:
    max(1.25rem, env(safe-area-inset-top, 0px))
    0.75rem
    calc(1.5rem + var(--safe-bottom));
  width: 100%;
  box-sizing: border-box;
}

.login-card {
  width: min(420px, 100%);
  margin: 0;
  flex-shrink: 0;
}

.login-card .brand {
  align-items: center;
  margin-bottom: 1.25rem;
}

.login-card .brand-logo {
  width: clamp(2.25rem, 12vw, 4.75rem);
  max-width: 100%;
  height: auto;
}

.login-card .actions .btn {
  width: 100%;
  flex: 1 1 100%;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.15rem 0 1.05rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-footnote {
  margin-top: 0.35rem;
  min-height: 0;
}

.login-footnote strong {
  color: var(--text);
  font-weight: 600;
}

.login-alt-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.btn.link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.35rem 0.5rem;
  background: transparent;
  color: var(--accent);
  border: none;
  box-shadow: none;
  font-weight: 600;
}

.btn.link:hover {
  color: #fff;
  text-decoration: underline;
}

#forgot-password-form .hint-block {
  margin-bottom: 0.85rem;
}

#reset-screen .hint-block {
  margin-bottom: 0.85rem;
}

.register-panel {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.register-panel .btn.ghost {
  width: 100%;
}

#register-form {
  margin-top: 1rem;
}

#google-signin-btn {
  display: flex;
  justify-content: center;
}

.login-card #google-signin-btn {
  width: 100%;
  min-height: var(--tap-min);
}

#login-api-status {
  margin: 0 0 1rem;
}

/* Claim status. Current step is red. Done steps use the same light green
   as the mileage figure. Upcoming stays muted. */

.claim-status-slot {
  margin: 0.35rem 0 0.85rem;
}

.claim-status-slot[hidden] {
  display: none !important;
}

.claim-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0;
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}

.claim-status-line li {
  display: inline;
}

.claim-status-line li:not(:last-child)::after {
  content: "·";
  margin-left: 0.35rem;
  color: var(--muted);
  font-weight: 400;
}

.claim-status-line li.is-done {
  color: var(--success);
  font-weight: 700;
}

.claim-status-line li.is-current {
  color: var(--danger);
  font-weight: 700;
}

.claim-status-line li.is-upcoming {
  color: var(--muted);
  font-weight: 500;
}

.trip-lock-note {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.trip-item.is-locked .trip-action:disabled,
.trip-item.is-locked .trip-action:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--muted);
  border-color: var(--border);
  background: rgba(16, 24, 34, 0.35);
}

#supervisor-queue.card {
  margin-top: 1.15rem;
  margin-bottom: 1.15rem;
}

#supervisor-queue > h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

#supervisor-queue > .hint {
  margin: 0 0 0.75rem;
}

#supervisor-queue .form-message:empty {
  display: none;
}

.queue-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 2.6rem),
    var(--surface-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.queue-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.queue-subject {
  margin: 0.1rem 0 0;
  font-size: 0.92rem;
}

.queue-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.queue-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.queue-comment {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-width: 0;
}

.queue-comment span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #c5d5e4;
}

.queue-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.queue-buttons .btn {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.queue-buttons .btn.primary,
.queue-buttons .btn.secondary {
  flex: 1 1 auto;
}

.queue-buttons .btn:disabled,
.queue-buttons .btn:disabled:hover {
  opacity: 0.5;
  cursor: not-allowed;
}

.inbox-actions .mark-received {
  white-space: normal;
  line-height: 1.2;
}

.btn.deny-claim {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 55%, #3a5570);
  background: linear-gradient(180deg, #1e2e40 0%, #172433 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.inbox-actions .btn.deny-claim,
.finance-deny-actions .btn.deny-claim {
  flex: 0 0 auto;
  width: 100%;
}

.inbox-actions .btn.deny-claim:hover:not(:disabled),
.finance-deny-actions .btn.deny-claim:hover:not(:disabled) {
  color: #fff;
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 22%, #172433);
}

.inbox-row.finance-denied-row {
  grid-template-columns: minmax(0, 1fr);
}

.finance-deny-reason {
  margin: 0.35rem 0 0;
  color: var(--text);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

body.finance-deny-open {
  overflow: hidden;
}

.finance-deny-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.finance-deny-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, 0.55);
}

.finance-deny-panel {
  position: relative;
  width: min(100%, 36rem);
  max-height: min(92dvh, 46rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 1rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
}

.finance-deny-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.finance-deny-actions {
  margin-top: 0.75rem;
}

.finance-deny-actions .btn {
  width: 100%;
  flex: 1 1 auto;
}

#finance-deny-error:empty {
  display: none;
}

@media (min-width: 560px) {
  .finance-deny-sheet {
    align-items: center;
    padding: 1.25rem;
  }

  .finance-deny-panel {
    border-bottom: 1px solid var(--border);
    border-radius: 16px;
    max-height: min(88dvh, 46rem);
  }
}

#submissions-own > h3,
#submissions-approved > h3 {
  margin: 0.85rem 0 0.55rem;
  font-size: 1rem;
  font-weight: 650;
}

#view-submissions .form-message:empty {
  display: none;
}

.submission-group {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.8rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 8%, transparent), transparent 2.4rem),
    var(--surface-2);
}

.submission-group h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.submission-group .portal-meta {
  margin-bottom: 0.65rem;
}

.submission-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 0.85rem;
  background: linear-gradient(180deg, #1e2e40, #172433);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.submission-row h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.submission-received {
  margin: 0.35rem 0 0;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.submission-row .btn {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.whats-new {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding:
    max(0.75rem, env(safe-area-inset-top, 0px))
    0.75rem
    calc(0.75rem + var(--safe-bottom));
  background: rgba(8, 12, 16, 0.78);
}

.whats-new-card {
  width: min(26rem, 100%);
  margin: 0;
}

.whats-new-version {
  display: inline-flex;
  align-items: center;
  margin: -0.35rem 0 0.85rem;
  min-height: 1.5rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand) 50%, transparent);
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
}

.whats-new-version:empty {
  display: none;
}

.whats-new-copy p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.whats-new-copy ul {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
}

.whats-new-copy li {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.whats-new-card .actions .btn.primary {
  width: 100%;
  flex: 1 1 100%;
}

.whats-new-card .form-message:empty {
  display: none;
}

.miles-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.miles-row:has(.field[hidden]:only-child),
.miles-row:has(#miles-source-field[hidden]),
.miles-row:has(#trip-edit-miles-source-field[hidden]) {
  grid-template-columns: 1fr;
}

.miles-row:not(:has(.field:not([hidden]))) {
  display: none;
}

#miles-input[readonly],
#trip-edit-miles-input[readonly] {
  color: var(--money);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--tap-min);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.switch-row > span {
  flex: 1 1 auto;
  min-width: 0;
}

.switch-row input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 1.6rem;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #101820;
  position: relative;
  cursor: pointer;
}

.switch-row input::after {
  content: "";
  position: absolute;
  top: 0.14rem;
  left: 0.16rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--muted);
  transition: left 0.15s ease, background 0.15s ease;
}

.switch-row input:checked {
  background: var(--accent);
  border-color: var(--select-border);
}

.switch-row input:checked::after {
  left: 1.28rem;
  background: #fff;
}

.switch-row input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#settings-switches-card .form-message:empty {
  display: none;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: var(--tap-min);
  margin-bottom: 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.check-row input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
}

.miles-changed {
  margin: 0.35rem 0 0;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
}

.trip-miles .miles-changed {
  text-align: right;
}

@media (min-width: 561px) {
  .queue-buttons {
    flex-direction: row;
  }
}

/* Dashboard widgets are separate cards. Phone width stacks them in DOM order:
   Reimbursements, Recent submissions, Miles claimed, then Dollars by account
   number when that card is shown. Wide screens stack Reimbursements and Miles
   claimed in the left column and stretch Recent submissions down the right
   column so the two columns end together. A long recent list scrolls inside
   that card. Miles stay the same light green as the trip figure. Extra bottom
   space keeps the last card above the fixed tab bar. */
#view-dashboard .dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#view-dashboard .dashboard-card {
  min-width: 0;
  margin-bottom: 0;
  padding: 0.9rem 0.95rem 1rem;
}

#view-dashboard > h2 {
  margin-bottom: 0.85rem;
}

@media (max-width: 560px) {
  #view-dashboard {
    padding-bottom: 1.5rem;
  }
}

#view-dashboard .form-message:empty {
  display: none;
}

#view-dashboard .dashboard-heading {
  margin: 0 0 0.4rem;
  padding: 0;
  border: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.dashboard-reimbursement-figures {
  display: flex;
  flex-direction: column;
}

.dashboard-reimbursement-figures > div + div {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.dashboard-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.dashboard-figure {
  margin: 0.2rem 0 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.dashboard-miles-total {
  justify-content: flex-start;
  margin: 0 0 0.55rem;
}

.dashboard-month-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

#dashboard-accounts-wrap {
  padding: 0.7rem 0.85rem 0.75rem;
}

#dashboard-accounts.dashboard-month-list {
  gap: 0.4rem;
}

#dashboard-accounts .dashboard-bar-track {
  margin-top: 0.22rem;
}

.dashboard-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.dashboard-bar-head span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-bar-track {
  height: 0.55rem;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: #121c28;
  border: 1px solid var(--border);
  overflow: hidden;
}

.dashboard-bar-fill {
  height: 100%;
  border-radius: 999px;
  max-width: 100%;
}

.dashboard-bar-fill-miles {
  background: var(--success);
}

.dashboard-bar-fill-dollars {
  background: linear-gradient(180deg, var(--action-from) 0%, var(--action-to) 100%);
}

.dashboard-month-miles {
  color: var(--success);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-account-dollars {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-status,
.dashboard-person {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  font-weight: 650;
}

#dashboard-recent.portal-list {
  gap: 0.5rem;
}

#dashboard-recent .submission-row {
  gap: 0.2rem;
  padding: 0.6rem 0.7rem;
}

#dashboard-recent .claim-status-line {
  margin: 0.15rem 0 0;
}

@media (min-width: 561px) {
  #view-dashboard .dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.7rem;
    align-items: stretch;
  }

  #dashboard-reimbursements-wrap {
    grid-column: 1;
    grid-row: 1;
  }

  #dashboard-miles-wrap {
    grid-column: 1;
    grid-row: 2;
  }

  /* Content is taken out of flow so a long list cannot stretch the rows.
     The card then matches the left column and the list scrolls inside it. */
  #dashboard-recent-wrap {
    grid-column: 2;
    grid-row: 1 / span 2;
    position: relative;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  #dashboard-recent-wrap .dashboard-recent-fill {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.9rem 0.95rem 1rem;
  }

  #dashboard-recent {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  #dashboard-accounts-wrap {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .dashboard-reimbursement-figures {
    flex-direction: row;
    align-items: stretch;
    gap: 0;
  }

  .dashboard-reimbursement-figures > div {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .dashboard-reimbursement-figures .dashboard-figure {
    margin-top: auto;
    padding-top: 0.2rem;
  }

  .dashboard-reimbursement-figures > div + div {
    margin-top: 0;
    margin-left: 0.85rem;
    padding-top: 0;
    padding-left: 0.85rem;
    border-top: 0;
    border-left: 1px solid var(--border);
  }
}

/* Admin hard delete. Red is only for this destructive action. */
.btn.danger {
  background: #d32732;
  color: #fff;
  border-color: #a61e27;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn.danger:hover:not(:disabled) {
  background: #e23d48;
  color: #fff;
  border-color: #c2303a;
}

.btn.danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.danger.compact {
  flex: none;
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.15;
  white-space: nowrap;
}

.trip-item.admin-trip {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.admin-trip-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.5rem;
  align-items: start;
  min-width: 0;
}

.admin-trip-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  min-width: 0;
}

.admin-trip-aside .trip-miles {
  text-align: right;
}

.admin-month-bar,
.admin-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-width: 0;
}

.admin-month-bar {
  margin: 0.35rem 0 0.85rem;
}

.admin-month-bar[hidden] {
  display: none !important;
}

.admin-month-head {
  list-style: none;
  padding: 0.7rem 0 0.35rem;
  border-top: 1px solid var(--border);
}

.admin-month-head:first-child {
  border-top: none;
  padding-top: 0.15rem;
}

.admin-month-label {
  margin: 0;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.report-trip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
}

.report-trip-row .report-trip-toggle {
  min-width: 0;
}

body.admin-delete-open {
  overflow: hidden;
}

.admin-delete-who,
.admin-delete-detail,
.admin-delete-permanent,
.admin-delete-claim {
  margin: 0.45rem 0 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.admin-delete-who {
  margin-top: 0;
  font-weight: 650;
}

.admin-delete-permanent {
  font-weight: 650;
}

.admin-delete-claim {
  color: var(--warning);
}

.admin-delete-claim[hidden] {
  display: none !important;
}

#admin-delete-error:empty {
  display: none;
}

.admin-delete-actions .btn.danger {
  width: 100%;
}

.admin-delete-toast {
  position: fixed;
  z-index: 70;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  max-width: 28rem;
  margin: 0 auto;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--success) 50%, var(--border));
  background: #13261c;
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.admin-delete-toast[hidden] {
  display: none !important;
}

.admin-delete-toast p {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.admin-delete-toast p:first-child {
  margin-top: 0;
  color: var(--success);
  font-weight: 700;
}

.admin-delete-toast .admin-delete-stale {
  color: var(--warning);
  font-weight: 650;
}
