/* ═══════════════════════════════════════════════════════════════════
   ARIA Search — sistema visual
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --navy: #0D2B4E; --navy-mid: #1A3F6F; --navy-light: #2E5FA3; --navy-deep: #081D36;
  --gold: #C8973A; --gold-light: #E8B84B; --gold-bg: #FDF5E6; --gold-text: #7D4E0F; --gold-border: #E8C88A;
  --surface: #F3F5F9; --white: #FFFFFF; --card: #FFFFFF;
  --text: #1A1F2E; --text-soft: #3D4A5C; --muted: #6B7A8D;
  --border: #CDD5E0; --border-light: #E1E6EE;
  --green: #1A5232; --green-bg: #E8F5EE; --green-border: #A9D6BC;
  --red: #7B1E1E; --red-bg: #FBEAEA; --red-border: #E8AAAA;
  --blue-bg: #EAF1FA; --blue-border: #B8CEE8;
  --violet: #4A2D8A; --violet-bg: #F2EEF9; --violet-border: #C5B3E8;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(13,43,78,.06), 0 6px 18px rgba(13,43,78,.05);
  --shadow-hover: 0 8px 28px rgba(13,43,78,.14);
  --serif: 'Libre Baskerville', Georgia, serif;
  --sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--navy-light); }
code { background: var(--blue-bg); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar { background: linear-gradient(90deg, var(--navy-deep), var(--navy) 55%, var(--navy-mid)); border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-text { font-family: var(--serif); font-size: 1.2rem; letter-spacing: .03em; }
.brand-text b { color: var(--gold-light); font-weight: 700; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { color: #B9CBE0; text-decoration: none; font-weight: 600; font-size: .92rem; padding: 8px 14px; border-radius: 8px; transition: background .15s, color .15s; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav a.active { color: var(--navy); background: var(--gold-light); }
.usage { margin-left: auto; font-size: .75rem; color: #8FA9C6; white-space: nowrap; }
.logout { background: none; border: 1px solid rgba(255,255,255,.25); color: #B9CBE0; border-radius: 8px; padding: 5px 12px; font-size: .8rem; font-weight: 600; cursor: pointer; }
.logout:hover { color: #fff; border-color: var(--gold-light); }
.usage + .logout { margin-left: 4px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: 4px 10px; font-size: 1.1rem; cursor: pointer; }

.app { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 26px 20px 50px; outline: none; }
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1320px; width: 100%; margin: 0 auto; padding: 18px 20px 26px; color: var(--muted); font-size: .76rem; letter-spacing: .04em; border-top: 1px solid var(--border-light); }

/* ── Encabezado de página ───────────────────────────────────────── */
.page-head { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, var(--navy-light) 100%); color: #fff; border-radius: 16px; padding: 26px 30px; margin-bottom: 22px; border-bottom: 4px solid var(--gold); box-shadow: 0 6px 24px rgba(13,43,78,.18); }
.page-head::after { content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(232,184,75,.16), transparent 70%); pointer-events: none; }
.page-kicker { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-light); font-weight: 700; margin-bottom: 6px; }
.page-title { font-family: var(--serif); font-size: 1.85rem; margin: 0 0 6px; line-height: 1.15; }
.page-title span { color: var(--gold-light); }
.page-sub { color: #C2D3E8; max-width: 760px; margin: 0; font-size: .95rem; }
.page-stats { display: flex; gap: 28px; margin-top: 16px; flex-wrap: wrap; }
.page-stat b { display: block; font-family: var(--serif); font-size: 1.35rem; color: var(--gold-light); }
.page-stat span { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #9DB5D0; }

/* ── Inicio ─────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 46px 20px 34px; }
.hero h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4vw, 2.8rem); color: var(--navy); margin: 0 0 10px; line-height: 1.12; }
.hero h1 span { color: var(--gold); }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; font-size: 1.02rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 8px; }
.tile { position: relative; background: var(--card); border: 1px solid var(--border-light); border-radius: 16px; padding: 26px 24px 22px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s; display: flex; flex-direction: column; overflow: hidden; }
.tile::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--gold), var(--navy-light)); }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--navy-light); }
.tile-icon { width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; font-size: 1.5rem; background: var(--navy); color: var(--gold-light); margin-bottom: 14px; }
.tile h2 { font-family: var(--serif); font-size: 1.2rem; color: var(--navy); margin: 0 0 6px; }
.tile p { color: var(--text-soft); font-size: .9rem; margin: 0 0 14px; flex: 1; }
.tile ul { margin: 0 0 16px; padding-left: 18px; color: var(--muted); font-size: .84rem; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border-light); padding-top: 12px; font-size: .8rem; color: var(--muted); }
.tile-go { color: var(--navy-light); font-weight: 700; }
.tile-new { position: absolute; top: 16px; right: 16px; }
.how { margin-top: 30px; background: var(--card); border: 1px solid var(--border-light); border-radius: 16px; padding: 22px 26px; }
.how h3 { font-family: var(--serif); color: var(--navy); margin: 0 0 12px; font-size: 1.05rem; }
.how ol { margin: 0; padding-left: 20px; color: var(--text-soft); font-size: .9rem; }
.how li { margin-bottom: 6px; }

/* ── Layout de buscador ─────────────────────────────────────────── */
.workspace { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.filters { position: sticky; top: 82px; background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%); border-radius: 14px; border-right: 3px solid var(--gold); color: #C8D8EC; padding: 18px 18px 8px; max-height: calc(100vh - 100px); overflow: auto; }
.filters::-webkit-scrollbar { width: 6px; } .filters::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.filters > summary { display: none; }
.fgroup { padding: 12px 0 14px; border-bottom: 1px solid rgba(255,255,255,.09); }
.fgroup:last-child { border-bottom: none; }
.fgroup h4 { margin: 0 0 9px; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-light); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.fgroup h4 button { background: none; border: none; color: #8FA9C6; font-size: .66rem; cursor: pointer; text-transform: none; letter-spacing: 0; padding: 0; }
.fgroup h4 button:hover { color: #fff; }
.fhint { font-size: .74rem; color: #8FA9C6; margin: -4px 0 8px; }
.check { display: flex; gap: 9px; align-items: flex-start; padding: 4px 0; font-size: .86rem; color: #C3D3E6; cursor: pointer; line-height: 1.35; }
.check input { accent-color: var(--gold-light); margin-top: 3px; flex-shrink: 0; }
.check small { display: block; color: #8098B4; font-size: .74rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; font-size: .76rem; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); color: #A9BDD4; cursor: pointer; transition: all .12s; user-select: none; }
.chip input:checked + span { background: var(--gold-light); color: var(--navy); border-color: var(--gold-light); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.filters .field { width: 100%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: .86rem; }
.filters .field::placeholder { color: #7891AE; }
.filters select.field option { color: var(--text); }
.subgroup { font-size: .7rem; color: #7E98B6; text-transform: uppercase; letter-spacing: .08em; margin: 10px 0 6px; }

.mainpane { min-width: 0; }
.searchbar { background: var(--card); border: 1px solid var(--border-light); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 18px; }
.searchrow { display: flex; gap: 10px; }
.searchrow .input { flex: 1; }
.input, .select, .textarea { width: 100%; background: var(--white); border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 14px; color: var(--text); font-size: .98rem; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy-light); box-shadow: 0 0 0 3px rgba(46,95,163,.13); }
.textarea { min-height: 80px; resize: vertical; font-size: .9rem; }
.select { width: auto; padding-right: 30px; }
.search-extra { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: .84rem; color: var(--muted); }
.search-extra label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.filelabel { display: inline-flex; gap: 6px; align-items: center; color: var(--navy-light); font-weight: 600; cursor: pointer; }
.filelabel input { display: none; }
.pdf-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ── Botones ────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; padding: 10px 18px; font-weight: 700; font-size: .9rem; border: 1.5px solid transparent; cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s; white-space: nowrap; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary { background: linear-gradient(135deg, var(--navy), var(--navy-mid)); color: #fff; border-color: var(--navy-light); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(13,43,78,.25); border-color: var(--gold); }
.btn-gold { background: var(--gold-light); color: var(--navy); border-color: var(--gold); }
.btn-gold:hover:not(:disabled) { background: var(--gold); color: #fff; }
.btn-ghost { background: var(--white); color: var(--navy); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--navy-light); background: var(--blue-bg); }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover:not(:disabled) { filter: brightness(1.12); }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Barra de estado / acciones ─────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 14px; }
.toolbar .grow { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--navy); color: var(--gold-light); font-weight: 700; font-size: .78rem; letter-spacing: .05em; padding: 7px 13px; border-radius: 8px; border-left: 3px solid var(--gold); }
.notice { border-radius: 10px; padding: 11px 14px; font-size: .87rem; margin: 0 0 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.notice-info { background: var(--blue-bg); border-color: var(--blue-border); color: var(--navy-mid); }
.notice-ok { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.notice-warn { background: var(--gold-bg); border-color: var(--gold-border); color: var(--gold-text); }
.notice-err { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }

/* ── Tarjetas de resultado ──────────────────────────────────────── */
.cards { display: grid; gap: 14px; }
.rcard { position: relative; background: var(--card); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 18px 20px 16px 24px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; overflow: hidden; }
.rcard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--gold), var(--navy-light)); }
.rcard:hover { border-color: var(--navy-light); box-shadow: var(--shadow-hover); }
.rcard.approved::before { background: var(--green); }
.rcard.rejected { opacity: .58; }
.rcard.rejected::before { background: var(--red); }
.rcard-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.rcard-num { font-family: var(--serif); font-size: 1.5rem; color: var(--border); font-weight: 700; line-height: 1; }
.rcard-title { font-family: var(--serif); font-size: 1.06rem; color: var(--navy); font-weight: 700; margin: 0 0 3px; line-height: 1.3; }
.rcard-url { font-size: .78rem; word-break: break-all; color: var(--muted); }
.rcard-url a { color: var(--navy-light); text-decoration: none; }
.rcard-url a:hover { text-decoration: underline; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; border: 1px solid; white-space: nowrap; }
.b-navy { background: var(--blue-bg); color: var(--navy-mid); border-color: var(--blue-border); }
.b-gold { background: var(--gold-bg); color: var(--gold-text); border-color: var(--gold-border); }
.b-green { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.b-red { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.b-violet { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-border); }
.b-grey { background: #F0F3F8; color: #3D4A5C; border-color: #C0CBDA; }
.stars { color: var(--gold); letter-spacing: 1px; font-size: .95rem; }
.stars i { color: var(--border); font-style: normal; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; margin-top: 10px; }
.fields .full { grid-column: 1 / -1; }
.flabel { font-size: .64rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border-light); padding-bottom: 2px; margin-bottom: 3px; }
.fval { font-size: .88rem; color: var(--text-soft); word-break: break-word; }
.fval ul { margin: 0; padding-left: 18px; }
.decision { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border-light); }
.seg { display: inline-flex; border: 1.5px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg button { background: var(--white); border: none; padding: 6px 12px; font-size: .8rem; font-weight: 600; color: var(--text-soft); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on[data-v="Aprobado"] { background: var(--green); color: #fff; }
.seg button.on[data-v="Rechazado"] { background: var(--red); color: #fff; }
.seg button.on[data-v="Pendiente"] { background: var(--navy); color: #fff; }
.decision .input { flex: 1; min-width: 200px; padding: 7px 11px; font-size: .86rem; }

.block-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.block-head .badge { font-size: .72rem; }
.block-head .line { flex: 1; height: 1px; background: var(--border); }

.more { text-align: center; border: 1.5px dashed var(--blue-border); border-radius: 14px; padding: 22px; margin-top: 22px; background: linear-gradient(135deg, rgba(46,95,163,.04), rgba(200,151,58,.05)); }
.more h3 { font-family: var(--serif); color: var(--navy); margin: 0 0 4px; font-size: 1.02rem; }
.more p { color: var(--muted); font-size: .85rem; margin: 0 0 14px; }
.more .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.fixbox { background: var(--gold-bg); border: 1px solid var(--gold-border); border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; padding: 14px 16px; margin: 16px 0; }
.fixbox h4 { margin: 0 0 6px; font-size: .7rem; letter-spacing: .13em; text-transform: uppercase; color: var(--gold-text); }
.fixbox p { margin: 0 0 8px; font-size: .86rem; color: var(--text-soft); }

/* ── Estado vacío / carga ───────────────────────────────────────── */
.empty { text-align: center; padding: 56px 20px; background: var(--card); border: 1.5px dashed var(--border); border-radius: 14px; color: var(--muted); }
.empty .ico { font-size: 2.4rem; opacity: .55; margin-bottom: 8px; }
.empty h3 { font-family: var(--serif); color: var(--navy); margin: 0 0 6px; font-size: 1.1rem; }
.empty p { margin: 0 auto; max-width: 520px; font-size: .9rem; }
.loading { display: flex; gap: 16px; align-items: center; background: var(--card); border: 1px solid var(--border-light); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 14px; }
.loading .mascot, .loading .dog { flex-shrink: 0; }
.loading .dog { width: 110px; height: auto; }
.loading b { color: var(--navy); display: block; }
.loading span { color: var(--muted); font-size: .86rem; }
.mascot .glass { transform-origin: 40px 30px; animation: sweep 1.4s ease-in-out infinite; }
.mascot .body { animation: bob 1.4s ease-in-out infinite; }
@keyframes sweep { 0%,100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg) translateX(3px); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.skeleton { height: 120px; border-radius: 12px; background: linear-gradient(90deg, #E9EDF3 25%, #F5F7FA 50%, #E9EDF3 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.progress { height: 8px; background: var(--border-light); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--navy-light)); border-radius: 99px; transition: width .3s; }

/* ── Schnauzer de búsqueda ─────────────────────────────────────── */
.dog { display: block; overflow: visible; }
.dog g { transform-box: view-box; }
.dog-cola   { transform-origin: 132px 190px; }
.dog-cabeza { transform-origin: 405px 175px; }
.dog-pda    { transform-origin: 410px 205px; }
.dog-pdf    { transform-origin: 355px 252px; }
.dog-pta    { transform-origin: 218px 168px; }
.dog-ptf    { transform-origin: 145px 190px; }
.dog.run .dog-cola   { animation: dogTail .32s ease-in-out infinite alternate; }
.dog.run .dog-cabeza { animation: dogSniff 1.1s ease-in-out infinite; }
.dog.run .dog-pdf, .dog.run .dog-pta { animation: dogLegA .5s ease-in-out infinite alternate; }
.dog.run .dog-pda, .dog.run .dog-ptf { animation: dogLegB .5s ease-in-out infinite alternate; }
.dog.run { animation: dogBob .25s ease-in-out infinite alternate; }
@keyframes dogTail { from { transform: rotate(-14deg); } to { transform: rotate(10deg); } }
@keyframes dogSniff { 0%,100% { transform: rotate(0deg); } 25% { transform: rotate(4deg) translateY(4px); } 35% { transform: rotate(2deg) translateY(1px); } 45% { transform: rotate(5deg) translateY(5px); } 70% { transform: rotate(-2deg); } }
@keyframes dogLegA { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
@keyframes dogLegB { from { transform: rotate(9deg); } to { transform: rotate(-9deg); } }
@keyframes dogBob { from { transform: translateY(0); } to { transform: translateY(-2%); } }
@media (prefers-reduced-motion: reduce) { .dog.run, .dog.run g { animation: none !important; } }

/* ── Stepper (Directivos) ───────────────────────────────────────── */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; counter-reset: step; }
.step { position: relative; background: var(--card); border: 1px solid var(--border-light); border-radius: 10px; padding: 10px 12px 10px 44px; font-size: .82rem; color: var(--muted); min-height: 52px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .78rem; background: var(--border-light); color: var(--muted); }
.step b { display: block; color: var(--text-soft); font-size: .85rem; }
.step.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,184,75,.18); }
.step.active::before { background: var(--gold-light); color: var(--navy); }
.step.done::before { content: '✓'; background: var(--green); color: #fff; }
.step.done b { color: var(--green); }

.panel { background: var(--card); border: 1px solid var(--border-light); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h3 { font-family: var(--serif); color: var(--navy); margin: 0 0 4px; font-size: 1.05rem; }
.panel .lead { color: var(--muted); font-size: .86rem; margin: 0 0 12px; }
.tagedit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-bg); border: 1px solid var(--blue-border); color: var(--navy-mid); padding: 4px 6px 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.tag button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; line-height: 1; padding: 0 3px; }
.tag button:hover { color: var(--red); }
.tagedit input { border: 1px dashed var(--border); border-radius: 999px; padding: 4px 12px; font-size: .8rem; min-width: 160px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: .88rem; margin-bottom: 12px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--text-soft); }

/* Tabla */
.tablewrap { overflow: auto; border: 1px solid var(--border-light); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); max-height: 70vh; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .84rem; }
table.data th { position: sticky; top: 0; z-index: 1; background: var(--navy); color: var(--gold-light); text-align: left; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; padding: 10px 12px; white-space: nowrap; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border-light); vertical-align: top; color: var(--text-soft); }
table.data tr:nth-child(even) td { background: #FAFBFD; }
table.data tr:hover td { background: var(--blue-bg); }
table.data td.nowrap { white-space: nowrap; }
table.data td a { word-break: break-all; }
.inst-row td { background: #fff; }

/* Organigrama */
.org { display: grid; gap: 18px; }
.org-inst { background: var(--card); border: 1px solid var(--border-light); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.org-inst-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; background: linear-gradient(90deg, var(--navy), var(--navy-mid)); color: #fff; }
.org-inst-head h3 { margin: 0; font-family: var(--serif); font-size: 1.02rem; }
.org-inst-head small { color: #A9C0DA; }
.org-levels { padding: 16px 18px 6px; }
.org-level { position: relative; padding-left: 18px; margin-bottom: 14px; }
.org-level::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: -8px; width: 2px; background: var(--border-light); }
.org-level:last-child::before { display: none; }
.org-level-name { font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-text); margin-bottom: 8px; position: relative; }
.org-level-name::before { content: ''; position: absolute; left: -18px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold-light); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--gold); }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.person { border: 1px solid var(--border-light); border-radius: 10px; padding: 10px 12px; background: #FBFCFE; font-size: .82rem; }
.person b { color: var(--navy); display: block; font-size: .9rem; }
.person .role { color: var(--text-soft); margin-bottom: 4px; }
.person .meta { color: var(--muted); font-size: .76rem; }
.person .contact { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.person .contact a { text-decoration: none; word-break: break-all; }
.person .contact .ok::before { content: '✓ '; color: var(--green); font-weight: 700; }
.person.saved { border-color: var(--green-border); background: var(--green-bg); }

.inst-list { display: grid; gap: 8px; }
.inst-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: 10px; background: #FBFCFE; cursor: pointer; }
.inst-item:hover { border-color: var(--navy-light); }
.inst-item input { margin-top: 4px; accent-color: var(--navy); }
.inst-item b { color: var(--navy); }
.inst-item .meta { font-size: .78rem; color: var(--muted); }
.inst-item .why { font-size: .8rem; color: var(--text-soft); }
.country-head { font-family: var(--serif); color: var(--navy); margin: 14px 0 8px; font-size: .95rem; display: flex; justify-content: space-between; align-items: center; }

.tabs { display: inline-flex; background: var(--white); border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; }
.tabs button { background: none; border: none; padding: 7px 14px; font-weight: 600; font-size: .84rem; color: var(--text-soft); cursor: pointer; }
.tabs button.on { background: var(--navy); color: var(--gold-light); }

/* ── Toasts y login ─────────────────────────────────────────────── */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--navy); color: #fff; padding: 11px 15px; border-radius: 10px; font-size: .88rem; box-shadow: 0 10px 30px rgba(0,0,0,.2); border-left: 4px solid var(--gold-light); animation: tin .2s ease-out; }
.toast.err { border-left-color: #F08A8A; }
.toast.ok { border-left-color: #7FD3A2; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.login { border: none; border-radius: 16px; padding: 0; width: min(380px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(8,29,54,.45); }
.login::backdrop { background: rgba(8,29,54,.7); backdrop-filter: blur(3px); }
.login form { padding: 28px; text-align: center; }
.login-mark { font-size: 2rem; }
.login h2 { font-family: var(--serif); color: var(--navy); margin: 6px 0; font-size: 1.2rem; }
.login p { color: var(--muted); font-size: .86rem; }
.login input { width: 100%; border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 13px; margin: 6px 0 12px; }
.login-err { color: var(--red) !important; min-height: 1em; margin: 8px 0 0; }

.muted { color: var(--muted); }
.small { font-size: .8rem; }
.right { text-align: right; }
.mt { margin-top: 14px; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .tiles { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; border-right: none; border-bottom: 3px solid var(--gold); }
  .filters > summary { display: flex; justify-content: space-between; cursor: pointer; color: var(--gold-light); font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; padding: 2px 0 10px; list-style: none; }
  .filters > summary::-webkit-details-marker { display: none; }
  .stepper { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .topbar-inner { height: auto; min-height: 58px; flex-wrap: wrap; padding: 8px 16px; gap: 10px; }
  .nav-toggle { display: block; }
  .usage { display: none; }
  .logout { order: 2; }
  .nav { display: none; width: 100%; flex-direction: column; margin: 0 0 6px; }
  .nav.open { display: flex; }
  .app { padding: 18px 16px 40px; }
  .page-head { padding: 20px; }
  .page-title { font-size: 1.45rem; }
  .searchrow { flex-direction: column; }
  .fields { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .stepper { grid-template-columns: 1fr; }
  .footer { padding: 16px; }
}

/* ── Hoja de Google ─────────────────────────────────────────────── */
.sheet-card { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; background: var(--card); border: 1px solid var(--border-light); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.sheet-icon { width: 56px; height: 56px; border-radius: 14px; background: #E8F5EE; display: grid; place-items: center; }
.sheet-card h2 { font-family: var(--serif); color: var(--navy); margin: 0 0 4px; font-size: 1.15rem; }
.sheet-card p { margin: 0; color: var(--muted); font-size: .9rem; word-break: break-all; }
.sheet-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.sheet-tab { background: var(--card); border: 1px solid var(--border-light); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.sheet-tab b { display: block; font-family: var(--serif); font-size: 1.6rem; color: var(--navy); }
.sheet-tab span { color: var(--muted); font-size: .82rem; }
.deep-box { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(232,184,75,.08); border: 1px solid rgba(232,184,75,.3); }
.via { font-size: .74rem; color: var(--muted); }
@media (max-width: 720px) { .sheet-card { grid-template-columns: 1fr; } .sheet-tabs { grid-template-columns: 1fr; } }

/* ── Empresas: banda superior + 3 columnas ── */
.emp-head { background: var(--navy); color: #fff; border-radius: 14px; padding: 20px 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.emp-head .page-kicker { color: var(--gold-light); }
.emp-head .page-title { color: #fff; }
.emp-head .page-sub { color: #C9D6E6; }
.emp-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.emp-summary span { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: #E6EDF6; border-radius: 999px; padding: 4px 12px; font-size: .8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.emp-col { background: var(--card); border: 1px solid var(--border-light); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.emp-col-h { background: var(--navy-mid); color: #fff; font-weight: 700; padding: 11px 16px; display: flex; align-items: center; gap: 10px; font-size: .95rem; border-bottom: 3px solid var(--gold); }
.emp-n { width: 24px; height: 24px; border-radius: 50%; background: var(--gold-light); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-size: .82rem; flex-shrink: 0; }
.emp-col-b { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 160px); overflow-y: auto; }
.emp-form { display: flex; flex-direction: column; gap: 8px; }
.emp-label { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.emp-subhead { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--text-soft); border-top: 1px solid var(--border-light); padding-top: 8px; }
.linkbtn { background: none; border: none; color: var(--navy-light); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.linkbtn:hover { color: var(--navy); }
.emp-group { font-size: .74rem; font-weight: 700; color: var(--gold-text); background: var(--gold-bg); border-radius: 6px; padding: 3px 8px; margin-top: 4px; }
.emp-check { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.emp-check:hover { background: var(--surface); border-color: var(--border-light); }
.emp-check input { margin-top: 3px; accent-color: var(--navy); flex-shrink: 0; }
.emp-check b { display: block; font-size: .88rem; color: var(--text); font-weight: 600; }
.emp-check small { display: block; font-size: .76rem; color: var(--muted); line-height: 1.3; }
.emp-co { padding: 4px 8px; }
.emp-hint { font-size: .8rem; color: var(--muted); margin: 0; }
.emp-hint.err { color: var(--red); background: var(--red-bg); border: 1px solid var(--red-border); border-radius: 8px; padding: 6px 10px; }
.emp-inline { display: flex; gap: 6px; }
.emp-inline .input, .emp-row .input { padding: 8px 11px; font-size: .9rem; }
.emp-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.emp-grow { flex: 1; min-width: 0; }
.emp-full { width: 100%; }
.emp-row .select, .emp-full.select { padding: 8px 30px 8px 11px; font-size: .9rem; }
.emp-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 10px; padding: 4px; }
.emp-list:empty { display: none; }
.emp-chips .chip span, .chip-light span { color: var(--text-soft); border-color: var(--border); background: var(--white); }
.chip-light input:checked + span { background: var(--navy); color: var(--gold-light); border-color: var(--navy); }
.emp-tabs { display: flex; width: 100%; }
.emp-tabs button { flex: 1; }
.emp-modebody { display: flex; flex-direction: column; gap: 8px; }
.emp-picked { display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow-y: auto; }
.emp-opts { justify-content: space-between; }
.emp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-li { background: #0A66C2; color: #fff; border-color: #0A66C2; }
.btn-li:hover { background: #004182; }
.b-li { background: #E8F1FB; color: #0A66C2; border: 1px solid #B7D3F2; }
.emp-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: .88rem; }
.emp-empty .ico { font-size: 2rem; margin-bottom: 6px; }
.emp-col-b .loading { flex-direction: column; text-align: center; padding: 16px; margin: 0; }
.fichas { display: flex; flex-direction: column; gap: 10px; }
.ficha { border: 1px solid var(--border-light); border-left: 4px solid var(--navy-light); border-radius: 10px; padding: 11px 13px; background: var(--white); }
.ficha.saved { border-left-color: var(--green); }
.ficha-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ficha-top b { font-family: var(--serif); color: var(--navy); font-size: .98rem; }
.ficha-role { color: var(--gold-text); font-weight: 600; font-size: .86rem; margin: 2px 0 6px; }
.ficha-dl { display: grid; grid-template-columns: 70px 1fr; gap: 3px 8px; margin: 0 0 4px; font-size: .82rem; }
.ficha-dl dt { color: var(--muted); font-weight: 600; }
.ficha-dl dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.emp-editor { border: none; border-radius: 14px; padding: 0; width: min(760px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.emp-editor::backdrop { background: rgba(8,29,54,.55); }
.emp-ed { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.emp-ed h3 { font-family: var(--serif); color: var(--navy); margin: 0; }
.emp-ed-table { max-height: 46vh; overflow: auto; border: 1px solid var(--border-light); border-radius: 10px; }
.emp-ed-table table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.emp-ed-table th, .emp-ed-table td { padding: 6px 9px; border-bottom: 1px solid var(--border-light); text-align: left; }
.emp-ed-table th { position: sticky; top: 0; background: var(--surface); }
.nowrap { white-space: nowrap; }
@media (max-width: 1100px) { .emp-grid { grid-template-columns: 1fr 1fr; } .emp-grid .emp-col:last-child { grid-column: 1 / -1; } }
@media (max-width: 720px) { .emp-grid { grid-template-columns: 1fr; } .emp-col-b { max-height: none; } .emp-actions { grid-template-columns: 1fr; } .emp-head { padding: 16px; } }
