:root {
  --teal-primary: #198EA0;
  --teal-secondary: #16B8BD;
  --teal-accent: #15E9DD;
  --navy: #001139;
  --text: #1A2E35;
  --bg: #FAF7F2;
  --card-radius: 14px;
  --line: #E7E2D8;
  --muted: #64777C;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 0;
  line-height: 1.4;
}

header.topnav {
  background: white;
  color: var(--text);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
}
header.topnav .brand img { height: 30px; display: block; }
header.topnav .navlinks { display: flex; gap: 22px; flex: 1; }
header.topnav .navlinks a { color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 700; opacity: 0.78; display: inline-flex; align-items: center; gap: 5px; }
header.topnav .navlinks a:hover { opacity: 1; color: var(--teal-primary); }
header.topnav .user { font-size: 13px; display: flex; align-items: center; gap: 10px; }
header.topnav .user .nombre { font-weight: 700; color: var(--navy); }
header.topnav .user a { color: var(--muted); text-decoration: none; }
header.topnav .user a:hover { color: var(--teal-primary); text-decoration: underline; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--teal-secondary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}
svg.icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; display: block; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}
@media (min-width: 640px) { main { padding: 32px 40px 56px; } }

h1, h2, h3 { font-family: Arial, Helvetica, sans-serif; color: var(--navy); }
h1 { font-size: 26px; margin: 4px 0 22px; }
h2 { font-size: 19px; margin: 4px 0 14px; }
h3 { font-size: 16px; margin: 18px 0 10px; color: var(--teal-primary); }

.page-intro { font-size: 14px; color: #4a5a61; margin: -8px 0 8px; max-width: 640px; }

.card {
  background: white;
  border-radius: var(--card-radius);
  box-shadow: 0 2px 10px rgba(0,17,57,0.08);
  padding: 18px;
  margin-bottom: 16px;
}

.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.vehicle-card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 0; }
.vehicle-card .top-row { display: flex; justify-content: space-between; align-items: flex-start; }
.vehicle-card h2 { margin: 0; font-size: 17px; }
.vehicle-card .meta { font-size: 13px; color: #4a5a61; line-height: 1.6; }
.vehicle-card ul.meta-list { list-style: none; margin: 0; padding: 0; font-size: 13px; color: #4a5a61; }
.vehicle-card ul.meta-list li { padding: 3px 0 3px 20px; position: relative; }
.vehicle-card ul.meta-list li::before { content: "▸"; position: absolute; left: 0; color: var(--teal-secondary); font-weight: bold; }
.vehicle-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.badge { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: bold; color: white; }
.badge.disponible { background: var(--teal-secondary); }
.badge.en-uso { background: #d9822b; }
.badge.pendiente { background: #b33636; }

.alert-box {
  background: #fdecec;
  border: 1px solid #e0a0a0;
  color: #7a1f1f;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  font-weight: bold;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-primary);
  color: white;
  padding: 13px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: bold;
  text-decoration: none;
  min-height: 46px;
  width: 100%;
}
.btn:hover, .btn:active { background: var(--teal-secondary); }
.btn.secondary { background: white; color: var(--teal-primary); border: 1.5px solid var(--teal-primary); }
.btn.small { width: auto; padding: 9px 14px; font-size: 13px; min-height: 38px; }
.btn.link { width: auto; background: none; color: var(--teal-primary); text-decoration: underline; padding: 6px 0; }
.btn.danger { background: #b33636; }
.btn.danger:hover, .btn.danger:active { background: #8f2b2b; }
.btn.icon { width: auto; padding: 8px 11px; font-size: 15px; min-height: 34px; line-height: 1; }

.acciones-cell { display: flex; gap: 6px; align-items: center; }

label { display: block; font-size: 13px; margin: 14px 0 5px; font-weight: bold; color: var(--navy); }
label .req { color: #b33636; }

input, select, textarea {
  width: 100%;
  padding: 12px;
  border: 1.5px solid #d5dde0;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background: white;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-primary); }

table.checklist { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
table.checklist th, table.checklist td { border: 1px solid #e0e6e8; padding: 10px 8px; text-align: left; }
table.checklist th { background: var(--teal-secondary); color: white; font-size: 13px; font-weight: 700; letter-spacing: 0.2px; }
table.checklist select { padding: 6px; font-size: 13px; }
table.checklist input { padding: 6px; font-size: 13px; }

.photo-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.photo-slot {
  border: 1.5px dashed #b9c4c8;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  background: #fafcfc;
}
.photo-slot label { margin: 0 0 6px; font-size: 12px; }
.photo-slot input[type=file] { font-size: 11px; padding: 6px; }
.photo-slot img.preview { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }

.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.photo-grid figure { margin: 0; text-align: center; }
.photo-grid img {
  width: 160px; height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid #d5dde0;
  cursor: zoom-in; transition: transform 0.15s, box-shadow 0.15s;
}
.photo-grid img:hover { transform: scale(1.03); box-shadow: 0 4px 14px rgba(0,17,57,0.18); }
.photo-grid figcaption { font-size: 12px; color: #4a5a61; margin-top: 4px; }
@media (max-width: 480px) {
  .photo-grid img { width: 47vw; height: 47vw; max-width: 160px; max-height: 160px; }
}

/* ---- Visor ampliado (lightbox) de fotos ---- */
.lightbox {
  display: none; position: fixed; inset: 0; background: rgba(0,17,57,0.88);
  z-index: 100; align-items: center; justify-content: center; padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 10px; box-shadow: 0 8px 40px rgba(0,0,0,0.5); }
.lightbox .lb-close {
  position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15); color: white; border: none; font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox .lb-close:hover { background: rgba(255,255,255,0.3); }
.lightbox .lb-caption {
  position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; color: white; font-size: 13px;
}

.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row > div { flex: 1; min-width: 140px; }

.login-box { text-align: center; margin-top: 60px; }
.login-box img { max-width: 220px; margin-bottom: 24px; }

table.historial { width: 100%; border-collapse: collapse; font-size: 13px; }
table.historial th, table.historial td { border: 1px solid #e0e6e8; padding: 10px 8px; text-align: left; }
table.historial th { background: var(--teal-primary); color: white; font-size: 13.5px; font-weight: 700; letter-spacing: 0.2px; }
table.historial tr:nth-child(even) { background: #f7fafb; }
table.historial tr:hover { background: #eaf6f7; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; }

.back-link { display: inline-block; margin-top: 16px; color: var(--teal-primary); text-decoration: none; font-size: 14px; }

@media (max-width: 420px) {
  .photo-slots { grid-template-columns: 1fr 1fr; }
  header .brand img { height: 28px; }
}
