:root {
  --brand: #008DAA;
  --brand-dark: #006f87;
  --brand-soft: #e6f4f8;
  --accent: #5EBF30;
  --accent-dark: #4a9a25;
  --ink: #1f2a37;
  --muted: #6b7785;
  --line: #e3e8ee;
  --bg: #f4f7fa;
  --card: #ffffff;
  --side-w: 244px;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: .925rem; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
.text-brand { color: var(--brand) !important; }
.ico { vertical-align: -3px; flex: 0 0 auto; }

/* Botones */
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-icon { border: 0; background: transparent; padding: .25rem .5rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(0,141,170,.15); }
.form-label { font-weight: 600; font-size: .8rem; color: #3b4755; margin-bottom: .25rem; }

/* Estructura */
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: var(--side-w); background: #0e2a35; color: #cfe3ea; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1040; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: .65rem; padding: 1rem 1.1rem; color: #fff; text-decoration: none; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand:hover { color: #fff; }
.brand b { color: var(--accent); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: #fff; padding: 3px; flex: 0 0 auto; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-mark-lg { width: 84px; height: 84px; border-radius: 18px; padding: 6px; background: transparent; }
.side-nav { padding: .75rem .6rem; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 8px; color: #b8d0d9; text-decoration: none; font-weight: 500; }
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.active { background: var(--brand); color: #fff; }
.side-sep { height: 1px; background: rgba(255,255,255,.1); margin: .6rem .4rem; }
.pill { margin-left: auto; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 20px; padding: 0 .5rem; }
.side-foot { padding: .9rem 1.1rem; font-size: .72rem; color: #7da0ad; border-top: 1px solid rgba(255,255,255,.08); }
.side-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
.main-col { margin-left: var(--side-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; background: #fff; border-bottom: 1px solid var(--line); padding: .55rem 1.25rem; }
.top-search { max-width: 320px; width: 100%; }
.content { padding: 1.4rem 1.25rem 3rem; max-width: 1500px; width: 100%; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .side-backdrop.open { display: block; }
  .main-col { margin-left: 0; }
  .content { padding: 1rem .85rem 2.5rem; }
  .topbar { padding: .5rem .85rem; }
}

/* Cabecera de página */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.4rem; margin: 0; font-weight: 700; }
.page-head .sub { color: var(--muted); font-size: .85rem; }

/* Tarjetas */
.card-x { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-x > .card-h { padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-weight: 700; }
.card-x > .card-b { padding: 1.1rem; }
.kpi { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; position: relative; overflow: hidden; height: 100%; text-decoration: none; color: inherit; }
.kpi:hover { color: inherit; border-color: var(--brand); }
.kpi .v { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k, var(--brand)); }
.kpi.danger .v { color: #dc3545; }

/* Tablas */
.table-x { margin: 0; }
.table-x thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 700; }
.table-x td { vertical-align: middle; }
.table-x tbody tr:hover { background: #fafcfd; }
.table-responsive { border-radius: 0 0 12px 12px; }
.row-late td:first-child { box-shadow: inset 3px 0 0 #dc3545; }

/* Etiquetas */
.badge-tag { display: inline-block; padding: .18rem .6rem; border-radius: 20px; font-size: .74rem; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); white-space: nowrap; }
.badge-late { color: #dc3545; font-weight: 700; font-size: .75rem; }
.code-tag { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; font-weight: 700; letter-spacing: .02em; color: #006b82; background: rgba(0,141,170,.12); border: 1px solid rgba(0,141,170,.35); border-radius: 6px; padding: .05rem .45rem; vertical-align: baseline; white-space: nowrap; }

/* Filtros */
.filters { padding: .9rem 1.1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; align-items: end; }
.filters .actions { display: flex; gap: .4rem; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .9rem; overflow-x: auto; padding-bottom: .75rem; align-items: start; }
.k-col { background: #eaf0f4; border-radius: 12px; min-height: 160px; display: flex; flex-direction: column; }
.k-head { padding: .7rem .85rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; border-top: 4px solid var(--c, var(--brand)); border-radius: 12px 12px 0 0; }
.k-head .n { background: #fff; border-radius: 20px; padding: 0 .55rem; font-size: .78rem; }
.k-body { padding: .15rem .6rem .7rem; display: flex; flex-direction: column; gap: .55rem; min-height: 90px; flex: 1; }
.k-col.over { outline: 2px dashed var(--brand); background: #dcecf2; }
.k-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .65rem .75rem; cursor: grab; box-shadow: 0 1px 2px rgba(16,24,40,.05); border-left: 4px solid var(--pc, #ccc); }
.k-card.dragging { opacity: .45; }
.k-card .t { font-weight: 600; text-decoration: none; color: var(--ink); display: block; margin-bottom: .25rem; }
.k-card .meta { font-size: .76rem; color: var(--muted); }
.k-card select { margin-top: .5rem; }
.k-empty { color: #8a99a6; font-size: .8rem; text-align: center; padding: 1rem 0; }

/* Calendario */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.cal .dow { background: #f8fafc; padding: .45rem; text-align: center; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 108px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem; font-size: .78rem; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: #fafbfc; color: #b0bac4; }
.cal .day.today { background: var(--brand-soft); }
.cal .dnum { font-weight: 700; display: block; margin-bottom: .2rem; }
.ev { display: block; padding: .1rem .35rem; margin-bottom: 2px; border-radius: 5px; color: #fff; text-decoration: none; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--ec, var(--brand)); }
.ev:hover { color: #fff; filter: brightness(.92); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--ec); margin-right: .3rem; }
@media (max-width: 767.98px) {
  .cal { display: block; }
  .cal .dow { display: none; }
  .cal .day { min-height: 0; border-right: 0; display: none; }
  .cal .day.has, .cal .day.today { display: block; }
  .cal .day.other { display: none; }
}

/* Detalle y varios */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: .45rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; font-size: .8rem; }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 575.98px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: .55rem; } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .6rem 0 .6rem 1.1rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .95rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline .when { font-size: .75rem; color: var(--muted); }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.chart-box { position: relative; height: 270px; }
.alert { border-radius: 10px; }

/* Acceso e instalador */
.login-body { background: linear-gradient(135deg, #0e2a35 0%, #008DAA 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; }
.login-card { background: #fff; border-radius: 16px; padding: 2rem; width: 100%; max-width: 410px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

@media print { .sidebar, .topbar, .btn, .filters { display: none !important; } .main-col { margin: 0; } }


/* ---- Proyecto seleccionado ---- */
.ctx-form { min-width: 190px; max-width: 280px; flex: 0 1 260px; }
.ctx-form .form-select { border-color: var(--brand); font-weight: 600; }
.ctx-chip { margin: .25rem 1rem .75rem; padding: .5rem .7rem; border-radius: 10px; background: rgba(255,255,255,.08); line-height: 1.2; }
.ctx-chip .ctx-c { display: block; font-size: .72rem; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }
.ctx-chip .ctx-p { display: block; font-weight: 700; font-size: .92rem; }

/* ---- Inicio: tarjetas por cliente y proyecto ---- */
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.pj-card { background: #fff; border: 1px solid var(--line, #e3e8ee); border-radius: 14px; overflow: hidden; }
.pj-card .pj-head { padding: .85rem 1rem; background: linear-gradient(135deg, rgba(0,141,170,.10), rgba(94,191,48,.10)); font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.pj-row { padding: .75rem 1rem; border-top: 1px solid var(--line, #e3e8ee); }
.pj-row .nm { font-weight: 600; }
.pj-stats { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 .6rem; }
.pj-stats .st { font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; background: #f1f4f7; color: #34414f; }
.pj-stats .st.warn { background: #fde8ea; color: #b02a37; }
.pj-stats .st.appr { background: #fff1e0; color: #b45309; }

/* ---- Tareas: resumen, grupos y tarjetas ---- */
.tsum { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tsum a { text-decoration: none; color: #1f2d3a; background: #fff; border: 1px solid var(--line, #e3e8ee); border-left: 4px solid var(--k, #008DAA); border-radius: 10px; padding: .45rem .8rem; min-width: 110px; }
.tsum a:hover, .tsum a.on { background: #f4fafc; border-color: var(--k, #008DAA); }
.tsum .v { display: block; font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
.tsum .l { font-size: .72rem; color: #5b6b7a; text-transform: uppercase; letter-spacing: .03em; }
.tgroup { background: #fff; border: 1px solid var(--line, #e3e8ee); border-radius: 14px; margin-bottom: .9rem; overflow: hidden; }
.tgroup > summary { list-style: none; cursor: pointer; padding: .7rem 1rem; display: flex; align-items: center; gap: .6rem; font-weight: 700; border-left: 5px solid var(--gc, #008DAA); background: #fafcfd; }
.tgroup > summary::-webkit-details-marker { display: none; }
.tgroup > summary::before { content: '▸'; display: inline-block; transition: transform .15s; color: #6b7a89; }
.tgroup[open] > summary::before { transform: rotate(90deg); }
.tgroup .cnt { font-weight: 600; font-size: .78rem; background: #eef2f5; border-radius: 99px; padding: .05rem .55rem; color: #34414f; }
.tgroup .hrs { margin-left: auto; font-weight: 600; font-size: .78rem; color: #5b6b7a; }
.trow { display: grid; grid-template-columns: 6px 1fr auto; gap: .8rem; padding: .65rem 1rem; border-top: 1px solid var(--line, #eef2f5); align-items: center; }
.trow .bar { align-self: stretch; border-radius: 3px; background: var(--pc, #ccc); }
.trow .tt { font-weight: 600; text-decoration: none; }
.trow .sub { font-size: .78rem; color: #6b7a89; margin-top: .1rem; }
.trow .chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.trow .chip { font-size: .72rem; border-radius: 99px; background: #f1f4f7; color: #34414f; padding: .08rem .55rem; }
.trow .chip.est { background: #e6f4ea; color: #1e6b34; font-weight: 600; }
.trow .chip.late { background: #fde8ea; color: #b02a37; font-weight: 600; }
.trow .side { text-align: right; font-size: .8rem; white-space: nowrap; }
.trow.is-late { background: #fffafa; }
@media (max-width: 575px) { .trow { grid-template-columns: 6px 1fr; } .trow .side { grid-column: 2; text-align: left; } .ctx-form { flex: 1 1 100%; max-width: none; order: 5; } }


/* ---- Código de tarea destacado, botón Volver y volver arriba ---- */
.code-pill { display: inline-flex; align-items: center; gap: .45rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 800; font-size: 1.15rem; letter-spacing: .04em; color: #fff; background: var(--brand); border: 0; border-radius: 10px; padding: .3rem .85rem; cursor: pointer; box-shadow: 0 2px 6px rgba(0,141,170,.35); }
.code-pill:hover { filter: brightness(1.08); }
.code-pill:focus-visible { outline: 3px solid rgba(0,141,170,.45); outline-offset: 2px; }
.code-pill.copied { background: var(--accent, #5EBF30); }
.btn-back { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.to-top { position: fixed; right: 1.1rem; bottom: 1.1rem; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.28); cursor: pointer; z-index: 1030; opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s; }
.to-top.show { opacity: 1; transform: none; }
.to-top[hidden] { display: none; }
.to-top:hover { filter: brightness(1.1); }
.to-top:focus-visible { outline: 3px solid rgba(0,141,170,.5); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }


/* ---- Ojo de la contraseña ---- */
.pw-wrap { position: relative; }
.pw-wrap > input { padding-right: 2.9rem; }
.pw-toggle { position: absolute; top: 50%; right: .3rem; transform: translateY(-50%); width: 2.4rem; height: 2.4rem; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: #5b6b7a; border-radius: 8px; cursor: pointer; }
.pw-toggle:hover { color: var(--brand); background: rgba(0,141,170,.08); }
.pw-toggle:focus-visible { outline: 3px solid rgba(0,141,170,.45); outline-offset: 0; color: var(--brand); }
.pw-toggle[aria-pressed="true"] { color: var(--brand); }

/* ---- Acceso: fondo interactivo y entrada suave (el formulario sigue siendo una tarjeta blanca y nítida) ---- */
.login-body { position: relative; overflow: hidden; background: radial-gradient(1200px 700px at 15% 10%, rgba(94,191,48,.18), transparent 60%), linear-gradient(135deg, #0e2a35 0%, #006b82 55%, #008DAA 100%); background-size: 160% 160%; animation: loginBg 22s ease-in-out infinite alternate; }
.login-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.login-card { position: relative; z-index: 1; animation: loginIn .7s cubic-bezier(.2,.8,.2,1) both; }
.login-card .brand-mark { animation: loginFloat 4.5s ease-in-out infinite; }
.login-card .form-control { transition: border-color .15s, box-shadow .15s; }
.login-card .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 .22rem rgba(0,141,170,.22); }
.login-card .btn-brand { transition: transform .12s, box-shadow .15s; }
.login-card .btn-brand:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,141,170,.4); }
.login-card .btn-brand:active { transform: translateY(0); }
@keyframes loginBg { from { background-position: 0% 40%; } to { background-position: 100% 60%; } }
@keyframes loginIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes loginFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .login-body, .login-card, .login-card .brand-mark { animation: none; } .login-card .btn-brand:hover { transform: none; } }


/* ---- Barra de búsqueda de Tareas con filtros plegables ---- */
.tbar-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .65rem .85rem; }
.tbar-search { flex: 1 1 260px; min-width: 190px; }
.tbar-group { display: flex; align-items: center; gap: .4rem; min-width: 130px; }
.tbar-lbl { margin: 0; font-size: .78rem; color: #5b6b7a; white-space: nowrap; }
.tbar-filters { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
.tbar-filters[aria-expanded="true"] { background: rgba(0,141,170,.1); border-color: var(--brand); color: #006b82; }
.filter-count { font-size: .7rem; }
.tbar-panel { border-top: 1px solid var(--line, #e3e8ee); }


/* ---- Calendario mensual: se ve completo en pantalla (escritorio) ---- */
.cal-head { margin-bottom: .6rem; }
@media (min-width: 992px) and (min-height: 560px) {
  .cal.cal-fit { height: calc(100vh - 172px); min-height: 440px; grid-template-rows: auto repeat(var(--weeks, 5), minmax(0, 1fr)); }
  .cal.cal-fit .day { min-height: 0; overflow: hidden; padding: .2rem .3rem; }
  .cal.cal-fit .dnum { margin-bottom: .1rem; }
  .cal.cal-fit .dow { padding: .3rem; }
  .content { padding-bottom: 1rem; }
}


/* ---- Texto enriquecido (observaciones) ---- */
.rte-bar { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .4rem; }
.rte-bar .btn { min-width: 2.1rem; font-size: .8rem; padding: .2rem .5rem; }
.rte-area { height: auto; overflow: auto; padding: .5rem .75rem; line-height: 1.5; }
.rte-area:empty:before { content: attr(data-placeholder); color: #6c757d; pointer-events: none; }
.rte-area.is-invalid { border-color: #dc3545; }
.rich p, .rte-area p { margin: 0 0 .5rem; }
.rich ul, .rich ol, .rte-area ul, .rte-area ol { margin: 0 0 .5rem; padding-left: 1.4rem; }
.rich blockquote, .rte-area blockquote { margin: 0 0 .5rem; padding-left: .75rem; border-left: 3px solid var(--line, #dde3e9); color: #555; }
.rich pre { background: #f6f8fa; padding: .5rem .75rem; border-radius: 6px; white-space: pre-wrap; margin: 0 0 .5rem; }
.rich code { background: #f2f4f6; padding: 0 .25rem; border-radius: 4px; }
.rich > :last-child { margin-bottom: 0; }
.rich { word-break: break-word; }

/* ---- Recorrido de bienvenida del cliente ---- */
.side-help { display:flex; align-items:center; gap:.65rem; width:calc(100% - 1.5rem); margin:.5rem .75rem; padding:.6rem .75rem; border:1px solid rgba(94,191,48,.55); border-radius:10px; background:rgba(94,191,48,.12); color:#fff; text-align:left; cursor:pointer; }
.side-help .ico { flex:0 0 auto; color:#5EBF30; }
.side-help-t { display:flex; flex-direction:column; line-height:1.2; }
.side-help-t strong { font-size:.9rem; }
.side-help-t small { font-size:.72rem; opacity:.85; }
.side-help:hover, .side-help:focus-visible { background:rgba(94,191,48,.22); }
.tour-overlay { position:fixed; inset:0; z-index:2000; background:transparent; }
.tour-spot { display:none; position:fixed; z-index:2001; border-radius:10px; box-shadow:0 0 0 9999px rgba(15,23,42,.65); pointer-events:none; outline:2px solid #5EBF30; transition:left .25s, top .25s, width .25s, height .25s; }
.tour-overlay.dim { background:rgba(15,23,42,.65); }
.tour-card { position:fixed; z-index:2002; width:min(360px, calc(100vw - 16px)); background:#fff; color:#1b2733; border-radius:12px; padding:1.1rem 1.2rem 1rem; box-shadow:0 18px 50px rgba(0,0,0,.35); }
.tour-card.tour-center { width:min(420px, calc(100vw - 16px)); }
.tour-card[hidden], .tour-overlay[hidden] { display:none; }
.tour-count { font-size:.75rem; color:#6b7a89; text-transform:uppercase; letter-spacing:.04em; min-height:1em; margin-bottom:.15rem; }
.tour-title { font-size:1.1rem; font-weight:700; margin:0 0 .4rem; }
.tour-text { font-size:.95rem; line-height:1.45; margin:0 0 .9rem; }
.tour-actions { display:flex; align-items:center; justify-content:space-between; gap:.75rem; flex-wrap:wrap; }
.tour-nav { display:flex; gap:.5rem; margin-left:auto; }
.tour-skip { background:none; border:0; padding:.25rem 0; color:#6b7a89; font-size:.85rem; text-decoration:underline; cursor:pointer; }
.tour-skip:hover, .tour-skip:focus-visible { color:#1b2733; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition:none; } }

/* ---- Informes ---- */
.rep-logo { height:22px; width:auto; max-width:56px; object-fit:contain; vertical-align:-6px; border-radius:4px; }
.rep-week { border:1px solid var(--bs-border-color, #dee2e6); border-radius:10px; margin-bottom:.6rem; background:#fff; }
.rep-week > summary { cursor:pointer; padding:.75rem 1rem; list-style:none; display:flex; align-items:baseline; gap:.5rem; flex-wrap:wrap; }
.rep-week > summary::-webkit-details-marker { display:none; }
.rep-week > summary::before { content:'+'; font-weight:700; width:1rem; color:#008DAA; }
.rep-week[open] > summary::before { content:'−'; }
.rep-hours { margin-left:auto; font-weight:600; color:#1b2733; }
.rep-body { padding:0 1rem 1rem 2.4rem; }
.rep-list { margin:0 0 .75rem; padding-left:1.1rem; }
.rep-list li { margin:.25rem 0; }
.rep-grid th:first-child, .rep-grid td:first-child { min-width:150px; }
.rep-grid input { min-width:68px; }
.rep-edit-week { padding:.9rem 0; border-top:1px solid #eef1f4; }
.rep-edit-week:first-child { border-top:0; padding-top:0; }

/* ---- Aviso de edición del informe (tomar el control) ---- */
.lock-overlay { position:fixed; inset:0; z-index:2100; background:rgba(15,23,42,.65); display:flex; align-items:center; justify-content:center; padding:1rem; }
.lock-card { background:#fff; color:#1b2733; border-radius:12px; padding:1.3rem 1.4rem; max-width:460px; width:100%; box-shadow:0 18px 50px rgba(0,0,0,.35); }
.lock-card h2 { font-size:1.15rem; font-weight:700; margin:0 0 .5rem; }
.lock-card p { line-height:1.5; margin:0 0 1rem; }
.lock-actions { display:flex; gap:.6rem; justify-content:flex-end; flex-wrap:wrap; }
.lock-actions form { margin:0; }
.rep-code { font-weight:600; color:#008DAA; }
/* ---- Desplegable con buscador (select múltiple tipo Select2) ---- */
.ss-wrap { position:relative; flex:1 1 320px; min-width:240px; max-width:560px; }
.ss-control { display:flex; flex-wrap:wrap; gap:.25rem; align-items:center; min-height:31px; height:auto; cursor:text; padding:.2rem .4rem; }
.ss-control:focus-within { border-color:#008DAA; box-shadow:0 0 0 .2rem rgba(0,141,170,.2); }
.ss-chips { display:contents; }
.ss-chip { display:inline-flex; align-items:center; gap:.3rem; background:#e8f4f8; border:1px solid #b9dde8; color:#0b4f61; border-radius:6px; padding:0 .3rem 0 .45rem; font-size:.8rem; max-width:100%; }
.ss-chip-t { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:260px; }
.ss-chip-x { border:0; background:none; color:#0b4f61; font-weight:700; line-height:1; padding:0 .15rem; cursor:pointer; }
.ss-input { border:0; outline:0; flex:1 1 120px; min-width:80px; font-size:.875rem; background:transparent; padding:.1rem; }
.ss-list { position:absolute; z-index:60; left:0; right:0; top:calc(100% + 2px); max-height:260px; overflow:auto; margin:0; padding:.25rem 0; list-style:none; background:#fff; border:1px solid #ced4da; border-radius:8px; box-shadow:0 10px 30px rgba(0,0,0,.15); }
.ss-list[hidden] { display:none; }
.ss-opt { padding:.4rem .75rem; font-size:.875rem; cursor:pointer; }
.ss-opt.ss-active { background:#e8f4f8; }
.ss-opt.ss-sel { font-weight:600; color:#0b4f61; }
.ss-opt.ss-sel::after { content:' ✓'; }
.ss-empty { padding:.5rem .75rem; color:#6b7a89; font-size:.85rem; }

/* ---- Keywords (posiciones en Google) ---- */
.kw-updated { display:flex; flex-wrap:wrap; align-items:center; gap:.35rem; font-size:.85rem; background:#e8f4f8; border:1px solid #b9dde8; color:#0b4f61; border-radius:8px; padding:.4rem .7rem; }
.kw-up { color:#1c8a3c; font-weight:600; white-space:nowrap; }
.kw-down { color:#c0392b; font-weight:600; white-space:nowrap; }
.kw-vs { font-size:.75rem; font-weight:600; }
.kw-chart { width:100%; height:auto; display:block; }
.kw-grid { stroke:#e6eaee; stroke-width:1; }
.kw-axis { fill:#7a8794; font-size:11px; }
.kw-l3 { stroke:#5EBF30; } .kw-l10 { stroke:#008DAA; } .kw-l100 { stroke:#9aa5b1; }
.kw-l3-dot { fill:#5EBF30; } .kw-l10-dot { fill:#008DAA; } .kw-l100-dot { fill:#9aa5b1; }
.kw-legend { display:flex; flex-wrap:wrap; gap:1rem; font-size:.82rem; margin-top:.5rem; align-items:center; }
.kw-dot { display:inline-block; width:12px; height:4px; border-radius:2px; vertical-align:middle; margin-right:.25rem; }
.kw-b3 { background:#5EBF30; } .kw-b10 { background:#008DAA; } .kw-b100 { background:#9aa5b1; }
.kw-spark { display:block; }
.kw-sp-up path { stroke:#1c8a3c; } .kw-sp-down path { stroke:#c0392b; } .kw-sp-flat path { stroke:#8a96a3; }
.kw-mv { list-style:none; margin:0; padding:0; }
.kw-mv li { display:flex; justify-content:space-between; gap:.75rem; padding:.3rem 0; border-bottom:1px solid #eef1f4; font-size:.88rem; }
.kw-mv li:last-child { border-bottom:0; }
.kw-mv-title { font-size:.8rem; text-transform:uppercase; letter-spacing:.03em; margin-bottom:.25rem; }
.kw-help > summary { cursor:pointer; list-style-position:inside; }
.kw-dl { display:grid; grid-template-columns:minmax(120px, 170px) 1fr; gap:.4rem 1rem; margin:0 0 .8rem; font-size:.9rem; }
.kw-dl dt { font-weight:700; } .kw-dl dd { margin:0; }
.kw-table td, .kw-table th { white-space:nowrap; }
.kw-table td:first-child { white-space:normal; min-width:200px; }
.kw-url a { font-size:.82rem; }
@media (max-width: 575px) { .kw-dl { grid-template-columns:1fr; } .kw-dl dt { margin-top:.4rem; } }
.kw-own td { background:#f2faf5; }
.kw-vsbar { display:flex; height:8px; border-radius:4px; overflow:hidden; background:#e6eaee; margin-bottom:.25rem; max-width:320px; }
.kw-vs-us { background:#2e9e5b; } .kw-vs-them { background:#d9534f; }
.kw-cth { font-size:.75rem; font-weight:600; }

/* Keywords: historial semanal en colores */
.kw-kbtn { background:none; border:0; padding:0; color:inherit; text-align:left; display:inline-flex; gap:.35rem; align-items:flex-start; cursor:pointer; font:inherit; }
.kw-kbtn:hover span, .kw-kbtn:focus-visible span { color:#008DAA; text-decoration:underline; }
.kw-kbtn svg { margin-top:.3rem; transition:transform .15s; flex-shrink:0; }
.kw-kbtn.is-open svg { transform:rotate(90deg); }
.kw-hrow > td { background:#f8fafb; white-space:normal !important; }
.kw-hbox { padding:.4rem .25rem .6rem; }
.kw-htitle { font-size:.85rem; margin-bottom:.45rem; }
.kw-heat { display:flex; flex-wrap:wrap; gap:3px; }
.kw-hc { width:38px; height:38px; border-radius:5px; display:flex; flex-direction:column; align-items:center; justify-content:center; line-height:1; color:#fff; }
.kw-hn { font-weight:700; font-size:.8rem; }
.kw-hd { font-size:.55rem; opacity:.85; margin-top:2px; }
.kw-h1 { background:#0b7a3b; } .kw-h2 { background:#2e9e5b; } .kw-h3 { background:#8cc56d; color:#163d1d; }
.kw-h4 { background:#f2c94c; color:#4a3b00; } .kw-h5 { background:#f2994a; color:#4a2300; } .kw-h6 { background:#e5533d; } .kw-h7 { background:#9b1c1c; }
.kw-h0 { background:#e9edf1; color:#8a96a3; }
.kw-heat-legend { display:inline-flex; flex-wrap:wrap; gap:.6rem; margin-left:.4rem; vertical-align:middle; }
.kw-heat-legend span { display:inline-flex; align-items:center; gap:.25rem; }
.kw-hc-mini { display:inline-block; width:12px; height:12px; border-radius:3px; }
