[hidden] { display: none !important; }
/* ==========================================================================
   Portal CIPA · hoja de estilos
   ========================================================================== */
:root {
  --brand: #150E7F;
  --brand-600: #1d1599;
  --brand-700: #10357E;
  --brand-50: #eef0ff;
  --brand-100: #e0e3ff;
  --accent: #fa360a;
  --ink: #161a33;
  --ink-2: #3b4160;
  --muted: #6a7090;
  --line: #e4e6f0;
  --line-2: #eef0f6;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --sidebar: #0e0b52;
  --sidebar-ink: #c9cbf2;
  --ok: #0f8a5f;  --ok-bg: #e7f6ef;
  --warn: #b26a00; --warn-bg: #fff4e0;
  --err: #c62828;  --err-bg: #fdecec;
  --info: #1f5fbf; --info-bg: #e8f0fc;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 22, 60, .06), 0 2px 8px rgba(20, 22, 60, .04);
  --shadow-lg: 0 12px 32px rgba(20, 22, 60, .14);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .75em; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .9em; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.icon.xl { width: 30px; height: 30px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.15rem 1.2rem 1rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, #2b22c9, var(--brand)); display: grid; place-items: center; font-weight: 800; font-size: .78rem; letter-spacing: .04em; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.brand-text strong { display: block; font-size: 1rem; line-height: 1.1; }
.brand-text span { font-size: .74rem; color: #9ea1d8; }
.nav { padding: .4rem .75rem 1rem; flex: 1; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: #7d80bf; padding: 1rem .6rem .35rem; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .52rem .65rem; border-radius: 8px; color: var(--sidebar-ink); font-weight: 500; font-size: .9rem; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .badge { margin-left: auto; }
.sidebar-foot { padding: .8rem; border-top: 1px solid rgba(255,255,255,.08); }
.me { display: flex; gap: .65rem; align-items: center; padding: .45rem; border-radius: 8px; color: #fff; }
.me:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.me small { display: block; color: #9ea1d8; font-size: .74rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #3a33c9; color: #fff; display: grid; place-items: center; font-weight: 650; font-size: .8rem; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.15rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; padding: 0 1.75rem; position: sticky; top: 0; z-index: 20; }
.topbar .crumbs { font-size: .88rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; min-width: 0; }
.topbar .crumbs strong { color: var(--ink); font-weight: 600; }
.topbar-search { margin-left: auto; position: relative; width: min(340px, 40vw); }
.topbar-search input[type=search] { padding-left: 2.2rem; background: var(--bg); border-color: transparent; }
.topbar-search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 1.75rem; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 1.25rem; }
.card-foot { padding: .85rem 1.25rem; border-top: 1px solid var(--line-2); background: #fafbfe; border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.split-left { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.stack > * + * { margin-top: 1.1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: 1rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 550; font-size: .88rem; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; line-height: 1.2; text-decoration: none !important; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #e02e05; }
.btn-light { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-light:hover { border-color: #c9cde0; background: #fafbff; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger { background: var(--surface); color: var(--err); border-color: #f2c4c4; }
.btn-danger:hover { background: var(--err-bg); }
.btn-zoom { background: #0b5cff; color: #fff; }
.btn-zoom:hover { background: #0049d9; }
.btn-sm { padding: .36rem .65rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.3rem; font-size: .95rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .42rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid #6d66ff; outline-offset: 2px; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .14rem .52rem; border-radius: 99px; font-size: .72rem; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge-brand { background: var(--brand-50); color: var(--brand); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-accent { background: var(--accent); color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.alert { display: flex; gap: .65rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 1rem; font-size: .9rem; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--ok-bg); border-color: #bfe5d3; color: #0b5e41; }
.alert-error { background: var(--err-bg); border-color: #f4c7c7; color: #8e1c1c; }
.alert-info { background: var(--info-bg); border-color: #c8d9f5; color: #194d99; }
.alert-warn { background: var(--warn-bg); border-color: #f5ddb0; color: #7a4a00; }
.flash-wrap .alert { animation: slide .25s ease-out; }
@keyframes slide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Formularios ---------- */
label, .label { display: block; font-weight: 550; font-size: .85rem; margin-bottom: .35rem; color: var(--ink-2); }
.req::after { content: ' *'; color: var(--accent); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=number], input[type=date], input[type=time], input[type=tel], select, textarea {
  width: 100%; font: inherit; font-size: .9rem; color: var(--ink); background: var(--surface); border: 1px solid #d6d9e6; border-radius: var(--radius-sm); padding: .55rem .75rem; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #6d66ff; box-shadow: 0 0 0 3px rgba(109, 102, 255, .16); }
textarea { min-height: 96px; resize: vertical; }
select[multiple] { min-height: 150px; }
input[type=color] { width: 46px; height: 38px; padding: 2px; border: 1px solid #d6d9e6; border-radius: var(--radius-sm); background: #fff; }
input[type=file] { font: inherit; font-size: .85rem; }
.field { margin-bottom: 1rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; }
.help { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.field-error { font-size: .78rem; color: var(--err); margin-top: .3rem; }
.has-error input, .has-error select, .has-error textarea { border-color: #e59a9a; }
.check { display: flex; align-items: flex-start; gap: .55rem; font-weight: 500; font-size: .88rem; color: var(--ink-2); margin-bottom: .45rem; cursor: pointer; }
.check input { margin-top: .2rem; width: 16px; height: 16px; accent-color: var(--brand); }
.checks-inline { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding-top: .5rem; }
.input-group { display: flex; }
.input-group input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem .4rem; margin: 0 0 1rem; }
legend { font-weight: 600; font-size: .85rem; padding: 0 .4rem; color: var(--ink-2); }
.dropzone { border: 2px dashed #cdd1e4; border-radius: var(--radius); padding: 1.6rem; text-align: center; background: #fafbff; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-50); }
.dropzone input { margin-top: .6rem; }
.filelist { list-style: none; padding: 0; margin: .75rem 0 0; text-align: left; font-size: .84rem; }
.filelist li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); color: var(--ink-2); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #fafbfe; white-space: nowrap; }
.table td { padding: .72rem 1rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbff; }
.table .actions { display: flex; gap: .3rem; justify-content: flex-end; }
.table .cell-title { font-weight: 550; color: var(--ink); }
.table .cell-title a { color: var(--ink); }
.empty { text-align: center; padding: 2.6rem 1rem; color: var(--muted); }
.empty > .icon { width: 38px; height: 38px; color: #b4b8d4; margin-bottom: .6rem; }

/* ---------- Inicio ---------- */
.hero { background: linear-gradient(120deg, var(--sidebar) 0%, var(--brand) 55%, var(--brand-700) 100%); color: #fff; border-radius: 14px; padding: 1.6rem 1.75rem; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(250,54,10,.35), transparent 65%); }
.hero h1 { color: #fff; margin-bottom: .2rem; }
.hero p { color: #cfd1ff; margin: 0; }
.hero .hero-date { text-align: right; font-size: .85rem; color: #cfd1ff; position: relative; z-index: 1; }
.hero .hero-date strong { display: block; color: #fff; font-size: 1.05rem; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.quick a { display: flex; gap: .85rem; align-items: center; padding: 1rem 1.1rem; color: var(--ink); }
.quick a:hover { text-decoration: none; border-color: #c7cbf3; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.quick a { transition: box-shadow .2s, transform .2s, border-color .2s; }
.quick strong { display: block; font-size: .92rem; }
.quick span { font-size: .78rem; color: var(--muted); }
.tile-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand); }
.tile-icon.t-accent { background: #fff0eb; color: var(--accent); }
.tile-icon.t-zoom { background: #e8f0ff; color: #0b5cff; }
.tile-icon.t-ok { background: var(--ok-bg); color: var(--ok); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list-item { display: flex; align-items: center; gap: .85rem; padding: .75rem 1.25rem; color: var(--ink); }
a.list-item:hover { background: #fafbff; text-decoration: none; }
.list-item .meta { font-size: .78rem; color: var(--muted); }
.list-item .grow { min-width: 0; flex: 1; }

.when { width: 50px; text-align: center; border-radius: 9px; background: var(--brand-50); color: var(--brand); padding: .3rem 0; flex: none; line-height: 1.1; }
.when b { display: block; font-size: 1.1rem; }
.when small { font-size: .66rem; text-transform: uppercase; font-weight: 600; letter-spacing: .05em; }

.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .85rem; }
.link-card { display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); transition: box-shadow .2s, border-color .2s; }
.link-card:hover { text-decoration: none; border-color: #c7cbf3; box-shadow: var(--shadow-lg); }
.link-card .tile-icon { width: 38px; height: 38px; }
.link-card strong { display: block; font-size: .9rem; }
.link-card span { display: block; font-size: .76rem; color: var(--muted); }
.link-card .ext { margin-left: auto; color: #b4b8d4; }

.stat { padding: 1rem 1.15rem; }
.stat b { display: block; font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; }
.stat span { font-size: .78rem; color: var(--muted); }

/* ---------- Documentos ---------- */
.tree { list-style: none; margin: 0; padding: .5rem; }
.tree ul { list-style: none; margin: 0 0 .2rem; padding: 0 0 0 1.05rem; border-left: 1px solid var(--line); margin-left: .95rem; }
.tree a { display: flex; align-items: center; gap: .55rem; padding: .42rem .6rem; border-radius: 7px; color: var(--ink-2); font-size: .87rem; }
.tree a:hover { background: var(--line-2); text-decoration: none; }
.tree a.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.tree .count { margin-left: auto; font-size: .72rem; color: var(--muted); }
.doc-row { display: flex; align-items: center; gap: .9rem; padding: .78rem 1.25rem; border-bottom: 1px solid var(--line-2); }
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: #fafbff; }
.doc-row .grow { min-width: 0; flex: 1; }
.doc-row .title { font-weight: 550; color: var(--ink); display: block; }
.doc-row .meta { font-size: .78rem; color: var(--muted); display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; }
.ficon { width: 38px; height: 44px; border-radius: 6px; display: grid; place-items: center; font-size: .6rem; font-weight: 800; letter-spacing: .03em; color: #fff; flex: none; position: relative; }
.ficon::before { content: ''; position: absolute; right: 0; top: 0; border-width: 0 10px 10px 0; border-style: solid; border-color: var(--surface) var(--surface) rgba(0,0,0,.22) rgba(0,0,0,.22); border-radius: 0 0 0 3px; }
.ficon.pdf { background: #d93a2b; } .ficon.word { background: #2b5bd7; } .ficon.excel { background: #1d8a4e; } .ficon.ppt { background: #d0632a; }
.ficon.image { background: #7b4bd1; } .ficon.zip { background: #6b6f86; } .ficon.file { background: #8a90ab; }
.viewer { width: 100%; height: calc(100vh - 210px); min-height: 520px; border: 0; border-radius: 0 0 var(--radius) var(--radius); background: #525659; display: block; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: .45rem .75rem; font-size: .86rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line-2); }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 160px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { padding: .3rem .7rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; color: var(--ink-2); font-weight: 500; }
.chip:hover { text-decoration: none; border-color: #c5c9de; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; overflow-x: auto; }
.tabs a { padding: .6rem .95rem; color: var(--muted); font-weight: 550; font-size: .88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

.pager { display: flex; gap: .3rem; justify-content: center; padding: 1rem; flex-wrap: wrap; }
.pager a, .pager span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); font-size: .84rem; color: var(--ink-2); padding: 0 .5rem; }
.pager a:hover { text-decoration: none; border-color: #c5c9de; }
.pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Plantillas ---------- */
.tpl-card { display: flex; flex-direction: column; gap: .5rem; padding: 1.15rem; color: var(--ink); height: 100%; transition: box-shadow .2s, border-color .2s; }
.tpl-card:hover { text-decoration: none; border-color: #c7cbf3; box-shadow: var(--shadow-lg); }
.tpl-card p { color: var(--muted); font-size: .84rem; margin: 0; flex: 1; }
.tpl-card .row-between { margin-top: .35rem; }
.fields-editor .frow { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr 1.2fr auto auto; gap: .5rem; align-items: center; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .5rem; background: #fcfcff; }
.fields-editor .frow input, .fields-editor .frow select { padding: .42rem .55rem; font-size: .84rem; }
.fields-editor .frow .check { margin: 0; font-size: .8rem; white-space: nowrap; }
.ph-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.ph { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .74rem; padding: .22rem .5rem; border-radius: 6px; background: var(--brand-50); color: var(--brand); border: 1px solid var(--brand-100); cursor: pointer; }
.ph:hover { background: var(--brand-100); }
.editor-toolbar { display: flex; gap: .2rem; flex-wrap: wrap; padding: .4rem; border: 1px solid #d6d9e6; border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: #fafbfe; }
.editor-toolbar button { border: 0; background: transparent; padding: .35rem .55rem; border-radius: 5px; cursor: pointer; font: inherit; font-size: .82rem; color: var(--ink-2); min-width: 30px; }
.editor-toolbar button:hover { background: var(--line); }
.editor-toolbar .sep { width: 1px; background: var(--line); margin: .2rem .25rem; }
.rich { min-height: 420px; border: 1px solid #d6d9e6; border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 1.5rem 1.75rem; background: #fff; overflow: auto; font-family: 'Times New Roman', Georgia, serif; font-size: 15px; line-height: 1.55; }
.rich:focus { outline: none; border-color: #6d66ff; box-shadow: 0 0 0 3px rgba(109, 102, 255, .16); }
.rich table, .doc-paper table { border-collapse: collapse; width: 100%; margin: .6rem 0; }
.rich td, .rich th, .doc-paper td, .doc-paper th { border: 1px solid #9aa0b8; padding: 6px 9px; text-align: left; vertical-align: top; }
.rich th, .doc-paper th { background: #f1f2f8; width: 32%; }
.rich .tpl-sign td, .doc-paper .tpl-sign td { border: 0; border-top: 1px solid #333; text-align: center; padding-top: 6px; width: 33%; }
.rich .tpl-sign, .doc-paper .tpl-sign { margin-top: 80px; border-spacing: 30px 0; border-collapse: separate; }
#html-source { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; min-height: 420px; }

/* ---------- Reuniones ---------- */
.day-group + .day-group { margin-top: 1.1rem; }
.day-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin: 0 0 .5rem; }
.meeting { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.15rem; border-bottom: 1px solid var(--line-2); }
.meeting:last-child { border-bottom: 0; }
.meeting .time { width: 92px; flex: none; font-weight: 650; color: var(--ink); font-size: .92rem; }
.meeting .time small { display: block; color: var(--muted); font-weight: 500; }
.meeting .grow { flex: 1; min-width: 0; }
.meeting .title { font-weight: 600; color: var(--ink); }
.meeting.live { background: #f3f7ff; }
.join-box { background: #f3f7ff; border: 1px solid #d3e1ff; border-radius: var(--radius); padding: 1.1rem; }
.join-box .mono { word-break: break-all; }
.people { display: flex; flex-wrap: wrap; gap: .4rem; }
.person { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .6rem .25rem .25rem; border-radius: 99px; background: var(--line-2); font-size: .8rem; }
.person .avatar { width: 24px; height: 24px; font-size: .62rem; }


/* ---------- Disponibilidad Zoom ---------- */
.cal-scroll { overflow-x: auto; }
.cal { display: grid; min-width: 640px; }
.cal-corner, .cal-dayhead { position: sticky; top: 0; background: #fafbfe; border-bottom: 1px solid var(--line); z-index: 3; }
.cal-dayhead { text-align: center; padding: .45rem 0; border-left: 1px solid var(--line-2); }
.cal-dayhead small { display: block; text-transform: uppercase; font-size: .68rem; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.cal-dayhead b { font-size: 1.05rem; }
.cal-dayhead.today b { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 .45rem; }
.cal-axis { position: relative; }
.cal-axis span { position: absolute; right: .45rem; transform: translateY(-50%); font-size: .7rem; color: var(--muted); }
.cal-axis span:first-child { transform: none; }
.cal-day { position: relative; display: flex; gap: 2px; padding: 0 2px; border-left: 1px solid var(--line-2);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px calc(var(--row) * 2)), repeating-linear-gradient(to bottom, var(--line-2) 0 1px, transparent 1px var(--row)); }
.cal-lane { position: relative; flex: 1; min-width: 0; border-top: 3px solid var(--c); }
.cal-lane + .cal-lane { border-left: 1px dotted #d9dcea; }
.cal-past { position: absolute; left: 0; right: 0; top: 0; background: repeating-linear-gradient(135deg, rgba(120,125,160,.07) 0 6px, rgba(120,125,160,.13) 6px 12px); z-index: 1; pointer-events: none; }
.cal-slot { position: absolute; left: 0; right: 0; height: var(--row); display: flex; align-items: center; justify-content: center; border-radius: 4px; z-index: 1; }
.cal-slot span { display: none; font-size: .68rem; font-weight: 600; color: var(--brand); }
.cal-slot:hover { background: var(--brand-50); outline: 1px dashed var(--brand); text-decoration: none; }
.cal-slot:hover span { display: inline; }
.cal-buffer { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(250,54,10,.10) 0 4px, transparent 4px 8px); z-index: 2; pointer-events: none; border-radius: 4px; }
.cal-block { position: absolute; left: 1px; right: 1px; z-index: 3; border-radius: 5px; background: var(--c, var(--brand)); color: #fff; padding: 2px 5px; overflow: hidden; font-size: .7rem; line-height: 1.25; box-shadow: 0 1px 2px rgba(0,0,0,.15); display: block; }
.cal-block:hover { text-decoration: none; filter: brightness(1.12); }
.cal-block b { display: block; font-weight: 700; }
.cal-block span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block small { display: block; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block.ext { background: repeating-linear-gradient(135deg, #5b6080 0 6px, #6b7090 6px 12px); }
.cal-block.own { box-shadow: 0 0 0 2px var(--accent); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 4; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.cal-closed { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .75rem; background: rgba(245,246,251,.85); z-index: 5; }
.legend-box { width: 14px; height: 12px; border-radius: 3px; display: inline-block; }
.ext-box { background: repeating-linear-gradient(135deg, #5b6080 0 3px, #6b7090 3px 6px); }
.buf-box { background: repeating-linear-gradient(135deg, rgba(250,54,10,.25) 0 3px, transparent 3px 6px); border: 1px solid #f3c4b6; }

/* Línea de tiempo del formulario */
.tl { margin-top: .35rem; }
.tl-row { display: grid; grid-template-columns: 150px 1fr; gap: .6rem; align-items: center; margin-bottom: .45rem; }
.tl-row .tl-name { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.tl-bar { position: relative; height: 26px; border-radius: 6px; background: #eef7f2; border: 1px solid #d3eadf; overflow: hidden; }
.tl-bar .busy { position: absolute; top: 0; bottom: 0; background: #e2584a; opacity: .85; }
.tl-bar .busy.buf { background: repeating-linear-gradient(135deg, rgba(226,88,74,.35) 0 4px, transparent 4px 8px); opacity: 1; }
.tl-bar .sel { position: absolute; top: 2px; bottom: 2px; border: 2px solid var(--brand); background: rgba(21,14,127,.15); border-radius: 4px; z-index: 2; }
.tl-bar .sel.bad { border-color: var(--err); background: rgba(198,40,40,.15); }
.tl-scale { display: grid; grid-template-columns: 150px 1fr; gap: .6rem; }
.tl-ticks { position: relative; height: 16px; font-size: .66rem; color: var(--muted); }
.tl-ticks span { position: absolute; transform: translateX(-50%); }
.tl-status { display: flex; gap: .5rem; align-items: center; padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .86rem; margin-bottom: .75rem; }
.tl-status.ok { background: var(--ok-bg); color: #0b5e41; }
.tl-status.bad { background: var(--err-bg); color: #8e1c1c; }
.tl-status.idle { background: var(--line-2); color: var(--muted); }
.sugg { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.sugg button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: .25rem .65rem; font: inherit; font-size: .78rem; cursor: pointer; color: var(--ink-2); }
.sugg button:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 560px) { .tl-row, .tl-scale { grid-template-columns: 90px 1fr; } }

/* ---------- Matriz permisos ---------- */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix .module td { background: #fafbfe; font-weight: 650; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; }
.matrix input { width: 17px; height: 17px; accent-color: var(--brand); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-side { background: linear-gradient(150deg, var(--sidebar) 0%, var(--brand) 60%, var(--brand-700) 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; width: 520px; height: 520px; right: -180px; bottom: -200px; border-radius: 50%; border: 70px solid rgba(255,255,255,.05); }
.auth-side::after { content: ''; position: absolute; width: 220px; height: 220px; left: -60px; top: 38%; border-radius: 50%; background: radial-gradient(circle, rgba(250,54,10,.35), transparent 70%); }
.auth-side h2 { color: #fff; font-size: 2rem; font-weight: 750; max-width: 15ch; line-height: 1.15; margin-bottom: .8rem; }
.auth-side p { color: #c9cbf2; max-width: 40ch; }
.auth-feats { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: .7rem; position: relative; z-index: 1; }
.auth-feats li { display: flex; gap: .7rem; align-items: center; color: #e2e3ff; font-size: .92rem; }
.auth-feats .icon { color: #ff8a6b; }
.auth-main { display: grid; place-items: center; padding: 2.5rem 1.5rem; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { font-size: 1.6rem; }
.auth-box .sub { color: var(--muted); margin-bottom: 1.6rem; }
.auth-foot { margin-top: 1.6rem; font-size: .86rem; color: var(--muted); text-align: center; }
.pw-meter { height: 5px; border-radius: 4px; background: var(--line); margin-top: .45rem; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--err); transition: width .2s, background .2s; }
.pw-rules { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .78rem; color: var(--muted); display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .6rem; }
.pw-rules li::before { content: '○ '; }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: '● '; }
.hp { position: absolute; left: -9999px; }

/* ---------- Error ---------- */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page .code { font-size: 4.5rem; font-weight: 800; color: var(--brand-100); letter-spacing: -.04em; line-height: 1; }

/* ---------- Documento imprimible ---------- */
.doc-paper { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 20mm 22mm; box-shadow: var(--shadow-lg); font-family: 'Times New Roman', Georgia, serif; font-size: 12pt; line-height: 1.5; color: #111; }
.doc-paper h1, .doc-paper h2, .doc-paper h3 { color: #111; font-family: inherit; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 920px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .25s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(10, 10, 40, .45); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 1rem; }
  .content { padding: 1.1rem 1rem; }
  .split-left { grid-template-columns: minmax(0, 1fr); }
  .split-left > aside .tree { max-height: 230px; overflow-y: auto; }
  .toolbar .grow { min-width: 0; flex-basis: 100%; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .fields-editor .frow { grid-template-columns: 1fr 1fr; }
  .topbar-search { display: none; }
}
@media (max-width: 560px) {
  .quick, .grid-4 { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero .hero-date { text-align: left; }
  .doc-row .hide-sm, .table .hide-sm { display: none; }
  .meeting { flex-wrap: wrap; }
  .page-head .actions { width: 100%; }
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .doc-paper { box-shadow: none; width: auto; min-height: 0; padding: 0; margin: 0; }
  @page { size: A4; margin: 18mm 20mm; }
}
