/* DECA-GO! — precisión logística: tinta profunda, ámbar de marca vial y placas de matrícula reales. */
:root {
  --ink-950: #0A0F1A;
  --ink-900: #121A2B;
  --ink-800: #1C2640;
  --ink-600: #3B4760;
  --ink-500: #5F6B82;
  --ink-400: #8A94A8;
  --ink-200: #D7DCE5;
  --canvas: #F6F5F1;
  --surface: #FFFFFF;
  --surface-soft: #FBFAF7;
  --line: #E6E3DC;
  --line-strong: #D5D1C7;
  --amber: #F5B301;
  --amber-600: #C98E00;
  --amber-50: #FFF6DB;
  --eu: #0038A8;
  --green: #0E7A4E;
  --green-50: #E7F5EE;
  --red: #B42318;
  --red-50: #FEF0EE;
  --slate-50: #EEF1F5;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(10, 15, 26, .05);
  --shadow: 0 1px 2px rgba(10, 15, 26, .04), 0 6px 20px -8px rgba(10, 15, 26, .10);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .55);
  --font-display: 'Archivo', 'Helvetica Neue', sans-serif;
  --font-body: 'Hanken Grotesk', 'Helvetica Neue', sans-serif;
  --font-plate: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 15px/1.55 var(--font-body);
  color: var(--ink-900);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-stretch: 112%; letter-spacing: -.015em; color: var(--ink-950); }
h1 { font-size: clamp(1.65rem, 2.5vw, 2.2rem); font-weight: 800; line-height: 1.12; }
h2 { font-size: 1.02rem; font-weight: 700; }
.eyebrow { margin: 0 0 8px; font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--amber-600); }
.lead { margin: 8px 0 0; color: var(--ink-500); max-width: 62ch; }
.muted { color: var(--ink-400); }
.arrow { margin: 0 .35em; color: var(--amber-600); font-weight: 400; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid rgba(245, 179, 1, .6); outline-offset: 2px; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.wordmark { font-family: var(--font-display); font-stretch: 125%; font-weight: 900; font-size: 1.08rem; letter-spacing: -.02em; color: #fff; }
.wordmark b { color: var(--amber); font-weight: 900; }

/* ---------- Estructura de la aplicación ---------- */
body.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 26px;
  padding: 22px 14px;
  background: var(--ink-950) radial-gradient(120% 55% at 0% 0%, rgba(245, 179, 1, .11), transparent 62%);
  color: #C9D0DC;
}
.sidebar .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 16px 12px 6px; font-size: .66rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-500); }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 9px;
  background: none; color: #C9D0DC; text-decoration: none;
  font: 500 .93rem/1.2 var(--font-body); cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.is-active { background: rgba(245, 179, 1, .12); color: #fff; box-shadow: inset 3px 0 0 var(--amber); }
.nav-item.is-active .ico { color: var(--amber); }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; flex-direction: column; gap: 4px; }
.user { display: flex; align-items: center; gap: 11px; padding: 6px 12px 10px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--amber); color: var(--ink-950); font: 800 .95rem/1 var(--font-display); }
.user strong { display: block; color: #fff; font-size: .9rem; font-weight: 600; }
.user small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-400); font-size: .78rem; }
.workspace { min-width: 0; }
.page { max-width: 1140px; margin: 0 auto; padding: 44px 44px 110px; }

/* ---------- Cabeceras ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 20px; color: var(--ink-500); font-size: .9rem; font-weight: 500; text-decoration: none; }
.back:hover { color: var(--ink-950); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px; border: 1px solid transparent; border-radius: 10px;
  font: 600 .92rem/1.2 var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .12s, background .15s, box-shadow .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink-950); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), var(--shadow-sm); }
.btn-primary:hover { background: var(--ink-800); }
.btn-accent { background: var(--amber); color: var(--ink-950); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 8px 20px -8px rgba(201, 142, 0, .7); }
.btn-accent:hover { background: #FFC21F; }
.btn-ghost { background: var(--surface); color: var(--ink-900); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink-400); }
.btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 20px; font-size: 1rem; }

/* ---------- Placa de matrícula europea ---------- */
.plate { display: inline-flex; align-items: stretch; height: 30px; border: 1.5px solid var(--ink-950); border-radius: 5px; background: #fff; overflow: hidden; box-shadow: var(--shadow-sm); vertical-align: middle; }
.plate-eu { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 17px; padding-bottom: 2px; background: var(--eu); color: #fff; font: 700 .58rem/1 var(--font-body); }
.plate-eu i { width: 8px; height: 8px; margin: 3px 0 auto; border: 1.5px dotted #FFD500; border-radius: 50%; }
.plate-num { display: flex; align-items: center; padding: 0 9px; font: 700 1.15rem/1 var(--font-plate); letter-spacing: .07em; color: var(--ink-950); white-space: nowrap; }
.plate-lg { height: 48px; border-width: 2px; border-radius: 7px; box-shadow: var(--shadow); }
.plate-lg .plate-eu { width: 25px; font-size: .78rem; padding-bottom: 4px; }
.plate-lg .plate-eu i { width: 12px; height: 12px; margin-top: 5px; }
.plate-lg .plate-num { padding: 0 15px; font-size: 1.95rem; }
.plate-missing { display: inline-grid; place-items: center; height: 48px; padding: 0 16px; border: 2px dashed var(--line-strong); border-radius: 7px; color: var(--ink-400); font-weight: 600; }
.plates { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.plate-join { color: var(--ink-400); font-weight: 700; }
.plate-input { font: 700 1.35rem/1.2 var(--font-plate) !important; letter-spacing: .09em; text-transform: uppercase; }

/* ---------- Estados ---------- */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px; background: var(--slate-50); color: var(--ink-600); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-borrador { background: var(--amber-50); color: #8A5A00; }
.pill-emitido { background: var(--green-50); color: var(--green); }
.pill-anulado { background: var(--red-50); color: var(--red); }
.pill-lg { padding: 8px 15px 8px 13px; font-size: .9rem; }

/* ---------- Métricas ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { position: relative; padding: 18px 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: repeating-linear-gradient(90deg, var(--amber) 0 18px, transparent 18px 30px); opacity: .55; }
.stat span { display: block; color: var(--ink-500); font-size: .82rem; font-weight: 500; }
.stat strong { display: block; margin-top: 6px; font: 800 2rem/1 var(--font-display); font-stretch: 112%; color: var(--ink-950); font-variant-numeric: tabular-nums; }

/* ---------- Listado ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-head, .list-row { display: grid; grid-template-columns: 180px minmax(0, 1.25fr) minmax(0, 1.4fr) 120px; gap: 20px; align-items: center; padding: 15px 22px; }
.list-head { padding-top: 11px; padding-bottom: 11px; background: var(--surface-soft); border-bottom: 1px solid var(--line); color: var(--ink-500); font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.list-row { position: relative; border-bottom: 1px solid var(--line); text-decoration: none; transition: background .15s; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-soft); }
.list-row:hover::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.cell-route strong { display: block; color: var(--ink-950); font-weight: 600; }
.cell-route small { color: var(--ink-500); font-size: .84rem; }
.cell-parties { color: var(--ink-600); font-size: .86rem; }
.cell-parties span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-parties em { display: inline-block; min-width: 74px; font-style: normal; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); }
.cell-status { justify-self: end; }

/* ---------- Estado vacío ---------- */
.empty { padding: 60px 24px; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-art { width: 120px; height: 96px; }
.empty h2 { margin-top: 18px; font-size: 1.4rem; }
.empty p { max-width: 46ch; margin: 8px auto 22px; color: var(--ink-500); }
.empty .head-actions { justify-content: center; }

/* ---------- Paneles ---------- */
.panel { padding: 24px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-main .panel + .panel { margin-top: 16px; }
.panel-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.panel-hint { margin: -8px 0 18px; color: var(--ink-500); font-size: .88rem; }
.letter { display: inline-grid; place-items: center; width: 21px; height: 21px; flex: none; border-radius: 6px; background: var(--ink-950); color: var(--amber); font: 800 .74rem/1 var(--font-display); }
.letter-inv { background: var(--amber); color: var(--ink-950); }
.prose { margin: 0; color: var(--ink-800); }

/* ---------- Ficha del DeCA ---------- */
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.doc-id { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.doc-side { position: sticky; top: 24px; }
.parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.party { padding: 16px 18px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 11px; }
.party-role { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; color: var(--ink-500); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.party strong { display: block; color: var(--ink-950); font-size: 1.02rem; }
.party .nif { display: inline-block; margin-top: 4px; font: 600 1.02rem/1.2 var(--font-plate); letter-spacing: .07em; color: var(--ink-600); }
.party p { margin: 4px 0 0; color: var(--ink-500); font-size: .88rem; }
.party.is-empty { border-style: dashed; }
.party.is-empty strong { color: var(--ink-400); font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; margin: 0; }
.facts > div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.facts > div:nth-last-child(-n+1) { border-bottom: 0; }
.facts dt { display: flex; align-items: center; gap: 9px; color: var(--ink-500); font-size: .8rem; font-weight: 500; }
.facts dd { margin: 5px 0 0 30px; color: var(--ink-950); font-weight: 600; }

/* ---------- Panel lateral ---------- */
.qr-card { text-align: center; }
.qr-status { display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px; border-radius: 999px; background: var(--green-50); color: var(--green); font-size: .82rem; font-weight: 700; }
.qr-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2.2s infinite; }
.qr { width: 196px; margin: 20px auto 14px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.qr svg { display: block; width: 100%; height: auto; }
.small { margin: 0 0 16px; color: var(--ink-500); font-size: .85rem; }
.copy { display: flex; gap: 8px; margin-top: 10px; }
.copy input { flex: 1; min-width: 0; padding: 9px 10px; background: var(--surface-soft); color: var(--ink-500); font-size: .78rem; }
.meta { margin: 14px 0 0; color: var(--ink-400); font-size: .78rem; line-height: 1.5; }
.emit-card h2 { margin-bottom: 10px; font-size: 1.15rem; }
.emit-card .btn + .btn, .emit-card form + .btn { margin-top: 10px; }
.checklist { list-style: none; margin: 0 0 18px; padding: 0; }
.checklist li { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .86rem; color: var(--ink-600); }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { content: ""; flex: none; width: 15px; height: 15px; margin-top: 2px; border: 2px solid var(--amber); border-radius: 50%; }
.checklist strong { font-weight: 600; color: var(--ink-900); }
.ok { display: flex; align-items: center; gap: 9px; margin: 6px 0 18px; color: var(--green); font-weight: 600; }
.ok::before { content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 11px no-repeat; }

/* ---------- Formularios ---------- */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.grid-2 .field + .field { margin-top: 0; }
.grid-2 + .field { margin-top: 16px; }
.field label { display: flex; align-items: center; gap: 9px; color: var(--ink-800); font-size: .86rem; font-weight: 600; }
input, textarea {
  width: 100%; padding: 11px 13px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: 400 .95rem/1.4 var(--font-body); color: var(--ink-950);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #A9B1C0; }
input:hover, textarea:hover { border-color: var(--ink-400); }
input:focus, textarea:focus { outline: none; border-color: var(--ink-950); box-shadow: 0 0 0 4px rgba(245, 179, 1, .28); }
textarea { resize: vertical; }
.hint { color: var(--ink-400); font-size: .78rem; }
.field-error { color: var(--red); font-size: .8rem; font-weight: 600; }
.has-error input, .has-error textarea { border-color: var(--red); background: #FFFBFA; }
.own { border: 0; color: #C9D0DC; background: linear-gradient(135deg, var(--ink-950), var(--ink-800)); box-shadow: var(--shadow-lg); }
.own-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.own h2 { display: flex; align-items: center; gap: 10px; color: #fff; }
.lock { color: var(--amber); font-size: .78rem; font-weight: 600; }
.own-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; margin: 18px 0 0; }
.own-list dt { color: var(--ink-400); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.own-list dd { margin: 5px 0 0; color: #fff; font-weight: 600; }
.role-badge { display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--ink-800); font-size: .86rem; font-weight: 600; box-shadow: var(--shadow-sm); }
.dot-amber { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(245, 179, 1, .2); }
.form-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 18px 0 6px; background: linear-gradient(to top, var(--canvas) 72%, rgba(246, 245, 241, 0)); }
.form-section-label { margin: 10px 0 -2px; color: var(--ink-400); font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

/* ---------- Verificación de empresa ---------- */
.verify-badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px; background: var(--amber-50); color: #8A5A00; font-size: .76rem; font-weight: 700; letter-spacing: .02em; }
.verify-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(245, 179, 1, .25); }
.verify-card h2 { margin: 14px 0 10px; }
.notice { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; padding: 14px 18px; background: var(--surface); border: 1px solid #F3DC9A; border-left: 4px solid var(--amber); border-radius: 12px; box-shadow: var(--shadow-sm); }
.notice p { flex: 1; min-width: 240px; margin: 0; color: var(--ink-600); font-size: .9rem; }

/* ---------- Avisos ---------- */
.alert { padding: 13px 16px; margin-bottom: 18px; border: 1px solid; border-radius: 11px; font-size: .9rem; font-weight: 500; }
.alert-error { background: var(--red-50); border-color: #F5C6BF; color: #7A1A12; }
.toast {
  position: fixed; top: 22px; right: 22px; z-index: 50;
  display: flex; align-items: center; gap: 10px; padding: 13px 18px;
  background: var(--ink-950); color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-weight: 500; animation: toast 5.5s ease forwards;
}
.toast .ico { color: var(--amber); }
.center-card { max-width: 520px; margin: 12vh auto 0; text-align: center; }
.center-card .lead { margin: 10px auto 26px; }

/* ---------- Acceso ---------- */
body.auth { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; padding: 40px 56px; background: var(--ink-950); color: #C9D0DC; }
.auth-brand::before {
  content: ""; position: absolute; inset: -30%; z-index: -1;
  background:
    repeating-linear-gradient(118deg, transparent 0 58px, rgba(245, 179, 1, .075) 58px 62px, transparent 62px 150px),
    radial-gradient(55% 45% at 85% 8%, rgba(245, 179, 1, .22), transparent 70%),
    radial-gradient(55% 55% at 0% 100%, rgba(0, 56, 168, .38), transparent 70%);
}
.auth-pitch { max-width: 500px; margin-top: auto; }
.auth-pitch .eyebrow { color: var(--amber); }
.auth-pitch h2 { font-size: clamp(2.1rem, 3.5vw, 3.2rem); font-weight: 800; font-stretch: 120%; line-height: 1.04; letter-spacing: -.025em; color: #fff; }
.auth-pitch h2 em { font-style: normal; color: var(--amber); }
.auth-points { list-style: none; display: flex; flex-direction: column; gap: 13px; margin: 28px 0 0; padding: 0; }
.auth-points li { display: flex; align-items: flex-start; gap: 12px; }
.auth-points li::before { content: ""; flex: none; width: 19px; height: 19px; margin-top: 1px; border-radius: 6px; background: var(--amber) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A0F1A' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat; }
.ticket { width: min(430px, 100%); margin: 44px 0 0 24px; padding: 20px 22px; background: #fff; color: var(--ink-900); border-radius: 18px; box-shadow: var(--shadow-lg); transform: rotate(-2.5deg); animation: float 7s ease-in-out infinite; }
.ticket-top { display: flex; justify-content: space-between; align-items: center; }
.ticket-route { margin: 16px 0 3px; font: 800 1.35rem/1.2 var(--font-display); font-stretch: 112%; color: var(--ink-950); }
.ticket-meta { margin: 0; color: var(--ink-500); font-size: .84rem; }
.ticket-body { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 16px; padding-top: 16px; border-top: 1.5px dashed var(--line-strong); }
.ticket-parties span { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-900); }
.ticket-parties span + span { margin-top: 6px; }
.ticket-parties em { display: block; font-style: normal; font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-400); }
.ticket-qr { width: 78px; flex: none; }
.ticket-qr svg { display: block; width: 100%; height: auto; }
.auth-foot { margin: 44px 0 0; color: var(--ink-400); font-size: .82rem; }
.auth-main { position: relative; display: flex; align-items: center; justify-content: center; padding: 56px 28px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card-wide { max-width: 540px; }
.auth-card h1 { font-size: 2.1rem; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 30px; }
.auth-card form .field + .field { margin-top: 0; }
.auth-card .grid-2 + .field { margin-top: 0; }
.auth-card .btn-lg { margin-top: 6px; }
.auth-switch { margin-top: 24px; color: var(--ink-500); font-size: .92rem; }
.auth-switch a { color: var(--ink-950); font-weight: 600; text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* ---------- Colaboración entre partes ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-600); font-size: .88rem; font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s; }
.tab:hover { border-color: var(--ink-400); }
.tab.is-active { background: var(--ink-950); border-color: var(--ink-950); color: #fff; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--slate-50); color: var(--ink-600); font-size: .74rem; }
.tab.is-active .count { background: var(--amber); color: var(--ink-950); }
.empty-inline { padding: 28px; text-align: center; color: var(--ink-500); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.tag { display: inline-flex; align-items: center; gap: 5px; margin: 4px 6px 0 0; padding: 2px 8px; border-radius: 6px; background: var(--slate-50); color: var(--ink-600); font-size: .72rem; font-weight: 600; letter-spacing: .01em; vertical-align: middle; white-space: nowrap; }
.tag-ok { background: var(--green-50); color: var(--green); }
.tag-warn { background: var(--red-50); color: var(--red); }
.panel-title .tag, .party-role .tag { margin-top: 0; }
.prov { display: block; margin-top: 4px; color: var(--ink-400); font-size: .76rem; }
.facts > div > .prov, .facts > div > .tag { margin-left: 30px; }
.facts > div.is-flagged { background: linear-gradient(90deg, var(--red-50), transparent 70%); }
.party .prov, .party .tag { margin-top: 8px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 14px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-400); }
.timeline li.ev-emitir::before { border-color: var(--green); background: var(--green); }
.timeline li.ev-anular::before, .timeline li.ev-marcar_incorrecto::before { border-color: var(--red); background: var(--red); }
.timeline li.ev-modificar::before { border-color: var(--amber); background: var(--amber); }
.timeline li.ev-confirmar::before { border-color: var(--green); }
.timeline .when { color: var(--ink-400); font-size: .74rem; font-weight: 600; letter-spacing: .02em; }
.timeline p { margin: 2px 0 0; font-size: .9rem; color: var(--ink-800); }
.timeline .motivo { color: var(--ink-500); font-size: .84rem; font-style: italic; }
.side-card { margin-top: 16px; }
.side-card h2 { margin-bottom: 8px; font-size: 1.05rem; }
.side-card .btn + form, .side-card form + details, .side-card .btn + details { margin-top: 10px; }
details.danger-zone, details.flag-zone { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details summary { cursor: pointer; color: var(--ink-600); font-size: .88rem; font-weight: 600; }
details.danger-zone summary { color: var(--red); }
details form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
details label { font-size: .8rem; font-weight: 600; color: var(--ink-600); }
select { width: 100%; padding: 10px 12px; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: 400 .9rem/1.3 var(--font-body); color: var(--ink-950); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #8F1C13; }
.qr-status.is-anulado { background: var(--red-50); color: var(--red); }
.qr-status.is-anulado .dot { background: var(--red); animation: none; }
.field.is-locked input { background: var(--surface-soft); color: var(--ink-500); border-style: dashed; }
.motivo-panel { border-color: #F3DC9A; box-shadow: 0 0 0 4px rgba(245, 179, 1, .12); }

/* ---------- Equipo ---------- */
.team-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.members { list-style: none; margin: 0; padding: 0; }
.member { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.member .member-actions { grid-column: 2; justify-content: flex-start; }
@media (min-width: 1360px) {
  .member { grid-template-columns: auto minmax(0, 1fr) auto; }
  .member .member-actions { grid-column: auto; justify-content: flex-end; }
}
.member:last-child { border-bottom: 0; }
.member.is-desactivado { opacity: .6; }
.avatar-sm { width: 38px; height: 38px; font-size: .95rem; }
.member-info strong { display: block; color: var(--ink-950); }
.member-info > small { display: block; color: var(--ink-500); font-size: .84rem; }
.member-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.member-state small { font-size: .76rem; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.inline-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { width: auto; padding: 7px 10px; font-size: .84rem; }
.btn-sm { padding: 7px 11px; font-size: .82rem; border-radius: 8px; }
.btn-danger-ghost { color: var(--red); }
.btn-danger-ghost:hover { border-color: var(--red); }
.role-label { color: var(--ink-500); font-size: .84rem; font-weight: 600; }
.invite-card h2 { margin-bottom: 6px; font-size: 1.1rem; }
.invite-card .form-stack { gap: 14px; margin-top: 16px; }
.invite-card .field + .field { margin-top: 0; }
.invite-ready { margin-bottom: 20px; border-color: #F3DC9A; box-shadow: 0 0 0 4px rgba(245, 179, 1, .12); }
.invite-ready h2 { margin: 12px 0 6px; font-size: 1.15rem; }
@media (max-width: 1080px) { .team-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .member .member-actions { grid-column: 1 / -1; } }

/* ---------- Entre partes: validación e invitaciones ---------- */
.block-state { display: block; margin-top: 8px; color: var(--ink-400); font-size: .78rem; }
.block-state.is-ok { color: var(--green); font-weight: 600; }
.block-state.is-ok::before { content: "✓ "; }
.invite-field { margin-top: 6px; padding-top: 14px; border-top: 1px dashed var(--line); }
.deca-summary { display: grid; gap: 1px; margin: 18px 0 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); text-align: left; }
.deca-summary div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 14px; background: var(--surface); }
.deca-summary dt { color: var(--ink-400); font-size: .8rem; }
.deca-summary dd { margin: 0; color: var(--ink-950); font-size: .88rem; font-weight: 600; text-align: right; }

/* ---------- Cuentas ---------- */
.alert-warn { background: var(--amber-50); border-color: #F3DC9A; color: #6B4700; }
.steps { margin: 18px 0 0; padding-left: 20px; color: var(--ink-600); font-size: .92rem; }
.steps li + li { margin-top: 6px; }
.resend { margin-top: 12px; }
.auth-forgot { margin-top: 16px; }

/* ---------- Movimiento ---------- */
.reveal { animation: rise .55s cubic-bezier(.2, .7, .2, 1) both; }
.page > .reveal:nth-child(2), .form-stack > .reveal:nth-child(3) { animation-delay: .06s; }
.page > .reveal:nth-child(3), .form-stack > .reveal:nth-child(4) { animation-delay: .12s; }
.page > .reveal:nth-child(4), .form-stack > .reveal:nth-child(5) { animation-delay: .18s; }
.doc-main .reveal:nth-child(2) { animation-delay: .08s; }
.doc-main .reveal:nth-child(3) { animation-delay: .14s; }
.doc-side.reveal { animation-delay: .1s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px); } 7%, 86% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); visibility: hidden; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(14, 122, 78, .45); } 70% { box-shadow: 0 0 0 8px rgba(14, 122, 78, 0); } 100% { box-shadow: 0 0 0 0 rgba(14, 122, 78, 0); } }
@keyframes float { 50% { transform: rotate(-2.5deg) translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Administración ---------- */
.admin-badge { align-self: flex-start; margin: 10px 8px 4px; padding: 3px 9px; border-radius: 6px; background: rgba(245, 179, 1, .14); color: var(--amber); font-size: .66rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
body.admin-acceso { min-height: 100vh; margin: 0; background: radial-gradient(1200px 600px at 80% -10%, rgba(245, 179, 1, .10), transparent 60%), var(--ink-950); }
.admin-acceso-main { display: flex; flex-direction: column; align-items: center; gap: 26px; min-height: 100vh; padding: 64px 20px; }
.admin-acceso-main > .brand .wordmark { color: #fff; }
.admin-card { padding: 34px 32px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); }
.admin-acceso .center-card { margin-top: 0; padding: 34px 32px; background: var(--surface); border-radius: 18px; }
.codigo-input { font: 700 1.6rem/1.2 var(--font-plate) !important; letter-spacing: .4em; text-align: center; }
.totp-alta { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 22px; align-items: start; padding: 18px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.totp-qr { padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.totp-qr svg { display: block; width: 100%; height: auto; }
.totp-secreto { margin: 0 0 16px; font: 700 .95rem/1.4 var(--font-plate); letter-spacing: .08em; word-break: break-all; color: var(--ink-950); }
a.stat { color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.stat:hover { border-color: var(--amber); transform: translateY(-1px); }
.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat strong small { font-size: .55em; color: var(--ink-400); }
.stats-4 .stat strong { white-space: nowrap; font-size: clamp(1.25rem, 2.2vw, 2rem); }
.section-title { margin: 26px 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-500); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 18px; }
.admin-grid > div > .panel + .panel, .admin-grid > aside > .panel + .panel { margin-top: 16px; }
.admin-grid .panel, .tabla-panel { overflow-x: auto; }
.tabla-panel { padding: 0; }
.tabla { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabla th { padding: 10px 12px; text-align: left; color: var(--ink-500); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.tabla td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla a { color: var(--ink-950); font-weight: 600; text-decoration-color: var(--amber); text-underline-offset: 3px; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--font-plate); letter-spacing: .04em; }
.nowrap { white-space: nowrap; }
.salud { list-style: none; margin: 0; padding: 0; }
.salud li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 10px 0 10px 14px; border-bottom: 1px solid var(--line); position: relative; font-size: .88rem; }
.salud li::before { content: ""; position: absolute; left: 0; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-200); }
.salud li.is-bien::before { background: var(--green); }
.salud li.is-mal::before { background: var(--red); }
.salud li.is-aviso::before { background: var(--amber); }
.salud li small { flex-basis: 100%; color: var(--red); }
.salud span { color: var(--ink-600); }
.subtitulo { margin: 20px 0 6px; font-size: .95rem; }
.buscador { display: flex; gap: 8px; flex-wrap: wrap; }
.buscador input { min-width: 260px; }
.paginacion { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; color: var(--ink-500); font-size: .88rem; }
.datos { display: grid; gap: 10px; margin: 0; }
.datos div { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.datos div:last-child { border-bottom: 0; padding-bottom: 0; }
.datos dt { color: var(--ink-500); font-size: .85rem; }
.datos dd { margin: 0; text-align: right; font-weight: 600; }
.con-sufijo { display: flex; align-items: center; gap: 10px; }
.con-sufijo input { max-width: 140px; }
.con-sufijo span { color: var(--ink-500); font-size: .85rem; }
.documento-vista { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.documento-vista.es-imagen { height: auto; max-height: 720px; object-fit: contain; }
@media (max-width: 1080px) { .admin-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-badge { display: none; }
  .totp-alta { grid-template-columns: minmax(0, 1fr); }
  .totp-qr { max-width: 200px; }
  .buscador input { min-width: 0; flex: 1; }
  .admin-card, .admin-acceso .center-card { padding: 26px 20px; }
  .documento-vista { height: 460px; }
}

/* ---------- Adaptación a pantallas ---------- */
@media (max-width: 1180px) and (min-width: 861px) {
  .list-head, .list-row { grid-template-columns: 170px minmax(0, 1fr) 110px; }
  .list-head span:nth-child(3), .cell-parties { display: none; }
}
@media (max-width: 1080px) {
  .doc-grid { grid-template-columns: minmax(0, 1fr); }
  .doc-side { position: static; order: -1; }
}
@media (max-width: 960px) {
  body.auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 26px 24px 30px; }
  .auth-pitch { margin-top: 28px; }
  .auth-pitch h2 { font-size: 1.75rem; }
  .ticket, .auth-points, .auth-foot { display: none; }
  .auth-main { padding: 36px 20px 56px; }
}
@media (max-width: 860px) {
  body.app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 6px; padding: 10px 12px; overflow-x: auto; }
  .sidebar .brand { padding: 0 6px 0 0; }
  .wordmark, .nav-label, .user { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { width: auto; padding: 8px 10px; white-space: nowrap; }
  .nav-item.is-active { box-shadow: inset 0 -3px 0 var(--amber); }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .page { padding: 26px 16px 90px; }
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat strong { font-size: 1.5rem; }
  .list-head { display: none; }
  .list-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 16px; }
  .cell-status { grid-column: 2; grid-row: 1; }
  .cell-route, .cell-parties { grid-column: 1 / -1; }
  .grid-2, .parties, .facts { grid-template-columns: minmax(0, 1fr); }
  .facts > div:nth-last-child(-n+1) { border-bottom: 0; }
  .panel { padding: 20px 18px; }
  .plate-lg { height: 42px; }
  .plate-lg .plate-num { font-size: 1.6rem; }
}
@media (max-width: 520px) {
  .nav-item span { display: none; }
  .stat { padding: 12px 12px 14px; }
  .stat span { font-size: .72rem; line-height: 1.25; }
  .stat strong { font-size: 1.35rem; }
  .stat::after { left: 12px; right: 12px; }
  .toast { left: 16px; right: 16px; }
}
