:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --info: #2563eb;
  --body-bg: linear-gradient(135deg, rgba(34,164,127,0.92) 0%, rgba(26,128,96,0.85) 45%, rgba(15,23,42,0.95) 100%), #22a47f;
  --input-bg: #ffffff;
  --input-disabled-bg: #f1f5f9;
  --tab-bg: #f1f5f9;
  --btn-soft-bg: #e2e8f0;
  --btn-soft-ink: #334155;
  --label-ink: #334155;
  --ac-hover: #f0fdfa;
  --ac-divider: #f1f5f9;
  --notif-unread: #eff6ff;
  --route-info-bg: #ecfdf5;
  --route-info-border: #a7f3d0;
  --route-info-ink: #065f46;
  --shadow-card: rgba(0,0,0,.25);
  --shadow-modal: rgba(0,0,0,.35);
  --modal-overlay: rgba(15, 23, 42, .6);
  --auth-bg: linear-gradient(135deg, #0d9488, #0f172a);
}

[data-theme="dark"] {
  --bg: #020617;
  --bg-soft: #0f172a;
  --card: #1e293b;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --line: #334155;
  --body-bg: #0f172a;
  --input-bg: #0f172a;
  --input-disabled-bg: #1e293b;
  --tab-bg: #334155;
  --btn-soft-bg: #334155;
  --btn-soft-ink: #f1f5f9;
  --label-ink: #cbd5e1;
  --ac-hover: #115e59;
  --ac-divider: #334155;
  --notif-unread: #1e3a5f;
  --route-info-bg: #064e3b;
  --route-info-border: #047857;
  --route-info-ink: #a7f3d0;
  --shadow-card: rgba(0,0,0,.55);
  --shadow-modal: rgba(0,0,0,.7);
  --modal-overlay: rgba(0, 0, 0, .75);
  --auth-bg: linear-gradient(135deg, #064e3b, #020617);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #020617;
    --bg-soft: #0f172a;
    --card: #1e293b;
    --ink: #f1f5f9;
    --muted: #94a3b8;
    --line: #334155;
    --body-bg: #0f172a;
    --input-bg: #0f172a;
    --input-disabled-bg: #1e293b;
    --tab-bg: #334155;
    --btn-soft-bg: #334155;
    --btn-soft-ink: #f1f5f9;
    --label-ink: #cbd5e1;
    --ac-hover: #115e59;
    --ac-divider: #334155;
    --notif-unread: #1e3a5f;
    --route-info-bg: #064e3b;
    --route-info-border: #047857;
    --route-info-ink: #a7f3d0;
    --shadow-card: rgba(0,0,0,.55);
    --shadow-modal: rgba(0,0,0,.7);
    --modal-overlay: rgba(0, 0, 0, .75);
    --auth-bg: linear-gradient(135deg, #064e3b, #020617);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--body-bg);
  background-attachment: fixed;
  min-height: 100vh;
}
.hidden { display: none !important; }
small { color: var(--muted); font-weight: 400; }

/* ===== Auth ===== */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--auth-bg);
  padding: 20px;
}
.auth-card {
  background: var(--card);
  width: 100%;
  max-width: 420px;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 20px 50px var(--shadow-card);
}
.brand { text-align: center; margin-bottom: 22px; }
.brand-logo-img {
  width: 160px; max-width: 80%; height: auto; display: block;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
}
.topbar-logo {
  height: 36px; width: auto; display: block;
  border-radius: 8px; background: #fff; padding: 3px 6px;
}
/* Wordmark "Rutín" en la topbar */
.brand-wordmark {
  font-family: 'Inter', -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.18em;
  background: linear-gradient(135deg, #34c595 0%, #6ee7b7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(34, 197, 149, 0.25);
}
.brand-logo { font-size: 38px; }
.brand h1 { font-size: 30px; color: var(--brand-dark); margin-top: 4px; }
.tagline { color: var(--muted); font-size: 14px; margin-top: 2px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab {
  flex: 1; padding: 10px; border: 0; background: var(--tab-bg);
  border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.tab.active { background: var(--brand); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .row { display: flex; gap: 10px; }
.auth-form .row label { flex: 1; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--label-ink); }
input, select, textarea {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: var(--input-bg); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand); border-color: transparent; }
.hint { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ===== Buttons ===== */
.btn {
  padding: 11px 18px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit;
  transition: all .18s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(34,164,127,.35); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(34,164,127,.5); }
.btn-ghost {
  background: rgba(255,255,255,.92); color: var(--brand-dark);
  border: 1px solid rgba(255,255,255,.6);
}
.btn-ghost:hover { background: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-soft { background: var(--btn-soft-bg); color: var(--btn-soft-ink); }

/* ===== App shell ===== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg); color: #fff; padding: 14px 22px;
}
.topbar-brand { font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.chip { background: rgba(255,255,255,.12); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.bell { position: relative; background: none; border: 0; font-size: 20px; cursor: pointer; }
.theme-toggle {
  background: none; border: 0; font-size: 20px; cursor: pointer;
  padding: 0; line-height: 1; color: inherit;
}
.theme-toggle:hover { filter: brightness(1.2); }
#auth-theme-toggle {
  position: absolute; top: 18px; right: 18px;
  background: rgba(255,255,255,.15); border: 0; color: #fff;
  width: 38px; height: 38px; border-radius: 999px; cursor: pointer;
  font-size: 18px; line-height: 1;
}
.badge {
  position: absolute; top: -6px; right: -8px; background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px;
  border-radius: 999px; padding: 0 4px;
}
.nav {
  display: flex; gap: 4px; background: var(--bg-soft); padding: 0 16px;
  flex-wrap: wrap;
}
#top-avatar, #user-chip { cursor: pointer; }
#user-chip:hover { background: rgba(255, 255, 255, .22); }
.navbtn {
  background: rgba(255,255,255,.06); border: 0; color: #cbd5e1;
  padding: 10px 18px; margin: 8px 4px;
  cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
  border-radius: 999px;
  transition: all .18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.navbtn:hover { background: rgba(255,255,255,.14); color: #fff; transform: translateY(-1px); }
.navbtn.active {
  background: var(--brand); color: #fff;
  box-shadow: 0 4px 14px rgba(34,164,127,.45);
}
.content { max-width: 880px; margin: 0 auto; padding: 26px 18px 60px; }
.panel h2 { margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* ===== Cards & forms ===== */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; margin-bottom: 18px;
}
.form-inline { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.form-inline label { flex: 1; min-width: 160px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid button { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

.list { display: flex; flex-direction: column; gap: 12px; }
.trip {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.trip-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.route { font-size: 16px; font-weight: 700; }
.route .arrow { color: var(--brand); margin: 0 6px; }
.meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.price { font-size: 20px; font-weight: 800; color: var(--ink); text-align: right; white-space: nowrap; }
.price small { display: block; font-size: 11px; color: var(--muted); }
.trip-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.tag-fair { background: #dcfce7; color: #166534; }
.tag-unfair { background: #fef3c7; color: #92400e; }
.tag-SCHEDULED { background: #dbeafe; color: #1e40af; }
.tag-IN_PROGRESS { background: #fef9c3; color: #854d0e; }
.tag-COMPLETED { background: #dcfce7; color: #166534; }
.tag-CANCELLED { background: #fee2e2; color: #991b1b; }
.tag-PENDING { background: #fef3c7; color: #92400e; }
.tag-CONFIRMED { background: #dcfce7; color: #166534; }
.tag-REJECTED { background: #fee2e2; color: #991b1b; }

.sub-list { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.passenger-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }

.notif {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--info);
  border-radius: 10px; padding: 14px 16px;
}
.notif.unread { background: var(--notif-unread); }
.notif .n-title { font-weight: 700; font-size: 14px; }
.notif .n-body { color: var(--muted); font-size: 13px; margin-top: 3px; }
.notif .n-time { color: #94a3b8; font-size: 11px; margin-top: 6px; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 14px; }

/* ===== Avatares ===== */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
  vertical-align: middle;
}
.avatar-ph { text-transform: uppercase; }
#top-avatar .avatar { width: 30px; height: 30px; font-size: 12px; }

/* Bloque chofer a la izquierda de cada viaje */
.trip { flex-direction: row; align-items: stretch; }
.trip-driver {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 92px;
  text-align: center;
  border-right: 1px solid var(--line);
  padding-right: 14px;
  margin-right: 4px;
}
.trip-driver .avatar { width: 56px; height: 56px; font-size: 20px; }
.trip-driver .d-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.trip-body { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@media (max-width: 560px) {
  .trip { flex-direction: column; }
  .trip-driver {
    flex-direction: row; width: auto; border-right: 0; padding-right: 0;
    border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-right: 0;
    justify-content: flex-start;
  }
  .trip-driver .avatar { width: 40px; height: 40px; font-size: 15px; }
}

/* ===== Perfil ===== */
.profile-card { display: flex; gap: 26px; flex-wrap: wrap; }
.profile-photo {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 160px;
}
.profile-photo #profile-avatar .avatar { width: 120px; height: 120px; font-size: 42px; }
.photo-btn { cursor: pointer; }
.profile-fields { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 14px; }
.profile-fields .row { display: flex; gap: 10px; }
.profile-fields .row label { flex: 1; }
.profile-fields textarea {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; resize: vertical;
  background: var(--input-bg); color: var(--ink);
}
.profile-fields input:disabled { background: var(--input-disabled-bg); color: var(--muted); }

.card-title { margin: 0; font-size: 16px; }

/* DNI preview en registro */
#dni-preview img {
  width: 100%; max-height: 160px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); margin-top: 4px;
}

/* Modal de ficha */
.modal {
  position: fixed; inset: 0; background: var(--modal-overlay);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 20px;
}
.modal-card {
  background: var(--card); color: var(--ink); border-radius: 16px; padding: 26px;
  width: 100%; max-width: 380px; position: relative;
  box-shadow: 0 24px 60px var(--shadow-modal);
}
.modal-x {
  position: absolute; top: 12px; right: 14px; border: 0; background: none;
  font-size: 16px; cursor: pointer; color: var(--muted);
}
.ficha { text-align: center; }
.ficha .avatar { width: 110px; height: 110px; font-size: 38px; margin: 0 auto 12px; }
.ficha h3 { font-size: 20px; margin-bottom: 2px; }
.ficha .ficha-role { color: var(--brand-dark); font-weight: 600; font-size: 13px; }
.ficha .ficha-rows { text-align: left; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.ficha .ficha-rows div { font-size: 14px; color: var(--ink); }
.ficha .ficha-rows .lbl { color: var(--muted); font-size: 12px; }

/* Editor de foto (Cropper) */
.crop-card { max-width: 560px; }
.crop-area { margin: 14px 0; background: #0f172a; border-radius: 10px; }
.crop-area img { display: block; max-width: 100%; }
.crop-area .cropper-container { max-height: 56vh; }
.crop-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.crop-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px;
}

.verif-ok, .verif-pend {
  display: inline-block; margin-top: 8px; padding: 4px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.verif-ok { background: #dcfce7; color: #166534; }
.verif-pend { background: #fef3c7; color: #92400e; }
#dni-back-preview img { max-width: 100%; max-height: 140px; border-radius: 10px; margin-top: 4px; border: 1px solid var(--line); }

.trip-driver[data-action] { cursor: pointer; }
.trip-driver[data-action]:hover { background: var(--ac-hover); border-radius: 10px; }
.ficha-link {
  font-size: 11px; color: var(--brand-dark); font-weight: 600;
  text-decoration: underline;
}
.passenger-row .pax {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.passenger-row .pax .avatar { width: 32px; height: 32px; font-size: 12px; }
.passenger-row .pax:hover b { text-decoration: underline; }

.chk { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 500; }
.chk input { width: auto; }
.filter-count { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
#viajes-filters .form-grid { gap: 12px; }
.route-info .suggest { margin-left: 16px; }
.route-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 13px 22px; border-radius: 10px; color: #fff; font-weight: 600;
  font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); z-index: 99;
  max-width: 90vw;
}
.toast { z-index: 1200; }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
.toast.info { background: var(--info); }

/* ===== Form helpers + Mapa ===== */
.form-grid .col-2 { grid-column: 1 / -1; }

.map {
  height: 320px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
  z-index: 0;
}
.trip .map { height: 260px; margin-top: 6px; margin-bottom: 0; }
.leaflet-container { border-radius: 12px; }

.route-info {
  background: var(--route-info-bg);
  border: 1px solid var(--route-info-border);
  color: var(--route-info-ink);
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 14px;
}

/* Autocompletado de direcciones */
.ac-wrap { position: relative; display: block; width: 100%; }
.ac-wrap input { width: 100%; }
.ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--brand);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.20), 0 4px 12px rgba(34,164,127,.15);
  z-index: 1500;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
}
.ac-item {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--ac-divider);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .12s ease;
}
.ac-item:not(.ac-loading):not(.ac-empty)::before {
  content: '📍';
  font-size: 14px;
  opacity: .7;
  flex-shrink: 0;
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.active { background: var(--ac-hover); }
.ac-loading, .ac-empty {
  color: var(--muted);
  font-style: italic;
  cursor: default;
  font-weight: 400;
}
.ac-loading:hover, .ac-empty:hover { background: transparent; }

.mark-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0 12px;
}
.btn-soft.active { background: var(--brand); color: #fff; }
.hint-inline { color: var(--muted); font-size: 13px; }
#search-map { cursor: crosshair; }
.pin-origin {
  background: var(--ok); color: #fff; border-radius: 50% 50% 50% 0;
  width: 22px; height: 22px; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.pin-dest {
  background: var(--bad); color: #fff; border-radius: 50% 50% 50% 0;
  width: 22px; height: 22px; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* ===== Admin sub-tabs y tablas ===== */
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin: 6px 0 16px;
}
.subtab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
.subtab:hover { color: var(--ink); }
.subtab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.subpanel { display: block; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 10px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}
.admin-table th,
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.admin-table thead th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .03em;
  position: sticky;
  top: 0;
}
.admin-table tbody tr:hover { background: #f0fdfa; }
.admin-table td.acts { white-space: nowrap; }
.admin-table td.acts > * + * { margin-left: 6px; }
.admin-table td.empty {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}
.admin-table code {
  background: #f1f5f9;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
}

.audit-scroll { max-height: 520px; overflow-y: auto; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.kpi-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.kpi-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--brand-dark);
  margin-top: 4px;
}
.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.tag-ok { background: #dcfce7; color: #166534; }
.tag-bad { background: #fee2e2; color: #991b1b; }
.tag-ADMIN { background: #ede9fe; color: #5b21b6; }
.tag-DRIVER { background: #dbeafe; color: #1e3a8a; }
.tag-PASSENGER { background: #fef3c7; color: #92400e; }
.tag-BOTH { background: #ccfbf1; color: #115e59; }
.tag-RESOLVED { background: #dcfce7; color: #166534; }
.tag-DISMISSED { background: #f1f5f9; color: #475569; }
.tag-PENDING { background: #fef3c7; color: #92400e; }
/* Calificaciones recibidas */
.rating-stars { color: #f5a623; letter-spacing: 1px; font-size: 14px; }
.ratings-summary {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border, #eee);
}
.ratings-summary strong { font-size: 18px; }
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0;
}
.review-row + .review-row { border-top: 1px solid var(--border, #f0f0f0); padding-top: 12px; }
.review-body { flex: 1; min-width: 0; }
.review-head {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  align-items: center; font-size: 13px;
}
.review-name { font-weight: 600; }
.review-date { font-size: 12px; }
.review-comment { margin-top: 4px; font-size: 14px; line-height: 1.4; }

/* ===== Onboarding banner (email no verif / DNI pendiente) ===== */
.onboarding-banner {
  display: flex; align-items: center; gap: 14px;
  max-width: 880px; margin: 16px auto 0; padding: 14px 20px;
  background: linear-gradient(135deg, rgba(34, 164, 127, 0.95), rgba(26, 128, 96, 0.95));
  color: #fff; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(34, 164, 127, .25);
}
.onboarding-banner .ob-icon { font-size: 28px; flex-shrink: 0; }
.onboarding-banner .ob-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.onboarding-banner .ob-body b { font-size: 15px; }
.onboarding-banner .ob-body span { font-size: 13px; opacity: .9; }
.onboarding-banner .ob-body code {
  background: rgba(255,255,255,.15); padding: 1px 6px; border-radius: 4px;
  font-size: 12px;
}
.onboarding-banner button { white-space: nowrap; }
.onboarding-banner button.btn-soft { background: rgba(255,255,255,.2); color: #fff; }
.onboarding-banner button.btn-soft:hover { background: rgba(255,255,255,.3); }

#dni-submit-preview img,
#dni-submit-back-preview img {
  width: 100%; max-height: 160px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); margin-top: 4px;
}

/* El cropper debe quedar SIEMPRE arriba de cualquier otro modal */
#crop-modal { z-index: 3000; }

/* ===== DNI pendientes de aprobación (admin) ===== */
.pending-dni-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
  margin-bottom: 10px;
}
.pending-dni-photo {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .15s ease;
}
.pending-dni-photo:hover { transform: scale(1.08); }
.pending-dni-info { font-size: 14px; }
.pending-dni-info b { font-size: 15px; }
.pending-dni-info .meta { gap: 10px; margin-top: 4px; }
.pending-dni-acts { display: flex; gap: 6px; flex-direction: column; }
@media (max-width: 640px) {
  .pending-dni-row { grid-template-columns: 1fr; }
  .pending-dni-photo { width: 100%; height: 140px; }
  .pending-dni-acts { flex-direction: row; }
}

/* ===== DNI tiles (frente + dorso + selfie) en admin ===== */
.pending-dni-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fafbfc;
}
.pending-dni-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 12px;
}
.pending-dni-head .meta { gap: 12px; margin-top: 4px; }
.pending-dni-acts { display: flex; gap: 6px; flex-shrink: 0; }
.dni-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dni-tile {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.dni-tile:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.dni-tile img {
  width: 100%; height: 140px; object-fit: cover; display: block;
}
.dni-tile span {
  display: block; padding: 8px 10px; font-size: 12px; font-weight: 600;
  text-align: center; background: #fff;
}
.dni-tile-empty {
  height: 174px;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: var(--muted);
  font-size: 13px;
}
.dni-tile-empty small { font-size: 11px; opacity: .7; }
@media (max-width: 640px) {
  .dni-tiles { grid-template-columns: 1fr; }
  .pending-dni-head { flex-direction: column; }
  .pending-dni-acts { flex-direction: row; }
}

/* ===== Ganancias ===== */
.earn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 700px) { .earn-grid { grid-template-columns: 1fr; } }
.earn-card {
  padding: 18px;
  border-radius: 16px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.earn-pending  { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.earn-available{ background: linear-gradient(135deg, #22a47f 0%, #1a8060 100%); }
.earn-total    { background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%); }
.earn-lbl  { font-size: 13px; font-weight: 600; opacity: .9; margin-bottom: 8px; }
.earn-val  { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; }
.earn-sub  { font-size: 12px; opacity: .8; margin-top: 4px; }

.earn-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 600px) { .earn-stats { grid-template-columns: 1fr; } }
.earn-stat {
  background: var(--bg-soft); padding: 14px; border-radius: 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1px solid var(--line);
}
.earn-stat span { font-size: 28px; }
.earn-stat b { font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.earn-stat small { color: var(--muted); font-size: 12px; }

.earn-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.earn-table th {
  text-align: left; padding: 10px 12px; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border-bottom: 1px solid var(--line); font-weight: 700;
}
.earn-table th.num, .earn-table td.num { text-align: right; }
.earn-table td { padding: 12px; border-bottom: 1px solid var(--line); }
.earn-table tr:last-child td { border-bottom: 0; }
.earn-row-in  td.num { color: var(--ok); font-weight: 700; }
.earn-row-out td.num { color: var(--bad); font-weight: 700; }

/* ===== Layout: sidebar izq + main + chats der ===== */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr 0;
  min-height: calc(100vh - 70px);
  position: relative;
}
.app-layout.with-chats {
  grid-template-columns: 240px 1fr 340px;
}
@media (max-width: 1100px) {
  .app-layout, .app-layout.with-chats { grid-template-columns: 1fr; }
}

/* Sidebar izquierdo */
.sidebar {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255,255,255,.06);
  padding: 18px 12px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
}
.sidebar .nav {
  display: flex; flex-direction: column;
  background: transparent; padding: 0; gap: 4px;
  flex-wrap: nowrap;
}
.sidebar .navbtn {
  text-align: left;
  width: 100%;
  margin: 0;
  border-radius: 12px;
  padding: 12px 14px;
}
.hamburger {
  background: rgba(255,255,255,.10); border: 0; color: #fff;
  font-size: 22px; cursor: pointer; padding: 4px 12px;
  border-radius: 8px; line-height: 1;
  display: none;
}
@media (max-width: 1100px) {
  .hamburger { display: inline-block; }
  .sidebar {
    position: fixed; top: 0; left: 0;
    width: 280px; height: 100vh; z-index: 1500;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 1400;
    background: rgba(0,0,0,.5);
  }
  .sidebar-backdrop.open { display: block; }
}
@media (min-width: 1101px) {
  .sidebar-backdrop { display: none !important; }
}

/* Topbar: brand a la izquierda, no centrado */
.topbar { padding: 12px 22px; gap: 14px; }

/* Panel de chats (derecha) */
.chats-panel {
  background: var(--card);
  border-left: 1px solid var(--line);
  padding: 0;
  display: none;
  flex-direction: column;
  position: sticky; top: 0;
  max-height: 100vh;
}
.app-layout.with-chats .chats-panel { display: flex; }
.chats-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  background: var(--bg-soft); color: var(--ink);
}
.chats-head h3 { font-size: 15px; font-weight: 700; }
.icon-btn {
  background: transparent; border: 0; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.icon-btn:hover { background: var(--btn-soft-bg); color: var(--ink); }
#chats-list { overflow-y: auto; flex: 1; padding: 8px; }

.chat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer; transition: background .12s ease;
  border-bottom: 1px solid var(--ac-divider);
}
.chat-row:hover { background: var(--ac-hover); }
.chat-row .avatar { width: 40px; height: 40px; font-size: 14px; flex-shrink: 0; }
.chat-row-body { flex: 1; min-width: 0; }
.chat-row-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); flex-shrink: 0; }

@media (max-width: 1100px) {
  .chats-panel {
    position: fixed; top: 0; right: 0;
    width: 340px; max-width: 100vw; height: 100vh; z-index: 1500;
    transform: translateX(100%);
    transition: transform .25s ease;
  }
  .app-layout.with-chats .chats-panel { transform: translateX(0); display: flex; }
}

/* ===== Publish success card ===== */
.publish-success {
  background: linear-gradient(135deg, rgba(34,164,127,.10) 0%, rgba(52,197,149,.05) 100%);
  border: 2px solid var(--brand);
  box-shadow: 0 8px 24px rgba(34,164,127,.18);
}
.success-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.success-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ok); color: #fff;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(22,163,74,.4);
}
.success-head h3 { font-size: 20px; font-weight: 800; color: var(--brand-dark); margin: 0; }
.publish-success .meta { gap: 16px; margin-bottom: 12px; }
.success-tag { margin-bottom: 16px; }
.success-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Evitar overflow horizontal en la app */
.content, .panel, .card { max-width: 100%; overflow-wrap: break-word; }
.app-layout { overflow-x: hidden; }
