@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #12161B;
  --bg-soft: #171D23;
  --panel: #1D242B;
  --panel-raised: #232B33;
  --line: #2B333B;
  --amber: #F2A73B;
  --amber-dark: #C7841E;
  --blue: #4C86A8;
  --green: #4C9A6A;
  --green-dim: #2E4B3B;
  --red: #D1493F;
  --red-dim: #4A2C2A;
  --text: #EDEAE2;
  --text-dim: #98A0AA;
  --text-faint: #5F6873;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
}

h1, h2, h3, .heading {
  font-family: 'Oswald', sans-serif; font-weight: 500; letter-spacing: .3px; margin: 0;
}

input, textarea, select, button { font-family: 'Inter', system-ui, sans-serif; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.field-label {
  font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px;
  display: flex; align-items: center; gap: 4px;
}
.field-label .req { color: var(--amber); }

.text-input, select.text-input {
  width: 100%; padding: 11px 12px; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--bg);
  color: var(--text); font-size: 14px; outline: none;
}
.text-input.error { border-color: var(--red); }
textarea.text-input { resize: vertical; }

.error-note { color: var(--red); font-size: 12px; margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 9px; cursor: pointer; font-size: 14px;
  padding: 11px 16px; font-weight: 600;
}
.btn-primary { background: var(--amber); color: #14181C; }
.btn-primary:disabled { background: var(--amber-dark); cursor: default; }
.btn-ghost {
  background: transparent; border: 1.5px solid var(--line); color: var(--text-dim);
}
.btn-icon {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text-dim);
  font-size: 12.5px; cursor: pointer; text-decoration: none;
}
.btn-icon.danger { color: var(--red); }

.chip {
  padding: 10px 12px; border-radius: 10px; font-size: 13.5px; cursor: pointer;
  border: 1.5px solid var(--line); background: transparent; color: var(--text);
  font-weight: 500;
}
.chip.active { font-weight: 700; }

.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented .chip { flex: 1 1 auto; min-width: 84px; text-align: center; }

.pill {
  padding: 7px 11px; border-radius: 20px; font-size: 12.5px; cursor: pointer;
  border: 1.5px solid var(--line); background: transparent; color: var(--text-dim);
}
.pill.active { border-color: var(--red); background: var(--red-dim); color: #F3C9C5; }

.center-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 26px; width: 100%; max-width: 360px;
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.auth-logo .box {
  width: 40px; height: 40px; border-radius: 10px; background: var(--panel-raised);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.auth-sub { color: var(--text-dim); font-size: 12.5px; margin: 6px 0 22px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #0D1F16; padding: 12px 20px; border-radius: 10px;
  display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 100;
}

.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }

/* ---- captura ---- */
.top-bar {
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-bottom: 3px solid var(--amber); padding: 22px 20px 20px;
}
.top-bar-inner { max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.top-bar h1 { font-size: 24px; }
.top-bar .sub { color: var(--text-dim); font-size: 12.5px; }

.form-wrap { max-width: 480px; margin: 0 auto; padding: 20px 16px 60px; }
.card {
  background: var(--panel); border-radius: 14px; border: 1px solid var(--line);
  overflow: hidden;
}
.clip-bar {
  background: var(--panel-raised); height: 26px; display: flex; align-items: center;
  justify-content: center; gap: 60px; border-bottom: 1px solid var(--line);
}
.rivet { width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.card-body { padding: 20px; }

.row2 { display: flex; gap: 12px; margin-bottom: 18px; }
.row2 > div { flex: 1; }

.section-title {
  display: flex; align-items: center; gap: 8px; margin: 22px 0 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 15px;
}

.field-block { margin-bottom: 16px; }

.gasolina-track {
  height: 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line);
  overflow: hidden; margin-bottom: 10px;
}
.gasolina-fill {
  height: 100%; background: linear-gradient(90deg, var(--red), var(--amber) 60%, var(--green));
  transition: width .2s ease; width: 0%;
}
.gasolina-opts { display: flex; gap: 8px; }
.gasolina-opts .chip { flex: 1; padding: 9px 4px; font-size: 12.5px; }

.falla-wrap { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }

.submit-btn { width: 100%; margin-top: 18px; padding: 16px; font-size: 17px; font-family: 'Oswald', sans-serif; }

.admin-link { text-align: center; margin-top: 28px; }
.admin-link a { color: var(--text-faint); font-size: 12px; text-decoration: none; }

/* ---- fotos ---- */
.foto-cat-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.foto-cat-btn {
  flex: 1 1 auto; min-width: 90px; padding: 12px 8px; border-radius: 10px; text-align: center;
  border: 1.5px dashed var(--line); background: transparent; color: var(--text-dim);
  font-size: 12.5px; cursor: pointer;
}
.foto-cat-btn:hover { border-color: var(--amber); color: var(--text); }
.foto-cat-check { display: inline-block; margin-right: 3px; font-weight: 700; }

/* ---- camara guiada 360 ---- */
.cam-modal-overlay {
  position: fixed; inset: 0; background: #000; z-index: 90;
  display: flex; align-items: center; justify-content: center;
}
.cam-modal {
  width: 100%; height: 100%; max-width: 480px; display: flex; flex-direction: column;
  background: #000;
}
.cam-header {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  color: var(--text); font-family: 'Oswald', sans-serif; font-size: 16px;
  background: rgba(0,0,0,.6); position: relative; z-index: 2;
}
.cam-cerrar { background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; }
.cam-viewport { flex: 1; position: relative; overflow: hidden; background: #000; }
.cam-viewport video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.cam-guia {
  position: absolute; inset: 8% 6%; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.cam-guia svg { width: 100%; height: 100%; }
.cam-guia svg path, .cam-guia svg circle, .cam-guia svg line, .cam-guia svg rect {
  fill: none; stroke: var(--amber); stroke-width: 2.5; opacity: .75;
}
.cam-progreso {
  position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px;
}
.cam-dot {
  width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.3); border: 1px solid rgba(255,255,255,.5);
}
.cam-dot.done { background: var(--green); border-color: var(--green); }
.cam-dot.actual { background: var(--amber); border-color: var(--amber); }
.cam-footer { padding: 16px; background: rgba(0,0,0,.6); }
.foto-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-bottom: 8px; }
.foto-thumb {
  position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
  aspect-ratio: 1; background: var(--bg);
}
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-thumb .cat-label {
  position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.65);
  font-size: 9.5px; padding: 3px 5px; color: var(--text);
}
.foto-thumb .remove-btn {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(20,20,20,.75); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1;
}

/* ---- dashboard ---- */
.dash-header {
  border-bottom: 1px solid var(--line); padding: 18px 20px; display: flex;
  align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.dash-header .title { display: flex; align-items: center; gap: 10px; font-size: 21px; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-content { max-width: 1150px; margin: 0 auto; padding: 22px 18px 60px; }

.veh-chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.veh-chip {
  padding: 9px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--panel);
  color: var(--text); font-size: 13px; cursor: pointer; font-weight: 500;
}
.veh-chip:hover { border-color: var(--amber); }

.badge-estado {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-ok { background: var(--green-dim); color: #9FE0B8; }
.badge-pronto { background: #4A3A1E; color: #F2C87A; }
.badge-vencido { background: var(--red-dim); color: #F3C9C5; }
.badge-sin_dato { background: var(--panel-raised); color: var(--text-faint); }

.perfil-section { margin-bottom: 22px; }
.perfil-section h4 { font-family:'Oswald',sans-serif; font-size:15px; margin-bottom:10px; color:var(--text); }
.perfil-kpis { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.perfil-kpi { background:var(--bg); border:1px solid var(--line); border-radius:9px; padding:10px 14px; flex:1 1 120px; }
.perfil-kpi .l { font-size:10.5px; color:var(--text-faint); }
.perfil-kpi .v { font-family:'Oswald',sans-serif; font-size:19px; color:var(--text); }
.mini-table { width:100%; border-collapse:collapse; font-size:12px; margin-top:6px; }
.mini-table th { text-align:left; color:var(--text-faint); font-weight:500; padding:5px 6px; }
.mini-table td { padding:5px 6px; border-top:1px solid var(--line); color:var(--text); }
.mini-table td.dim { color:var(--text-dim); }

.kpi-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; flex: 1 1 150px; min-width: 150px;
}
.kpi .label { color: var(--text-dim); font-size: 11.5px; margin-bottom: 8px; }
.kpi .value { font-family: 'Oswald', sans-serif; font-size: 30px; font-weight: 500; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 14px 8px; }
.chart-card .ctitle { font-family: 'Oswald', sans-serif; font-size: 15.5px; margin-bottom: 8px; padding-left: 6px; }
.chart-card canvas { max-height: 260px; }

.table-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-head {
  padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
table.registros { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.registros th { color: var(--text-dim); text-align: left; padding: 10px 12px; font-weight: 500; white-space: nowrap; }
table.registros td { padding: 10px 12px; border-top: 1px solid var(--line); color: var(--text); vertical-align: top; }
table.registros td.dim { color: var(--text-dim); }
.thumb-strip { display: flex; gap: 4px; flex-wrap: wrap; max-width: 160px; }
.thumb-strip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 1px solid var(--line); }
.badge-falla { color: var(--red); }
.badge-none { color: var(--text-faint); }

.side-panel-overlay {
  position: fixed; inset: 0; background: rgba(10,12,14,.75); z-index: 50;
  display: flex; justify-content: flex-end;
}
.side-panel {
  width: 100%; max-width: 400px; height: 100%; background: var(--panel); padding: 22px;
  overflow-y: auto; border-left: 1px solid var(--line);
}
.side-panel .sp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.sp-head .sp-title { font-family: 'Oswald', sans-serif; font-size: 18px; }
.sp-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 18px; }

.list-row {
  display: flex; align-items: center; justify-content: space-between; padding: 9px 12px;
  background: var(--bg); border-radius: 8px; border: 1px solid var(--line); margin-bottom: 8px;
}
.list-row .tag { font-size: 10.5px; padding: 2px 7px; border-radius: 8px; background: var(--panel-raised); color: var(--text-faint); margin-left: 8px; }
.list-row .row-actions { display: flex; gap: 8px; align-items: center; }
.list-row .row-actions button { background: none; border: none; color: var(--text-faint); cursor: pointer; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,14,.8); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--panel-raised); border-radius: 14px; padding: 24px; width: 100%;
  max-width: 320px; border: 1px solid var(--line);
}

.empty-state {
  text-align: center; padding: 70px 20px; color: var(--text-dim);
  background: var(--panel); border-radius: 14px; border: 1px dashed var(--line);
}

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out;
}
.lightbox-overlay img { max-width: 100%; max-height: 100%; border-radius: 8px; }

@media (max-width: 640px) {
  .dash-header { padding: 14px; }
  .dash-content { padding: 16px 10px 50px; }
}
