:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1c1b19; --muted: #6b675f; --line: #e3dfd6;
  --accent: #1f5f4a; --accent-ink: #ffffff; --accent-soft: #e3efe9;
  --warn: #8a5a00; --warn-soft: #fbf0d9; --bad: #9b2c2c; --bad-soft: #fbe6e3;
  --info: #2c4f7c; --info-soft: #e4ecf7; --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }

.side { position: fixed; inset: 0 auto 0 0; width: 232px; background: #17211d; color: #d9e2dd;
  padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.1rem; overflow-y: auto; }
.brand { color: #fff; font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.orgpick label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: #8fa59b; margin-bottom: .3rem; }
.orgpick select { width: 100%; background: #22302a; color: #fff; border: 1px solid #34463e; }
.side nav { display: flex; flex-direction: column; gap: .15rem; }
.side nav a { color: #d9e2dd; padding: .45rem .6rem; border-radius: 7px; }
.side nav a:hover { background: #22302a; text-decoration: none; }
.side nav a.on { background: var(--accent); color: #fff; }
.who { margin-top: auto; font-size: .87rem; color: #8fa59b; }
.who strong { color: #fff; display: block; }
.who form { margin-top: .5rem; }
.linkbtn { background: none; border: 0; padding: 0; color: #b9c9c1; cursor: pointer; font: inherit; }
.linkbtn:hover { color: #fff; text-decoration: underline; }

.main { margin-left: 232px; padding: 1.75rem 2rem 4rem; max-width: 1180px; }
.main.solo { margin: 0 auto; max-width: 420px; padding-top: 12vh; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.25rem; flex-wrap: wrap; }
.crumbs { font-size: .87rem; color: var(--muted); margin-bottom: .2rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; margin-bottom: 1.1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.grid .card { margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.stat b { display: block; font-size: 1.5rem; letter-spacing: -.01em; }
.stat span { color: var(--muted); font-size: .87rem; }

label { display: block; font-weight: 600; font-size: .9rem; margin: .7rem 0 .25rem; }
label.check { display: flex; align-items: center; gap: .45rem; font-weight: 400; margin: .3rem 0; }
label.check input { width: auto; }
input[type=text], input[type=password], input[type=file], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid #cfc9bd; border-radius: 7px; background: #fff;
  font: inherit; color: inherit; }
textarea { min-height: 7rem; resize: vertical; }
textarea.tall { min-height: 14rem; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.hint { color: var(--muted); font-size: .85rem; margin: .2rem 0 0; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.top { margin-top: .9rem; }
.inline { display: inline; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem .7rem; margin: .8rem 0 0; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .35rem; }

.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 7px; padding: .5rem .95rem; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.sm { padding: .25rem .6rem; font-size: .85rem; font-weight: 500; }
.btn.danger { background: transparent; color: var(--bad); border-color: #dcb1ab; }

.flash { border-radius: 8px; padding: .65rem .9rem; margin-bottom: .9rem; border: 1px solid; }
.flash.ok { background: var(--accent-soft); border-color: #b9d5c8; color: #17483a; }
.flash.error { background: var(--bad-soft); border-color: #eab9b2; color: var(--bad); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; }
.tabs a { padding: .55rem .9rem; border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; }
.tabs a.on { background: var(--panel); border: 1px solid var(--line); border-bottom-color: var(--panel);
  margin-bottom: -1px; color: var(--ink); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: #ece9e1; color: #55514a; white-space: nowrap; }
.badge.lista { background: var(--accent-soft); color: #17483a; }
.badge.error, .badge.cancelada { background: var(--bad-soft); color: var(--bad); }
.badge.en_curso, .badge.en_cola, .badge.en_pasos { background: var(--info-soft); color: var(--info); }
.badge.esperando_aprobacion, .badge.plan_manual, .badge.pendiente { background: var(--warn-soft); color: var(--warn); }
.badge.tier { background: #eee9fb; color: #4b3a8a; }
.badge.pin { background: var(--warn-soft); color: var(--warn); }

.item { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; padding-bottom: 0; }
.item:first-child { padding-top: 0; }
.item .t { font-weight: 600; }
.excerpt { color: var(--muted); font-size: .9rem; white-space: pre-wrap; overflow: hidden; max-height: 4.3rem; }

.prose { overflow-wrap: anywhere; }
.prose h1 { font-size: 1.35rem; margin: 1rem 0 .5rem; }
.prose h2 { font-size: 1.15rem; margin: 1.1rem 0 .4rem; }
.prose h3 { font-size: 1rem; margin: 1rem 0 .3rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 .75rem; }
.prose pre { background: #f1eee7; padding: .75rem .9rem; border-radius: 8px; overflow-x: auto; font-size: .85rem; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
.prose table { margin-bottom: .9rem; }
.prose blockquote { margin: 0 0 .75rem; padding-left: .9rem; border-left: 3px solid var(--line); color: var(--muted); }

details { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .85rem; margin-bottom: .6rem; background: #fcfbf8; }
details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: .6rem; }
.spin { display: inline-block; width: .8rem; height: .8rem; border: 2px solid #b9c7da; border-top-color: var(--info);
  border-radius: 50%; animation: spin .9s linear infinite; vertical-align: -1px; margin-right: .35rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none; }
form[data-mode="objetivo"] .only-simple, form[data-mode="objetivo_manual"] .only-simple { display: none; }
.errbox { background: var(--bad-soft); border: 1px solid #eab9b2; color: var(--bad); border-radius: 8px;
  padding: .65rem .9rem; margin-bottom: .9rem; white-space: pre-wrap; }
.warnbox { background: var(--warn-soft); border: 1px solid #ecd9a8; color: var(--warn); border-radius: 8px;
  padding: .65rem .9rem; margin-bottom: .9rem; white-space: pre-wrap; }
.thumb { max-width: 72px; max-height: 54px; border-radius: 5px; border: 1px solid var(--line); display: block; }

@media (max-width: 860px) {
  .side { position: static; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .who { margin: 0; }
  .main { margin-left: 0; padding: 1.1rem; }
  .cols { grid-template-columns: 1fr; }
}
