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

:root {
  --sixt-orange: #FF5F00;
  --sixt-orange-dark: #E55400;
  --sixt-orange-soft: #FFF1E6;
  --sixt-black: #1A1A1A;
  --text: #1A1A1A;
  --text-muted: #6B7280;
  --line: #E5E7EB;
  --line-strong: #D1D5DB;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --success: #047857;
  --success-soft: #ECFDF5;
  --warning: #B45309;
  --warning-soft: #FFFBEB;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(17, 24, 39, 0.08), 0 2px 6px rgba(17, 24, 39, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--sixt-orange);
  z-index: 20;
}

body.centered main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

/* ===== Topbar (en registro.html) ===== */
header.topbar {
  position: sticky;
  top: 6px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar .brand img.logo { height: 32px; width: auto; display: block; }
.topbar .brand .sep {
  width: 1px; height: 24px; background: var(--line);
}
.topbar .brand .product {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.user-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.user-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.user-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.user-pill .muted { color: var(--text-muted); }
.logout {
  padding: 6px 12px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer; text-decoration: none;
}
.logout:hover { color: var(--sixt-orange); border-color: var(--sixt-orange); }

/* ===== Login card ===== */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px 28px;
  position: relative;
}
.brand {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 28px;
}
.brand img.logo { height: 64px; width: auto; display: block; }
.brand .product {
  margin-top: 16px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
h1 {
  margin: 0 0 6px;
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
}
.subtitle {
  margin: 0 0 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Registro card (más ancha) ===== */
main.app {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 22px 80px;
  display: grid;
  gap: 22px;
}
.app .card {
  max-width: none;
  padding: 0;
}
.card-header { padding: 18px 22px 6px; }
.card-header h2 {
  margin: 0;
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em;
}
.card-header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}
.card-body { padding: 18px 22px 22px; }

/* ===== Form ===== */
form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
label {
  font-size: 13px; font-weight: 600; color: var(--text);
}
label .opt { color: var(--text-muted); font-weight: 500; }
.input-wrap { position: relative; }
input[type="text"], input[type="password"], input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus {
  border-color: var(--sixt-orange);
  box-shadow: 0 0 0 3px rgba(255, 95, 0, 0.18);
}
input.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}
.hint { font-size: 12px; color: var(--text-muted); }
.hint.error { color: var(--danger); }

.toggle-pwd {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  background: transparent; border: 0;
  padding: 6px 10px; cursor: pointer;
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: 6px;
}
.toggle-pwd:hover { color: var(--text); background: #F3F4F6; }

/* ===== Segment toggle OUT/IN ===== */
.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
}
.segment button {
  appearance: none; border: 0; background: transparent;
  padding: 12px;
  font-size: 14px; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer; border-radius: 9px;
  font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.segment button:hover { color: var(--text); }
.segment button[aria-pressed="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(17,24,39,0.06), 0 0 0 1px var(--line-strong);
}
.segment button .ico { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.segment button[aria-pressed="true"][data-evt="OUT"] .ico { background: var(--sixt-orange); }
.segment button[aria-pressed="true"][data-evt="IN"]  .ico { background: var(--success); }

/* ===== Fuel — 8 octavos (4×2) ===== */
.fuel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.fuel button {
  appearance: none;
  border: 1px solid var(--line);
  background: #FFFFFF;
  color: var(--text);
  padding: 14px 4px;
  font-size: 15px; font-weight: 700;
  font-family: inherit;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .05s ease;
}
.fuel button:hover { border-color: var(--line-strong); }
.fuel button[aria-pressed="true"] {
  background: var(--sixt-orange);
  border-color: var(--sixt-orange);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(255, 95, 0, 0.25);
}
.fuel button:active { transform: translateY(1px); }

/* ===== Buttons ===== */
button.primary {
  width: 100%;
  padding: 14px 16px;
  background: var(--sixt-orange);
  color: #FFFFFF;
  border: 0;
  border-radius: 10px;
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, transform .05s ease;
}
button.primary:hover { background: var(--sixt-orange-dark); }
button.primary:active { transform: translateY(1px); }
button.primary[disabled] { opacity: .55; cursor: not-allowed; }

/* ===== Banners ===== */
.alert, .banner {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid;
  line-height: 1.45;
}
.alert {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #FECACA;
}
.banner.warn {
  background: var(--warning-soft);
  border-color: #FCD9A0;
  color: var(--warning);
}
.banner.danger {
  background: var(--danger-soft);
  border-color: #FECACA;
  color: var(--danger);
}

/* ===== Success card (registro) ===== */
.success {
  padding: 22px;
  background: var(--success-soft);
  border: 1px solid #A7F3D0;
  border-radius: 12px;
  margin-bottom: 18px;
}
.success .row1 {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  color: var(--success); font-weight: 700;
}
.success .row1 .check {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--success); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.success .tid {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: #FFFFFF;
  border: 1px solid #A7F3D0;
  border-radius: 8px;
  font-family: "SF Mono", "Menlo", ui-monospace, monospace;
  font-size: 14px; color: var(--text);
  word-break: break-all;
}
.success .copy {
  margin-left: auto;
  padding: 6px 10px;
  font-size: 12px; font-weight: 600;
  border: 1px solid #A7F3D0;
  background: #FFFFFF;
  color: var(--success);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
}
.success .copy:hover { background: var(--success-soft); }
.success .next { margin-top: 12px; display: flex; gap: 8px; }
.success .next button {
  flex: 1; padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #FFFFFF; font-weight: 600;
  cursor: pointer; font-family: inherit;
}

/* ===== History ===== */
.history { padding: 8px 22px 18px; }
.history h3 {
  margin: 0 0 10px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.history ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 6px;
}
.history li {
  display: grid;
  grid-template-columns: 56px 56px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
}
.history .hh { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.history .tag {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.history .tag.out { background: var(--sixt-orange-soft); color: var(--sixt-orange-dark); }
.history .tag.in  { background: var(--success-soft); color: var(--success); }
.history .placa { font-weight: 700; }
.history .tid-small {
  font-family: "SF Mono", "Menlo", ui-monospace, monospace;
  font-size: 11px; color: var(--text-muted);
  text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history .empty {
  color: var(--text-muted); font-style: italic;
  padding: 12px; text-align: center; font-size: 13px;
}

/* ===== Meta + footer ===== */
.meta {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
footer {
  padding: 18px 20px 26px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .topbar-inner { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar .brand .sep, .topbar .brand .product { display: none; }
  .user-meta { width: 100%; margin-left: 0; justify-content: space-between; }
  main.app { padding: 18px 14px 60px; gap: 16px; }
  .fuel button { padding: 12px 4px; font-size: 14px; }
  .history li { grid-template-columns: 50px 52px 1fr; }
  .history .tid-small { display: none; }
  .card { padding: 32px 22px 22px; border-radius: 12px; }
  h1 { font-size: 20px; }
}
