:root {
  --celeste: #23C2F3;      /* color del logo */
  --blue: #2287C9;         /* color del logo (texto AGEFEC) */
  --deep: #0B4F82;         /* derivado oscuro: texto/botones (contraste AAA sobre blanco) */
  --ink: #14232f;
  --muted: #4c5f6e;
  --line: #d4e6f0;
  --soft: #eef9fe;
  --bg: #f3fbfe;
  --card: #ffffff;
  --danger: #b3261e;
  --ok: #17703f;
  --q-fortaleza: #1b7fc2;
  --q-debilidade: #5a6f9e;
  --q-ameaza: #0B4F82;
  --q-oportunidade: #0e9bc4;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(11,79,130,.06), 0 8px 24px rgba(11,79,130,.08);
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  background-image: radial-gradient(900px 400px at 85% -10%, rgba(35,194,243,.22), transparent 70%), radial-gradient(700px 380px at -10% 0%, rgba(34,135,201,.12), transparent 70%);
  background-repeat: no-repeat;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--deep); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; color: var(--deep); }
h1 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--deep); }
:focus-visible { outline: 3px solid var(--celeste); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 64px; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 0; flex-wrap: wrap; }
.topbar .logo { height: 64px; width: auto; display: block; background: #fff; border-radius: 14px; padding: 4px 10px; box-shadow: var(--shadow); }
.topbar .grow { flex: 1; min-width: 160px; }
.topbar .title { font-weight: 700; color: var(--deep); font-size: 1.05rem; }
.topbar .sub { color: var(--muted); font-size: .88rem; }
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.langs button { border: 0; background: none; padding: 6px 12px; font: inherit; font-size: .88rem; cursor: pointer; color: var(--muted); min-height: 36px; }
.langs button[aria-pressed="true"] { background: var(--deep); color: #fff; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.btn { font: inherit; font-weight: 600; border-radius: 12px; border: 1px solid var(--deep); background: var(--deep); color: #fff; padding: 9px 16px; min-height: 44px; cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s; }
.btn:hover { box-shadow: 0 6px 16px rgba(11,79,130,.25); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.sec { background: #fff; color: var(--deep); }
.btn.sec:hover { background: var(--soft); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.sm { min-height: 36px; padding: 5px 11px; font-size: .88rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.celeste { background: var(--celeste); border-color: var(--celeste); color: #04202f; }

input[type=text], input[type=datetime-local], textarea, select {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid #aac8da; background: #fff; color: var(--ink); min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 4px; color: var(--deep); }
.field { margin-bottom: 14px; }

.notice { display: flex; gap: 10px; align-items: flex-start; background: #fff8e1; border: 1px solid #f0d98a; color: #503c00; border-radius: 12px; padding: 12px 14px; font-size: .94rem; }
.notice.info { background: var(--soft); border-color: #b9e4f5; color: #05364f; }
.notice.err { background: #fdecea; border-color: #f2b8b5; color: #601410; }
.notice svg { flex: none; margin-top: 2px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: 14px; margin: 8px 0 18px; scrollbar-width: thin; }
.tabs button { flex: none; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 9px 16px; border-radius: 10px; cursor: pointer; min-height: 42px; transition: background .2s, color .2s; }
.tabs button[aria-selected="true"] { background: var(--deep); color: #fff; }
.tabs button:not([aria-selected="true"]):hover { background: var(--soft); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--deep); border: 1px solid #b9e4f5; white-space: nowrap; }
.chip.fortaleza { background: #e3f2fc; color: #0b4f82; }
.chip.debilidade { background: #e9edf6; color: #3b4a70; }
.chip.ameaza { background: #dde8f1; color: #0b3a60; }
.chip.oportunidade { background: #def5fc; color: #06556f; }
.chip.test { background: #fff3cd; color: #5b4300; border-color: #f0d98a; }
.chip.closed { background: #eee; color: #444; border-color: #ccc; }

/* ----- Tablero DAFO ----- */
.board { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quad { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 200px; animation: rise .5s var(--ease) both; }
.quad:nth-child(2) { animation-delay: .06s; } .quad:nth-child(3) { animation-delay: .12s; } .quad:nth-child(4) { animation-delay: .18s; }
.quad > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #fff; }
.quad.fortaleza > header { background: var(--q-fortaleza); }
.quad.debilidade > header { background: var(--q-debilidade); }
.quad.ameaza > header { background: var(--q-ameaza); }
.quad.oportunidade > header { background: var(--q-oportunidade); }
.quad > header .letter { width: 32px; height: 32px; display: grid; place-items: center; background: rgba(255,255,255,.22); border-radius: 50%; font-weight: 800; }
.quad > header h2 { color: #fff; margin: 0; font-size: 1.1rem; }
.quad > header .count { margin-left: auto; background: rgba(255,255,255,.22); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: .85rem; }
.quad .body { padding: 12px; display: grid; gap: 10px; align-content: start; flex: 1; }
.empty { color: var(--muted); font-size: .92rem; padding: 14px 6px; text-align: center; }

.group { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fcfeff; transition: box-shadow .2s, border-color .2s, background .3s; }
.group:hover { box-shadow: 0 4px 14px rgba(11,79,130,.12); border-color: #b9e4f5; }
.group.enter { animation: pop .55s var(--ease) both; }
.group.flash { animation: flash 1.2s ease-out; }
.group .gtop { display: flex; gap: 10px; align-items: flex-start; }
.group .gtitle { font-weight: 650; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.group .gmeta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.group .toggle { background: none; border: 0; font: inherit; color: var(--deep); font-size: .86rem; cursor: pointer; text-decoration: underline; padding: 4px 0; min-height: 32px; }
.votebar { height: 6px; background: #dcecf4; border-radius: 99px; overflow: hidden; flex: 1; min-width: 50px; }
.votebar > i { display: block; height: 100%; background: var(--celeste); width: 0; transition: width .6s var(--ease); }
.voter { display: inline-flex; align-items: center; gap: 4px; }
.voter button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--deep); background: #fff; color: var(--deep); font-size: 1.2rem; line-height: 1; cursor: pointer; transition: transform .12s, background .15s; }
.voter button:hover:not([disabled]) { background: var(--soft); }
.voter button:active:not([disabled]) { transform: scale(.88); }
.voter button[disabled] { opacity: .35; cursor: not-allowed; }
.voter output { min-width: 22px; text-align: center; font-weight: 800; color: var(--deep); }
.pop { animation: bump .35s var(--ease); }
.clist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.clist li { background: var(--soft); border-radius: 10px; padding: 8px 10px; font-size: .92rem; }
.clist .orig { color: var(--muted); font-size: .85rem; margin-top: 4px; font-style: italic; overflow-wrap: anywhere; }
.clist .who { font-weight: 700; color: var(--deep); font-size: .82rem; }
.clist select { min-height: 36px; padding: 4px 8px; font-size: .85rem; width: auto; max-width: 100%; }
.sticky { position: sticky; top: 8px; z-index: 20; }
.votepill { display: inline-flex; gap: 8px; align-items: center; background: var(--deep); color: #fff; border-radius: 999px; padding: 8px 16px; font-weight: 700; box-shadow: var(--shadow); }
.votepill .dots { display: inline-flex; gap: 4px; }
.votepill .dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.3); transition: background .25s, transform .25s; }
.votepill .dots i.on { background: var(--celeste); transform: scale(1.15); }

.mine { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.mine li { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; animation: rise .4s var(--ease) both; }
.mine .txt { overflow-wrap: anywhere; white-space: pre-wrap; }
.mine .meta { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.spinner { width: 14px; height: 14px; border: 2px solid #b9e4f5; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }

table.t { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.t th, table.t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--deep); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tablewrap { overflow-x: auto; }
.linkbox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; word-break: break-all; color: var(--muted); }

.report h2 { margin-top: 1.4em; }
.report .came { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.report .came > div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
.report ul { padding-left: 1.2em; margin: .4em 0; }
.prio { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prio .n { width: 30px; height: 30px; border-radius: 50%; background: var(--deep); color: #fff; display: grid; place-items: center; font-weight: 800; }

.hero { text-align: center; padding: 56px 16px; }
.hero img { max-width: 320px; width: 70%; height: auto; }
.center { max-width: 560px; margin: 40px auto; }
dialog { border: 0; border-radius: var(--radius); padding: 22px; max-width: 460px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(5,30,48,.5); backdrop-filter: blur(2px); }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: min(92vw, 440px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); animation: rise .3s var(--ease) both; }
.toast.err { background: var(--danger); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { background: #d8f4fd; } 100% { background: #fcfeff; } }
@keyframes bump { 50% { transform: scale(1.25); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .board, .grid2, .report .came { grid-template-columns: 1fr; }
  .topbar .logo { height: 48px; }
  .wrap { padding: 0 12px 64px; }
  .card { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print { .topbar .langs, .tabs, .btn { display: none; } }
