:root {
  color-scheme: dark;
  --bg: #08090c;
  --panel: #15171d;
  --panel-strong: #1d2028;
  --field: #101217;
  --text: #f4f6f8;
  --muted: #9aa1ad;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #e7f0ff;
  --active: #ffffff;
  --done: #60d394;
  --danger: #ff7b7b;
  --success: #8ce9b2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, rgba(111, 132, 156, 0.26), transparent 32rem),
    linear-gradient(180deg, #0d0f14 0%, var(--bg) 42%);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.phone-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.view {
  min-height: calc(100vh - 42px);
}

.login-view {
  display: grid;
  align-content: center;
  gap: 20px;
}

.brand-header {
  display: grid;
  gap: 8px;
}

.brand-header h1 {
  max-width: 9ch;
  font-size: clamp(2.6rem, 14vw, 4.6rem);
  line-height: 0.92;
  font-weight: 680;
}

.lead {
  max-width: 24rem;
  color: var(--muted);
  line-height: 1.5;
}

.subtle-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.login-card,
.admin-form {
  display: grid;
  gap: 12px;
}

.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.search-field {
  margin-bottom: 10px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  padding: 0 13px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding-top: 12px;
}

input::placeholder {
  color: #5e6570;
}

input[type="file"] {
  min-height: auto;
  padding: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.5rem;
  font-weight: 650;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.icon-button span {
  font-size: 0.74rem;
  font-weight: 750;
}

.vehicle-picker {
  margin-top: 22px;
}

.vehicle-picker label {
  margin-bottom: 8px;
}

.hero-vehicle {
  min-height: 292px;
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 32px 0 16px;
}

.vehicle-meta {
  text-align: center;
}

.vehicle-meta p {
  color: var(--muted);
  font-size: 0.92rem;
}

.vehicle-meta h2 {
  margin-top: 4px;
  font-size: clamp(1.55rem, 8vw, 2.5rem);
  line-height: 1.04;
  font-weight: 620;
}

.hero-vehicle img {
  width: 100%;
  height: 170px;
  object-fit: contain;
  filter: drop-shadow(0 28px 28px rgba(0, 0, 0, 0.42));
}

.delivery-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  padding: 16px;
}

.status-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.status-head span,
.quick-data span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.status-head strong {
  display: block;
  margin-top: 5px;
  font-size: 0.96rem;
  line-height: 1.25;
}

.eta {
  text-align: right;
}

.timeline {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  min-height: 38px;
  color: var(--muted);
  font-size: 0.82rem;
}

.timeline li::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 3px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
}

.timeline li::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 17px;
  bottom: -3px;
  width: 2px;
  background: var(--line);
}

.timeline li:last-child::after {
  display: none;
}

.timeline li.done {
  color: var(--text);
}

.timeline li.done::before {
  border-color: var(--done);
  background: var(--done);
}

.timeline li.active {
  color: var(--active);
  font-weight: 750;
}

.timeline li.active::before {
  border-color: var(--active);
  background: var(--panel);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.quick-data {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.quick-data div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 13px 2px;
}

.quick-data strong {
  max-width: 62%;
  text-align: right;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.primary-button,
.secondary-button,
.danger-button,
.small-button,
.text-button {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 760;
}

.primary-button {
  width: 100%;
  margin-top: 8px;
  border: 0;
  background: var(--accent);
  color: #101219;
}

.secondary-button {
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.danger-button {
  width: 100%;
  border: 1px solid rgba(255, 123, 123, 0.42);
  background: rgba(255, 123, 123, 0.08);
  color: #ffb4b4;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.small-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  padding: 0 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.form-message {
  min-height: 18px;
  color: var(--danger);
  font-size: 0.78rem;
  line-height: 1.35;
}

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

.hint {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.admin-view {
  display: grid;
  gap: 18px;
  align-content: start;
}

.admin-list {
  margin-top: 6px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.74rem;
  padding: 7px 10px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title.inline {
  margin: 6px 0 0;
}

.section-title h2 {
  font-size: 1rem;
}

.vehicle-list {
  display: grid;
  gap: 8px;
}

.empty-state {
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 14px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.vehicle-list.compact {
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.vehicle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  padding: 12px;
  text-align: left;
}

.vehicle-row.selected {
  border-color: rgba(231, 240, 255, 0.72);
  background: rgba(231, 240, 255, 0.12);
}

.vehicle-row span {
  display: grid;
  gap: 3px;
}

.vehicle-row small,
.vehicle-row em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
}

.vehicle-row em {
  max-width: 42%;
  text-align: right;
}

.admin-preview {
  display: grid;
  place-items: center;
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    var(--panel);
  overflow: hidden;
}

.admin-preview img {
  width: 100%;
  height: 126px;
  object-fit: contain;
  filter: drop-shadow(0 20px 20px rgba(0, 0, 0, 0.38));
}

.access-preview {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(96, 211, 148, 0.08);
  padding: 12px;
}

.access-preview span,
.access-preview small {
  color: var(--muted);
  font-size: 0.76rem;
}

.access-preview strong {
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.details-dialog {
  width: min(calc(100% - 28px), 430px);
  max-height: 82vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 18px;
}

.details-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}

.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-top h2 {
  font-size: 1.3rem;
}

.close {
  font-size: 1.4rem;
}

.details-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.details-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.details-list dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.details-list dd {
  margin: 0;
  max-width: 64%;
  text-align: right;
  overflow-wrap: anywhere;
  font-weight: 650;
}

@media (min-width: 700px) {
  body::before {
    content: "Accede desde el móvil para una experiencia optimizada.";
    position: fixed;
    left: 50%;
    top: 24px;
    transform: translateX(-50%);
    color: var(--muted);
    font-size: 0.86rem;
  }

  .phone-shell {
    min-height: auto;
    margin-top: 68px;
    margin-bottom: 48px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(8, 9, 12, 0.9);
  }
}
