/* =====================================================================
   AGEON · Estilos
   ===================================================================== */
:root {
  color-scheme: light dark;
  /* AGEON: tinta + verde neón */
  --brand: #00874A;        /* verde legible sobre blanco (enlaces, foco, bordes activos) */
  --brand-600: #006B3A;
  --brand-50: #E8FBF0;
  --accent: #39FF88;       /* verde neón (botón principal, detalles sobre oscuro) */
  --accent-hover: #22EC74;
  --accent-soft: #39FF88;
  --green: #00A651;        /* verde de marca para gráficos e iconos */
  --navy: #0E0C1D;         /* tinta */
  --ink-2: #17142C;

  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --text: #0F172A;
  --muted: #64748B;
  --border: #E2E8F0;
  --ring: rgba(0, 166, 81, .28);

  --ok: #059669;   --ok-bg: #ECFDF5;
  --ko: #DC2626;   --ko-bg: #FEF2F2;
  --warn: #B45309; --warn-bg: #FFFBEB;
  --info: #0369A1; --info-bg: #F0F9FF;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --sidebar-w: 248px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-50: rgba(57, 255, 136, .10);
    --brand: #39FF88;
    --bg: #0B0A17;
    --surface: #141226;
    --surface-2: #0E0C1D;
    --text: #E2E8F0;
    --muted: #94A3B8;
    --border: #2A2645;
    --ring: rgba(57, 255, 136, .25);
    --ok-bg: rgba(5, 150, 105, .15);
    --ko-bg: rgba(220, 38, 38, .15);
    --warn-bg: rgba(180, 83, 9, .18);
    --info-bg: rgba(3, 105, 161, .18);
    --ok: #34D399; --ko: #F87171; --warn: #FBBF24; --info: #38BDF8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { a { color: var(--accent-soft); } }
h1, h2, h3 { line-height: 1.25; margin: 0; }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.ico { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------- Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 600 14px/1.2 var(--font); cursor: pointer; text-decoration: none !important;
  background: var(--surface); color: var(--text); transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn-primary { background: var(--accent); color: var(--navy) !important; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 0 4px rgba(57, 255, 136, .18); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text) !important; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--ko); color: #fff !important; }
.btn-danger:hover { filter: brightness(.92); }
.btn-danger-ghost { background: transparent; border-color: var(--border); color: var(--ko) !important; }
.btn-danger-ghost:hover { background: var(--ko-bg); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; color: var(--text); padding: 6px; border-radius: 8px; cursor: pointer; display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); }

/* --------------------------------------------------------- Formularios */
.form { display: flex; flex-direction: column; gap: 16px; }
.form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: contents; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field-row label { font-weight: 600; font-size: 13.5px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search],
input[type=date], input[type=datetime-local], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: 15px/1.3 var(--font); color: var(--text); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; margin: 0; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.check.inline { align-items: center; }
.check.inline input { margin: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-gap { margin-bottom: 20px; }
.input-pass { position: relative; }
.input-pass input { padding-right: 44px; }
.pass-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; }
.pass-toggle:hover { color: var(--text); }
.strength { height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; background: var(--ko); transition: width .2s, background .2s; }
.link-sm { font-size: 13px; }

/* -------------------------------------------------------------- Alertas */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert .ico { margin-top: 1px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error { background: var(--ko-bg); color: var(--ko); border-color: color-mix(in srgb, var(--ko) 25%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }

/* --------------------------------------------------------------- Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge-lg { padding: 5px 12px; font-size: 13px; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-ko { background: var(--ko-bg); color: var(--ko); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* =====================================================================
   Pantallas de acceso
   ===================================================================== */
.auth { display: grid; grid-template-columns: minmax(320px, 44%) 1fr; min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; color: #E8E6F5; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 520px at -10% 110%, rgba(57, 255, 136, .20), transparent 60%),
              radial-gradient(700px 460px at 110% -10%, rgba(0, 166, 81, .22), transparent 60%),
              #0E0C1D;
}
.auth-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .12;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
}
.auth-logo { width: 200px; height: auto; position: relative; z-index: 1; }
.auth-claim { position: relative; z-index: 1; max-width: 420px; }
.auth-claim h2 { font-size: 34px; color: #fff; letter-spacing: -.5px; margin-bottom: 14px; }
.auth-claim p { font-size: 16px; color: #B9B6CF; margin: 0; }
.auth-claim em { font-style: normal; color: var(--accent); text-shadow: 0 0 18px rgba(57, 255, 136, .45); }
.auth-brand small { position: relative; z-index: 1; color: #8F8BAA; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-logo-mobile { display: none; width: 170px; margin-bottom: 28px; }
.auth-title { font-size: 26px; letter-spacing: -.3px; margin-bottom: 6px; }
.auth-sub { color: var(--muted); margin: 0 0 24px; }
.auth-alt { margin-top: 22px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-message { text-align: center; }
.auth-message-icon { width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 16px; display: grid; place-items: center; color: var(--accent); background: var(--navy); box-shadow: 0 0 24px rgba(57, 255, 136, .25); }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-logo-mobile { display: block; }
  .auth-main { align-items: flex-start; padding-top: 48px; }
}

/* =====================================================================
   Aplicación
   ===================================================================== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: #004b7d;
  color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { display: block; padding: 22px 20px 18px; }
.sidebar-logo img { width: 140px; height: auto; display: block; }
.nav { display: flex; flex-direction: column; padding: 4px 12px 20px; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: #fff; padding: 18px 10px 6px; font-weight: 700; }
.nav-sec > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; border-radius: 8px; user-select: none; }
.nav-sec > summary::-webkit-details-marker { display: none; }
.nav-sec > summary:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-sec > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-sec > summary .ico { transition: transform .18s; opacity: .8; }
.nav-sec:not([open]) > summary .ico { transform: rotate(-90deg); }
.nav-sec:not([open]) > summary { padding-bottom: 10px; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-sec + .nav-sec > summary { border-top: 1px solid rgba(255,255,255,.12); border-radius: 0; margin-top: 4px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: #fff !important; font-size: 14px; text-decoration: none !important; }
.nav-link:hover { background: rgba(255, 255, 255, .10); color: #fff !important; }
.nav-link.active { background: rgba(255, 255, 255, .14); color: #fff !important; box-shadow: inset 3px 0 0 var(--accent-soft); }
.nav-link.active .ico { color: var(--accent); filter: drop-shadow(0 0 6px rgba(57, 255, 136, .6)); }
.sidebar-foot { padding: 14px 22px; font-size: 12px; color: rgba(255, 255, 255, .7); }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.topbar-spacer { flex: 1; }
.centro-select { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.centro-select select { width: auto; min-width: 200px; padding: 7px 10px; font-weight: 600; }
.centro-select.static span { color: var(--text); font-weight: 600; }
.only-mobile { display: none; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 10px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--navy); background: var(--accent); }
.user-name { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; line-height: 1.2; }
.user-name small { color: var(--brand); font-weight: 600; font-size: 11px; }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
.user-dropdown a, .user-dropdown button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border-radius: 8px; font: 14px var(--font); color: var(--text) !important; background: none; border: 0; cursor: pointer; text-decoration: none !important; text-align: left; }
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--surface-2); }
.user-dropdown form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

.content { padding: 28px 28px 48px; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; }
.head-actions { display: flex; gap: 8px; }
.head-actions form { margin: 0; }
.back { font-size: 13px; color: var(--muted) !important; display: inline-block; margin-bottom: 6px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; min-width: 0; }
.card-narrow { max-width: 560px; }
.card-title { font-size: 16px; margin-bottom: 16px; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title-row .card-title { margin: 0; }
.card-title-row form { margin: 0; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-main > .card { margin-bottom: 0; }
.grid-main { margin-bottom: 20px; }

/* Estadísticas */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text) !important; text-decoration: none !important; position: relative; }
a.stat:hover { border-color: var(--brand); }
.stat-icon { position: absolute; right: 16px; top: 16px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
@media (prefers-color-scheme: dark) { .stat-icon { color: var(--accent-soft); } }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-value.ok { color: var(--ok); } .stat-value.ko { color: var(--ko); }
.stat-label { color: var(--muted); font-size: 13.5px; }
.stats-inline { margin: 18px 0 0; }
.stats-inline .stat { box-shadow: none; background: var(--surface-2); padding: 12px 16px; }
.stats-inline .stat-value { font-size: 22px; }

/* Mosaicos de apartados */
.tiles-group { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 6px 0 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text) !important; text-decoration: none !important; font-weight: 600; font-size: 14px; }
.tile:hover { border-color: var(--brand); background: var(--brand-50); }
.tile small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.tile-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: var(--navy); flex: none; }

/* Línea de tiempo */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.timeline li > div { display: flex; flex-direction: column; min-width: 0; }
.timeline small { font-size: 12px; }
.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.list-plain li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td form { margin: 0; display: inline; }
.table-compact td { padding: 9px 12px; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--surface-2); }
.ua { color: var(--muted); font-size: 12.5px; max-width: 280px; }
.diff-old { color: var(--ko); background: var(--ko-bg); font-family: var(--mono); font-size: 13px; word-break: break-all; }
.diff-new { color: var(--ok); background: var(--ok-bg); font-family: var(--mono); font-size: 13px; word-break: break-all; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; padding: 8px 10px; font-size: 14px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; }
.toolbar .search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search input { width: 100%; padding-left: 32px; }
.toolbar label.inline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.toolbar-form { margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted) !important; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none !important; white-space: nowrap; }
.tab.active { color: var(--brand) !important; border-color: var(--brand); }
.tab .count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; font-size: 13px; flex-wrap: wrap; }
.pagination div { display: flex; gap: 8px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .ico { opacity: .5; }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.actions-list { display: flex; flex-direction: column; gap: 8px; }
.actions-list form { margin: 0; }
.actions-list .btn { justify-content: flex-start; }

/* Matriz de permisos */
.levels-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.levels-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lv, .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lv-0 { background: var(--border); } .lv-1 { background: #38BDF8; } .lv-2 { background: #6366F1; } .lv-3 { background: #059669; }
.dot { border-radius: 50%; } .dot-ok { background: var(--green); } .dot-ko { background: var(--ko); }
.set-all { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.matrix { display: flex; flex-direction: column; }
.matrix-group { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 16px 0 8px; }
.matrix-group:first-child { padding-top: 0; }
.matrix-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.matrix-mod { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; padding: 3px; background: var(--surface-2); gap: 2px; }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.seg-opt input:checked + span { color: #fff; }
.lv-opt-0 input:checked + span { background: #64748B; }
.lv-opt-1 input:checked + span { background: #0284C7; }
.lv-opt-2 input:checked + span { background: #4F46E5; }
.lv-opt-3 input:checked + span { background: #059669; }
fieldset:disabled .seg-opt { cursor: default; }

/* Gráfico de barras */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; margin-top: 20px; padding-bottom: 22px; overflow-x: auto; }
.bar-col { flex: 1 0 18px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar { width: 100%; max-width: 28px; min-height: 2px; background: var(--green); border-radius: 4px 4px 0 0; display: flex; flex-direction: column; overflow: hidden; }
.bar-ko { display: block; width: 100%; background: var(--ko); }
.bar-col small { position: absolute; bottom: -20px; font-size: 10px; color: var(--muted); white-space: nowrap; }

/* Error */
.error-page { text-align: center; padding: 60px 20px; }
.error-code { font-size: 72px; font-weight: 800; letter-spacing: -2px; background: linear-gradient(135deg, var(--green), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { margin: 6px 0 10px; }
.error-page p { color: var(--muted); margin: 0 0 24px; }

/* --------------------------------------------------------- Responsive */
@media (max-width: 1024px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(14, 12, 29, .6); }
  .only-mobile { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 40px; }
  .user-name { display: none; }
  .centro-select select { min-width: 0; max-width: 46vw; }
}
@media (max-width: 600px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 10px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .seg-opt span { padding: 6px 8px; font-size: 12px; }
  .page-head h1 { font-size: 22px; }
}

/* Bloqueo por agente */
.badge-block { background: var(--ko); color: #fff; gap: 4px; }
.row-off td { opacity: .55; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack > .card { margin-bottom: 0; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 8px; }
.chip { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.chip:hover { border-color: var(--brand); }
.chip input { margin-top: 3px; accent-color: var(--brand); flex: none; }
.chip small { display: block; color: var(--muted); font-size: 12px; }
.chip:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.ua-cell { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; max-width: 560px; }
.ua-inline { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.inline-setting { margin: 0; }
.grid-gap > .card { margin-bottom: 0; }
@media (prefers-color-scheme: dark) { .tile-icon, .auth-message-icon { box-shadow: inset 0 0 0 1px #2A2645; } }

/* =====================================================================
   Movimientos
   ===================================================================== */
:root { --c-ing: #1BAF7A; --c-gas: #EB6834; --c-line: #00874A; --c-prev: #94A3B8; --pos: #047857; --neg: #C2410C; }
@media (prefers-color-scheme: dark) { :root { --c-ing: #199E70; --c-gas: #D95926; --c-line: #39FF88; --c-prev: #6B7280; --pos: #34D399; --neg: #FB923C; } }
.pos { color: var(--pos) !important; }
.neg { color: var(--neg) !important; }
.center { text-align: center; }
.card-narrow-lg { max-width: 820px; }
.stats-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stats .stat small { font-size: 12.5px; margin-top: 2px; }
.kpis .stat-value { font-size: 26px; }

/* Cuentas */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 16px; }
.acc-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text) !important; text-decoration: none !important; overflow: hidden; }
.acc-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--acc); }
.acc-card:hover { border-color: var(--acc); }
.acc-card.off { opacity: .6; }
.acc-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.acc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); }
.acc-name { font-weight: 700; font-size: 16px; margin-top: 4px; }
.acc-bank { font-size: 13px; color: var(--muted); }
.acc-balance { font-size: 26px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; margin-top: 10px; }
.acc-foot { font-size: 12px; color: var(--muted); }

/* Selector de color */
.label { font-weight: 600; font-size: 13.5px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 8px; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.swatch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 4px; }

/* Árbol de tipos */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree > li { border-top: 1px solid var(--border); padding: 6px 0; }
.tree > li:first-child { border-top: 0; }
.tree ul { margin: 2px 0 4px 22px; border-left: 2px solid var(--border); padding-left: 10px; }
.tree li.off { opacity: .55; }
.tree-row { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; }
.tree-name { color: var(--text) !important; }
.tree-count { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; vertical-align: -1px; }
.cat-dot.sm { width: 8px; height: 8px; }
.nat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.nat-gasto { background: var(--c-gas); } .nat-ingreso { background: var(--c-ing); }

/* Periodos */
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pill { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted) !important; text-decoration: none !important; }
.pill:hover { border-color: var(--brand); color: var(--text) !important; }
.pill.active { background: var(--navy); border-color: var(--navy); color: var(--accent) !important; }
@media (prefers-color-scheme: dark) { .pill.active { background: rgba(57,255,136,.12); border-color: var(--accent); } }

/* Listado de movimientos */
.mov-table td { vertical-align: middle; }
.mov-concepto { font-weight: 600; color: var(--text) !important; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.amount.ingreso { color: var(--pos); } .amount.gasto { color: var(--text); } .amount.traspaso { color: var(--muted); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); margin-left: 4px; }
.tick { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: transparent; cursor: pointer; }
.tick:hover { border-color: var(--brand); color: var(--muted); }
.tick.on { background: var(--brand-50); border-color: var(--brand); color: var(--brand); }

/* Formulario de movimiento */
.seg-lg { display: flex; width: 100%; }
.seg-lg .seg-opt { flex: 1; text-align: center; }
.seg-lg .seg-opt span { padding: 10px 12px; font-size: 14px; }
.nat-opt-gasto input:checked + span { background: var(--c-gas); color: #fff; }
.nat-opt-ingreso input:checked + span { background: var(--c-ing); color: #fff; }
.nat-opt-traspaso input:checked + span { background: #64748B; color: #fff; }
.input-affix { position: relative; }
.input-affix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.num-input { text-align: right; font-variant-numeric: tabular-nums; }
.input-affix .num-input { padding-right: 30px; }
.num-input.big { font-size: 20px; font-weight: 700; }
.adjunto-actual { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13.5px; }
input[type=file] { font: 13px var(--font); color: var(--muted); }
[hidden] { display: none !important; }

/* Indicadores */
.filters-card { padding-bottom: 6px; }
.chart-card .card-title-row { margin-bottom: 8px; }
.chart { width: 100%; min-height: 240px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--border); stroke-width: 1; }
.chart .grid line.zero { stroke: var(--muted); stroke-opacity: .5; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .hit { fill: transparent; }
.chart .hit.on { fill: var(--text); fill-opacity: .05; }
.chart .hit-area { fill: transparent; }
.chart .cross { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .mark { stroke: var(--surface); stroke-width: 2; }
.chart .dot { stroke: var(--surface); stroke-width: 1.5; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-ing { background: var(--c-ing); } .lg-gas { background: var(--c-gas); }
.lg-line { height: 3px; border-radius: 2px; background: var(--c-line); }
.lg-prev { height: 0; border-top: 3px dashed var(--c-prev); border-radius: 0; }
.chart-tip { position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 10px 12px; font-size: 13px; min-width: 170px; }
.tip-title { font-weight: 700; margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row i { width: 10px; height: 10px; border-radius: 3px; }
.tip-row b { margin-left: auto; font-variant-numeric: tabular-nums; }
.tip-total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.chart-table { margin-top: 10px; font-size: 13px; }
.chart-table summary { cursor: pointer; color: var(--muted); }
.hbars, .budgets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.hbar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; margin-bottom: 6px; }
details > summary.hbar-head { cursor: pointer; list-style: none; }
details > summary.hbar-head::-webkit-details-marker { display: none; }
.hbar-head strong { font-variant-numeric: tabular-nums; }
.pct { font-size: 12px; }
.hbar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar span { display: block; height: 100%; border-radius: 4px; min-width: 2px; }
.sub-list { list-style: none; margin: 0 0 8px; padding: 6px 0 2px 18px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.sub-list li { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
.budget span.b-ok { background: var(--c-ing); } .budget span.b-warn { background: #EDA100; } .budget span.b-ko { background: var(--ko); }
.budget-state { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; margin-top: 4px; color: var(--muted); }
.b-text-warn { color: var(--warn); } .b-text-ko { color: var(--ko); font-weight: 600; }
@media (max-width: 600px) {
  .kpis, .stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis .stat, .stats-3 .stat { padding: 14px; }
  .kpis .stat-value, .stats-3 .stat-value { font-size: 19px; }
  .stats-3 .stat:last-child { grid-column: 1 / -1; }
}

/* =====================================================================
   Utilidades comunes (v1.2)
   ===================================================================== */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 2fr 1.5fr 1.2fr; gap: 16px; }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.strong-link { font-weight: 600; color: var(--text) !important; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: 600 12.5px var(--font); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.input-row { display: flex; gap: 8px; }
.input-row select, .input-row input { flex: 1; min-width: 0; }
.seg-brand input:checked + span { background: var(--navy); color: var(--accent); }
.seg-opt span .ico { vertical-align: -2px; }
@media (prefers-color-scheme: dark) { .seg-brand input:checked + span { background: rgba(57,255,136,.14); } }
.progress { display: block; height: 6px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--c-ing); border-radius: 4px; }
.progress-lg { height: 10px; margin: 14px 0 6px; }
.legend-sm { margin-top: 12px; font-size: 12px; }
.tag-first { margin-left: 0; margin-right: 4px; }
.tag .ico { vertical-align: -1px; }
a.tag { text-decoration: none !important; }
a.tag:hover { border-color: var(--brand); color: var(--text); }

/* Personas */
.person { display: flex; align-items: center; gap: 10px; }
.person > div { display: flex; flex-direction: column; min-width: 0; }
.person small { font-size: 12.5px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; flex: none; }
.avatar-emp { background: var(--navy); color: var(--accent); }
@media (prefers-color-scheme: dark) { .avatar-emp { box-shadow: inset 0 0 0 1px #2A2645; } }
.contact-cell a { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text) !important; white-space: nowrap; }
.contact-cell a .ico { color: var(--muted); }

/* Deudas */
.dir-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 0; }
.dir-me_deben { background: var(--c-ing); } .dir-debo { background: var(--c-gas); }
.debt-col { min-width: 120px; }
.debt-col small { display: block; font-size: 12px; margin-top: 3px; }
.dir-opt-me_deben input:checked + span { background: var(--c-ing); color: #fff; }
.dir-opt-debo input:checked + span { background: var(--c-gas); color: #fff; }
.debt-summary { padding-bottom: 16px; }
.debt-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 16px; align-items: end; }
.debt-figs > div { display: flex; flex-direction: column; gap: 2px; }
.debt-fig { font-size: 26px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.debt-state { align-items: flex-end; }
@media (max-width: 600px) { .debt-figs { grid-template-columns: 1fr 1fr; } .debt-fig { font-size: 20px; } .debt-state { align-items: flex-start; } }
.pay-form { padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 18px; gap: 12px; }
.pay-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pay-list li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.pay-list li:first-child { border-top: 0; }
.pay-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.pay-main { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; font-size: 14px; }
.pay-main small { flex-basis: 100%; font-size: 12px; }
.mov-link { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.debt-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.debt-mini a { display: flex; flex-direction: column; gap: 4px; color: var(--text) !important; text-decoration: none !important; font-size: 13.5px; }
.debt-mini-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.debt-mini a:hover strong { color: var(--brand); }

/* Importar extractos */
.inline-form { display: inline; margin: 0; }
.d-block { display: block; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop:focus-within { border-color: var(--brand); background: var(--brand-50); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--navy); color: var(--accent); }
.drop-name { font-size: 13px; }
.help-card .steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.wizard { display: flex; gap: 0; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: paso; font-size: 13px; font-weight: 600; color: var(--muted); }
.wizard li { counter-increment: paso; display: flex; align-items: center; gap: 8px; padding-right: 28px; position: relative; }
.wizard li::before { content: counter(paso); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); font-size: 12px; }
.wizard li:not(:last-child)::after { content: ""; position: absolute; right: 8px; top: 50%; width: 12px; border-top: 1px solid var(--border); }
.wizard li.done { color: var(--text); }
.wizard li.done::before { content: "✓"; background: var(--brand-50); border-color: var(--brand); color: var(--brand); }
.wizard li.on { color: var(--text); }
.wizard li.on::before { background: var(--navy); border-color: var(--navy); color: var(--accent); }
.sheet { font-size: 12.5px; }
.sheet th { text-align: center; }
.sheet td { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.sheet-n { color: var(--muted); text-align: right; width: 1%; }
.sheet tr.sheet-head td { background: var(--brand-50); font-weight: 700; }
.imp-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.imp-stats .stat-value { font-size: 26px; }
@media (max-width: 860px) { .imp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.imp-errores summary { cursor: pointer; display: flex; gap: 8px; align-items: center; }
.imp-errores ul { margin: 8px 0 0; padding-left: 20px; }
.imp-errores { display: block; }
.imp-tools { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.imp-tools .chips-row { margin-bottom: 6px; }
button.pill { background: none; cursor: pointer; font-family: var(--font); }
.imp-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.imp-bulk select { width: auto; max-width: 200px; padding: 6px 8px; font-size: 13px; }
.imp-table td { vertical-align: middle; }
.imp-table select { padding: 6px 8px; font-size: 13px; min-width: 190px; }
.imp-concepto { font-size: 13.5px; max-width: 420px; }
.imp-concepto .badge { margin-left: 4px; font-size: 11px; }
.imp-row.is-dup td { background: color-mix(in srgb, var(--warn-bg) 70%, transparent); }
.imp-row.is-sin select.imp-tipo { border-color: color-mix(in srgb, var(--ko) 55%, var(--border)); }
.imp-row:has(input[name="sel[]"]:not(:checked)) td:not(:first-child) { opacity: .45; }
.imp-rec { display: flex; align-items: center; gap: 8px; min-width: 210px; }
.imp-patron { padding: 6px 8px !important; font: 12px var(--mono) !important; text-transform: uppercase; }
.imp-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 2px; align-items: center; }
.rule-pat { font-size: 12.5px; }
.test-result { margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; }
.test-result p { margin: 0; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }

/* =====================================================================
   Ejercicios (Fase 3)
   ===================================================================== */
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 12px; }
.spacer { flex: 1; }
.center-flex { justify-content: center; margin-top: 8px; }
.mono { font-family: var(--mono) !important; font-size: 13.5px !important; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.grow { flex: 1; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); padding: 12px 0; margin-top: 0; }
.drop-sm { padding: 14px; flex-direction: column; }
.drop-sm .drop-text { display: flex; align-items: center; gap: 6px; }
.inline-file { font-size: 12px; max-width: 230px; }
.err-list { margin: 6px 0 0; padding-left: 18px; }

/* Materias */
.mat-card { padding: 0; gap: 0; }
.mat-head { display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 10px; color: var(--text) !important; text-decoration: none !important; }
.mat-temas { padding: 0 18px 10px; display: flex; flex-wrap: wrap; gap: 4px 0; align-items: center; }
.mat-counts { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); margin-top: auto; }
.mat-counts a { padding: 10px 6px; text-align: center; font-size: 12px; color: var(--muted) !important; text-decoration: none !important; }
.mat-counts a + a { border-left: 1px solid var(--border); }
.mat-counts a:hover { background: var(--surface-2); color: var(--text) !important; }
.mat-counts strong { display: block; font-size: 18px; color: var(--text); }
.topic-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.topic-list li { display: flex; align-items: center; gap: 8px; }
.topic-list input:not(.topic-order) { flex: 1; padding: 7px 10px; }
.topic-order { width: 64px !important; padding: 7px 6px !important; text-align: center; flex: none; }
.topic-uses { min-width: 24px; text-align: center; font-size: 12px; }

/* Aprendizaje */
.lesson-group { border-top: 4px solid var(--acc); }
.lesson-subject { display: flex; align-items: center; gap: 8px; }
.lesson-subject .acc-dot { background: var(--acc); }
.lesson-topic { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 16px 0 6px; }
.lesson-topic:first-of-type { margin-top: 4px; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list a { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; color: var(--text) !important; text-decoration: none !important; }
.lesson-list a:hover { background: var(--surface-2); }
.lesson-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: grid; place-items: center; color: #fff; }
.is-read .lesson-check { background: var(--c-ing); border-color: var(--c-ing); }
.lesson-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lesson-main small { font-size: 12.5px; }
.lesson-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.lesson-body { border-top: 4px solid var(--acc); font-size: 16px; line-height: 1.7; padding: 28px 32px; }
.lesson-done { display: flex; align-items: center; gap: 8px; color: var(--c-ing); font-weight: 700; margin: 0 0 10px; }
.doc-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.doc-list li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.doc-list li a:not(.icon-btn) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.lesson-nav { display: flex; flex-direction: column; gap: 10px; }
.lesson-nav a { display: flex; flex-direction: column; font-weight: 600; font-size: 14px; color: var(--text) !important; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none !important; }
.lesson-nav a:hover { border-color: var(--brand); }
.lesson-nav a.next { text-align: right; }
@media (max-width: 600px) { .lesson-body { padding: 18px; font-size: 15px; } }

/* Contenido Markdown */
.md > :first-child { margin-top: 0; }
.md h2 { font-size: 22px; margin: 28px 0 10px; letter-spacing: -.2px; }
.md h3 { font-size: 18px; margin: 22px 0 8px; }
.md h4, .md h5 { font-size: 16px; margin: 18px 0 6px; }
.md p { margin: 0 0 14px; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 24px; }
.md li { margin: 4px 0; }
.md blockquote { margin: 0 0 16px; padding: 12px 16px; border-left: 4px solid var(--acc, var(--brand)); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.md blockquote p:last-child { margin: 0; }
.md img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 8px 0; }
.md mark { background: color-mix(in srgb, var(--accent) 45%, transparent); color: inherit; padding: 0 3px; border-radius: 3px; }
.md hr { margin: 24px 0; }
.md-code { background: var(--navy); color: #E8E6F5; padding: 14px 16px; border-radius: 8px; overflow-x: auto; font: 13.5px/1.5 var(--mono); margin: 0 0 16px; }
.md-code code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.md-math { margin: 6px 0 16px; overflow-x: auto; text-align: center; }
.md-table { overflow-x: auto; margin: 0 0 16px; }
.md-table table { border-collapse: collapse; min-width: 50%; font-size: 14.5px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 7px 12px; }
.md-table th { background: var(--surface-2); }
.md-video { position: relative; aspect-ratio: 16 / 9; margin: 6px 0 16px; border-radius: 10px; overflow: hidden; background: #000; }
.md-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.md-media { width: 100%; margin: 6px 0 16px; border-radius: 10px; }
.md-task { list-style: none; margin-left: -20px; display: flex; gap: 8px; align-items: baseline; }
.md-check { width: 14px; height: 14px; border: 2px solid var(--border); border-radius: 4px; flex: none; }
.md-check.on { background: var(--c-ing); border-color: var(--c-ing); }

/* Editor */
.editor { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-top: 16px; }
.editor:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.editor-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.editor-tabs { display: flex; gap: 2px; }
.editor-tab { background: none; border: 0; padding: 6px 12px; border-radius: 6px; font: 600 13px var(--font); color: var(--muted); cursor: pointer; }
.editor-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.editor-tools { display: flex; gap: 2px; flex-wrap: wrap; }
.editor-tools button { min-width: 32px; height: 30px; border: 0; background: none; border-radius: 6px; cursor: pointer; font: 600 13px var(--font); color: var(--text); }
.editor-tools button:hover { background: var(--surface); }
.editor-text { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; font: 14.5px/1.6 var(--mono) !important; min-height: 380px; }
.editor-preview { padding: 18px 20px; min-height: 380px; font-size: 15.5px; line-height: 1.7; }
.md-help { margin-top: 12px; font-size: 13px; }
.md-help summary { cursor: pointer; color: var(--muted); }
.md-help ul { padding-left: 18px; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }

/* Preguntas */
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 8px; border-radius: 8px; background: var(--surface-2); }
.bulk-bar select { width: auto; padding: 6px 8px; font-size: 13px; max-width: 220px; }
.q-cell { max-width: 560px; }
.q-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
.qtype { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.qtype-test_unica, .qtype-test_multiple { color: #2A78D6; border-color: color-mix(in srgb, #2A78D6 35%, transparent); background: color-mix(in srgb, #2A78D6 8%, transparent); }
.qtype-verdadero_falso { color: #6250D6; border-color: color-mix(in srgb, #6250D6 35%, transparent); background: color-mix(in srgb, #6250D6 8%, transparent); }
.qtype-respuesta_corta, .qtype-numerica { color: #B45309; border-color: color-mix(in srgb, #B45309 35%, transparent); background: color-mix(in srgb, #B45309 8%, transparent); }
.qtype-ordenar, .qtype-relacionar { color: #0E7490; border-color: color-mix(in srgb, #0E7490 35%, transparent); background: color-mix(in srgb, #0E7490 8%, transparent); }
.qtype-desarrollo { color: #BE185D; border-color: color-mix(in srgb, #BE185D 35%, transparent); background: color-mix(in srgb, #BE185D 8%, transparent); }
@media (prefers-color-scheme: dark) { .qtype { filter: brightness(1.5); } }
.type-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 860px) { .type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.type-opt { position: relative; cursor: pointer; }
.type-opt input { position: absolute; opacity: 0; }
.type-opt span { display: block; text-align: center; padding: 9px 6px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.type-opt input:checked + span { border-color: var(--brand); background: var(--brand-50); color: var(--text); box-shadow: inset 0 0 0 1px var(--brand); }
.type-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.ia-steps .card { margin-bottom: 0; }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: var(--accent); font-size: 13px; margin-right: 6px; }
.chips-sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.chips-sm .chip { padding: 7px 10px; font-size: 13px; align-items: center; }
.chips-sm .chip input { margin-top: 0; }
.prompt-box { background: var(--surface-2) !important; font-size: 12.5px !important; }
.q-preview { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: qp; }
.q-preview > li { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); counter-increment: qp; }
.q-prev-check { padding-top: 2px; }
.q-prev-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.q-prev-body { flex: 1; min-width: 0; }
.q-prev-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 6px; }
.q-prev-meta::before { content: counter(qp) "."; font-weight: 700; color: var(--muted); }
.q-prev-text { font-weight: 600; margin-bottom: 6px; }
.q-prev-opts { margin: 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
.q-prev-opts li.ok { color: var(--pos); font-weight: 600; }
.q-prev-opts li.ok::marker { content: "✓  "; }
.q-prev-sol { margin: 0; font-size: 14px; color: var(--pos); display: flex; gap: 6px; align-items: baseline; }
.q-prev-exp { margin: 6px 0 0; font-size: 13px; }

/* Exámenes: listado */
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 16px; margin-bottom: 24px; }
.exam-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.exam-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--acc); }
.exam-card.off { opacity: .7; }
.exam-card .acc-dot { background: var(--acc); }
.exam-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.exam-top .badge { margin-left: auto; }
.exam-card h3 { font-size: 17px; }
.exam-card h3 a { color: var(--text) !important; }
.exam-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.exam-facts li { display: flex; align-items: center; gap: 5px; }
.exam-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.exam-best { font-size: 13px; color: var(--muted); }
.exam-best strong { font-size: 18px; margin-left: 4px; }
.exam-why { font-size: 12.5px; text-align: right; }
.grade-pill { display: inline-grid; place-items: center; min-width: 44px; height: 30px; padding: 0 8px; border-radius: 8px; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--surface-2); border: 1px solid var(--border); }
.grade-pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.grade-pill.ko { background: var(--ko-bg); color: var(--ko); border-color: transparent; }
.user-pick { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 260px; overflow-y: auto; }
.pick-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; }
.pick-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.pick-text { flex: 1; min-width: 0; font-size: 14px; }
.bank-head { margin-top: 10px; padding-top: 16px; border-top: 2px solid var(--border); }
.inline-toolbar { margin: 0; }
.bank-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; max-height: 520px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.bank-list li { padding: 10px 12px; border-top: 1px solid var(--border); font-size: 14px; }
.bank-list li:first-child { border-top: 0; }
.bank-list li:hover { background: var(--surface-2); }
.exam-intro { border-top: 4px solid var(--acc); }
.exam-rules { list-style: none; margin: 4px 0 22px; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.exam-rules li { display: flex; gap: 12px; align-items: flex-start; }
.exam-rules .ico { color: var(--brand); margin-top: 2px; }
.attempts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attempts a { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; color: var(--text) !important; text-decoration: none !important; font-size: 14px; }
.attempts a:hover { background: var(--surface-2); }

/* Examen en curso */
.exam { max-width: 860px; margin: 0 auto; }
.exam-bar { position: sticky; top: 60px; z-index: 15; display: flex; align-items: center; gap: 16px; padding: 12px 16px; margin: -8px 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(14, 12, 29, .08); }
.exam-bar-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.exam-bar-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-bar-title span { font-size: 12px; }
.exam-progress { display: flex; flex-direction: column; gap: 4px; width: 120px; font-size: 12.5px; font-weight: 700; text-align: center; }
.exam-timer { display: flex; align-items: center; gap: 6px; font: 700 20px var(--mono); padding: 6px 12px; border-radius: 10px; background: var(--navy); color: var(--accent); font-variant-numeric: tabular-nums; }
.exam-timer.warn { background: var(--warn-bg); color: var(--warn); }
.exam-timer.danger { background: var(--ko); color: #fff; animation: latido 1s infinite; }
@keyframes latido { 50% { opacity: .65; } }
@media (prefers-reduced-motion: reduce) { .exam-timer.danger { animation: none; } }
.exam-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.exam-nav a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--muted) !important; text-decoration: none !important; }
.exam-nav a.done { background: var(--brand-50); border-color: var(--brand); color: var(--text) !important; }
.q-card { scroll-margin-top: 150px; }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.q-num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--navy); color: var(--accent); font-weight: 800; font-size: 14px; flex: none; }
.q-enunciado { font-size: 16px; font-weight: 500; margin-bottom: 14px; }
.q-enunciado p:last-child { margin-bottom: 0; }
.q-answer { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 15px; transition: border-color .12s, background .12s; }
.opt:hover { border-color: var(--brand); }
.opt input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand); }
.opt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.num-answer { max-width: 220px; font: 600 18px var(--mono) !important; }
.order-list, .match-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.order-list li, .match-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.order-list select { width: 70px; flex: none; }
.match-left { flex: 1; font-weight: 600; min-width: 0; }
.match-arrow { color: var(--muted); }
.match-list select { flex: 1; min-width: 0; }
@media (max-width: 600px) { .match-list li { flex-wrap: wrap; } .match-list select { flex-basis: 100%; } .match-arrow { display: none; } .exam-bar { flex-wrap: wrap; top: 60px; } .exam-progress { width: 90px; } .exam-timer { font-size: 16px; } }
.q-check { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.q-feedback { width: 100%; padding: 12px 14px; border-radius: 10px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.q-feedback.ok { background: var(--ok-bg); color: var(--ok); }
.q-feedback.ko { background: var(--ko-bg); color: var(--ko); }
.q-feedback.info { background: var(--info-bg); color: var(--info); }
.q-feedback div { color: var(--text); }
.exam-end { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.exam-end p { margin: 0; }

/* Resultados */
.result-hero { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.grade-ring { --c: var(--c-gas); width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; align-content: center; flex: none;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0); }
.is-ok .grade-ring { --c: var(--c-ing); } .is-pend .grade-ring { --c: #EDA100; }
.grade-ring span { font-size: 36px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.grade-ring small { color: var(--muted); font-size: 12px; }
.result-text h2 { font-size: 24px; margin-bottom: 4px; }
.is-ok .result-text h2 { color: var(--pos); } .is-ko .result-text h2 { color: var(--neg); }
.result-text p { margin: 0 0 10px; }
.result-facts { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.result-facts strong { color: var(--text); font-size: 18px; }
.q-review { border-left: 4px solid var(--border); }
.q-review.q-ok { border-left-color: var(--c-ing); } .q-review.q-ko { border-left-color: var(--c-gas); } .q-review.q-parcial, .q-review.q-pend, .q-card.q-pend { border-left-color: #EDA100; }
.q-score { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.q-state { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 12.5px; }
.q-ok .q-state { color: var(--pos); } .q-ko .q-state { color: var(--neg); } .q-parcial .q-state, .q-pend .q-state { color: var(--warn); }
.q-dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; font-size: 14.5px; }
.q-dl dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.q-dl dd { margin: 0; min-width: 0; }
.q-sol { color: var(--pos); font-weight: 600; }
.q-comment { background: var(--info-bg); color: var(--info); padding: 6px 10px; border-radius: 8px; }
@media (max-width: 600px) { .q-dl { grid-template-columns: 1fr; gap: 2px; } .q-dl dd { margin-bottom: 8px; } }
.dist { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-bottom: 22px; }
.dist-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.dist-val { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.dist-bar { width: 100%; max-width: 26px; min-height: 0; border-radius: 4px 4px 0 0; }
.dist-bar.ok, .dist-ok-lg { background: var(--c-ing); } .dist-bar.ko, .dist-ko-lg { background: var(--c-gas); }
.dist-lbl { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); }
.q-stat-text { min-width: 0; }
.grade-row { display: flex; gap: 16px; align-items: flex-end; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.grade-row .field:first-child { width: 160px; }

/* Tarjetas dentro de formularios de varias columnas: separación entre campos */
.form > .grid-main > .card, .form > .grid-main > .stack > .card { display: flex; flex-direction: column; gap: 14px; }
.form > .grid-main > .card > .card-title, .form > .grid-main > .stack > .card > .card-title { margin-bottom: 0; }
.form > .grid-main { margin-bottom: 0; }
.card .sticky-actions { background: color-mix(in srgb, var(--surface) 92%, transparent); }

.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--navy); font: 800 11px/20px var(--font); text-align: center; letter-spacing: 0; }
.nav-sec > summary .nav-badge { margin: 0 6px 0 auto; }
.nav-sec[open] > summary .nav-badge { display: none; }

/* =====================================================================
   Trabajo · Comunicación · Equipamiento (v1.3)
   ===================================================================== */
:root { --est-pend: #64748B; --est-proc: #EDA100; --est-fin: #1BAF7A; }
.push-right { margin-left: auto !important; }
.form-tight { gap: 10px; }
.link-btn.neg { color: var(--ko); }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; display: inline-grid; flex: none; vertical-align: middle; }
.avatars { display: inline-flex; align-items: center; }
.avatars .avatar-xs + .avatar-xs { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatars small { margin-left: 4px; color: var(--muted); }
.swatches-sm .swatch span { width: 22px; height: 22px; border-radius: 6px; }
.clock-alert { align-items: center; }
.clock-alert form { margin: 0; }
.user-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-height: 240px; }
.user-pick .check { align-items: center; }
.user-pick .check input { margin-top: 0; }

/* Tablero de tareas */
.board-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.board-groups { position: sticky; top: 80px; margin-bottom: 0; }
.group-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.group-list a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text) !important; text-decoration: none !important; font-size: 14px; }
.group-list a:hover { background: var(--surface-2); }
.group-list a.active { background: var(--brand-50); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); }
.group-list small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 400; }
.group-form summary { cursor: pointer; font-size: 13px; color: var(--brand); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.group-form form { margin-top: 10px; }
.tipo-pick { display: grid; gap: 6px; margin-bottom: 10px; }
.tipo-pick .card-title { margin: 0; }
.tipo-pick select { font-weight: 600; }
.board-groups-title { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.group-form form select { margin-bottom: 2px; }
.touch-only { display: none; }
@media (hover: none) { .touch-only { display: inline; } }
/* Tiempos: filtro Tipo › Grupo */
.tiempos-filtro { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.tiempos-filtro .field { margin: 0; min-width: 180px; }
.board-main .toolbar { margin-bottom: 14px; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 240px; }
.board-col header { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.board-col h2 { font-size: 14px; margin: 0; }
.board-col header b { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.col-dot { width: 10px; height: 10px; border-radius: 50%; }
.col-pendiente .col-dot { background: var(--est-pend); } .col-proceso .col-dot { background: var(--est-proc); } .col-finalizada .col-dot { background: var(--est-fin); }
.board-drop { display: flex; flex-direction: column; gap: 8px; min-height: 180px; border-radius: 10px; transition: background .15s, box-shadow .15s; }
.board-drop.drop-over { background: var(--brand-50); box-shadow: inset 0 0 0 2px var(--brand); }
.board-empty { margin: 0; padding: 26px 10px; text-align: center; color: var(--muted); font-size: 13px; border: 2px dashed var(--border); border-radius: 10px; }
.task { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 10px 14px; box-shadow: var(--shadow); cursor: grab; display: flex; flex-direction: column; gap: 6px; }
.task::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--g); }
.task:hover { border-color: var(--brand); }
.task.dragging { opacity: .45; cursor: grabbing; }
.task.moved { animation: aterriza .6s; }
@keyframes aterriza { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }
@media (prefers-reduced-motion: reduce) { .task.moved { animation: none; } }
.col-finalizada .task-title { text-decoration: line-through; color: var(--muted) !important; }
.task-top { display: flex; align-items: center; gap: 6px; font-size: 11.5px; min-height: 14px; }
.task-group { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; font-size: 10.5px; }
.task-grip { margin-left: auto; color: var(--border); }
.task:hover .task-grip { color: var(--muted); }
.task-title { font-weight: 650; font-size: 14.5px; color: var(--text) !important; line-height: 1.35; }
.task-obj { align-self: flex-start; font-size: 11.5px; font-weight: 600; color: var(--o); background: color-mix(in srgb, var(--o) 10%, transparent); border-radius: 6px; padding: 1px 7px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.task-meta span { display: inline-flex; align-items: center; gap: 4px; }
.task-foot { display: flex; align-items: center; gap: 6px; }
.task-foot form { margin: 0; }
.chip-btn { display: inline-flex; align-items: center; gap: 4px; font: 600 11.5px var(--font); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip-btn:hover { border-color: var(--brand); }
.chip-btn.on { background: var(--ko); border-color: var(--ko); color: #fff; }
.seg-estado .est-opt-pendiente input:checked + span { background: var(--est-pend); color: #fff; }
.seg-estado .est-opt-proceso input:checked + span { background: var(--est-proc); color: #fff; }
.seg-estado .est-opt-finalizada input:checked + span { background: var(--est-fin); color: #fff; }
.est-badge-pendiente { background: color-mix(in srgb, var(--est-pend) 14%, transparent); color: var(--est-pend); }
.est-badge-proceso { background: color-mix(in srgb, var(--est-proc) 18%, transparent); color: #B45309; }
.est-badge-finalizada { background: color-mix(in srgb, var(--est-fin) 16%, transparent); color: var(--pos); }
@media (prefers-color-scheme: dark) { .est-badge-proceso { color: var(--est-proc); } .est-badge-pendiente { color: #CBD5E1; } }
@media (max-width: 1100px) { .board-layout { grid-template-columns: minmax(0, 1fr); } .board-groups { position: static; } .group-list { flex-direction: row; flex-wrap: wrap; } }
@media (max-width: 860px) { .board { grid-template-columns: 1fr; } .board-col { min-height: 0; } .board-drop { min-height: 60px; } }

/* Tiempos */
.time-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.time-list li { display: flex; align-items: center; gap: 8px; }
.time-list li > span:nth-child(2) { flex: 1; min-width: 0; }
.time-list b { font-variant-numeric: tabular-nums; }
.clock-card { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.clock-card.is-on { background: linear-gradient(120deg, var(--surface), var(--brand-50)); border-color: var(--brand); }
.clock-big { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 240px; }
.clock-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.clock-task { font-size: 20px; }
.clock-task a { color: var(--text) !important; }
.clock-time { font: 800 44px/1.1 var(--mono); letter-spacing: -1px; color: var(--brand); font-variant-numeric: tabular-nums; }
.clock-out { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
.clock-out input { width: 280px; max-width: 100%; }
.clock-tasks { list-style: none; margin: 0; padding: 0; }
.clock-tasks li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.clock-tasks li:first-child { border-top: 0; }
.clock-tasks li.on { background: var(--brand-50); margin: 0 -10px; padding: 10px; border-radius: 8px; }
.clock-tasks form { margin: 0; }
.hbars-sm { gap: 10px; margin-bottom: 14px; }
.hbars-sm .hbar-head { font-size: 13px; margin-bottom: 4px; }

/* Agenda */
.ag-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.ag-nav { display: flex; align-items: center; gap: 6px; }
.ag-nav h2 { font-size: 20px; margin-left: 8px; }
.ag-nav .icon-btn { font-size: 18px; width: 34px; justify-content: center; }
.ag-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ag-tools select { width: auto; padding: 7px 10px; font-size: 14px; }
.seg-link { padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted) !important; text-decoration: none !important; }
.seg-link.on { background: var(--navy); color: var(--accent) !important; }
@media (prefers-color-scheme: dark) { .seg-link.on { background: rgba(57,255,136,.14); } }
.ag-month { padding: 12px; }
.ag-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ag-grid.ag-head { background: none; border: 0; margin-bottom: 4px; }
.ag-head span { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 4px 8px; }
.ag-day { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ag-day.weekend { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.ag-day.out { background: var(--surface-2); }
.ag-day.out .ag-num { color: var(--muted) !important; opacity: .5; }
.ag-num { align-self: flex-start; font-weight: 700; font-size: 13px; color: var(--text) !important; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; text-decoration: none !important; }
.ag-num:hover { background: var(--surface-2); }
.ag-day.today .ag-num { background: var(--navy); color: var(--accent) !important; }
.ag-chip { display: block; font-size: 11.5px; line-height: 1.3; padding: 2px 6px 2px 8px; border-radius: 5px; color: var(--text) !important; text-decoration: none !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--g) 14%, var(--surface)); border-left: 3px solid var(--g); }
.ag-chip:hover { background: color-mix(in srgb, var(--g) 26%, var(--surface)); }
.ag-chip.est-finalizada { text-decoration: line-through !important; opacity: .65; }
.ag-chip.est-proceso { font-weight: 700; }
.ag-chip.is-limit { background: none; border-left-style: dashed; }
.ag-more { font-size: 11px; color: var(--muted) !important; padding-left: 6px; }
.ag-time { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--brand) !important; background: var(--brand-50); padding: 1px 6px; border-radius: 999px; text-decoration: none !important; }
.est-lg-pendiente { background: var(--est-pend); } .est-lg-proceso { background: var(--est-proc); } .est-lg-finalizada { background: var(--est-fin); }
.ag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ag-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--g); border-radius: 8px; }
.ag-list li > div { flex: 1; min-width: 0; }
.ag-list-sm li { padding: 8px 10px; }
.ag-hour { font: 700 14px var(--mono); min-width: 46px; color: var(--muted); }
.ag-timeline { position: relative; height: 26px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); margin: 4px 0 22px; }
.ag-timeline span { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; }
.ag-timeline i { position: absolute; bottom: -18px; transform: translateX(-50%); font-style: normal; font-size: 10.5px; color: var(--muted); }
.ag-year { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 12px; }
.ag-mini { padding: 14px; margin-bottom: 0; }
.ag-mini-title { display: block; font-weight: 700; margin-bottom: 8px; color: var(--text) !important; }
.ag-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; font-size: 11px; }
.ag-mini-grid b { color: var(--muted); font-weight: 600; }
.ag-mini-grid a { display: grid; place-items: center; aspect-ratio: 1; border-radius: 5px; color: var(--text) !important; text-decoration: none !important; position: relative; }
.ag-mini-grid a:hover { box-shadow: inset 0 0 0 1px var(--brand); }
.ag-mini-grid a.today { box-shadow: inset 0 0 0 2px var(--navy); font-weight: 800; }
.ag-mini-grid a.has-task::after { content: ""; position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--c-gas); }
.heat-1, .heat-lg-1 { background: color-mix(in srgb, var(--c-ing) 22%, transparent); }
.heat-2 { background: color-mix(in srgb, var(--c-ing) 42%, transparent); }
.heat-3 { background: color-mix(in srgb, var(--c-ing) 64%, transparent); }
.heat-4, .heat-lg-4 { background: var(--c-ing); color: #fff !important; }
.heat-lg-2 { background: color-mix(in srgb, var(--c-ing) 50%, transparent); }
.dot-task { width: 8px !important; height: 8px !important; border-radius: 50% !important; background: var(--c-gas); }
@media (max-width: 860px) { .ag-day { min-height: 70px; padding: 3px; } .ag-chip { font-size: 10px; padding: 1px 3px 1px 4px; } .ag-time { font-size: 9.5px; } .ag-head span { padding: 2px; font-size: 10px; } }

/* Objetivos */
.obj-card { color: var(--text) !important; text-decoration: none !important; }
.obj-card:hover { border-color: var(--acc); }
.obj-card h3 { margin: 2px 0 4px; }
.obj-progress { display: flex; align-items: center; gap: 10px; }
.obj-progress .progress { flex: 1; margin: 0; }
.obj-hero { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; border-top: 4px solid var(--acc); }
.obj-hero .result-text { flex: 1; min-width: 260px; }
.obj-ring span { font-size: 30px; }
.progress.stacked { display: flex; }
.progress.stacked > span { border-radius: 0; }

/* Mensajes */
.chat { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; height: calc(100vh - 200px); min-height: 460px; }
.chat > .card { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-list { padding: 8px; overflow-y: auto; }
.chat-empty { padding: 16px; text-align: center; }
.chat-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: var(--text) !important; text-decoration: none !important; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--brand-50); }
.chat-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-item-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-main small { color: var(--text); font-weight: 600; }
.chat-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11px; color: var(--muted); }
.chat-item-meta .nav-badge { margin: 0; }
.chat-pane { padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-head form { margin: 0; }
.chat-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.chat-day { text-align: center; margin: 10px 0 4px; }
.chat-day span { font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.bubble { max-width: min(560px, 78%); padding: 8px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; box-shadow: var(--shadow); }
.bubble small { display: block; text-align: right; font-size: 10.5px; opacity: .7; margin-top: 2px; }
.bubble.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.mine { align-self: flex-end; background: var(--navy); color: #EDEBFA; border-bottom-right-radius: 4px; }
@media (prefers-color-scheme: dark) { .bubble.mine { background: #1F5A3A; } }
.bubble-text { overflow-wrap: anywhere; }
.chat-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); margin: 0; align-items: flex-end; }
.chat-compose textarea { flex: 1; resize: none; }
.chat-new { padding: 16px; overflow-y: auto; }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 170px); }
  .chat.has-open .chat-list { display: none; }
  .chat:not(.has-open) .chat-pane { display: none; }
}

/* Avisos */
.startup { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.startup-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.startup-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.startup-head form { margin: 0; }
.notice { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); border-left: 5px solid var(--info); }
.notice-importante { border-left-color: #EDA100; background: color-mix(in srgb, var(--warn-bg) 60%, var(--surface)); }
.notice-urgente { border-left-color: var(--ko); background: color-mix(in srgb, var(--ko-bg) 70%, var(--surface)); }
.notice-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--info-bg); color: var(--info); }
.notice-importante .notice-icon { background: var(--warn-bg); color: var(--warn); }
.notice-urgente .notice-icon { background: var(--ko); color: #fff; }
.notice-body { flex: 1; min-width: 0; }
.notice-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.notice-top strong { font-size: 15.5px; }
.notice-text { font-size: 14.5px; }
.notice-text p:last-child { margin-bottom: 0; }
.notice form { margin: 0; }
@media (max-width: 600px) { .notice { flex-wrap: wrap; } }
.msg-alert { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 20px; border-radius: var(--radius); background: var(--navy); color: #E8E6F5; flex-wrap: wrap; }
.msg-alert-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(57,255,136,.14); color: var(--accent); }
.msg-from { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: 13.5px; }
.msg-from a { color: #E8E6F5 !important; display: inline-flex; align-items: center; gap: 6px; }
.notice-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notice-mini a { display: flex; flex-direction: column; padding: 8px 10px 8px 12px; border-radius: 8px; border-left: 3px solid var(--info); background: var(--surface-2); color: var(--text) !important; text-decoration: none !important; font-size: 14px; }
.notice-mini .niv-importante a { border-left-color: #EDA100; } .notice-mini .niv-urgente a { border-left-color: var(--ko); }
.niv-opt-info input:checked + span { background: var(--info); color: #fff; }
.niv-opt-importante input:checked + span { background: #EDA100; color: #fff; }
.niv-opt-urgente input:checked + span { background: var(--ko); color: #fff; }

/* Equipos */
.eq-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.eq-activo { background: var(--c-ing); } .eq-reparacion { background: #EDA100; } .eq-almacen { background: #2A78D6; } .eq-baja { background: var(--muted); }
.track { list-style: none; margin: 0; padding: 0; position: relative; }
.track::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.track li { position: relative; display: flex; gap: 14px; padding: 0 0 16px; }
.track-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--muted); flex: none; z-index: 1; margin-top: 2px; }
.track-incidencia .track-dot { border-color: var(--ko); } .track-reparacion .track-dot { border-color: #EDA100; } .track-mantenimiento .track-dot, .track-revision .track-dot { border-color: #2A78D6; } .track-asignacion .track-dot { border-color: var(--c-ing); }
.track li.is-open .track-dot { background: #EDA100; }
.track-body { flex: 1; min-width: 0; }
.track-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.track-body p { margin: 4px 0 0; font-size: 14px; }
.track-actions { display: flex; gap: 14px; margin-top: 4px; }
.track-actions form { margin: 0; }
.doc-list-lg li { padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.doc-list-lg li:first-child { border-top: 0; }
.doc-list-lg form { margin: 0; }

/* Próximamente */
.soon { text-align: center; padding: 56px 20px; }
.soon-icon { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 24px; display: grid; place-items: center; background: var(--navy); color: var(--accent); box-shadow: 0 0 30px rgba(57,255,136,.25); }
.soon p { max-width: 460px; margin: 8px auto 0; }

/* =====================================================================
   App instalable (PWA) y móvil
   ===================================================================== */
.pwa-grid { margin-top: 4px; }
.pwa-grid + .pwa-grid { margin-top: 16px; }
.pwa-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.pwa-box h3 { margin: 0; font-size: 15px; }
.pwa-box p { margin: 0; }
.pwa-box .head-actions { flex-wrap: wrap; }
.pwa-box .list-plain { width: 100%; }
.pwa-box .list-plain li { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.pwa-box .list-plain li form { margin: 0 0 0 auto; flex: none; width: auto; }
.pwa-box .list-plain li small { min-width: 0; }
.app:has(.touch-dragging) ~ .bottom-nav { opacity: .25; }
.pwa-ios ol { margin: 6px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.pwa-ios p { margin: 0; }
.ios-share { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid currentColor; border-radius: 5px; font-size: 12px; vertical-align: -5px; color: #0A84FF; }
.pwa-ok { color: var(--pos) !important; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pwa-ok[hidden] { display: none; }
.text-danger { color: var(--neg, #DC2626); font-weight: 600; }

/* Barra inferior (solo móvil) */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(14, 12, 29, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px 4px; border: 0; background: none; color: #9D99BC !important; font: 600 11px var(--font);
    text-decoration: none; border-radius: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav a span, .bottom-nav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav a.active { color: var(--accent) !important; }
  .bottom-nav a.active::before { content: ""; position: absolute; top: -6px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
  .bottom-nav a:active, .bottom-nav button:active { background: rgba(255, 255, 255, .06); }
  .bottom-nav a.is-on { color: var(--accent) !important; }
  .bn-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #EF4444; color: #fff; font: 700 10.5px/18px var(--font); text-align: center; }
  .bn-dot { position: absolute; top: 5px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #0E0C1D, 0 0 10px var(--accent); animation: bn-pulso 1.6s infinite; }
  @keyframes bn-pulso { 50% { opacity: .35; } }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  body.nav-open .sidebar { z-index: 60; padding-bottom: env(safe-area-inset-bottom); }
  body.nav-open .sidebar-backdrop { z-index: 55; }

  /* Fichar: botones grandes y fáciles de pulsar */
  .clock-card { flex-direction: column; align-items: stretch; text-align: center; }
  .clock-big { min-width: 0; align-items: center; }
  .clock-time { font-size: 52px; }
  .clock-out { flex-direction: column; align-items: stretch; }
  .clock-out .btn { width: 100%; justify-content: center; padding: 16px; font-size: 18px; border-radius: 14px; }
  .clock-tasks li { flex-wrap: wrap; }
  .clock-tasks .push-right .btn { padding: 10px 18px; font-size: 15px; border-radius: 12px; }
}
/* En la app instalada, la barra de estado del iPhone queda por encima de la cabecera */
html.is-app .topbar { padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
html.is-app .sidebar { padding-top: env(safe-area-inset-top); }

/* Tablero: arrastrar con el dedo */
@media (hover: none) {
  .task { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .task-grip { color: var(--muted); }
}
.task.touch-armed { transition: transform .35s ease; }
.task.touch-armed:not(.dragging) { transform: scale(.985); }
.task-ghost { position: fixed !important; z-index: 80; margin: 0; pointer-events: none; transform: rotate(-2deg) scale(1.03); box-shadow: 0 18px 40px rgba(14, 12, 29, .35); opacity: .96; border-color: var(--brand) !important; }
.board.touch-dragging .board-drop { box-shadow: inset 0 0 0 1px var(--border); }
.board.touch-dragging .board-empty { display: block !important; padding: 14px 10px; }

/* =====================================================================
   Comunicación › Alertas
   ===================================================================== */
.alert-push a { font-weight: 700; }
.count-hot { background: #EF4444 !important; border-color: #EF4444 !important; color: #fff; font-weight: 700; }
.alert-feed { list-style: none; margin: -6px 0; padding: 0; }
.alert-feed li + li { border-top: 1px solid var(--border); }
.af-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 6px; color: var(--text) !important; text-decoration: none !important; border-radius: 10px; position: relative; }
a.af-item:hover { background: var(--surface-2); }
.af-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.af-recordatorio { background: var(--brand-50); color: var(--brand); }
.af-tarea { background: color-mix(in srgb, var(--est-proc) 16%, transparent); color: var(--est-proc); }
.af-deuda, .af-presupuesto { background: color-mix(in srgb, var(--c-gas) 14%, transparent); color: var(--c-gas); }
.af-garantia { background: var(--info-bg); color: var(--info); }
.af-examen { background: color-mix(in srgb, #8B5CF6 14%, transparent); color: #8B5CF6; }
.af-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.af-body strong { font-size: 14.5px; line-height: 1.35; }
.af-text { font-size: 13.5px; color: var(--text); opacity: .85; overflow-wrap: anywhere; }
.af-body small { font-size: 12px; }
.af-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin-top: 6px; box-shadow: 0 0 0 3px var(--brand-50); }
.af-go { flex: none; color: var(--muted); align-self: center; transform: rotate(-90deg); }
.alert-feed li.is-new .af-item { background: var(--brand-50); }
.alert-feed li.is-new strong { color: var(--text); }

.rem-list { list-style: none; margin: -6px 0; padding: 0; }
.rem { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.rem + .rem { border-top: 1px solid var(--border); }
.rem-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: flex-start; color: var(--text) !important; text-decoration: none !important; }
a.rem-main:hover strong { color: var(--brand); }
.rem-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.rem-pausa .rem-ico, .rem-fin .rem-ico { background: var(--surface-2); color: var(--muted); }
.rem-pausa .rem-body strong, .rem-fin .rem-body strong { color: var(--muted); }
.rem-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rem-body small { font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rem-next { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 13px; font-variant-numeric: tabular-nums; }
.rem-act { margin: 0; flex: none; }
@media (max-width: 600px) {
  .rem { flex-wrap: wrap; }
  .rem-main { flex: 1 1 100%; }
  .rem-next { flex-direction: row; align-items: center; margin-left: 50px; }
  .rem-act { margin-left: auto; }
}

.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; margin-top: 12px; }
.auto-rule { display: flex; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-2); transition: border-color .15s, background .15s; }
.auto-rule.on { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: var(--surface); }
.auto-rule.off { opacity: .6; }
.auto-ico { flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.auto-rule.on .auto-ico { background: var(--brand-50); color: var(--brand); border-color: transparent; }
.auto-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.auto-body p { margin: 0; font-size: 13px; }
.auto-val { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.auto-val input { width: 84px; text-align: right; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--border); position: relative; transition: background .15s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--brand); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { box-shadow: 0 0 0 3px var(--ring); }
.switch input:disabled + .switch-ui { opacity: .6; }
.cron-card p { margin: 6px 0; }

.chips-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.chips-quick .chip-btn { padding: 5px 11px; font-size: 12.5px; }
.chip-btn.is-filled { background: var(--brand-50); border-color: var(--brand); }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap .seg-opt { flex: 1 1 auto; }
.seg-wrap .seg-opt input:checked + span { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .seg-wrap .seg-opt input:checked + span { color: var(--navy); } }
.dl-tight { grid-template-columns: 80px 1fr; gap: 4px 10px; margin: 14px 0; font-size: 13px; }

/* Inicio: alertas sin leer */
.home-alerts .alert-feed li.is-new .af-item { background: transparent; }

/* =====================================================================
   Centros › Apartados por centro
   ===================================================================== */
.apt-fieldset { display: block !important; margin-top: 18px !important; padding-top: 18px !important; border-top: 1px solid var(--border) !important; }
.apt-fieldset legend { font-weight: 700; font-size: 15px; padding: 0; margin-bottom: 4px; }
.apt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.apt-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.apt-group .check { font-size: 14px; }
.apt-group .check .ico { color: var(--muted); }
.apt-head { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; margin-bottom: 2px; border-bottom: 1px solid var(--border); }
.apt-head .badge { margin-left: auto; }
.apt-fixed p { margin: 0; font-size: 13px; }
.apt-matrix th, .apt-matrix td { white-space: nowrap; }
.apt-matrix thead th { vertical-align: bottom; }
.apt-matrix .center { text-align: center; }
.apt-matrix .apt-grp-row th, .apt-matrix .apt-grp-row td { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.apt-matrix .apt-name { white-space: normal; min-width: 180px; }
.apt-matrix .apt-name .ico { color: var(--muted); vertical-align: -3px; }
.apt-cell { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; }
.apt-cell:hover { background: var(--brand-50); }
.apt-cell input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.apt-matrix td:first-child, .apt-matrix th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.apt-matrix .apt-grp-row th:first-child { background: var(--surface-2); }

/* Historial de un registro */
.hist-btn { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted) !important; text-decoration: none !important; background: var(--surface); }
.hist-btn:hover { color: var(--brand) !important; border-color: var(--brand); }
h1 + .hist-btn { margin-bottom: 4px; }
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.hist-item { margin: 0; border-left: 3px solid var(--info); }
.hist-item.hist-ok { border-left-color: var(--ok); }
.hist-item.hist-ko { border-left-color: var(--ko); }
.hist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.hist-desc { margin: 8px 0 0; color: var(--text); font-size: 14px; }
.hist-diff { margin-top: 10px; }
.hist-diff summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand); margin-bottom: 8px; }
.hist-diff td:first-child { white-space: nowrap; text-transform: capitalize; }
.hist-url { word-break: break-all; font-size: 12px; }

/* Papelera */
.trash-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.w-check { width: 34px; }
.w-check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* Indicadores · deuda: barra doble por persona */
.hbar-dual { display: flex; flex-direction: column; gap: 3px; height: auto; background: none; }
.hbar-dual span { display: block; height: 6px; border-radius: 4px; }

/* Nombre de usuario (#alias) */
.alias { color: var(--brand); font-weight: 600; font-size: .92em; }
.alias-lg { font-size: 1.05em; }
.alias-input span { left: 12px; right: auto; }
.alias-input input { padding-left: 28px; }
.badge-xs { padding: 0 6px; font-size: 10.5px; }

/* Amigos */
.friend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.friend-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.friend-list li:last-child { border-bottom: 0; }
.friend-main { flex: 1; min-width: 0; font-size: 14px; }
.friend-act { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.friend-act form { margin: 0; }
.pick-title { display: block; margin: 10px 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Plataformas */
.plat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.plat-card { display: flex; flex-direction: column; gap: 8px; margin: 0; border-top: 4px solid var(--pc); color: var(--text) !important; text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
.plat-card:hover { box-shadow: 0 6px 18px rgba(14, 12, 29, .08); }
.plat-card.is-off { opacity: .65; }
.plat-head { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.plat-head .badge { margin-left: auto; }
.plat-desc { margin: 0; font-size: 13.5px; }
.plat-mods { display: flex; flex-wrap: wrap; gap: 4px; }
.apt-off { opacity: .5; cursor: not-allowed; }
.apt-na { color: var(--muted); }
.help-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

/* Actualizaciones */
.releases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.release { margin: 0; }
.release.is-current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.release-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.release-head h2 { margin: 0; font-size: 17px; }
.release-ver { display: grid; place-items: center; min-width: 54px; height: 54px; border-radius: 14px; background: var(--brand-50); color: var(--brand); font-weight: 800; font-size: 16px; }
.release-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.release-list li { display: flex; gap: 10px; align-items: flex-start; }
.release-list li .badge { min-width: 66px; justify-content: center; margin-top: 2px; }
.release-list p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.sidebar-foot a { color: inherit; text-decoration: none; }
.sidebar-foot a:hover { text-decoration: underline; }

/* Ayuda */
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.help-index { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; margin: 0; }
.help-index .search { position: relative; margin-bottom: 12px; }
.help-index .search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.help-index .search input { width: 100%; padding-left: 32px; }
.help-index nav { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.help-index nav strong { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.help-index nav a { padding: 5px 8px; border-radius: 6px; color: var(--text) !important; text-decoration: none !important; }
.help-index nav a:hover { background: var(--surface-2); }
.help-group { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.help-group:first-child { margin-top: 0; }
.help-topic { scroll-margin-top: 80px; }
.help-topic.is-target { box-shadow: 0 0 0 2px var(--brand); }
.help-topic-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.help-topic-head h2 { margin: 0; font-size: 17px; }
.help-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-50); color: var(--brand); flex: none; }
.help-steps { margin: 8px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.help-tip { display: flex; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--info-bg); color: var(--text); font-size: 13.5px; }
.help-tip .ico { color: var(--info); flex: none; margin-top: 2px; }
.help-tip p { margin: 0; }
.help-tip p + p { margin-top: 4px; }
.topbar-help { color: var(--muted); }
@media (max-width: 900px) { .help-layout { grid-template-columns: minmax(0, 1fr); } .help-index { position: static; max-height: none; } }

/* Exportar a PDF / Excel */
.export-btns { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: 0 1px 2px rgba(14, 12, 29, .05); flex: none; }
.export-btns:not(.is-placed) { float: right; margin: 0 0 12px 12px; }
.page-head > .export-btns { align-self: flex-start; }
.export-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--text) !important; text-decoration: none !important; transition: background .15s, color .15s; }
.export-btn + .export-btn { border-left: 1px solid var(--border); }
.export-pdf .ico { color: #D93025; }
.export-xls .ico { color: #1D6F42; }
.export-pdf:hover { background: #FDECEA; color: #A50E0E !important; }
.export-xls:hover { background: #E6F4EA; color: #0D5A2E !important; }
@media (prefers-color-scheme: dark) { .export-pdf:hover { background: rgba(217, 48, 37, .18); color: #FF8A80 !important; } .export-xls:hover { background: rgba(29, 111, 66, .25); color: #7EE2A8 !important; } }
@media (max-width: 640px) { .export-btn { padding: 8px 10px; font-size: 12.5px; } }
.export-only { display: none !important; }
@media print { .sidebar, .topbar, .bottom-nav, .export-btns, .head-actions, .flash, .toolbar { display: none !important; } .main { margin: 0 !important; } }

/* Login: mantener la sesión iniciada */
.login-remember { margin: 2px 0 16px; font-size: 14px; }
.login-remember small { margin-left: 2px; }

/* =====================================================================
   Documentos › Documentos y Notas
   ===================================================================== */
.doc-cell { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.doc-cell .doc-ico { flex: none; margin-top: 2px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.row-actions form { margin: 0; }
.upload-card > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; margin: 0; list-style: none; }
.upload-card > summary::-webkit-details-marker { display: none; }
.upload-card[open] > summary { margin-bottom: 14px; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 6px 18px; }
.perm-chips .badge { gap: 4px; }
.perm-chips small { width: 100%; }

.nota-form-card { background: color-mix(in srgb, var(--nota) 55%, var(--surface)); border-color: color-mix(in srgb, var(--nota) 70%, var(--border)); transition: background .2s; }
.nota-form input, .nota-form textarea { background: var(--surface); }
.nota-form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.nota-form-foot .form-actions { margin: 0; }
.notas-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.notas-toolbar .search { flex: 1; max-width: 420px; }
.notas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; align-items: start; }
.nota {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 10px; border-radius: var(--radius);
  background: var(--nota); color: #1E293B; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 18px rgba(15, 23, 42, .07);
  border: 1px solid rgba(15, 23, 42, .06);
}
.nota.is-pinned::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 3px; border-radius: 0 0 3px 3px; background: #004b7d; }
.nota.is-editing { outline: 2px solid #004b7d; outline-offset: 2px; }
.nota-titulo { margin: 0; font-size: 15px; font-weight: 700; color: #0F172A; }
.nota-texto { font-size: 14px; line-height: 1.55; white-space: normal; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.nota-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; border-top: 1px solid rgba(15, 23, 42, .08); }
.nota-foot small { color: #475569; font-size: 12px; }
.nota-acciones { display: flex; gap: 2px; }
.nota-acciones form { margin: 0; }
.nota .icon-btn { color: #475569; }
.nota .icon-btn:hover { background: rgba(15, 23, 42, .07); color: #0F172A; }
.nota .icon-btn.on { color: #004b7d; }

/* =====================================================================
   Móvil: nada puede ser más ancho que la pantalla
   (evita el desplazamiento lateral y que la barra inferior se vea cortada)
   ===================================================================== */
.main { overflow-x: clip; }
.grid-main > *, .board-layout > *, .stack > *, .help-layout > *, .grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; }
.sm-only { display: none; }
.content img, .content video, .content iframe { max-width: 100%; height: auto; }
.page-head > div { min-width: 0; }
.page-head h1 { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  /* Cabecera: el selector de centro se encoge (con «…») para que el menú de la cuenta quepa siempre */
  .topbar { gap: 8px; }
  .topbar > * { flex: none; }
  .topbar .centro-select { flex: 0 1 auto; min-width: 0; gap: 6px; }
  .topbar .centro-select select { width: 100%; min-width: 0; max-width: none; text-overflow: ellipsis; }
  .topbar .centro-select.static span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .centro-select > .ico { flex: none; }
  .topbar-spacer { flex: 1 1 0; min-width: 0; }
  .user-menu summary { gap: 2px; padding: 4px 0 4px 4px; }
  .user-dropdown { max-width: calc(100vw - 24px); }
  .bottom-nav { width: 100%; max-width: 100vw; box-sizing: border-box; }
  .page-head { flex-wrap: wrap; }
  .head-actions { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .col-sm-hide { display: none; }
  .sm-only { display: inline; }
  .doc-cell small { overflow-wrap: anywhere; }
}

/* =====================================================================
   Menú lateral: segundo nivel (submenús) y apartados «Próximamente»
   ===================================================================== */
.nav-sub > summary { list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 7px 10px 7px 12px; margin-top: 2px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: rgba(255, 255, 255, .92); user-select: none; }
.nav-sub > summary::-webkit-details-marker { display: none; }
.nav-sub > summary::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .55); flex: none; }
.nav-sub > summary span { flex: 1; }
.nav-sub > summary:hover { background: rgba(255, 255, 255, .08); }
.nav-sub > summary .ico { transition: transform .18s; opacity: .75; }
.nav-sub:not([open]) > summary .ico { transform: rotate(-90deg); }
.nav-sub > summary .nav-badge { margin: 0 4px 0 0; }
.nav-sub[open] > summary .nav-badge { display: none; }
.nav-sub-items { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 15px; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, .18); }
.nav-sub-items .nav-link { padding: 7px 10px; font-size: 13.5px; }
.nav-link.is-soon { opacity: .72; }
.nav-link.is-soon:hover { opacity: 1; }
.nav-soon { margin-left: auto; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .2px; background: rgba(255, 255, 255, .14); color: #fff; }

/* Página «Próximamente» */
.proximamente { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.proximamente h2 { margin: 4px 0 0; font-size: 20px; }
.proximamente p { margin: 0; max-width: 560px; }
.proximamente .badge { gap: 4px; }
.proximamente-ico { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; background: color-mix(in srgb, #004b7d 12%, var(--surface)); color: #004b7d; }

/* Políticas de seguridad */
.seg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(110px, 100%), 1fr)); gap: 10px; margin: 6px 0 10px; }
.seg-card { position: relative; cursor: pointer; }
.seg-card input { position: absolute; opacity: 0; }
.seg-card > span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); transition: border-color .15s, background .15s; }
.seg-card strong { font-size: 22px; line-height: 1.1; }
.seg-card small { color: var(--muted); font-size: 12px; }
.seg-card input:checked + span { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand); }
.seg-card input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
fieldset[disabled] .seg-card { cursor: default; }

/* Tickets */
.tk-cell { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.tk-ico { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; vertical-align: middle; }
.page-head .tk-ico { width: 22px; height: 22px; border-radius: 6px; }
.tk-incidencia { background: var(--ko-bg); color: var(--ko); }
.tk-sugerencia { background: var(--warn-bg); color: var(--warn); }
.tk-informacion { background: var(--info-bg); color: var(--info); }
.tk-estado { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.tk-estado::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tk-e-abierto { color: var(--info); }
.tk-e-tramitando { color: var(--warn); }
.tk-e-cerrado { color: var(--ok); }
.tk-e-eliminado { color: var(--muted); }
.row-new td:first-child { box-shadow: inset 3px 0 0 var(--info); }
.tk-tipos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tk-tipo { position: relative; cursor: pointer; }
.tk-tipo input { position: absolute; opacity: 0; }
.tk-tipo > span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.tk-tipo small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.tk-tipo input:checked + span { border-color: var(--brand); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand); }
.tk-tipo input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 600px) { .tk-tipos { grid-template-columns: minmax(0, 1fr); } .tk-tipo > span { flex-direction: row; flex-wrap: wrap; align-items: center; } .tk-tipo small { flex-basis: 100%; } }
.tk-hilo { display: flex; flex-direction: column; gap: 14px; }
.tk-msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); max-width: 92%; }
.tk-msg.tk-admin { align-self: flex-end; background: color-mix(in srgb, #004b7d 7%, var(--surface)); border-color: color-mix(in srgb, #004b7d 25%, var(--border)); }
.tk-msg header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 6px; font-size: 13.5px; }
.tk-msg header strong { display: inline-flex; align-items: center; gap: 4px; }
.tk-texto { font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.tk-msg .doc-list { margin: 10px 0 0; }
.tk-evento { align-self: center; display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ===================================================================
   Recursos humanos (Puestos, Empleados), Nóminas y Clientes
   =================================================================== */
.row-group td { background: var(--surface-2); font-size: 13px; padding-top: 8px; padding-bottom: 8px; }
.row-sel td { background: var(--brand-50); }
.row-past td { color: var(--muted); }
td.cell-actions { white-space: nowrap; text-align: right; width: 1%; }
td.cell-actions > * { display: inline-flex; vertical-align: middle; }
td.cell-actions form { margin: 0; }
.card-hl { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.card-sel { box-shadow: 0 0 0 2px var(--ring); }
.sub-title { font-size: 14px; font-weight: 700; margin: 18px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.link-sm { font-size: 13px; }
.toolbar-plain { justify-content: space-between; }
.toolbar-plain .muted { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.stat-form { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.stat-form input { width: 80px; font-size: 20px; font-weight: 700; padding: 4px 8px; }

/* Horario semanal */
.horario-tabla td, .horario-tabla th { font-size: 12.5px; padding: 6px 4px; }
.horario-edit { max-width: 760px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; margin-bottom: 14px; background: var(--surface-2); }
.horario-head, .horario-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; }
.horario-head { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-bottom: 4px; }
.horario-head span:not(:first-child) { text-align: center; }
.horario-row { padding: 3px 0; border-top: 1px solid var(--border); }
.horario-row strong { font-size: 12.5px; }
.horario-row.is-weekend strong { color: var(--muted); }
.horario-tramo { display: flex; gap: 4px; min-width: 0; }
.horario-tramo input { width: 100%; min-width: 0; padding: 5px 4px; font-size: 12.5px; }
.horario-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; font-size: 12.5px; }

/* Agenda: vacaciones y ausencias */
.ag-chip.ag-aus { --g: #0EA5E9; font-weight: 600; }
.ag-chip.ag-aus-ausencia { --g: #F59E0B; }
.ag-day.is-vac { background: color-mix(in srgb, #0EA5E9 7%, var(--surface)); }
.ag-mini-grid a.has-vac { background: color-mix(in srgb, #0EA5E9 28%, var(--surface)); }
.ag-mini-grid a.has-aus { box-shadow: inset 0 -3px 0 #F59E0B; }
.lg-vac { background: #0EA5E9; } .lg-aus { background: #F59E0B; }
.ag-aus-card .ag-list li { --g: #0EA5E9; }
.ag-aus-card .ag-list li.ag-aus-ausencia { --g: #F59E0B; }
.ag-aus-card .card-title { display: flex; align-items: center; gap: 8px; }
.stats-inline + .grid-main, .stats-inline + .chips-row { margin-top: 16px; }
@media (max-width: 600px) {
  .horario-head { display: none; }
  .horario-row { grid-template-columns: 40px minmax(0, 1fr); row-gap: 4px; }
  .horario-row span.horario-tramo:nth-of-type(2) { grid-column: 2; }
  .horario-tramo input { font-size: 14px; padding: 6px; }
}

/* =====================================================================
   Versión 2.2 · Centro (moneda y logotipo), alcance de permisos, Servicios,
   Presupuestos, Contratos, Proyectos y Seguimientos
   ===================================================================== */
/* Perfiles: alcance TODOS / PROPIOS junto al nivel */
.matrix-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg-alcance .seg-opt span { font-size: 12px; padding: 5px 10px; }
.seg-alcance .seg-opt input:checked + span { background: #0F766E; }
.matrix-hint { display: block; margin: -6px 0 8px; font-size: 12px; }

/* Logotipo del centro */
.centro-logo { height: 30px; max-width: 120px; object-fit: contain; border-radius: 6px; }
.logo-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-preview { max-height: 72px; max-width: 200px; object-fit: contain; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

/* Referencia del presupuesto: siempre visible en presupuestos, contratos y proyectos */
.ref-tag { display: inline-flex; align-items: baseline; gap: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; font-size: .92em;
  padding: 1px 7px; border-radius: 6px; background: var(--brand-50); color: var(--brand-600); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); white-space: nowrap; }
.ref-tag small { font-weight: 600; font-size: .8em; opacity: .8; }
h1 .ref-tag { font-size: .62em; vertical-align: middle; margin-right: 4px; }

.big-num { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin: 2px 0; font-variant-numeric: tabular-nums; }
.text-ko { color: var(--ko) !important; }
.line-through { text-decoration: line-through; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.ellipsis-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.btn-xs { padding: 3px 7px; font-size: 12px; }
.check-inline { margin: 0; white-space: nowrap; }
.search-sm { position: relative; max-width: 240px; flex: 1; }
.search-sm .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-sm input { width: 100%; padding: 6px 10px 6px 30px; font-size: 13px; }
.list-rows li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); }
.list-rows li:first-child { border-top: 0; }
.card-accent { border-color: var(--brand); background: linear-gradient(120deg, var(--surface), var(--brand-50)); }
.form-inline-upload { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.form-inline-upload .drop { flex: 1; }

/* Presupuestos: tabla de servicios, totales y estados */
.pre-lineas td { vertical-align: middle; }
.pre-lineas tr[data-pre-linea] { opacity: .62; transition: opacity .15s; }
.pre-lineas tr[data-pre-linea].is-on { opacity: 1; background: var(--brand-50); }
.pre-lineas .w-check { width: 34px; }
.pre-lineas .row-group td { background: var(--surface-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.input-qty { width: 150px; margin-left: auto; display: flex; align-items: center; gap: 6px; }
.input-qty input { text-align: right; padding: 6px 8px !important; width: 72px; flex: none; }
.input-qty span { position: static; transform: none; font-size: 12px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.pre-totales { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 16px; }
.pre-totales > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.pre-totales dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.pre-totales dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.pre-totales .total { background: var(--brand-50); }
.pre-totales .total dd { font-size: 18px; color: var(--brand-600); }
.rev-box { border-style: dashed; }
.pre-opt-pendiente input:checked + span, .pro-opt-pausado input:checked + span { background: #B45309; }
.pre-opt-aceptado input:checked + span { background: #059669; }
.pre-opt-cancelado input:checked + span, .pro-opt-cerrado input:checked + span { background: #64748B; }
.pro-opt-abierto input:checked + span { background: #0369A1; }
.res-opt-positivo input:checked + span { background: #059669; }
.res-opt-neutro input:checked + span, .seg-opt input[name=resultado][value=""]:checked + span { background: #64748B; }
.res-opt-negativo input:checked + span { background: #DC2626; }
.pre-stats .stat.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-50); }
.pre-stats .stat-pendiente .stat-value { color: var(--warn); }
.pre-stats .stat-aceptado .stat-value { color: var(--ok); }
.pre-stats .stat-cancelado .stat-value { color: var(--muted); }

/* Proyectos: barra de progreso de tareas */
.mini-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.mini-bar span { display: block; height: 100%; background: var(--ok); }

/* Seguimientos e historial de estados: línea de tiempo */
.seg-timeline { list-style: none; margin: 0; padding: 0; }
.seg-timeline li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.seg-timeline li:first-child { border-top: 0; }
.seg-timeline p { margin: 6px 0 0; }
.seg-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; background: var(--muted); }
.seg-llamada { background: #0369A1; } .seg-email { background: #6250D6; } .seg-reunion { background: #059669; }
.seg-visita { background: #EB6834; } .seg-mensaje { background: #E87BA4; }
.pro-dot-abierto { background: #0369A1; } .pro-dot-pausado { background: #B45309; } .pro-dot-cerrado { background: #64748B; }

/* Agenda: contratos (inicio / fin) y próximos pasos comerciales */
.ag-chip.ag-con { --g: #0F766E; font-weight: 600; }
.ag-chip.ag-con-fin { --g: #B45309; }
.ag-chip.ag-acc { --g: #6250D6; }
.ag-chip.is-done { text-decoration: line-through; opacity: .6; }

@media (max-width: 720px) {
  .pre-totales { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input-qty { width: 120px; }
  .ellipsis { max-width: 220px; }
  .centro-logo { height: 24px; max-width: 80px; }
}
.form-narrow { max-width: 1000px; }
.chips-row .chip-btn { padding: 5px 11px; font-size: 12.5px; text-decoration: none; }
.chips-row .chip-btn.active { background: var(--brand-50); border-color: var(--brand); color: var(--brand-600); }

/* ---------------------------------------------- v2.3 · Facturación por horas */
.text-warn { color: var(--warn); font-weight: 600; }
.tab .count.count-warn { background: var(--warn-bg); color: var(--warn); }
a.stat:hover { border-color: var(--brand); }
.tfoot-plain th { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* ---------------------------------------------- v2.4 · Tareas que se repiten */
.rep-box { margin-top: 4px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.rep-box .grid-auto { margin: 0; }
.dias-semana { display: flex; flex-wrap: wrap; gap: 6px; }
.dias-semana label { position: relative; cursor: pointer; }
.dias-semana input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.dias-semana span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: 14px; }
.dias-semana input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.dias-semana input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.ag-prevista { opacity: .6; border-style: dashed !important; }
.group-list a span b.mono { font-size: 11.5px; }

/* ---------------------------------------------- v2.4 · Verificación de presupuestos (página pública) */
.verif { text-align: center; }
.verif-sello { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); }
.verif-sello.verif-ko { background: var(--ko-bg); color: var(--ko); }
.verif-datos { margin: 18px 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: left; }
.verif-datos div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.verif-datos div:last-child { border-bottom: 0; }
.verif-datos dt { color: var(--muted); }
.verif-datos dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.verif-total dd { font-size: 20px; }
.verif .alert { text-align: left; }
.verif-aceptar { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); text-align: left; }
.verif-aceptar h2 { margin: 0 0 10px; font-size: 17px; }
.btn-block { width: 100%; justify-content: center; }
.rep-cada { display: flex; align-items: center; gap: 8px; }
.rep-cada input { width: 80px; }
.rep-cada span { color: var(--muted); }
.rep-box .hint, .rep-box > p { margin-top: 8px; }
.verif-huella { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------- v2.5 · Facturación */
.form-narrow.fac-ancho { max-width: 980px; }
.fac-lineas td { vertical-align: top; }
.fac-lineas .fac-concepto { width: 100%; min-width: 220px; min-height: 38px; resize: vertical; }
.fac-lineas .num-input { width: 100%; min-width: 80px; }
.fac-lineas td:nth-child(2) { width: 90px; } .fac-lineas td:nth-child(3) { width: 120px; } .fac-lineas td:nth-child(4) { width: 100px; } .fac-lineas td:nth-child(5) { width: 110px; padding-top: 14px; }
.fac-pie { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-top: 12px; }
.fac-ret { max-width: 160px; }
.pre-totales.fac-totales { display: flex; flex-direction: column; gap: 6px; min-width: 300px; margin: 0; }
.fac-totales > div, .fac-totales [data-t=desglose] > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 7px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.fac-totales [data-t=desglose] { display: contents; }
.fac-totales dd { margin: 0; }
.fac-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.huella { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.row-due td { background: var(--warn-bg); }
@media (max-width: 700px) { .fac-pie { flex-direction: column; } .fac-totales { min-width: 0; width: 100%; } }
.fac-enviar { margin-bottom: 10px; }
.seg-cobro .seg-opt input:checked + span { background: var(--brand); color: #fff; }

/* --------------------------------------------------------- Actividades › Juegos */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 18px; margin-bottom: 28px; }
.game-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.game-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15, 23, 42, .12); }
.game-shot { position: relative; display: block; aspect-ratio: 4 / 3; background: #07060f; overflow: hidden; }
.game-shot img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform .3s; }
.game-card:hover .game-shot img { transform: scale(1.03); }
.game-shot-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); opacity: .6; }
.game-play { position: absolute; right: 12px; bottom: 12px; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--navy); box-shadow: 0 4px 18px rgba(57, 255, 136, .45); transition: transform .15s; }
.game-play .ico { margin-left: 3px; }
.game-card:hover .game-play { transform: scale(1.08); }
.game-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.game-body h3 { font-size: 18px; margin: 0; }
.game-body h3 a { color: var(--text) !important; }
.game-desc { margin: 0; font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.game-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.game-best { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.game-best strong { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }
.game-best .ico { color: #D4A017; }

.rank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 18px; }
.rank-grid > .card { margin-bottom: 0; }
.rank-card .card-title, .juego-side .card-title { display: flex; align-items: center; gap: 8px; }
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: none; }
.ranking li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); font-size: 14px; }
.ranking li:nth-child(even) { background: var(--surface-2); }
.rk-pos { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rk-1 .rk-pos { background: #F5C542; color: #3B2A00; }
.rk-2 .rk-pos { background: #C9D1DB; color: #1F2937; }
.rk-3 .rk-pos { background: #D9915A; color: #3A1B05; }
.rk-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rk-who strong, .rk-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-who strong small { color: var(--brand); font-weight: 700; }
.rk-who > small { color: var(--muted); font-size: 12px; }
.rk-lvl { display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; color: var(--muted); line-height: 1.2; white-space: nowrap; }
.rk-lvl small { font-size: 11px; }
.rk-pts { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; min-width: 64px; }
.ranking li.rk-yo { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.rk-empty { margin: 0; font-size: 14px; }

/* Jugar */
.juego-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.juego-side { display: flex; flex-direction: column; gap: 20px; }
.juego-side > .card { margin: 0; }
.juego-stage { position: relative; background: #0a0a0d; border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 1px var(--border), var(--shadow); height: min(calc(100vh - 190px), 820px); min-height: 420px; }
.juego-stage iframe { display: block; width: 100%; height: 100%; border: 0; background: #0a0a0d; }
.juego-start { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; text-align: center; color: #fff; background: radial-gradient(ellipse at center, rgba(10, 10, 13, .5), rgba(10, 10, 13, .9)); backdrop-filter: blur(2px); }
.juego-start[hidden] { display: none; }
.juego-start strong { font-size: 22px; letter-spacing: .2px; }
.juego-start-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.juego-aqui { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); color: #fff !important; }
.juego-aqui:hover { background: rgba(255, 255, 255, .18); }
.juego-start-ico { width: 82px; height: 82px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; background: var(--accent); color: var(--navy); box-shadow: 0 0 0 8px rgba(57, 255, 136, .18), 0 8px 30px rgba(57, 255, 136, .4); transition: transform .15s; }
.juego-start-ico .ico { margin-left: 5px; }
.juego-start-ico:hover { transform: scale(1.06); }
.juego-salir { display: none; position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); z-index: 3; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font: 600 13px var(--font); cursor: pointer; opacity: .55; transition: opacity .15s; }
.juego-salir:hover, .juego-salir:focus-visible { opacity: 1; }
.juego-stage.is-fs .juego-salir { display: inline-flex; }
.juego-stage:fullscreen { height: 100%; width: 100%; border-radius: 0; box-shadow: none; }
.juego-stage:-webkit-full-screen { height: 100%; width: 100%; border-radius: 0; }
.juego-stage.is-max { position: fixed; inset: 0; z-index: 1000; height: auto; min-height: 0; border-radius: 0; }
html.juego-max-on, html.juego-max-on body { overflow: hidden; }
.juego-toast { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 4; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; background: var(--navy); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); pointer-events: none; animation: juego-toast .25s ease-out; }
.juego-toast.is-ok { background: var(--accent); color: var(--navy); }
.juego-toast.is-ko { background: var(--ko); }
@keyframes juego-toast { from { opacity: 0; transform: translate(-50%, 8px); } }
.juego-rec { display: flex; align-items: baseline; gap: 8px; margin: -4px 0 14px; }
.juego-rec strong { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.juego-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.juego-dl div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.juego-dl dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.juego-dl dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.juego-desc { margin: 0 0 10px; font-size: 14px; }
@media (max-width: 1100px) {
  .juego-layout { grid-template-columns: minmax(0, 1fr); }
  .juego-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
}
@media (max-width: 640px) {
  .juego-stage { height: min(calc(100svh - 170px), 720px); min-height: 360px; margin: 0 -16px; border-radius: 0; }
}

/* Gestionar juegos */
.gj-thumb { width: 76px; }
.gj-thumb img { display: block; width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: #07060f; image-rendering: pixelated; }
.gj-prev { display: block; width: 100%; max-width: 320px; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: #07060f; image-rendering: pixelated; }
.table tr.is-sel td { background: var(--brand-50); }
.gj-reset { margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.code-block { margin: 8px 0 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font: 12.5px/1.55 var(--mono); overflow-x: auto; white-space: pre; }
.help-list + .hint { margin-top: 14px; }

/* ---------------------------------------------------------------- Organización › Seguridad */
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.seg-live-ctrl { align-items: center; flex-wrap: wrap; gap: 10px; }
.seg-live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.seg-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: seg-pulso 2s infinite; }
.seg-live-ctrl.pausado .seg-live { color: var(--muted); }
.seg-live-ctrl.pausado .seg-live i { background: var(--muted); animation: none; }
.seg-live-ctrl.error .seg-live { color: var(--ko); }
.seg-live-ctrl.error .seg-live i { background: var(--ko); animation: none; }
@keyframes seg-pulso { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .seg-live i { animation: none; } }
.seg-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.seg-kpis .stat-value { font-size: 26px; }
.seg-stat-alerta { border-color: color-mix(in srgb, var(--ko) 40%, var(--border)); }
.seg-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-bottom: 20px; align-items: start; }
.seg-grid > .card { margin-bottom: 0; min-width: 0; }
.seg-feed { list-style: none; margin: 0 0 12px; padding: 0; max-height: 520px; overflow-y: auto; }
.seg-feed li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.seg-feed li:last-child { border-bottom: 0; }
.seg-feed-hora { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; padding-top: 2px; display: flex; flex-direction: column; }
.seg-feed-hora small { font-size: 11px; }
.seg-feed-desc { overflow-wrap: anywhere; }
.seg-ruta code { font-size: 12px; word-break: break-all; }
.seg-row-alerta td { background: var(--ko-bg); }
.seg-pill-alerta { color: var(--ko) !important; border-color: color-mix(in srgb, var(--ko) 40%, var(--border)); display: inline-flex; align-items: center; gap: 4px; }
.seg-sub { margin: 2px 0 0; font-size: 13px; }
.seg-chips { margin: 0; }
.seg-legend { margin-bottom: 8px; }
.seg-legend-item { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.seg-legend-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.seg-legend-item b { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.seg-legend-item.off { opacity: .45; }
.seg-legend-item.off i { background: transparent !important; border: 2px solid var(--muted); }
.seg-nota { font-size: 12.5px; margin: 6px 0 0; }
.inline-form { display: inline; margin: 0; }
@media (max-width: 900px) { .seg-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .seg-kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .seg-kpis .stat { padding: 12px; } .seg-kpis .stat-value { font-size: 22px; } }
