:root {
  --ink: #142033;
  --muted: #4d5d6b;
  --line: #d9e2ec;
  --line-strong: #c5d1dc;
  --bg: #eef3f6;
  --card: #ffffff;
  --accent: #0b6e4f;
  --accent-dark: #084d38;
  --accent-soft: #e8f6f0;
  --danger: #9f1d1d;
  --danger-bg: #fdecec;
  --warn-bg: #fff6e6;
  --warn-ink: #7a4e00;
  --shadow: 0 16px 40px rgba(20, 32, 51, 0.06);
  --radius: 18px;
  --focus: 0 0 0 3px rgba(11, 110, 79, 0.28);
  color-scheme: light;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 280px at 0% -10%, rgba(11, 110, 79, 0.12), transparent 55%),
    var(--bg);
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

::selection {
  background: #cfe8dc;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 5;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}

.skip:focus {
  top: 12px;
}

.wrap {
  width: min(740px, calc(100% - 32px));
  margin: 32px auto 64px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(20, 32, 51, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 6px;
  margin-bottom: 16px;
}

.hero {
  border-top: 6px solid var(--accent);
  padding-top: 22px;
  padding-bottom: 18px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.35rem);
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.required-note {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.95rem;
}

.field {
  margin: 0 0 18px;
}

.label,
legend.label {
  display: block;
  font-weight: 600;
  margin: 0 0 8px;
  padding: 0;
}

fieldset {
  border: 0;
  margin: 0 0 18px;
  padding: 0;
  min-inline-size: 0;
}

.req {
  color: var(--danger);
}

input[type="text"],
input[type="email"],
input[type="date"],
select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background-color: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
.choice:focus-within {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.has-error input,
.has-error select,
.has-error .choice,
.has-error .add-file {
  border-color: var(--danger);
}

.hint,
.privacy,
.preview-size,
.preview-note,
.status {
  color: var(--muted);
  font-size: 0.92rem;
}

.hint,
.privacy {
  margin: 8px 0 0;
}

.note {
  margin: 4px 4px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.92rem;
}

.field-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 600;
}

.time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(88px, 0.8fr);
  gap: 8px;
  align-items: center;
}

.time-sep {
  font-weight: 700;
  color: var(--muted);
}

select {
  appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin: 8px 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: #fff;
}

.choice input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.uploader {
  position: relative;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.add-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}

.add-file:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.is-dragover .add-file {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.preview {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfd;
}

.preview img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  background: #e7eef3;
}

.preview-name {
  margin: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-size,
.preview-note {
  margin: 2px 0 0;
}

.preview-note {
  color: var(--accent-dark);
}

.progress {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-track {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e8ee;
}

.progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
}

.progress-bar.is-indeterminate {
  width: 40%;
  animation: slide 1s ease-in-out infinite;
}

.progress-label {
  min-width: 3.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

.banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
}

.banner.error {
  color: var(--danger);
  background: var(--danger-bg);
}

.banner.warn {
  color: var(--warn-ink);
  background: var(--warn-bg);
}

.status {
  min-height: 1.4em;
  margin: 0 4px 8px;
  font-weight: 600;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
}

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

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
}

.btn:disabled {
  background: #5f6e7d;
  border-color: #5f6e7d;
  color: #fff;
  cursor: not-allowed;
}

.btn-ghost:disabled {
  background: #e6ebf0;
  border-color: #e6ebf0;
  color: #5f6e7d;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.text-btn {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--danger);
  font-weight: 700;
  cursor: pointer;
}

.privacy {
  margin: 0 0 18px;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.success {
  padding-bottom: 18px;
}

.success-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 16px;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.success-meta {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.success-meta div {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f6f8fa;
}

.success-meta dt {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.success-meta dd {
  margin: 2px 0 0;
  font-weight: 700;
  word-break: break-all;
}

#success-heading:focus {
  outline: none;
}

@media (max-width: 640px) {
  .wrap {
    width: min(740px, calc(100% - 20px));
    margin-top: 12px;
  }

  .card {
    padding: 16px 16px 4px;
    border-radius: 14px;
  }

  .time-row {
    grid-template-columns: 1fr 1fr;
  }

  .time-sep {
    display: none;
  }

  .time-row select:last-child {
    grid-column: 1 / -1;
  }

  .actions {
    flex-direction: column-reverse;
  }

  .actions .btn {
    width: 100%;
  }

  .preview {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .preview img {
    width: 72px;
    height: 72px;
  }
}

.form-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.clock {
  margin: 10px 0 0;
  font-weight: 700;
  color: var(--accent-dark);
}

.step-btn {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}

.step-btn[aria-current="step"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: default;
}

.step-btn:disabled:not([aria-current="step"]) {
  background: #e6ebf0;
  border-color: #e6ebf0;
  color: #5f6e7d;
  cursor: default;
}

.step h2:focus {
  outline: none;
}

.repeat {
  margin: 12px 0;
  padding: 14px 14px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbfa;
}

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

.repeat h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.repeat .text-btn {
  margin-top: 0;
}

#add-ride,
#add-expense,
#add-misc {
  margin: 4px 0 16px;
}

.empty-copy {
  margin: 8px 0 12px;
  color: var(--muted);
}

.summary dl {
  display: grid;
  gap: 8px;
  margin: 14px 0 8px;
}

.summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.summary dt,
.summary dd {
  margin: 0;
}

.summary dd {
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
