/* Marca Go Online Now
   Azul marino #1D2843 → #19316A · Celeste #55C8EF / #73C6EB · Celeste claro #CFF0FD · Gris texto #4C4C4C
   Acentos del logo: rojo #C3262E · naranja #F79420 · verde #8CC640 · morado #663091
   Tipografías: Unbounded (títulos) · Kanit (texto) */
:root {
  --navy: #1d2843;
  --navy-2: #19316a;
  --sky: #55c8ef;
  --sky-title: #73c6eb;
  --sky-soft: #cff0fd;
  --sky-ink: #0f77a6;       /* celeste oscurecido para enlaces legibles sobre blanco */
  --bg: #f3fafe;
  --surface: #ffffff;
  --text: #4c4c4c;
  --heading: #1d2843;
  --muted: #7a8090;
  --border: #dde7ee;
  --ok: #4d7a17;   --ok-soft: #eef7e3;
  --warn: #a35a00; --warn-soft: #fef1e1;
  --bad: #c3262e;  --bad-soft: #fbe7e8;
  --info: #0f6f96; --info-soft: #e3f6fd;
  --violet: #663091; --violet-soft: #f0e9f6;
  --radius: 14px;
  --font-title: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Kanit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-family: var(--font-body);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; font-weight: 300; line-height: 1.5; }
b, strong, th { font-weight: 500; }
a { color: var(--sky-ink); }
h1, h2 { font-family: var(--font-title); color: var(--heading); font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: 26px; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 500; color: var(--heading); margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- barra superior ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--heading); }
.brand img { height: 40px; display: block; }
.brand span { font-family: var(--font-title); font-size: 12px; font-weight: 500; padding-left: 12px; border-left: 1px solid var(--border); }
.topbar nav > a { margin-left: 20px; text-decoration: none; color: var(--muted); font-weight: 400; }
.topbar nav > a:hover, .topbar nav > a.active { color: var(--navy); }

/* ---------- encabezado de marca ---------- */
#hero:empty { display: none; }
.hero {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; padding: 18px 16px 20px;
}
.hero-inner { max-width: 1180px; margin: 0 auto; }
.hero h1 { color: #fff; font-size: 26px; font-weight: 500; margin: 0; }
.hero h1 .sky { color: var(--sky-title); }
.hero p { margin: 4px 0 0; color: #c9d6ec; }
.hero a { color: var(--sky-title); }
.hero .badge { background: rgba(255,255,255,.12); color: #fff; }
.hero button:not(.primary) { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }

main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
main.full { max-width: none; padding: 0; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
a.card { transition: border-color .15s, box-shadow .15s; }
a.card:hover { border-color: var(--sky); box-shadow: 0 6px 24px rgba(29, 40, 67, .08); }

/* ---------- botones ---------- */
button, .btn {
  font: inherit; font-weight: 400; border: 1px solid var(--border); background: var(--surface); color: var(--heading);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { border-color: var(--sky); }
button.primary, .btn.primary { background: var(--sky); border-color: var(--sky); color: var(--navy); font-weight: 500; }
button.primary:hover { background: #3fbbe6; }
button.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
button.danger { color: var(--bad); }
button.link { border: none; background: none; padding: 2px 4px; color: var(--sky-ink); border-radius: 4px; }
button.small, .btn.small { padding: 3px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }

/* ---------- tablas ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; text-align: right; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 400; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- modal y formularios ---------- */
dialog { border: none; border-radius: var(--radius); padding: 0; width: min(580px, 94vw); box-shadow: 0 24px 60px rgba(29, 40, 67, .25); color: var(--text); }
dialog::backdrop { background: rgba(29, 40, 67, .45); }
dialog form { padding: 22px; }
dialog .fields { display: grid; gap: 12px; max-height: 65vh; overflow-y: auto; padding: 2px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 400; }
input, select, textarea {
  font: inherit; font-weight: 300; font-size: 15px; color: var(--heading); padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sky-soft); border-color: var(--sky); }
textarea { min-height: 80px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); margin: 0; font-weight: 300; }

pre.output {
  white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; max-height: 480px; overflow: auto; color: var(--heading);
}

.dropzone {
  border: 2px dashed #a9dcf0; border-radius: var(--radius); background: var(--bg); padding: 26px 16px; text-align: center;
  transition: background .15s, border-color .15s;
}
.dropzone.over { background: var(--sky-soft); border-color: var(--sky); }
.dropzone .big { font-family: var(--font-title); color: var(--navy); font-size: 14px; margin-bottom: 6px; }
.filelist { font-size: 13px; max-height: 140px; overflow: auto; margin: 0; padding-left: 18px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px; max-width: 90vw; z-index: 20;
}
.toast.error { background: var(--bad); border-radius: 10px; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
.alert { padding: 10px 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 14px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- visor de entregables ---------- */
.viewer { display: flex; flex-direction: column; height: calc(100vh - 61px); }
.viewer-bar {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 16px; background: var(--navy); color: #fff;
}
.viewer-bar a { color: var(--sky-title); text-decoration: none; }
.viewer-bar .title { font-family: var(--font-title); font-size: 14px; font-weight: 500; }
.viewer-bar select { width: auto; padding: 4px 8px; font-size: 13px; border-radius: 999px; }
.viewer-bar button:not(.primary) { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.viewer-bar button:not(.primary):hover { border-color: var(--sky); }
.seg { display: inline-flex; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; overflow: hidden; }
.seg button { border: none !important; border-radius: 0; }
.seg button.on { background: var(--sky) !important; color: var(--navy) !important; font-weight: 500; }
.viewer-info { padding: 6px 16px; font-size: 13px; background: var(--sky-soft); color: var(--navy); }
.viewer-stage { flex: 1; overflow: auto; background: #e9eef3; display: flex; justify-content: center; padding: 16px; }
.viewer-stage iframe { border: 0; background: #fff; height: 100%; width: 100%; box-shadow: 0 6px 28px rgba(29, 40, 67, .15); border-radius: 6px; transition: width .2s; }
.viewer-stage.tablet iframe { width: 834px; flex: none; }
.viewer-stage.movil iframe { width: 390px; flex: none; border-radius: 18px; }

@media (max-width: 640px) {
  .two { grid-template-columns: 1fr; }
  .topbar { padding: 10px 16px; }
  .brand span { display: none; }
  .brand img { height: 32px; }
  .hero h1 { font-size: 22px; }
  .viewer { height: auto; min-height: calc(100vh - 53px); }
  .viewer-stage { min-height: 70vh; }
}

/* =================== Componentes modernos =================== */
.nowrap { flex-wrap: nowrap; }
.gap-s { gap: 6px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 18px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 14px; }
.card.flush thead th { background: #f8fbfd; }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 400; line-height: 1; white-space: nowrap;
  background: #eef2f6; color: var(--heading); border: 1px solid transparent; text-decoration: none;
}
.pill .pi { font-size: 12px; }
.pill .k { color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.bad.strong { background: var(--bad); color: #fff; }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.violet, .badge.violet { background: var(--violet-soft); color: var(--violet); }
.pill.link { background: #fff; border-color: var(--border); color: var(--sky-ink); }
.pill.link:hover { border-color: var(--sky); }
.pill.status { background: #fff; border-color: var(--border); color: var(--heading); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #b8c0cc; flex: none; }
.pill.status.ok .dot { background: #8cc640; }
.pill.status.warn .dot { background: #f79420; }
.pill.status.bad .dot { background: #c3262e; }
.pill.status.info .dot { background: var(--sky); }
.pill.status.violet .dot { background: #663091; }
.pill.glass { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.14); }
.pill.glass .k { color: #9fb2d3; }
.pill.glass.sky { background: rgba(85,200,239,.18); border-color: rgba(85,200,239,.4); }
.pill.glass.ok { background: rgba(140,198,64,.2); }
.pill.glass.bad { background: rgba(195,38,46,.35); }
.num-pill { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 500; }
.code { display: inline-grid; place-items: center; padding: 0 9px; height: 26px; border-radius: 8px; background: var(--sky-soft); color: var(--navy); font-family: var(--font-title); font-size: 11px; font-weight: 600; letter-spacing: .04em; flex: none; }
.code.lg { height: 34px; padding: 0 12px; font-size: 14px; background: var(--sky); }
select.pill-select { width: auto; height: 28px; padding: 0 28px 0 12px; border-radius: 999px; font-size: 13px; font-weight: 400; }
select.pill-select.ok { background-color: var(--ok-soft); color: var(--ok); border-color: transparent; }
select.pill-select.warn { background-color: var(--warn-soft); color: var(--warn); border-color: transparent; }
select.pill-select.bad { background-color: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* Botones extra */
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.btn.ghost:hover { border-color: var(--sky); }
.icon-btn {
  width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 10px;
  font-size: 18px; line-height: 1; letter-spacing: 1px; background: transparent; border-color: transparent; color: var(--muted);
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: #eef2f6; color: var(--heading); border-color: transparent; }
.hero button.icon-btn { color: #fff; background: rgba(255,255,255,.1); }
.hero button.icon-btn:hover, .hero button.icon-btn[aria-expanded="true"] { background: rgba(255,255,255,.2); color: #fff; }

/* Menú desplegable */
.menu { position: relative; display: inline-flex; }
.menu-list {
  position: fixed; z-index: 30; min-width: 210px; padding: 6px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 36px rgba(29, 40, 67, .18); display: grid; gap: 2px;
}
.menu-list[hidden] { display: none; }
.menu-list > button, .menu-list > a {
  all: unset; box-sizing: border-box; display: block; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 400; color: var(--heading); white-space: nowrap;
}
.menu-list > button:hover, .menu-list > a:hover, .menu-list > button:focus-visible, .menu-list > a:focus-visible { background: var(--bg); }
.menu-list > a.on { background: var(--sky-soft); }
.menu-list > .danger { color: var(--bad); }
.menu-list > .danger:hover { background: var(--bad-soft); }

/* Encabezado del proyecto */
.crumbs { display: flex; gap: 6px; color: #9fb2d3; margin-bottom: 8px; }
.crumbs a { color: var(--sky-title); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.head-row { gap: 12px; }
.meta { margin-top: 12px; }

/* Pestañas tipo pill */
.tabbar {
  display: flex; gap: 4px; padding: 4px; margin: 0 0 20px; background: #fff; border: 1px solid var(--border);
  border-radius: 999px; overflow-x: auto; width: fit-content; max-width: 100%; scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 999px; cursor: pointer; white-space: nowrap; color: var(--muted); font-weight: 400; font-size: 14px;
}
.tab:hover { color: var(--heading); background: var(--bg); }
.tab.active { background: var(--navy); color: #fff; font-weight: 500; }
.tab .count { background: var(--sky-soft); color: var(--navy); border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 500; }
.tab.active .count { background: var(--sky); }
.tab:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.alert.row { margin-bottom: 16px; }

/* Encabezado de sección */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.section-head h2 { margin: 0; }
.section-head .hint { margin-top: 4px; }

/* Stepper de fases */
.stepper { list-style: none; margin: 0 0 22px; padding: 16px 18px; display: flex; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.step { flex: 1; min-width: 150px; position: relative; }
.step:not(:last-child)::after {
  content: ''; position: absolute; top: 17px; left: 44px; right: 8px; height: 2px; background: var(--border); border-radius: 2px;
}
.step.done:not(:last-child)::after { background: #8cc640; }
.step button { all: unset; box-sizing: border-box; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding-right: 16px; border-radius: 10px; }
.step .node, .phase .node {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; position: relative; z-index: 1;
  background: #fff; border: 2px solid var(--border); color: var(--muted); font-weight: 500; font-size: 14px;
}
.step-txt { display: grid; padding-top: 2px; background: #fff; position: relative; z-index: 1; padding-right: 8px; }
.step-txt b { color: var(--heading); font-size: 14px; white-space: nowrap; }
.step-txt small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.step.done .node, .phase.s-aprobado .node, .phase.done .node { background: #8cc640; border-color: #8cc640; color: #fff; }
.step.current .node, .phase.s-en_curso .node { border-color: var(--sky); color: var(--navy); box-shadow: 0 0 0 4px var(--sky-soft); }
.step.current .step-txt small { color: var(--sky-ink); }
.phase.s-entregado .node { border-color: #f79420; color: #a35a00; }
.step.late .node, .phase.late .node { border-color: var(--bad); color: var(--bad); }
.step.late .step-txt small { color: var(--bad); }

/* Acordeón de fases */
.phases { display: grid; gap: 10px; }
.phase { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); transition: box-shadow .15s, border-color .15s; }
.phase[open] { box-shadow: 0 6px 24px rgba(29, 40, 67, .06); border-color: #cfe3ee; }
.phase > summary {
  list-style: none; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; cursor: pointer; border-radius: var(--radius);
}
.phase > summary::-webkit-details-marker { display: none; }
.phase > summary:hover { background: #fafcfe; }
.phase-title { display: grid; flex: 1; min-width: 0; }
.phase-title b { font-family: var(--font-title); font-weight: 500; font-size: 15px; color: var(--heading); }
.phase-title small { color: var(--muted); font-size: 13px; }
.phase-pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.phase-actions { display: flex; gap: 6px; align-items: center; }
.chev { color: var(--muted); font-size: 20px; transition: transform .2s; width: 14px; text-align: center; }
.phase[open] .chev { transform: rotate(90deg); }
.phase-body { padding: 4px 18px 18px 64px; display: grid; gap: 14px; border-top: 1px solid var(--border); padding-top: 16px; }
.phase-body.flush { padding: 0; }
.phase-body p { margin: 0; }
.phase-body .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; font-weight: 400; }

/* Tarjetas del tablero */
.project-card { display: grid; gap: 12px; text-decoration: none; color: inherit; }
.project-card h2 { margin: 0; font-size: 16px; }
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.segments span { height: 6px; border-radius: 3px; background: #e6ecf1; }
.segments .ok { background: #8cc640; }
.segments .warn { background: #f79420; }
.segments .info { background: var(--sky); }
.segments .late { background: var(--bad); }
.card-foot { border-top: 1px solid var(--border); padding-top: 10px; }

@media (max-width: 760px) {
  .phase > summary { flex-wrap: wrap; gap: 10px; }
  .phase-title { flex-basis: calc(100% - 100px); }
  .phase-pills { order: 3; justify-content: flex-start; flex-basis: 100%; padding-left: 48px; }
  .phase-actions { order: 4; padding-left: 48px; }
  .chev { margin-left: auto; }
  .phase-body { padding-left: 18px; }
  .phase-body .cols { grid-template-columns: 1fr; }
  .head-row h1 { font-size: 20px; }
  .tabbar { border-radius: 14px; }
}

/* =================== Sesión =================== */
body.auth-mode #nav { display: none; }
main.auth-page { max-width: none; min-height: calc(100vh - 61px); display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--sky-soft), transparent 70%), var(--bg); }
.auth-card { width: min(420px, 100%); padding: 28px; box-shadow: 0 18px 50px rgba(29, 40, 67, .1); }
.auth-card h1 { font-size: 22px; }
.auth-logo { height: 54px; display: block; }
.sky-ink { color: var(--sky-ink); }
button.block { width: 100%; justify-content: center; height: 42px; font-size: 15px; }
.user-btn { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--border); color: var(--heading); font-size: 14px; margin-left: 20px; }
.user-btn:hover, .user-btn[aria-expanded="true"] { border-color: var(--sky); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 500; }
.menu-head { display: grid; gap: 4px; padding: 8px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head span:not(.pill) { color: var(--muted); font-size: 13px; }
.menu-head .pill { justify-self: start; }
@media (max-width: 640px) { .user-name { display: none; } .user-btn { margin-left: 12px; } .topbar nav > a { margin-left: 12px; } }
