/* Portal Masterbets x Digital North. Estilo SaaS moderno.
   Neutros tipo zinc, acento amarillo Masterbets, verde Digital North como acento secundario.
   Tema claro y oscuro (oscuro casi negro) con html[data-theme]. */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/inter-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/inter-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root, [data-theme="light"] {
  --bg: #FFFFFF; --bg-side: #FAFAFA;
  --surface: #FFFFFF; --surface-2: #F4F4F5; --surface-3: #EBEBED;
  --line: #E4E4E7; --line-2: #F0F0F2;
  --text: #09090B; --text-2: #3F3F46; --muted: #71717A; --faint: #A1A1AA;
  --shadow-sm: 0 1px 2px rgba(9,9,11,.05);
  --shadow: 0 1px 2px rgba(9,9,11,.04), 0 4px 16px rgba(9,9,11,.06);
  --shadow-lg: 0 24px 64px rgba(9,9,11,.18);
  --tint: 13%; --scrim: rgba(9,9,11,.4);
  --ok: #15803D; --ok-bg: #ECFDF3; --warn: #A16207; --warn-bg: #FEF9C3; --danger: #DC2626; --danger-bg: #FEF2F2; --info: #2563EB; --info-bg: #EFF6FF; --muted-bg: #F4F4F5;
  --yellow-soft: #FFF8D6; --focus: #8A6A00; --dn-ink: #15803D;
}
[data-theme="dark"] {
  --bg: #09090B; --bg-side: #0C0C0E;
  --surface: #111113; --surface-2: #18181B; --surface-3: #232326;
  --line: #27272A; --line-2: #1C1C1F;
  --text: #FAFAFA; --text-2: #D4D4D8; --muted: #8B8B94; --faint: #5B5B63;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.6);
  --tint: 12%; --scrim: rgba(0,0,0,.65);
  --ok: #4ADE80; --ok-bg: rgba(74,222,128,.1); --warn: #FACC15; --warn-bg: rgba(250,204,21,.1); --danger: #F87171; --danger-bg: rgba(248,113,113,.1); --info: #60A5FA; --info-bg: rgba(96,165,250,.1); --muted-bg: rgba(255,255,255,.06);
  --yellow-soft: rgba(255,204,0,.1); --focus: #FFCC00; --dn-ink: #4ADE80;
}
:root {
  --yellow: #FFCC00; --yellow-2: #FFD633; --yellow-ink: #0A0A0A; --navy: #0A1433; --green: #22B14C;
  --radius: 10px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --side: 248px; --bnav: 0px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
svg { flex: none; }
.muted { color: var(--muted); }
.sm-text { font-size: 12px; }
.boot { padding: 40px; color: var(--muted); }
::selection { background: var(--yellow); color: #000; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 12px; font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--yellow-ink); font-weight: 650; box-shadow: 0 1px 0 rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.3); }
.btn.primary:hover { background: var(--yellow-2); }
.btn.danger { background: #DC2626; border-color: #DC2626; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.block { width: 100%; }
.btn svg { width: 15px; height: 15px; }
.btn-group { display: inline-flex; gap: 6px; }
.danger-text { color: var(--danger) !important; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; font-size: 17px; line-height: 1; flex: none; box-shadow: var(--shadow-sm); }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.icon-btn svg { width: 17px; height: 17px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Demo */
.demobar { background: var(--surface-2); color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.demobar b { color: var(--text); }
.demobar select { padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }

/* Layout con barra lateral */
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg-side); border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 14px; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.sb-logo { width: 34px; height: 34px; border-radius: 9px; background: var(--navy); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.sb-logo img { height: 24px; width: auto; }
.sb-logo.sm { width: 30px; height: 30px; border-radius: 8px; }
.sb-logo.sm img { height: 20px; }
.sb-name { display: grid; line-height: 1.2; min-width: 0; }
.sb-name b { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.sb-name span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-x { display: inline-flex !important; align-items: center; gap: 5px; }
.sb-new { justify-content: flex-start; padding: 8px 12px; }
.sb-nav { display: grid; gap: 2px; }
.sb-nav button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; cursor: pointer; text-align: left; position: relative; }
.sb-nav button svg { width: 17px; height: 17px; color: var(--muted); }
.sb-nav button:hover { background: var(--surface-2); color: var(--text); }
.sb-nav button.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.sb-nav button.on svg { color: var(--text); }
.sb-nav button.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--yellow); }
.sb-nav .count { margin-left: auto; }
.sb-sec { display: grid; gap: 2px; }
.sb-h { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 10px 4px; }
.sb-cat { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px 10px; border-radius: 8px; color: var(--text-2); cursor: pointer; text-align: left; font-size: 13.5px; width: 100%; }
.sb-cat:hover { background: var(--surface-2); }
.sb-cat.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.sb-cat em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sq { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sb-clear { border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 4px 10px; text-align: left; cursor: pointer; text-decoration: underline; }
.sb-foot { margin-top: auto; display: grid; gap: 10px; }
.sb-partner { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); padding: 0 8px; }
.sb-dn { height: 13px; width: auto; }
[data-theme="light"] .sb-dn { filter: invert(1) hue-rotate(180deg) saturate(1.5); }
.sb-user { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.sb-uinfo { display: grid; line-height: 1.25; min-width: 0; flex: 1; }
.sb-uinfo b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-uinfo span { font-size: 11.5px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; }
.avatar.org-DN { background: rgba(34,177,76,.15); color: var(--dn-ink); }
.avatar.org-MB { background: var(--yellow-soft); color: #9A7400; }
[data-theme="dark"] .avatar.org-MB { color: var(--yellow); }
.content { min-width: 0; display: flex; flex-direction: column; }
.mtop { display: none; }

/* Encabezado de página */
.toolbar { padding: 20px 28px 4px; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ph-l { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ph-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ph-sub { color: var(--muted); }
.tb-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.tb-title .yr { color: var(--faint); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 4px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 11px; font-weight: 550; font-size: 13px; cursor: pointer; color: var(--muted); border-radius: 7px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.selects { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.selects select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 28px 6px 10px; background-color: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-sm); appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 11px; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); white-space: nowrap; flex: none; }
.chip.on { border-color: var(--c, var(--yellow)); color: var(--text); background: color-mix(in srgb, var(--c, var(--yellow)) 12%, var(--surface)); box-shadow: inset 0 0 0 1px var(--c, var(--yellow)); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; flex: none; }
.chip .dot { margin-right: 0; }

/* Contenido */
main { padding: 14px 28px 40px; }
.fade-in { animation: fadeUp .2s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Indicadores */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.kpi { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column-reverse; gap: 2px; cursor: pointer; color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, background .15s; position: relative; }
.kpi:hover:not([disabled]) { background: var(--surface-2); }
.kpi[disabled] { cursor: default; }
.kpi.on { border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); }
.kpi-v { font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-l { color: var(--muted); font-weight: 500; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi-l::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.kpi-activa .kpi-l::before { background: var(--green); }
.kpi-pendiente_mb .kpi-l::before { background: var(--yellow); }
.kpi-revision_dn .kpi-l::before { background: var(--info); }

/* Calendario */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.wdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); background: var(--surface); }
.wdays span { padding: 8px 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: 30px repeat(var(--lanes), 24px) minmax(12px, 1fr); min-height: 116px; row-gap: 3px; border-bottom: 1px solid var(--line-2); }
.week:last-child { border-bottom: 0; }
.week.tall { min-height: 440px; grid-template-rows: 36px repeat(var(--lanes), 30px) 1fr; }
.day { grid-row: 1 / -1; border-right: 1px solid var(--line-2); padding: 5px 7px; cursor: default; transition: background .12s; }
.day:hover { background: var(--surface-2); }
.day:nth-child(7) { border-right: 0; }
.day.wkend { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.day.out .dnum { color: var(--faint); }
.dnum { font-size: 12.5px; font-weight: 500; color: var(--text-2); display: inline-block; min-width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 99px; font-variant-numeric: tabular-nums; }
.week.tall .dnum { padding: 0 8px; }
.day.today .dnum { background: var(--yellow); color: #000; font-weight: 700; }
.bar { z-index: 1; margin: 0 4px; border-radius: 6px; border: 0; padding: 0 8px; font-size: 12px; font-weight: 550; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 6px; overflow: hidden; min-width: 0; color: var(--text); transition: filter .12s; }
.bar:hover { filter: brightness(.97); }
[data-theme="dark"] .bar:hover { filter: brightness(1.15); }
.bar::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.bar .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .bt { font-weight: 600; color: var(--muted); flex: none; }
.bar.solid { background: color-mix(in srgb, var(--c) var(--tint), var(--surface-2)); box-shadow: inset 2px 0 0 var(--c); }
.bar.solid.cont-l { box-shadow: none; }
.bar.soft { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, var(--line)); }
.bar.done { background: transparent; color: var(--muted); text-decoration: line-through; }
.bar.done::before { background: var(--faint); }
.bar.live::before { background: var(--green); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,177,76,.55); } 70% { box-shadow: 0 0 0 5px rgba(34,177,76,0); } 100% { box-shadow: 0 0 0 0 rgba(34,177,76,0); } }
.bar.cont-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.lock { font-size: 9.5px; font-weight: 700; background: rgba(34,177,76,.14); color: #15803D; padding: 1px 5px; border-radius: 4px; flex: none; letter-spacing: .03em; vertical-align: middle; }
[data-theme="dark"] .lock { color: #4ADE80; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; }
.lg-sep { width: 1px; height: 12px; background: var(--line); }
.lg { width: 16px; height: 10px; border-radius: 3px; margin-right: 6px; display: inline-block; }
.lg-solid { background: color-mix(in srgb, var(--muted) 25%, var(--surface)); }
.lg-soft { box-shadow: inset 0 0 0 1px var(--muted); }
.lg-done { box-shadow: inset 0 0 0 1px var(--line); }
.empty { color: var(--muted); text-align: center; padding: 32px; }
.empty.big { display: grid; gap: 4px; padding: 64px 20px; }
.empty.big b { font-size: 18px; color: var(--text); }
.print-head { display: none; }

/* Tarjetas */
.cards { display: grid; gap: 8px; }
.cards.grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.icard { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 5px; cursor: pointer; color: var(--text); box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, box-shadow .12s; width: 100%; }
.icard:hover { border-color: color-mix(in srgb, var(--text) 18%, var(--line)); box-shadow: var(--shadow); }
.icard.st-finalizada, .icard.st-rechazada { opacity: .6; }
.ic-top { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--muted); }
.ic-cat { display: inline-flex; align-items: center; color: var(--text-2); font-weight: 600; }
.ic-cat .dot { width: 7px; height: 7px; margin-right: 6px; }
.ic-top .badge { margin-left: auto; }
.ic-title { font-size: 14.5px; font-weight: 650; line-height: 1.35; letter-spacing: -.005em; }
.ic-dates { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ic-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.ic-prog { display: inline-flex; align-items: center; gap: 3px; }
.ic-prog i { width: 18px; height: 4px; border-radius: 99px; background: var(--line); }
.ic-prog i.ok { background: var(--green); }
.ic-prog em { font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 6px; font-variant-numeric: tabular-nums; }
.ic-ref { font-size: 11.5px; color: var(--muted); }
.ic-alert { font-size: 12px; font-weight: 600; color: var(--danger); }
.ic-act { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text); background: var(--yellow-soft); padding: 2px 9px; border-radius: 99px; }

/* Agenda */
.agenda { display: grid; gap: 18px; }
.ag-day { display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: start; }
.ag-date { position: sticky; top: 16px; display: grid; justify-items: center; padding: 6px 0; border-radius: 10px; }
.ag-date b { font-size: 22px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.ag-date span { font-size: 11.5px; color: var(--muted); font-weight: 500; text-transform: capitalize; }
.ag-day.today .ag-date b { background: var(--yellow); color: #000; border-radius: 99px; width: 36px; height: 36px; line-height: 36px; text-align: center; font-size: 18px; }
@media (min-width: 761px) { .ag-day .cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }

/* Mes compacto (móvil) */
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: var(--shadow-sm); }
.mini-h, .mini-g { display: grid; grid-template-columns: repeat(7, 1fr); }
.mini-h span { text-align: center; font-size: 11px; font-weight: 500; color: var(--muted); padding: 2px 0 6px; }
.md { border: 0; background: transparent; color: var(--text); height: 46px; border-radius: 10px; display: grid; justify-items: center; align-content: center; gap: 3px; cursor: pointer; padding: 0; }
.md.out { visibility: hidden; }
.md-n { font-weight: 500; font-size: 14.5px; width: 28px; height: 28px; line-height: 28px; border-radius: 99px; text-align: center; font-variant-numeric: tabular-nums; }
.md.today .md-n { color: #000; background: var(--yellow); font-weight: 700; }
.md.sel { background: var(--surface-2); }
.md.sel:not(.today) .md-n { font-weight: 700; }
.md-dots { display: flex; gap: 3px; align-items: center; height: 6px; }
.md-dots i { width: 6px; height: 6px; border-radius: 50%; }
.md-dots b { font-size: 9px; font-weight: 700; color: var(--muted); }
.dayhead { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 10px; }
.dayhead h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }

/* Tabla */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; box-shadow: var(--shadow-sm); }
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.list td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.list tr:last-child td { border-bottom: 0; }
.list td.t { font-weight: 600; color: var(--text); white-space: normal; min-width: 220px; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: var(--surface-2); }

/* Estados */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 550; padding: 1px 8px; border-radius: 99px; white-space: nowrap; margin-left: 6px; border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
td .badge { margin-left: 0; }
.tone-muted { background: var(--muted-bg); color: var(--muted); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-danger { background: var(--danger-bg); color: var(--danger); }
.tone-live { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

/* Ficha */
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(540px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(16px); opacity: 0; visibility: hidden; transition: transform .2s ease, opacity .2s ease, visibility .2s; z-index: 40; overflow-y: auto; padding: 16px 24px 40px; }
.drawer.open { transform: none; opacity: 1; visibility: visible; }
.dr-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; position: sticky; top: -16px; margin: -16px -24px 0; padding: 14px 24px 10px; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--line-2); }
.dr-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.dr-meta .sep { color: var(--faint); margin: 0 2px; }
.dr-title { font-size: 22px; font-weight: 700; margin: 14px 0 4px; line-height: 1.25; letter-spacing: -.02em; }
.dr-dates { margin: 0 0 14px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.dr-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.warn-box { margin-top: 12px; background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 500; }
.sec { padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.sec h4 { margin: 0 0 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.sec p { margin: 0 0 8px; }
dl { margin: 0; display: grid; gap: 8px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.tag { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; font-size: 12px; margin: 0 4px 4px 0; font-weight: 500; }
.pre { white-space: pre-wrap; word-break: break-word; }
.terms { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; max-height: 320px; overflow: auto; color: var(--text-2); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 13.5px; }
.checks .yes { color: var(--ok); }
.checks .no { color: var(--muted); }
.links { margin: 0; padding-left: 18px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; position: relative; }
.steps li { display: grid; padding-left: 26px; position: relative; font-size: 13.5px; }
.steps li::before { content: ''; position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.steps li.done::before { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 3px var(--surface); }
.steps span { color: var(--muted); font-size: 12.5px; }
.comments, .audit { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 10px; }
.comments li { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; font-size: 13.5px; }
.comments li.action { background: transparent; border: 1px dashed var(--line); }
.comments li.internal { background: color-mix(in srgb, var(--green) 8%, var(--surface)); }
.c-head { font-size: 12.5px; margin-bottom: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.c-form textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; resize: vertical; }
.c-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.audit li { font-size: 12.5px; color: var(--text-2); }
.chg { color: var(--muted); padding-left: 10px; border-left: 2px solid var(--line); margin-top: 2px; }

/* Modal y formularios */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.open { display: grid; place-items: center; }
.m-back { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(2px); animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } }
.m-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(440px, calc(100% - 32px)); box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .16s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.m-card.wide { width: min(720px, calc(100% - 32px)); padding: 0; }
.m-card.sheet { width: min(520px, calc(100% - 32px)); }
.m-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.m-card textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; }
.m-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.m-head h3 { margin: 0; }
.m-scroll { overflow-y: auto; padding: 16px 18px; display: grid; gap: 16px; }
.m-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; align-items: center; }
.m-card.wide .m-actions { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.m-actions .muted { margin-right: auto; }
.exp { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.exp .lbl { font-weight: 600; color: var(--text-2); }
.iform { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.span2 { grid-column: 1 / -1; }
.fld { display: grid; gap: 6px; }
.fld > span { font-size: 13px; font-weight: 550; color: var(--text-2); }
.fld input, .fld select, .fld textarea, .link-row input, .sub input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); color: var(--text); width: 100%; min-width: 0; font-size: 15px; box-shadow: var(--shadow-sm); }
[data-theme="dark"] input, [data-theme="dark"] select { color-scheme: dark; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .c-form textarea:focus, .m-card textarea:focus, .link-row input:focus, .sub input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); }
.chk-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.chk-grid .inline { border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.chk-grid .inline:has(input:checked) { border-color: var(--text); color: var(--text); background: var(--surface-2); }
.fld input[type=checkbox], .inline input[type=checkbox] { width: auto; flex: none; margin: 0; accent-color: var(--green); box-shadow: none; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; font-weight: 500; color: var(--text-2); }
.blockline { display: flex; margin: 6px 0; }
.fs { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px; margin: 0; }
.fs legend { font-size: 12.5px; font-weight: 600; padding: 0 6px; color: var(--text); }
#detailBox { display: grid; gap: 14px; }
#detailBox:empty { display: none; }
.link-row { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-bottom: 6px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pk { position: relative; cursor: pointer; }
.pk input { position: absolute; opacity: 0; pointer-events: none; }
.pk > span { display: inline-flex; align-items: center; padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; font-size: 13px; color: var(--text-2); background: var(--surface); box-shadow: var(--shadow-sm); transition: all .12s; }
.pk > span .dot { margin-right: 6px; }
.pk input:checked + span { border-color: var(--c, var(--yellow)); color: var(--text); background: color-mix(in srgb, var(--c, var(--yellow)) 12%, var(--surface)); box-shadow: inset 0 0 0 1px var(--c, var(--yellow)); }
.pk input:focus-visible + span { outline: 2px solid var(--yellow); outline-offset: 2px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 32px; height: 18px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .15s; box-shadow: inset 0 0 0 1px var(--line); }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--green); }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:checked + i::after { transform: translateX(14px); }
.sub { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.sub em { grid-column: 1 / -1; font-style: normal; font-size: 12px; color: var(--muted); }
.sub input[hidden] { display: none; }
.sub:has(input[type=time][hidden]) { grid-template-columns: 1fr; }
.adv { border: 1px solid var(--line); border-radius: 10px; }
.adv summary { cursor: pointer; padding: 11px 14px; font-weight: 600; list-style: none; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before { content: '›'; color: var(--muted); display: inline-block; transition: transform .15s; width: 10px; }
.adv[open] summary::before { transform: rotate(90deg); }
.adv summary small { color: var(--muted); font-weight: 400; }
.adv-in { padding: 2px 14px 14px; display: grid; gap: 14px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg);
  background-image: radial-gradient(600px 300px at 50% 0%, var(--yellow-soft), transparent 70%); }
.login-card { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: min(400px, 100%); display: grid; gap: 12px; text-align: center; box-shadow: var(--shadow-lg); }
.duo { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; margin-bottom: 4px; border-radius: 12px; background: var(--navy); }
.duo-mb { height: 52px; width: auto; }
.duo-x { color: var(--yellow); font-size: 16px; }
.duo-dn { height: 32px; width: auto; }
.eyebrow { margin: 4px 0 0; font-size: 12px; color: var(--muted); font-weight: 500; }
.login-card h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.02em; line-height: 1.2; }
.login-card p { margin: 0; }
.gbtn { min-height: 44px; display: flex; justify-content: center; margin-top: 6px; }
.linkish { background: none; border: 0; color: var(--muted); font-size: 12.5px; text-decoration: underline; cursor: pointer; padding: 4px; }

/* Varios */
.count { background: var(--yellow); color: #000; border-radius: 99px; font-size: 11px; padding: 0 6px; font-weight: 700; line-height: 18px; font-style: normal; min-width: 18px; text-align: center; }
.bottomnav { display: none; }
#toast { position: fixed; bottom: calc(20px + var(--bnav)); left: 50%; transform: translate(-50%, 16px); background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 10px; font-weight: 550; font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 80; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: #DC2626; color: #fff; }
body.modal-open #toast { top: calc(env(safe-area-inset-top) + 12px); bottom: auto; transform: translate(-50%, -10px); }
body.modal-open #toast.show { transform: translate(-50%, 0); }

@media (max-width: 1180px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ============ Móvil ============ */
@media (max-width: 760px) {
  :root { --bnav: 66px; }
  body { padding-bottom: calc(var(--bnav) + env(safe-area-inset-bottom)); }
  .desk, .hide-m, .sidebar { display: none !important; }
  .layout { display: block; }
  .mtop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 10px 14px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .mtop .sb-name { flex: 1; }
  .toolbar { padding: 14px 14px 2px; }
  .ph-l { width: 100%; justify-content: space-between; }
  .tb-title { font-size: 22px; white-space: nowrap; }
  main { padding: 10px 14px 24px; }
  .strip { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 10px 12px; }
  .kpi-v { font-size: 20px; }
  .kpi-l { font-size: 12px; }
  .cards.grid { grid-template-columns: 1fr; }
  .ag-day { grid-template-columns: 44px 1fr; gap: 10px; }
  .ag-date { top: 62px; }
  .ag-date b { font-size: 19px; }

  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav:not(:has(.fab)) { grid-template-columns: repeat(4, 1fr); }
  .bottomnav button { border: 0; background: none; color: var(--muted); display: grid; justify-items: center; gap: 2px; font-size: 10.5px; font-weight: 550; padding: 4px 0; cursor: pointer; position: relative; }
  .bottomnav button svg { width: 21px; height: 21px; }
  .bottomnav button.on { color: var(--text); }
  .bottomnav .count { position: absolute; top: -2px; left: calc(50% + 4px); }
  .bottomnav .fab { width: 52px; height: 52px; border-radius: 16px; background: var(--yellow); color: #000; justify-self: center; margin-top: -24px; box-shadow: 0 6px 18px rgba(255,204,0,.35), inset 0 1px 0 rgba(255,255,255,.35); display: grid; place-items: center; }
  .bottomnav .fab svg { width: 24px; height: 24px; }
  .bottomnav .fab:active { transform: scale(.95); }

  .drawer { width: 100%; padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); transform: translateY(20px); border-left: 0; }
  .drawer.open { transform: none; }
  .dr-title { font-size: 20px; }
  .dr-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); flex-wrap: nowrap; overflow-x: auto; }
  .drawer:not(.open) .dr-actions { display: none; }
  .dr-actions .btn { flex: none; }
  .kv { grid-template-columns: 1fr; gap: 0; }

  .modal.open { place-items: end center; }
  .m-card, .m-card.wide, .m-card.sheet { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; animation: slideUp .22s ease; border-bottom: 0; }
  @keyframes slideUp { from { transform: translateY(32px); opacity: 0; } }
  .m-card:not(.wide) { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .m-card.wide .m-actions { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; }
  .m-actions .btn { flex: 1; padding: 10px; }
  .m-scroll { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .link-row { grid-template-columns: 1fr; }
  .modal .selects select { flex: 1 1 100%; }
}

/* Impresión / PDF (siempre en claro) */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  :root, [data-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #F4F4F5; --surface-3: #EBEBED; --line: #E4E4E7; --line-2: #F0F0F2; --text: #09090B; --text-2: #3F3F46; --muted: #71717A; --faint: #A1A1AA; --tint: 15%; }
  body { background: #fff; font-size: 11px; padding: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .demobar, .sidebar, .mtop, .toolbar, #toast, .modal, .strip, .bottomnav { display: none !important; }
  .layout { display: block; }
  body.print-cal .drawer { display: none !important; }
  body.print-cal main { padding: 0; animation: none; }
  body.print-cal .print-head { display: flex; gap: 16px; align-items: baseline; margin-bottom: 8px; font-size: 13px; border-bottom: 2px solid var(--yellow); padding-bottom: 6px; }
  body.print-cal .print-head b { font-size: 15px; }
  body.print-cal .print-head span:last-child { margin-left: auto; color: var(--muted); font-size: 10px; }
  .cal, .table-wrap, .icard, .mini { box-shadow: none; }
  .week { break-inside: avoid; min-height: 84px; }
  .icard { break-inside: avoid; }
  body.print-ficha main { display: none; }
  body.print-ficha .drawer { position: static; transform: none; opacity: 1; visibility: visible; box-shadow: none; border: 0; width: 100%; padding: 0; overflow: visible; height: auto; }
  body.print-ficha .dr-actions, body.print-ficha #drClose, .no-print { display: none !important; }
  body.print-ficha .terms { max-height: none; overflow: visible; }
}

/* QA v4 */
.icard:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ic-btns { margin-left: auto; display: inline-flex; gap: 6px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.presets .chip { padding: 4px 10px; font-size: 12.5px; }
.ic-alert { display: inline-flex; align-items: center; gap: 6px; }
.ic-alert::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
@media (max-width: 760px) {
  .grid2.dates { grid-template-columns: 1fr 1fr; }
  .dr-head { margin: -12px -16px 0; padding: 12px 16px 10px; top: -12px; }
  .ic-btns { margin-left: 0; width: 100%; }
  .ic-btns .btn { flex: 1; }
}
