:root {
  --navy: #123b5d;
  --navy-2: #0c2b45;
  --orange: #e8711a;
  --green: #0f8a5f;
  --bg: #f3f5f8;
  --border: #e2e7ee;
  --bs-primary: #123b5d;
  --bs-primary-rgb: 18, 59, 93;
  --bs-link-color: #1d5a8c;
  --bs-link-hover-color: #123b5d;
  --bs-font-sans-serif: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
body { background: var(--bg); color: #1f2933; font-size: .935rem; }
.btn-primary { --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy); --bs-btn-hover-bg: var(--navy-2); --bs-btn-hover-border-color: var(--navy-2); --bs-btn-active-bg: var(--navy-2); }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--orange); --bs-btn-border-color: var(--orange); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #cf5f0d; --bs-btn-hover-border-color: #cf5f0d; --bs-btn-active-bg: #cf5f0d; --bs-btn-active-color:#fff; }
.text-navy { color: var(--navy) !important; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 262px; flex-shrink: 0; background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); color: #cfe0ee; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: .75rem; align-items: center; padding: 1.25rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 42px; height: 42px; border-radius: 10px; background: var(--orange); color: #fff; font-weight: 800; display: grid; place-items: center; letter-spacing: .5px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.brand-title { color: #fff; font-weight: 700; line-height: 1.1; }
.brand-sub { font-size: .75rem; opacity: .75; }
.sidebar .nav { padding: .75rem .6rem 2rem; }
.sidebar .nav-link { color: #cfe0ee; border-radius: 8px; padding: .55rem .75rem; display: flex; gap: .65rem; align-items: center; font-size: .9rem; }
.sidebar .nav-link i { font-size: 1.05rem; opacity: .9; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: rgba(232,113,26,.18); color: #fff; box-shadow: inset 3px 0 0 var(--orange); }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 1rem .75rem .35rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 1.5rem; position: sticky; top: 0; z-index: 20; }
.topbar-title { font-weight: 600; color: var(--navy); }
.content { padding: 1.5rem; flex: 1; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; color: var(--navy); margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.app-footer { padding: 1rem 1.5rem; color: #8592a3; font-size: .78rem; border-top: 1px solid var(--border); background: #fff; }

@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: -280px; z-index: 1050; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .content { padding: 1rem; }
}

/* Cards */
.card { border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; color: var(--navy); border-radius: 12px 12px 0 0 !important; }
.kpi { padding: 1.1rem 1.2rem; display: flex; flex-direction: row; gap: 1rem; align-items: center; }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1; color: #111827; }
.kpi-label { font-size: .8rem; color: #6b7280; margin-top: .2rem; }

/* Tables */
.table { --bs-table-hover-bg: #f6f9fc; margin-bottom: 0; }
.table thead th { background: #f8fafc; color: #52606d; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
.numero { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; color: #374151; white-space: nowrap; }
.mention-pill { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #fff; white-space: nowrap; }
.progress-sign { height: 6px; width: 70px; }

/* Registre view */
.pv-field { display: grid; grid-template-columns: 170px 1fr; gap: .25rem 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--border); }
.pv-field:last-child { border-bottom: 0; }
.pv-label { color: #6b7280; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; padding-top: .1rem; }
.pv-value { font-weight: 500; }
@media (max-width: 575.98px) { .pv-field { grid-template-columns: 1fr; } }

.jury-row { display: flex; gap: 1rem; align-items: center; padding: .9rem 0; border-bottom: 1px solid var(--border); }
.jury-row:last-child { border-bottom: 0; }
.jury-qr { width: 104px; height: 104px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: #fff; flex-shrink: 0; cursor: zoom-in; }
.jury-sig { max-height: 64px; max-width: 160px; }
.jury-role { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--orange); font-weight: 700; }

.seal-box { border-radius: 12px; padding: 1rem; font-size: .85rem; }
.seal-ok { background: #e8f6ef; border: 1px solid #b7e3cc; color: #0b5d40; }
.seal-ko { background: #fdecec; border: 1px solid #f5b5b5; color: #8a1c1c; }
.seal-pending { background: #fff6e8; border: 1px solid #f6d6a8; color: #7a4a0b; }
.hash { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .72rem; word-break: break-all; opacity: .85; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, #1d5a8c 0%, transparent 60%), linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; border-radius: 16px; border: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-flag { height: 5px; background: linear-gradient(90deg, #f77f00 33%, #fff 33% 66%, #009e60 66%); border-radius: 16px 16px 0 0; }

/* Public pages (signature / vérification) */
.public-body { background: var(--bg); }
.public-head { background: var(--navy); color: #fff; padding: 1rem 0; }
.public-head small { opacity: .8; }
.sig-pad-wrap { border: 2px dashed #b8c4d2; border-radius: 12px; background: #fff; position: relative; touch-action: none; }
.sig-pad-wrap canvas { width: 100%; height: 220px; display: block; border-radius: 12px; }
.sig-pad-hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: #a0aec0; font-size: .8rem; pointer-events: none; }

.form-section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--orange); font-weight: 700; margin-bottom: .75rem; }
.mention-preview { min-height: 38px; display: flex; align-items: center; }
.required::after { content: " *"; color: #dc3545; }
.filters .form-control, .filters .form-select { font-size: .85rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: #8592a3; }
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .6; }
