:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #5f6368;
  --line: #dedede;
  --paper: #ffffff;
  --page: #f6f6f6;
  --brand: #ef2334;
  --brand-dark: #bd1322;
  --brand-soft: #fff0f2;
  --alert: #d90429;
  --warn: #b45309;
  --ok: #1f7a3f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--page);
  color: var(--ink);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f6f6f6 48%, #fff0f2 100%);
}

.login-card {
  width: min(100%, 460px);
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

.login-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
  margin-bottom: 12px;
}

.login-card h1 {
  font-size: 34px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.access-note {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.access-note strong {
  color: var(--ink);
}

.register-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.register-box summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 800;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 24px clamp(16px, 4vw, 48px);
  background: #ffffff;
  border-bottom: 4px solid var(--brand);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 86px;
  height: 86px;
  object-fit: contain;
}

.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.view-tab {
  min-width: 128px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
}

.view-tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.session-box {
  display: grid;
  gap: 4px;
  min-width: 180px;
  justify-items: end;
  color: var(--muted);
  font-size: 13px;
}

.session-box strong {
  color: var(--ink);
}

.session-box .ghost {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 4vw, 42px);
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 1fr));
  gap: 8px;
  padding: 20px clamp(16px, 4vw, 48px) 0;
}

.status-strip div {
  min-height: 70px;
  padding: 12px;
  background: var(--brand-soft);
  border: 1px solid #ffd0d6;
}

.status-strip span {
  display: block;
  font-size: 26px;
  font-weight: 800;
}

.status-strip small {
  color: var(--muted);
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 48px) 48px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.owner-dashboard {
  display: grid;
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 48px) 48px;
}

.owner-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.owner-hero h2 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.05;
}

.owner-hero p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.owner-total {
  min-width: 260px;
  padding: 18px;
  background: var(--brand-soft);
  border: 1px solid #ffd0d6;
  text-align: right;
}

.owner-total span {
  display: block;
  font-size: 30px;
  font-weight: 900;
  color: var(--brand-dark);
}

.owner-total small {
  color: var(--muted);
  font-weight: 800;
}

.owner-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.owner-metrics div,
.owner-panel {
  background: var(--paper);
  border: 1px solid var(--line);
}

.owner-metrics div {
  min-height: 84px;
  padding: 14px;
}

.owner-metrics span {
  display: block;
  font-size: 28px;
  font-weight: 900;
}

.owner-metrics small {
  color: var(--muted);
  font-weight: 800;
}

.owner-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 20px;
}

.owner-panel {
  padding: 18px;
}

.owner-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.owner-daily-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.owner-day-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) repeat(8, minmax(96px, 1fr));
  gap: 10px;
  align-items: center;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.owner-day-card strong,
.owner-day-card span,
.owner-day-card small {
  display: block;
}

.owner-day-card span {
  font-size: 22px;
  font-weight: 900;
}

.owner-day-card small {
  color: var(--muted);
  font-weight: 800;
}

.owner-item {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.owner-item strong,
.owner-item span,
.owner-item small {
  display: block;
}

.owner-item span,
.owner-item small {
  color: var(--muted);
}

.driver-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 48px) 48px;
}

.driver-hero,
.driver-status {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px;
}

.driver-hero {
  align-self: start;
}

.driver-hero h2 {
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.05;
}

.driver-hero p {
  color: var(--muted);
  line-height: 1.5;
}

.quick-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.main-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.menu-button {
  min-height: 58px;
  font-size: 16px;
}

.menu-button.active-menu {
  outline: 3px solid #ffb3bd;
  outline-offset: 2px;
}

.hidden-panel {
  display: none;
}

.panic-button {
  width: 100%;
  min-height: 58px;
  margin-top: 18px;
  background: var(--alert);
  color: #fff;
  font-size: 18px;
  text-transform: uppercase;
}

.panic-button:hover {
  background: #8f1d14;
}

.panic-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.tracking-box {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.tracking-box h3 {
  margin-bottom: 0;
}

.tracking-box p {
  margin-bottom: 0;
}

.tracking-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tracking-status {
  min-height: 22px;
  color: var(--muted);
  font-weight: 800;
}

.quick-actions a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  background: var(--brand-soft);
  border: 1px solid #ffd0d6;
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}

.driver-submit {
  min-height: 52px;
  font-size: 16px;
}

.submit-message {
  min-height: 22px;
  margin-bottom: 0;
  color: var(--ok);
  font-weight: 800;
}

.driver-status {
  grid-column: 1 / -1;
}

.mini-report-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.mini-report {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.mini-report span,
.mini-report small,
.mini-empty {
  color: var(--muted);
}

.panel,
.workspace {
  background: var(--paper);
  border: 1px solid var(--line);
}

.panel {
  align-self: start;
  padding: 20px;
}

.section-heading p,
.toolbar p {
  margin-bottom: 18px;
  color: var(--muted);
}

.report-form,
.trip-form {
  display: grid;
  gap: 14px;
}

.required-notice {
  padding: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 800;
}

.required-notice.is-ready {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: var(--ok);
}

.paper-assignment {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #ffd0d6;
  background: var(--brand-soft);
}

.paper-assignment h3 {
  margin-bottom: 0;
}

.paper-assignment p {
  margin-bottom: 0;
  color: var(--muted);
}

.paper-assignment p.ready {
  color: var(--ok);
  font-weight: 800;
}

.odometer-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.odometer-box h3,
.odometer-box p {
  margin-bottom: 0;
}

.odometer-preview {
  display: none;
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  background: #111827;
  object-fit: contain;
}

.odometer-preview.has-photo {
  display: block;
}

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

label,
legend {
  color: #26324a;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #bfc7d5;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

textarea {
  resize: vertical;
}

.capture-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.capture-box p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.4;
}

.capture-status {
  min-height: 22px;
  padding: 8px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 800;
}

.capture-status.ready {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: var(--ok);
}

.camera-preview,
.evidence-preview {
  display: none;
  width: 100%;
  max-height: 320px;
  background: #111827;
  border: 1px solid var(--line);
  object-fit: contain;
}

.camera-preview.is-active,
.evidence-preview.has-photo {
  display: block;
}

.capture-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

fieldset {
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.check input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

button,
.primary,
.ghost {
  min-height: 42px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

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

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

.workspace {
  min-height: 680px;
  margin: 20px clamp(16px, 4vw, 48px) 48px;
}

.tracking-workspace {
  min-height: auto;
  margin-top: 0;
}

.user-admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  padding: 20px;
}

.user-form,
.user-list,
.request-list {
  display: grid;
  gap: 12px;
}

.user-card,
.request-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.user-card strong,
.user-card span,
.request-card strong,
.request-card span {
  display: block;
}

.user-card span,
.user-card small,
.request-card span,
.request-card small {
  color: var(--muted);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  background: var(--brand-soft);
  border: 1px solid #ffd0d6;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.user-actions,
.request-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.request-list {
  padding: 20px;
}

.request-card {
  background: #fff;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
}

.filter {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
}

.filter.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.report-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.tracking-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.tracking-card {
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.tracking-card h3 {
  margin-bottom: 10px;
}

.tracking-card a,
.location a {
  color: var(--brand-dark);
  font-weight: 800;
}

.sheet-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.sheet-panel textarea {
  min-height: 190px;
  font-family: Consolas, "Courier New", monospace;
}

.empty-state {
  padding: 44px 18px;
  border: 1px dashed #bfc7d5;
  color: var(--muted);
  text-align: center;
}

.report-card {
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.meta {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.card-head h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: #fff;
  background: var(--warn);
  font-size: 12px;
  font-weight: 800;
}

.badge.urgente {
  background: var(--alert);
}

.badge.baja {
  background: var(--ok);
}

.description {
  color: #26324a;
  line-height: 1.45;
}

dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 4px 0 0;
}

.photo {
  display: none;
  max-width: 100%;
  max-height: 260px;
  margin-top: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
}

.photo.has-photo {
  display: block;
}

.panic-audio {
  display: none;
  width: 100%;
  margin-top: 10px;
}

.panic-audio.has-audio {
  display: block;
}

.cost-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 4px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.cost-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 16px;
}

.cost-editor {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(120px, 0.7fr) minmax(220px, 1.6fr);
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.assign-field {
  flex: 1 1 260px;
}

.assign-field input {
  margin-top: 4px;
}

.status-select {
  max-width: 220px;
  margin-top: 0;
}

.ghost {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

@media (max-width: 900px) {
  .topbar,
  .toolbar,
  .owner-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .layout,
  .owner-grid {
    grid-template-columns: 1fr;
  }

  .driver-shell {
    grid-template-columns: 1fr;
  }

  .user-admin-grid {
    grid-template-columns: 1fr;
  }

  .session-box {
    justify-items: start;
  }

  .owner-total {
    min-width: 0;
    text-align: left;
  }

  .mini-report-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .status-strip,
  .owner-metrics,
  .owner-day-card,
  .form-grid,
  .main-menu,
  .tracking-actions,
  .capture-actions,
  dl,
  .cost-summary,
  .cost-editor,
  .mini-report-list,
  .user-card,
  .request-card {
    grid-template-columns: 1fr;
  }

  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .status-select {
    max-width: none;
  }
}
