/* Layout: barra superior; arriba el modelo 3D con panel de detalle; abajo el programa (tabla + Gantt) con divisor ajustable. */
  :root {
    color-scheme: light;
    --bg: #f2f5f9; --panel: #ffffff; --panel-2: #f7f9fc; --line: #d8dfe9; --line-soft: #e9eef4; --line-strong: #b4c0d1;
    --fg: #1b2340; --muted: #5b6880; --faint: #94a0b3;
    --accent: #12408c; --accent-2: #1f2a5c; --accent-ink: #ffffff; --accent-soft: rgba(18,64,140,.08); --today: #e5533d;
    --ok: #1d9a5a; --run: #c9820f; --late: #d33f3f; --pend: #8a97ab;
    --hover: #eef3fa; --sel: #e2eaf7; --input: #ffffff; --glass: rgba(255,255,255,.93); --track: #e4e9f0; --scroll: #c3ccd8;
    --shadow: 0 1px 2px rgba(27,35,64,.06), 0 1px 1px rgba(27,35,64,.04);
    --f-body: 'Archivo', system-ui, sans-serif; --f-mono: 'IBM Plex Mono', ui-monospace, monospace;
    --dw: 30px; --lw: 616px; --top-h: 46%;
  }
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 13px; }
  h1, h2, h3, p { margin: 0; }
  button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
  input, select, textarea { font: inherit; color: inherit; }
  .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
  .app { display: flex; flex-direction: column; height: 100%; height: 100dvh; }
  .btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 6px; padding: 5px 9px; font-size: 12px; white-space: nowrap; }
  .btn:hover { border-color: var(--line-strong); background: var(--hover); }
  .btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
  .btn-accent:hover { background: #0d3270; border-color: #0d3270; }
  .btn:focus-visible, .chip:focus-visible, .g-row:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .field { background: var(--input); border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; font-size: 12px; width: 100%; min-width: 0; }
  .field:disabled { opacity: .55; }
  .lbl { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
  .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--glass); }
  .seg button { padding: 4px 9px; font-size: 11.5px; color: var(--muted); }
  .seg button + button { border-left: 1px solid var(--line); }
  .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

  /* Barra superior */
  .topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--panel); }
  .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .brand .tag { font-family: var(--f-mono); font-weight: 600; font-size: 11px; background: var(--accent); color: var(--accent-ink); padding: 3px 7px; border-radius: 4px; }
  .brand h1 { font-size: 15px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
  .brand p { font-size: 11px; color: var(--muted); }
  .kpis { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .kpi { display: flex; flex-direction: column; padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); min-width: 0; }
  .kpi span { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
  .kpi b { font-family: var(--f-mono); font-size: 13px; font-weight: 600; }
  .kpi input { background: transparent; border: 0; padding: 0; font-family: var(--f-mono); font-size: 13px; font-weight: 600; width: 128px; }
  .spacer { flex: 1; }
  .meter { display: grid; gap: 3px; width: 150px; }
  .meter .m { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
  .meter .m i { display: block; height: 100%; }

  /* Parte superior: visor + detalle */
  .top { position: relative; display: flex; height: var(--top-h); min-height: 160px; border-bottom: 1px solid var(--line); }
  #viewer { position: relative; flex: 1; min-width: 0; overflow: hidden; }
  #canvas-container { position: absolute; inset: 0; }
  #labels-container { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
  .label-3d { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-family: var(--f-mono); font-size: 10px; padding: 2px 6px; border-radius: 3px; border: 1px solid var(--line); background: var(--glass); }
  .vtools { position: absolute; top: 8px; left: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; z-index: 5; }
  .vtools label { display: inline-flex; gap: 5px; align-items: center; font-size: 11.5px; background: var(--glass); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
  .vsel { position: absolute; left: 8px; bottom: 8px; right: 8px; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; pointer-events: none; }
  .vsel > * { pointer-events: auto; }
  .vbadge { background: var(--glass); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 12px; max-width: 100%; }
  .legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); }
  .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
  #tip { position: fixed; z-index: 50; pointer-events: none; font-size: 11.5px; padding: 6px 8px; border-radius: 6px; background: rgba(255,255,255,.98); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(27,35,64,.15); max-width: 300px; display: none; }

  #detail { width: 360px; flex: none; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 12px 14px 16px; }
  #detail .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #detail label { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; color: var(--muted); }
  .d-title { font-size: 15px; font-weight: 700; line-height: 1.25; text-wrap: balance; }
  .d-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
  .d-ind { font-size: 11.5px; line-height: 1.5; background: var(--accent-soft); border-left: 2px solid var(--accent); padding: 7px 9px; border-radius: 4px; }
  .stack > * + * { margin-top: 10px; }
  .pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
  .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
  .tlist button { display: flex; width: 100%; gap: 8px; align-items: center; text-align: left; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
  .tlist button:hover { color: var(--accent); }
  .tlist .when { margin-left: auto; font-family: var(--f-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
  #btn-detail-close { display: none; }

  /* Divisor */
  .splitter { height: 7px; cursor: row-resize; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; justify-content: center; align-items: center; touch-action: none; }
  .splitter::after { content: ""; width: 42px; height: 3px; border-radius: 2px; background: var(--line-strong); }

  /* Programa */
  .bottom { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .gbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 7px max(12px, env(safe-area-inset-right, 0px)) 7px max(12px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--panel); }
  .chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
  .chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  #gantt { flex: 1; min-height: 0; overflow: auto; position: relative; background: var(--bg); }
  .g-inner { position: relative; min-width: 100%; }
  .g-head { position: sticky; top: 0; z-index: 6; background: var(--panel); }
  .g-hrow { display: flex; height: 22px; border-bottom: 1px solid var(--line); }
  .g-left { position: sticky; left: 0; z-index: 4; flex: none; width: var(--lw); display: grid; grid-template-columns: 34px minmax(0,1fr) 38px 60px 60px 60px 60px 40px; align-items: center; background: var(--panel); border-right: 1px solid var(--line); }
  .g-head .g-left { z-index: 7; }
  .g-left > * { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .g-head .g-left > * { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
  .compact .g-left { grid-template-columns: 34px minmax(0,1fr); }
  .compact .c-x { display: none; }
  .g-days { position: relative; display: flex; }
  .g-day { flex: none; width: var(--dw); text-align: center; font-family: var(--f-mono); font-size: 10px; color: var(--muted); border-left: 1px solid var(--line-soft); line-height: 1.05; padding-top: 2px; cursor: pointer; }
  .g-day:hover, .g-week:hover { color: var(--fg); background: var(--hover); }
  .g-day.we { color: var(--faint); }
  .g-day.sel, .g-week.sel { background: rgba(18,64,140,.14); color: var(--accent); font-weight: 600; }
  .g-day.today { color: var(--today); font-weight: 600; }
  .g-week { flex: none; text-align: left; font-size: 10.5px; padding: 3px 6px; border-left: 1px solid var(--line); color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; }
  .g-row { display: flex; height: 30px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
  .g-row:hover .g-left { background: var(--hover); }
  .g-row.sel .g-left { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
  .g-row.ph .g-left { background: #eef2f7; font-weight: 700; }
  .g-row.ph { height: 28px; }
  .g-left .nm { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .g-left .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .g-left .num { font-family: var(--f-mono); font-size: 11px; }
  .g-left .dt { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
  .g-left .dt.real { color: var(--fg); }
  .g-left .dt.late { color: var(--late); }
  .g-track { position: relative; flex: none; }
  .g-bg { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 0; }
  .g-bg .we { position: absolute; top: 0; bottom: 0; width: var(--dw); background: rgba(27,35,64,.035); }
  .g-bg .grid { position: absolute; inset: 0; background-image: repeating-linear-gradient(to right, transparent 0 calc(var(--dw) - 1px), var(--line-soft) calc(var(--dw) - 1px) var(--dw)); }
  .g-bg .todayl { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--today); opacity: .85; }
  .g-bg .selcol { position: absolute; top: 0; bottom: 0; background: rgba(18,64,140,.06); border-left: 1px solid rgba(18,64,140,.35); border-right: 1px solid rgba(18,64,140,.35); }
  .bar { position: absolute; top: 6px; height: 12px; border-radius: 3px; z-index: 2; touch-action: none; }
  .bar .pg { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: rgba(0,0,0,.35); }
  .bar.pinned { box-shadow: 0 0 0 1.5px #fff inset; }
  .bar.lateb { outline: 1.5px solid var(--late); outline-offset: 1px; }
  .bar.editable { cursor: grab; }
  .bar.dragging { cursor: grabbing; opacity: .85; }
  .rbar { position: absolute; top: 20px; height: 5px; border-radius: 2px; background: var(--accent-2); z-index: 2; }
  .rbar.open { background: repeating-linear-gradient(90deg, var(--accent-2) 0 6px, transparent 6px 9px); }
  .ms { position: absolute; top: 7px; width: 12px; height: 12px; transform: rotate(45deg); z-index: 2; border: 1.5px solid #fff; }
  .sum { position: absolute; top: 11px; height: 6px; border-radius: 1px; z-index: 2; }
  .sum::before, .sum::after { content: ""; position: absolute; bottom: -4px; border: 4px solid transparent; }
  .sum::before { left: 0; border-left-color: inherit; border-top-color: inherit; }
  .bar-lbl { position: absolute; top: 5px; font-size: 10.5px; white-space: nowrap; color: var(--muted); z-index: 2; pointer-events: none; }
  .save { font-size: 11px; color: var(--muted); }
  .toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--accent-2); color: #fff; box-shadow: 0 8px 24px rgba(27,35,64,.25); border: 1px solid var(--line); padding: 7px 12px; border-radius: 8px; font-size: 12px; z-index: 60; }

  @media (max-width: 900px) {
    :root { --top-h: 40%; --dw: 26px; }
    #detail { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 100%); z-index: 20; box-shadow: -10px 0 30px rgba(27,35,64,.18); transform: translateX(105%); transition: transform .2s ease; }
    #detail.open { transform: none; }
    #btn-detail-close { display: inline-flex; }
    .meter { width: 120px; }
  }
  @media (max-width: 700px) {
    :root { --top-h: 36%; }
    .brand p { display: none; }
    .topbar, .gbar { flex-wrap: nowrap; overflow-x: auto; }
    .topbar > *, .gbar > * { flex: none; }
    .kpis { flex-wrap: nowrap; }
    .spacer { display: none; }
  }
  @media (prefers-reduced-motion: reduce) { #detail { transition: none; } }
  ::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 6px; } ::-webkit-scrollbar-corner { background: var(--bg); }

/* ======================================================================
   Plataforma de control: navegación, páginas, formularios, fotos
   ====================================================================== */
:root { --ok-bg: rgba(29,154,90,.09); --warn-bg: rgba(201,130,15,.10); --bad-bg: rgba(211,63,63,.08); --radius: 10px; }
.hdr { display: flex; align-items: center; gap: 10px; padding: 6px max(10px, env(safe-area-inset-right, 0px)) 6px max(10px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--panel); min-height: 46px; }
.hdr .brand h1 { font-size: 14px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 7px 10px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 600; white-space: nowrap; position: relative; }
.tabs a:hover { color: var(--fg); background: var(--hover); }
.tabs a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); }
.tabs a .badge { position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; border-radius: 8px; background: var(--late); color: #fff; font-size: 9.5px; line-height: 15px; text-align: center; padding: 0 3px; font-family: var(--f-mono); }
.who { display: flex; align-items: center; gap: 8px; flex: none; font-size: 11.5px; color: var(--muted); }
.who .sync { font-family: var(--f-mono); font-size: 10.5px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.who .sync.off { color: var(--late); border-color: var(--late); }
.who .sync.pend { color: var(--run); border-color: var(--run); }
.who .role { font-weight: 700; color: var(--fg); }
main.views { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
#view-programa { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#view-programa .topbar { padding-top: 6px; padding-bottom: 6px; }
#view-page { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { max-width: 1240px; margin: 0 auto; padding: 16px max(14px, env(safe-area-inset-right, 0px)) 80px max(14px, env(safe-area-inset-left, 0px)); }
.page h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.page h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-head .sub { color: var(--muted); font-size: 12.5px; width: 100%; margin-top: -6px; }
.grow { flex: 1; }
.banner { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 12.5px; line-height: 1.5; margin-bottom: 12px; background: var(--panel); }
.banner.warn { border-color: rgba(242,179,61,.5); background: var(--warn-bg); }
.banner.bad { border-color: rgba(239,91,91,.5); background: var(--bad-bg); }
.banner.ok { border-color: rgba(63,191,127,.5); background: var(--ok-bg); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card + .card { margin-top: 12px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cols2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.cols2 > .card + .card { margin-top: 0; }
.kgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 12px; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.kcard span { display: block; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kcard b { display: block; font-family: var(--f-mono); font-size: 19px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.kcard small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.kcard.bad b { color: var(--late); } .kcard.ok b { color: var(--ok); } .kcard.warn b { color: var(--run); }
.bar2 { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; position: relative; margin-top: 6px; }
.bar2 i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ok); border-radius: 4px; }
.bar2 .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--accent); }
.pill.ok { color: var(--ok); border-color: rgba(63,191,127,.5); background: var(--ok-bg); }
.pill.warn { color: var(--run); border-color: rgba(242,179,61,.5); background: var(--warn-bg); }
.pill.bad { color: var(--late); border-color: rgba(239,91,91,.5); background: var(--bad-bg); }
.pill.mute { color: var(--muted); }
.holds { display: flex; flex-wrap: wrap; gap: 5px; }
.alerts { display: grid; gap: 6px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; line-height: 1.45; }
.alert b { font-weight: 700; }
.alert.bad { border-color: rgba(239,91,91,.45); } .alert.warn { border-color: rgba(242,179,61,.45); } .alert.ok { border-color: rgba(63,191,127,.45); }
.alert .ic { flex: none; width: 18px; text-align: center; }
.alert a, .linkbtn { color: var(--accent); text-decoration: underline; cursor: pointer; }

/* Tablas */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.tbl td.mono { font-family: var(--f-mono); font-size: 11.5px; }
.tbl tr.pend td { opacity: .75; font-style: italic; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: var(--panel-2); }
.tbl .thumbs { display: flex; gap: 3px; }
.tbl .thumbs img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }
.empty { color: var(--muted); font-size: 12.5px; padding: 18px; text-align: center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.filters .field { width: auto; }

/* Formularios */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form .full { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 600; min-width: 0; }
.fld .help { font-weight: 400; font-size: 11px; color: var(--faint); }
.fld .field, .page .field { font-size: 14px; padding: 8px 9px; border-radius: 7px; color: var(--fg); }
.fld textarea.field { resize: vertical; min-height: 64px; }
.fld.req > span::after { content: " *"; color: var(--accent); }
.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--fg); font-weight: 500; }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
.checklist { display: grid; gap: 4px; }
.checklist .it { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 8px; border: 1px solid var(--line-soft); border-radius: 7px; background: var(--panel-2); font-size: 12.5px; }
.checklist .it.crit > span::before { content: "● "; color: var(--late); font-size: 9px; vertical-align: 2px; }
.tri { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tri button { padding: 5px 9px; font-size: 12px; color: var(--muted); }
.tri button + button { border-left: 1px solid var(--line); }
.tri button[aria-pressed="true"][data-v="si"] { background: var(--ok); color: #fff; font-weight: 700; }
.tri button[aria-pressed="true"][data-v="no"] { background: var(--late); color: #fff; font-weight: 700; }
.tri button[aria-pressed="true"][data-v="na"] { background: #6b7890; color: #fff; }
.btn-lg { padding: 9px 14px; font-size: 13.5px; border-radius: 8px; }
.btn-danger { border-color: rgba(239,91,91,.6); color: var(--late); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Tareas del avance diario */
.trow { display: grid; grid-template-columns: minmax(0, 1fr) 150px 92px; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-2); }
.trow + .trow { margin-top: 6px; }
.trow.on { border-color: rgba(18,64,140,.45); background: #f4f7fc; }
.trow .tn { font-size: 12.5px; line-height: 1.35; }
.trow .tn small { display: block; color: var(--muted); font-size: 11px; }
.trow input[type=range] { width: 100%; accent-color: var(--accent); }
.elist { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; margin-top: 6px; padding-right: 4px; }
.elchk { display: grid !important; grid-template-columns: 18px 64px minmax(0, 1fr) auto; gap: 6px; align-items: center; font-size: 11.5px !important; color: var(--fg) !important; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.elchk input { accent-color: var(--ok); }
.elchk span:nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.elgroup { margin-top: 8px; border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; }
.elgroup summary { cursor: pointer; font-size: 12.5px; }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.phc { position: relative; border-radius: 8px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; }
.phc img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; cursor: zoom-in; background: #e9eef5; }
.phc .pdf { aspect-ratio: 4 / 3; display: grid; place-items: center; font-family: var(--f-mono); font-size: 12px; color: var(--muted); cursor: pointer; }
.phc .cap { padding: 4px 6px; font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.phc .cap b { color: var(--fg); font-weight: 600; }
.phc .x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 12px; background: rgba(0,0,0,.65); color: #fff; font-size: 14px; line-height: 24px; text-align: center; }
.phc .st { position: absolute; left: 4px; top: 4px; font-size: 10px; font-family: var(--f-mono); background: rgba(0,0,0,.65); padding: 1px 5px; border-radius: 4px; }
.phc select, .phc input { font-size: 11px; padding: 3px 4px; border: 0; border-top: 1px solid var(--line); background: var(--panel-2); width: 100%; }
.picker { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 10px; background: var(--panel-2); }
.picker .btnrow { margin-bottom: 8px; }
.picker input[type=file] { display: none; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(4,6,10,.94); display: flex; flex-direction: column; }
.lightbox img { flex: 1; min-height: 0; object-fit: contain; width: 100%; }
.lightbox .lb-bar { display: flex; gap: 10px; align-items: center; padding: 10px 14px; font-size: 12px; color: #c8d1df; flex-wrap: wrap; }
.lightbox .lb-bar b { color: #fff; }

/* Modal */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(20,28,50,.45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; }
.modal { width: min(760px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 30px 80px rgba(20,28,50,.3); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); border-radius: 14px 14px 0 0; z-index: 2; }
.modal-h h3 { font-size: 15px; font-weight: 800; flex: 1; margin: 0; }
.modal-b { padding: 14px 16px; }
.modal-f { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); border-radius: 0 0 14px 14px; }
.sec { margin-top: 16px; }
.sec > .lbl { margin-bottom: 6px; display: block; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.datebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.datebar .field { width: auto; font-family: var(--f-mono); }
.days { display: flex; flex-wrap: wrap; gap: 4px; }
.days button { width: 38px; padding: 4px 0; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); font-family: var(--f-mono); font-size: 11px; line-height: 1.2; }
.days button small { display: block; font-size: 9px; color: var(--muted); }
.days button.ok { border-color: rgba(63,191,127,.6); background: var(--ok-bg); }
.days button.ap { border-color: var(--ok); background: rgba(63,191,127,.3); }
.days button.miss { border-color: rgba(239,91,91,.6); background: var(--bad-bg); }
.days button.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.days button.fut { opacity: .45; }
.stn { display: flex; flex-direction: column; gap: 6px; }
.stn-h { display: flex; gap: 8px; align-items: center; }
.stn img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #e9eef5; }
.stn .noimg { width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; background: #edf1f6; display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.bbar { position: absolute; top: 8px; height: 12px; border-radius: 3px; z-index: 2; border: 1.5px dashed #7d8aa3; background: rgba(31,42,92,.05); }
.bbar .pg { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(31,42,92,.28); }
.g-row[data-task^="A"] .nm span { color: var(--muted); }
.mnum { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.tagx { display: inline-block; font-family: var(--f-mono); font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: #eef2f7; color: var(--muted); }

@media (max-width: 900px) {
  .cols2 { grid-template-columns: minmax(0, 1fr); }
  .who .name { display: none; }
}
@media (max-width: 640px) {
  .hdr { flex-wrap: wrap; gap: 6px; }
  .hdr .brand { order: 1; }
  .who { order: 2; margin-left: auto; }
  .tabs { order: 3; flex-basis: 100%; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .kgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trow { grid-template-columns: minmax(0, 1fr) 96px; }
  .trow .rg { grid-column: 1 / -1; }
  .modal-bg { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  .modal-h, .modal-f { border-radius: 0; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { margin-top: 6px; }
  /* tablas como tarjetas */
  table.tbl.resp thead { display: none; }
  table.tbl.resp, .tbl.resp tbody, .tbl.resp tr, .tbl.resp td { display: block; width: 100%; }
  .tbl.resp tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tbl.resp td { border: 0; padding: 2px 12px; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; }
  .tbl.resp td::before { content: attr(data-l); color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding-top: 2px; }
  .tbl.resp td.num { text-align: left; }
  .tbl.resp tfoot { display: block; }
}
/* ajustes */
.cards > .card + .card { margin-top: 0; }
a.btn { text-decoration: none; }
.tbl td.num { white-space: nowrap; }
#view-programa .topbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
#view-programa .topbar > * { flex: none; }
.kcard b.sm { font-size: 15px; }
@media (max-width: 1500px) { .hdr .brand h1 { display: none; } }
@media (max-width: 1280px) { .who .name { display: none; } .tabs a { padding: 7px 8px; } }
a.btn { color: var(--fg); } a.btn.btn-accent { color: var(--accent-ink); }
.tbl.resp td .pill { width: fit-content; }

/* ======================================================================
   Tema claro Lambagüer: encabezado con logo, acceso con PIN
   ====================================================================== */
.hdr { background: #fff; box-shadow: 0 1px 0 var(--line), 0 2px 8px rgba(27,35,64,.04); border-bottom: 0; min-height: 56px; }
.brand { text-decoration: none; color: var(--fg); gap: 12px; flex: none; }
.brand .logo-full { height: 34px; width: auto; display: block; }
.brand .logo-mark { height: 34px; width: auto; display: none; }
.brand-sep { width: 1px; height: 28px; background: var(--line); }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt b { font-family: var(--f-mono); font-size: 12px; color: var(--accent); letter-spacing: .04em; }
.brand-txt small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); }
.who { cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.who:hover { background: var(--hover); }
.who .role { color: var(--accent); }
.card, .kcard, .tbl-wrap { box-shadow: var(--shadow); }
.phc .st { color: #fff; }
.page h2 { color: var(--accent-2); }
.kcard b { color: var(--accent-2); }
.d-title { color: var(--accent-2); }
#view-programa .topbar { background: #fff; }
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #f6f8fc 0%, #e6edf8 100%); }
.login-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(27,35,64,.12); display: grid; gap: 12px; }
.login-logo { width: 100%; max-width: 300px; height: auto; margin: 0 auto 6px; display: block; }
.login-card h2 { font-size: 18px; color: var(--accent-2); text-align: center; }
.login-card > p { text-align: center; }
.login-card .field { font-size: 16px; padding: 10px 12px; }
@media (max-width: 1500px) { .brand-txt small { display: none; } }
@media (max-width: 1100px) { .brand .logo-full { display: none; } .brand .logo-mark { display: block; } }
@media (max-width: 640px) { .brand-sep { display: none; } .hdr { min-height: 0; } }
@media print { .hdr, .tabs { display: none; } }
.tabs a .badge { position: static; display: inline-block; margin-left: 5px; vertical-align: 1px; }
.kpi .meter { margin: 3px 0 2px; }
@media (max-width: 1640px) { .brand .logo-full { display: none; } .brand .logo-mark { display: block; } .who .name { display: none; } .tabs a { padding: 7px 8px; } }
.who .sync.ok { width: 9px; height: 9px; padding: 0; border: 0; background: var(--ok); box-shadow: 0 0 0 3px rgba(29,154,90,.15); }
.tabs { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); padding-right: 20px; }
@media (max-width: 1400px) { .brand-sep, .brand-txt { display: none; } }
.asis { display: grid; gap: 6px; }
.arow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-2); }
.arow > .chk { flex: 1 1 220px; min-width: 0; }
.arow .ameta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.arow .ameta .field { width: 116px; }
.arow:has([data-p]:checked) { border-color: rgba(29,154,90,.45); background: #f3faf6; }
