:root {
  /* Paleta BCF */
  --navy: #1b1464;          /* Azul marino del logotipo bcflaw.mx */
  --navy-deep: #1a3b7a;     /* Azul corporativo web BCF */
  --charcoal: #2a2a2a;
  --white: #ffffff;
  --teal: #2e5fa3;          /* Azul de acción (sustituye al teal verde) */
  --teal-dark: #1a3b7a;
  --sage: #e8a020;          /* Dorado BCF: foco y acentos */
  --gray-light: #f5f5f5;
  --gray-mid: #cccccc;
  --warm: #e8a020;

  --bg: var(--gray-light);
  --surface: #ffffff;
  --border: #e3e3e8;
  --text: var(--charcoal);
  --text-muted: #707070;    /* Gris corporativo web BCF */

  --ok: #2e9e6b;
  --warn: #d99a16;
  --danger: #c0392b;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(27, 20, 100, 0.08), 0 4px 16px rgba(27, 20, 100, 0.06);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

#app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: #cfd0e6;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  transition: transform .2s ease;
}
.sidebar__brand {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align: center;
}
.sidebar__logo {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--teal);
  color: #fff; font-weight: 700;
  display: grid; place-items: center;
  letter-spacing: .5px; font-size: 13px;
}
.sidebar__brand-text { font-family: 'Oswald', 'Inter', sans-serif; font-weight: 400; color: #fff; font-size: 16px; letter-spacing: 1px; text-transform: uppercase; line-height: 1.2; max-width: 100%; overflow-wrap: anywhere; }
.sidebar__nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #c2c3da; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link__icon { width: 20px; text-align: center; font-size: 16px; opacity: .9; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.is-active { background: var(--teal); color: #fff; }
/* ── Menú agrupado y colapsable ── */
.nav-group { margin-top: 2px; }
.nav-group__head { width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: none; cursor: pointer; color: #8f91b8; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; padding: 12px 12px 5px; font-family: inherit; }
.nav-group__head:hover { color: #c2c3da; }
.nav-group__arrow { font-size: 9px; transition: transform .18s; }
.nav-group.is-collapsed .nav-group__arrow { transform: rotate(-90deg); }
.nav-group.is-collapsed .nav-group__items { display: none; }
.sidebar__nav--classic .nav-group__head { display: none !important; }
.sidebar__footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); text-align: center; }

/* ---------- Main ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar__toggle { display: none; background: none; border: none; font-size: 22px; color: var(--navy); }
.topbar__search { flex: 1; max-width: 420px; }
.topbar__search input {
  width: 100%; padding: 9px 14px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--gray-light); font-size: 13px;
}
.topbar__search input:focus { outline: 2px solid var(--sage); background: #fff; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar__user {
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fff; font-size: 13px; max-width: 180px;
}
.mini-timer {
  display: flex; align-items: center; gap: 8px;
  background: #eaf0f9; color: var(--teal-dark);
  padding: 6px 10px; border-radius: 999px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.mini-timer__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.3;} }

/* Dropdown de búsqueda global */
.search-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 40; max-height: 60vh; overflow-y: auto; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--gray-light); }
.search-item__icon { font-size: 17px; width: 22px; text-align: center; }
.search-item__main { display: flex; flex-direction: column; min-width: 0; }
.search-item__t { font-weight: 600; color: var(--navy-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item__s { font-size: 12px; color: var(--text-muted); }
.search-empty { padding: 12px; color: var(--text-muted); font-size: 13px; }

/* Banner (nivel 1) */
.app-banner { display: flex; align-items: center; gap: 10px; background: #0e3a7f; color: #fff; padding: 9px 18px; font-size: 13px; }
.app-banner a { color: #9cd3ff; text-decoration: underline; }
.app-banner__text { flex: 1; }
.app-banner__close { background: none; border: none; color: #cfd9ee; font-size: 20px; line-height: 1; }
.app-banner.is-hidden { display: none; }

/* Timekeeper (nivel 2) */
.timekeeper { display: flex; align-items: center; gap: 8px; background: var(--gray-light); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--navy-deep); }
.timekeeper__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-mid); }
.timekeeper.is-running { background: #eaf0f9; color: var(--teal-dark); border-color: #c3d3ec; }
.timekeeper.is-running .timekeeper__dot { background: var(--teal); animation: pulse 1.4s infinite; }

/* Icon buttons + badge */
.icon-btn { position: relative; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); width: 38px; height: 38px; font-size: 16px; }
.icon-btn:hover { background: var(--gray-light); }
.icon-btn__badge { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; }
.dropdown__menu--wide { min-width: 300px; max-width: 340px; max-height: 60vh; overflow-y: auto; }
.dd-item { width: 100%; text-align: left; background: none; border: none; }
.notif-item { display: block; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.notif-item:hover { background: var(--gray-light); }
.notif-item__t { font-weight: 600; color: var(--navy-deep); font-size: 13px; }
.notif-item__s { color: var(--text-muted); font-size: 12px; }

/* Breadcrumb (nivel 3) */
.breadcrumb { position: sticky; top: 62px; z-index: 15; display: flex; align-items: center; gap: 10px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 22px; }
.breadcrumb__icon { font-size: 16px; }
.breadcrumb__section { font-weight: 700; color: var(--navy-deep); }
.breadcrumb__tabs { display: flex; gap: 4px; margin-left: 10px; }
.breadcrumb__tab { font-size: 13px; color: var(--text-muted); padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.breadcrumb__tab.is-active { background: var(--navy); color: #fff; }

.view { padding: 26px; max-width: 1180px; width: 100%; }

/* ---------- Headings ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; color: var(--navy-deep); margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 18px; }
.grid--kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.card__title { font-size: 11px; font-weight: 700; color: #c0392b; margin: 0 0 10px; text-transform: uppercase; letter-spacing: 1.5px; }
.kpi__label { color: var(--text-muted); font-size: 13px; }
.kpi__value { font-size: 28px; font-weight: 700; color: var(--navy-deep); margin: 6px 0 2px; }
.kpi__delta { font-size: 12px; font-weight: 600; }
.kpi__delta.up { color: var(--ok); }
.kpi__delta.down { color: var(--danger); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item__main { flex: 1; min-width: 0; }
.list-item__title { font-weight: 600; color: var(--navy-deep); }
.list-item__sub { color: var(--text-muted); font-size: 12px; }
.empty { color: var(--text-muted); text-align: center; padding: 30px 10px; font-size: 13px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
table.data th { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .4px; }
table.data tbody tr:hover { background: #fafafb; cursor: pointer; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges / chips ---------- */
.demo-badge { display: inline-flex; align-items: center; margin-left: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 1px; background: #E8A020; color: #3a2600; text-transform: uppercase; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge--local { background: rgba(255,255,255,.12); color: #cfd0e6; }
.badge--cloud { background: var(--teal); color: #fff; }
.status { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status--open { background: #e8f6ef; color: var(--ok); }
.status--pending { background: #fdf3df; color: var(--warn); }
.status--closed { background: #ececed; color: var(--text-muted); }
.risk--alto { color: var(--danger); font-weight: 700; }
.risk--medio { color: var(--warn); font-weight: 700; }
.risk--bajo { color: var(--ok); font-weight: 700; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-size: 13px; color: var(--text-muted); }
.chip.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 13px; }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-deep); }
.btn--teal { background: var(--teal); color: #fff; }
.btn--teal:hover { background: var(--teal-dark); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--navy-deep); }
.btn--ghost:hover { background: var(--gray-light); }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; background: #fff;
  width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
}
.field select { text-overflow: ellipsis; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--sage); }
.field textarea { resize: vertical; min-height: 70px; }

/* ---------- Portal de cliente ---------- */
.comm-portal-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 860px) { .comm-portal-grid { grid-template-columns: 1fr; } }
.pp-muted { color: var(--text-muted); font-size: 13px; }

.pp-chat__list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 4px; }
.pp-chat__form { display: flex; gap: 8px; }
.pp-chat__form input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
.pp-chat__readonly { text-align: center; color: var(--text-muted); padding: 12px; font-size: 13px; }
.pp-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.pp-msg--me { align-self: flex-end; align-items: flex-end; }
.pp-bubble { background: var(--gray-light); color: var(--text); padding: 9px 13px; border-radius: 14px; border-bottom-left-radius: 4px; font-size: 14px; }
.pp-msg--me .pp-bubble { background: var(--teal); color: #fff; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.pp-msg__meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.pp-share { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pp-share:last-child { border-bottom: none; }
.pp-share__icon { width: 30px; height: 30px; border-radius: 7px; background: var(--gray-light); display: grid; place-items: center; }
.pp-share__main { flex: 1; min-width: 0; }
.pp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.pp-field { display: flex; flex-direction: column; }
.pp-field strong { color: var(--navy-deep); }
.widget-toggle { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer; }
.widget-toggle input { width: auto; }
.pp-share__t { font-weight: 600; color: var(--navy-deep); font-size: 13px; }
.pp-shares { display: flex; flex-direction: column; }

/* Vista pública full-screen */
#publicPortal { min-height: 100vh; background: #eef1f6; }
.pp-head { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%); color: #fff; padding: 24px 30px; }
.pp-firm { color: #9fe8df; font-weight: 700; letter-spacing: 1px; font-size: 13px; margin-bottom: 6px; }
.pp-head__row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pp-head h1 { margin: 0; font-size: 24px; }
.pp-head .pp-muted { color: #c2c3da; }
.pp-body { max-width: 1080px; margin: 0 auto; padding: 26px; display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .pp-body { grid-template-columns: 1fr; } }
.pp-chat { display: flex; flex-direction: column; height: 560px; }
.pp-chat .pp-chat__list { flex: 1; }
.pp-foot { text-align: center; color: var(--text-muted); font-size: 12px; padding: 24px; border-top: 1px solid var(--border); background: #fff; }
.pp-wall { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #eef1f6, #dfe6f0); padding: 20px; }
.pp-wall__card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 40px; text-align: center; max-width: 420px; }
.pp-wall__card h1 { color: var(--navy-deep); font-size: 22px; margin: 10px 0 6px; }
.pp-wall__card p { color: var(--text-muted); }

/* Portal rediseñado (dashboard visual) */
.pp-portal-new { background: #f5f5f5; min-height: 100vh; display: flex; flex-direction: column; }
.pp-header-new { background: #fff; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.pp-header-brand { font-weight: 600; color: var(--navy-deep); }
.pp-hero { background: linear-gradient(135deg, #1a3b7a 0%, #2e5fa3 100%); color: #fff; padding: 20px 28px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; align-items: center; }
.pp-hero h1 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.pp-hero p { margin: 6px 0 0; opacity: .95; font-size: 13px; }
.pp-traffic-light { text-align: center; animation: pulse 2s infinite; }
.pp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; padding: 18px 28px; background: #fff; border-bottom: 1px solid var(--border); }
.pp-kpi { background: var(--gray-light); padding: 16px; border-radius: 8px; border-left: 4px solid #1a3b7a; }
.pp-kpi-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: .3px; }
.pp-kpi-value { font-size: 26px; font-weight: 700; color: #1a3b7a; margin: 6px 0; }
.pp-kpi-sub { font-size: 12px; color: var(--text-muted); }
.pp-kpi-bar { height: 5px; background: #e0e0e0; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.pp-kpi-bar-fill { height: 100%; background: linear-gradient(90deg, #1a3b7a, #2e5fa3); }
.pp-tabs-container { flex: 1; padding: 20px 28px; width: 100%; box-sizing: border-box; }
.pp-tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 2px solid var(--border); overflow-x: auto; }
.pp-tab { padding: 11px 16px; border: none; background: none; color: var(--text-muted); cursor: pointer; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.pp-tab:hover { color: var(--navy-deep); }
.pp-tab.is-active { color: #1a3b7a; border-bottom-color: #1a3b7a; }
.pp-tab--export { margin-left: auto; background: #1a3b7a; color: #fff; border-radius: 6px; padding: 8px 14px; font-size: 13px; align-self: center; }
.pp-tab--export:hover { background: #2e5fa3; color: #fff; }
.pp-tab-pane { display: none; }
.pp-tab-pane.is-active { display: block; }
.pp-dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.pp-dash-left, .pp-dash-right { display: flex; flex-direction: column; gap: 16px; }
.pp-card { background: #fff; padding: 16px; border-radius: 8px; border: 1px solid var(--border); }
.pp-card h3 { margin: 0 0 12px; color: var(--navy-deep); font-size: 15px; }
.pp-info-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.pp-info-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.pp-info-table td:first-child { color: var(--text-muted); width: 40%; }
.pp-footer { text-align: center; color: var(--text-muted); font-size: 12px; padding: 22px; background: #fff; border-top: 1px solid var(--border); }
@media (max-width: 760px) { .pp-dashboard { grid-template-columns: 1fr; } .pp-hero h1 { font-size: 22px; } }

/* ---------- Portales tipo SharePoint ---------- */
.sp-banner { background: linear-gradient(135deg, #1a3b7a 0%, #2e5fa3 100%); color: #fff; padding: 30px 24px; border-radius: 12px; margin-bottom: 22px; }
.sp-banner h1 { margin: 0; font-size: 26px; font-weight: 600; }
.sp-banner p { margin: 6px 0 0; opacity: .9; }
.sp-tabs { display: flex; gap: 18px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.sp-tab { border: none; background: none; padding: 10px 2px; font-weight: 600; font-size: 14px; color: var(--text-muted); border-bottom: 3px solid transparent; cursor: pointer; }
.sp-tab.is-active { color: #1a3b7a; border-bottom-color: #1a3b7a; }
.sp-search { width: 100%; max-width: 360px; padding: 11px 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.sp-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column; }
.sp-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,.14); }
.sp-card__head { height: 96px; display: grid; place-items: center; color: #fff; font-size: 38px; font-weight: 700; }
.sp-card__body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.sp-card__title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sp-card__title strong { color: var(--navy-deep); font-size: 15px; }
.sp-card__msg { margin: 0; font-size: 13px; color: var(--text-muted); flex: 1; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sp-card__foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-muted); }
.sp-badge { background: #ff6b6b; color: #fff; padding: 2px 9px; border-radius: 12px; font-weight: 700; }

/* ---------- Comunicaciones ---------- */
.comm-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.comm-side { display: flex; flex-direction: column; gap: 4px; }
.comm-navlink { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: none; border-radius: var(--radius-sm); text-align: left; font-size: 13px; color: var(--text); font-weight: 500; }
.comm-navlink:hover { background: var(--gray-light); }
.comm-navlink.is-active { background: var(--navy); color: #fff; }
.comm-thread:hover { border-color: var(--teal); }
@media (max-width: 860px) { .comm-layout { grid-template-columns: 1fr; } }

/* ---------- Logo de la firma ---------- */
.logo-box { width: 84px; height: 84px; border-radius: 12px; border: 1px solid var(--border); background: var(--gray-light); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- Configuración: tipografía más grande ---------- */
.config-scope { font-size: 15px; }
.config-scope .card__title { font-size: 13px; }
.config-scope .field label { font-size: 13px; }
.config-scope .field input, .config-scope .field select, .config-scope .field textarea { font-size: 15px; padding: 11px 13px; }
.config-scope .comm-navlink { font-size: 14px; padding: 12px 14px; }
.config-scope table.data td, .config-scope table.data th { font-size: 14px; }
.config-scope .chip-edit { font-size: 14px; padding: 7px 13px; }
.config-scope .data .num, .config-scope p { font-size: 14px; }

/* ---------- Dashboard: toggle Personal/Firma ---------- */
.view-toggle { display: inline-flex; gap: 4px; background: var(--gray-light); padding: 4px; border-radius: 8px; }
.view-toggle button { padding: 8px 16px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 6px; font-weight: 600; font-size: 13px; }
.view-toggle button.is-active { background: #fff; color: var(--navy-deep); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ---------- Configuración: catálogos y permisos ---------- */
.chips-edit { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-edit { display: inline-flex; align-items: center; gap: 6px; background: var(--gray-light); border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px; font-size: 13px; }
.chip-edit button { background: none; border: none; color: var(--text-muted); font-size: 14px; cursor: pointer; }
.chip-edit button:hover { color: var(--danger); }
/* Matriz de roles y permisos (rediseño) */
.matrix-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.matrix-title { font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--navy-deep); margin: 0; }
.roles-permissions-table { width: 100%; border-collapse: collapse; background: #fff; table-layout: fixed; }
.roles-permissions-table td, .roles-permissions-table th { border: 1px solid #ececf0; padding: 0; text-align: center; }
.roles-permissions-table th { background-color: #f6f7fb; padding: 8px 6px; }
.roles-permissions-table td:first-child, .roles-permissions-table th:first-child { text-align: left; padding-left: 12px; width: 150px; }
.roles-permissions-table tbody tr:hover { background-color: #fafbff; }
.role-header { display: block; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; font-size: 11px; color: #424242; }
.role-subheader { display: inline-block; margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: .3px; font-size: 10px; color: #1a237e; background: none; border: none; cursor: pointer; text-decoration: underline; }
.module-header { font-weight: 600; font-size: 13px; color: #212121; }
.permission-cell { display: flex; align-items: center; justify-content: center; padding: 5px 6px; min-height: 0; }
.permission-button { width: 96px; min-width: 96px; max-width: 96px; height: 26px; padding: 0 10px; border: 1px solid; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .2px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all .15s ease; white-space: nowrap; }
.permission-button.perm-edit { background-color: #e8f5e9; color: #2e7d32; border-color: #4caf50; }
.permission-button.perm-edit:hover { background-color: #c8e6c9; border-color: #388e3c; }
.permission-button.perm-view { background-color: #fff3e0; color: #e65100; border-color: #ff9800; }
.permission-button.perm-view:hover { background-color: #ffe0b2; border-color: #f57c00; }
.permission-button.perm-none { background-color: #f5f5f5; color: #757575; border-color: #bdbdbd; }
.permission-button.perm-none:hover { background-color: #e0e0e0; border-color: #9e9e9e; }
.add-role-button, .save-permissions-button { height: 34px; padding: 0 16px; font-weight: 600; font-size: 12.5px; letter-spacing: .3px; text-transform: uppercase; border: none; border-radius: 8px; background-color: #1a237e; color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all .15s ease; }
.add-role-button:hover, .save-permissions-button:hover { background-color: #0d1854; box-shadow: 0 2px 8px rgba(26,35,126,.3); }

/* ---------- Notas (tipo OneNote) ---------- */
.notes-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 2px solid var(--border); margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.notes-header h1 { margin: 0; color: var(--navy-deep); font-size: 22px; }
.notes-header p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
.notes-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.notes-sidebar { background: var(--gray-light); border-radius: 10px; padding: 12px; border: 1px solid var(--border); max-height: 70vh; overflow-y: auto; }
.notes-search { margin-bottom: 14px; }
.notes-sections { display: flex; flex-direction: column; gap: 8px; }
.notes-section { background: #fff; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.notes-section__header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; user-select: none; }
.notes-section__header:hover { background: var(--gray-light); }
.notes-pages { display: flex; flex-direction: column; gap: 3px; padding: 6px; }
.notes-pages.hidden { display: none; }
.notes-page { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; border-left: 3px solid transparent; }
.notes-page:hover { background: var(--gray-light); }
.notes-page.is-active { background: #e3f2fd; border-left-color: #1a3b7a; }
.notes-page__t { font-weight: 500; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy-deep); }
.notes-page__d { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notes-editor { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 22px; min-height: 60vh; min-width: 0; overflow: hidden; }
.notes-page-editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.notes-toolbar { display: flex; gap: 4px; padding: 8px; background: var(--gray-light); border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; align-items: center; }
.note-btn { padding: 6px 10px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; min-width: 32px; }
.note-btn:hover { border-color: #1a3b7a; color: #1a3b7a; }
.note-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.notes-content { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-size: 14px; line-height: 1.6; outline: none;
  /* Evita que contenido ancho (texto largo, tablas, imágenes) estire el recuadro de más */
  max-width: 100%; overflow-wrap: anywhere; word-break: break-word;
  max-height: 62vh; overflow-y: auto; }
.notes-content:focus { border-color: #1a3b7a; box-shadow: 0 0 0 3px rgba(26,59,122,.1); }
.notes-content ul, .notes-content ol { margin: 8px 0; padding-left: 20px; }
.notes-content pre { background: #f5f5f5; padding: 12px; border-radius: 4px; overflow-x: auto; font-family: 'Courier New', monospace; font-size: 12px; white-space: pre-wrap; }
.notes-content img { max-width: 100%; height: auto; }
.notes-content table { width: 100%; max-width: 100%; table-layout: fixed; }
.notes-content table td, .notes-content table th { overflow-wrap: anywhere; }
@media (max-width: 860px) { .notes-layout { grid-template-columns: 1fr; } }

/* ---------- Avatares / contactos ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.avatar--person { background: var(--teal); }
.avatar--lg { width: 56px; height: 56px; font-size: 19px; }
.contact-card:hover { border-color: var(--teal); }

/* ---------- Visualizador de documentos ---------- */
.modal:has(.doc-viewer) { max-width: 780px; }
.doc-viewer__text { white-space: pre-wrap; max-height: 56vh; overflow-y: auto; background: var(--gray-light); border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-size: 13px; line-height: 1.6; }
/* Markdown ya renderizado (correos .md): el HTML trae sus propios saltos, sin pre-wrap */
.doc-viewer__text--md { white-space: normal; background: #fff; }
.doc-viewer__text--md p { margin: 6px 0; }
.doc-viewer__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.doc-viewer__meta > div { display: flex; flex-direction: column; }
.doc-viewer__meta span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.doc-viewer__meta strong { color: var(--navy-deep); font-size: 13px; }

/* ---------- Panel de detalle (Actividad / Documentos) ---------- */
.dp-tabs { display: flex; gap: 4px; padding: 10px 14px 0; border-bottom: 1px solid var(--border); background: var(--gray-light); border-radius: var(--radius) var(--radius) 0 0; }
.dp-tab { background: none; border: none; padding: 10px 18px; font-weight: 600; font-size: 14px; color: var(--text-muted); border-bottom: 3px solid transparent; }
.dp-tab.is-active { color: var(--navy-deep); border-bottom-color: var(--teal); background: #fff; border-radius: 8px 8px 0 0; }
.dp-body { padding: 18px 20px; }
.dp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dp-head h3 { margin: 0; font-size: 15px; color: var(--navy-deep); flex: 1; }

/* Línea de tiempo visual */
.timeline { position: relative; padding-left: 8px; }
.timeline__item { position: relative; padding: 0 0 18px 28px; }
.timeline__item::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: -2px; width: 2px; background: #d3dbe8; }
.timeline__item:last-child::before { display: none; }
.timeline__dot { position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 2px #c9d6ee; z-index: 1; }
.timeline__content { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; position: relative; }
.timeline__content:hover { border-color: var(--teal); }
.timeline__date { font-weight: 700; color: var(--navy-deep); font-size: 14px; }
.timeline__title { font-weight: 600; color: var(--charcoal); margin-top: 2px; }
.timeline__text { color: var(--text); margin-top: 4px; font-size: 13px; }
.timeline__meta { color: var(--text-muted); font-size: 11px; margin-top: 6px; }
.timeline__del { position: absolute; top: 8px; right: 10px; background: none; border: none; color: var(--text-muted); font-size: 16px; opacity: 0; transition: opacity .15s; }
.timeline__content:hover .timeline__del { opacity: 1; }

/* Dropzone */
.dropzone { border: 2px dashed var(--gray-mid); border-radius: 12px; padding: 26px; text-align: center; color: var(--text-muted); background: var(--gray-light); transition: all .15s; cursor: default; }
.dropzone.is-over { border-color: var(--teal); background: #eaf0f9; color: var(--teal-dark); }
.dropzone__icon { font-size: 30px; margin-bottom: 6px; }
.dp-search { width: 100%; margin: 14px 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
.dp-doclist { display: flex; flex-direction: column; gap: 8px; }
.doc-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.doc-row:hover { border-color: var(--teal); }
.doc-row__icon { font-size: 22px; }
.doc-row__main { flex: 1; min-width: 0; }
.doc-row__name { font-weight: 600; color: var(--navy-deep); }
.doc-row__snip { margin-top: 5px; font-size: 12px; color: var(--text); background: #fbf7e6; border-radius: 6px; padding: 5px 8px; }
.doc-row__snip mark { background: #ffe58a; padding: 0 2px; border-radius: 3px; }
.doc-row__actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ---------- Banner de alertas (Dashboard) ---------- */
.alert-banner { border: 1px solid var(--warn); background: #fffaf0; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.alert-banner--critical { border-color: var(--danger); background: #fff5f4; }
.alert-banner__head { font-size: 15px; color: var(--navy-deep); margin-bottom: 10px; }
.alert-banner__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; }
.alert-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; background: #fff; border-left: 3px solid var(--warn); font-size: 13px; color: var(--text); }
.alert-item:hover { box-shadow: var(--shadow); }
.alert-item--critical { border-left-color: var(--danger); }

/* ---------- Plazos legales ---------- */
.compliance { display: flex; gap: 14px; margin-bottom: 16px; }
.comp-stat { flex: 1; background: var(--gray-light); border-radius: 10px; padding: 12px; text-align: center; }
.comp-stat b { display: block; font-size: 24px; }
.comp-stat span { font-size: 12px; color: var(--text-muted); }
.dl-list { display: flex; flex-direction: column; gap: 12px; }
.dl-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.dl-card__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dl-card__head strong { color: var(--navy-deep); }
.dl-card__info { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 8px 16px; margin-top: 10px; }
.dl-card__info > div { display: flex; flex-direction: column; }
.dl-card__info strong { color: var(--charcoal); font-size: 13px; }
.dl-card__actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Plan de trabajo / Gantt ---------- */
.plan-summary { display: flex; gap: 24px; flex-wrap: wrap; background: var(--gray-light); border-radius: 10px; padding: 14px 18px; margin-bottom: 16px; }
.plan-summary > div { display: flex; flex-direction: column; gap: 4px; }
.plan-summary strong { color: var(--navy-deep); }
.progress { height: 8px; background: #e3e3e8; border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--teal); border-radius: 999px; }

.gantt { position: relative; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 18px; overflow: hidden; }
.gantt__row { display: flex; align-items: center; height: 30px; }
.gantt__label { width: 220px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--navy-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.gantt__track { position: relative; flex: 1; height: 16px; background: #f1f3f7; border-radius: 6px; }
.gantt__bar { position: absolute; top: 0; height: 16px; border-radius: 6px; min-width: 8px; display: flex; align-items: center; }
.gantt__barpct { color: #fff; font-size: 10px; font-weight: 700; padding-left: 6px; }
.gantt__axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 6px; padding-left: 220px; }
.gantt__today { position: absolute; top: 8px; bottom: 24px; width: 2px; background: var(--danger); z-index: 2; }

.ms-list { display: flex; flex-direction: column; gap: 12px; }
.ms-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.ms-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ms-card__head strong { color: var(--navy-deep); }
.ms-del, .ms-task { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; cursor: pointer; }
.ms-del input, .ms-task input { width: auto; }
.ms-del .done, .ms-task .done { text-decoration: line-through; color: var(--text-muted); }
.ms-tasks { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 4px; }

/* ---------- Bitácora de avances ---------- */
.bita { display: flex; flex-direction: column; }
.bita__item { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.bita__item:not(:last-child)::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.bita__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--teal); flex-shrink: 0; margin-top: 3px; z-index: 1; }
.bita__body { flex: 1; }
.bita__head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bita__head span { color: var(--text-muted); font-size: 12px; }
.bita__del { margin-top: 6px; opacity: 0; transition: opacity .15s; }
.bita__item:hover .bita__del { opacity: 1; }

/* ---------- Filas dinámicas (plantillas) ---------- */
.tpl-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.tpl-row input, .tpl-row select { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; min-width: 0; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,26,71,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal__head h2 { margin: 0; font-size: 18px; color: var(--navy-deep); }
.modal__body { padding: 22px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); flex-shrink: 0; background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.modal__close { background: none; border: none; font-size: 22px; color: var(--text-muted); line-height: 1; }

/* ---------- Timer big ---------- */
.timer-display { font-size: 52px; font-weight: 700; color: var(--navy-deep); font-variant-numeric: tabular-nums; text-align: center; margin: 10px 0 18px; }
.timer-controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy-deep); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); z-index: 80; }
.toast.is-error { background: var(--danger); }

/* ---------- Calendario ---------- */
.cal-layout { display: grid; grid-template-columns: 1fr 248px; gap: 18px; align-items: start; }
.cal-side {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.cal-row { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.cal-row .cal-edit { opacity: 0; transition: opacity .15s; }
.cal-row:hover .cal-edit { opacity: 1; }
.cal-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; cursor: pointer; }

/* Mes */
.cal-mhead { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); background: var(--gray-light); }
.cal-mhead > div { padding: 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.cal-mgrid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); }
.cal-mcell { min-width: 0; min-height: 96px; border: 1px solid var(--border); padding: 5px; background: #fff; overflow: hidden; }
.cal-mcell--off { background: #fafafb; }
.cal-mcell.is-today { box-shadow: inset 0 0 0 2px var(--teal); }
.cal-mcell__n { font-size: 12px; font-weight: 600; color: var(--navy-deep); margin-bottom: 4px; }
.cal-mcell--off .cal-mcell__n { color: var(--text-muted); }
.cal-chip { padding: 2px 6px; border-radius: 4px; font-size: 11px; margin-bottom: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }


/* ── Calendario timeline (semana / día) ─────────────────────────────────
   Solución definitiva al desfase de columnas:
   - Las líneas verticales de separación las genera background-image
     (repeating-linear-gradient) en el contenedor, NO border en las celdas.
   - Así flex:1 divide espacio idéntico en header, allday y body.
   - --gutter-w compartida entre corner/alldaylabel y gutter de horas.
   ──────────────────────────────────────────────────────────────────── */

.cal-grid {
  --gutter-w: 52px;
  --col-border: var(--border, #e5e7eb);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
}

/* ---- Zona fija ---- */
.cal-grid__fixed {
  flex-shrink: 0;
}
.cal-grid__header-row,
.cal-grid__allday-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--col-border);
}

/* Corner y alldaylabel: ancho fijo igual al gutter */
.cal-grid__corner,
.cal-grid__alldaylabel {
  flex: 0 0 var(--gutter-w);
  width: var(--gutter-w);
  box-sizing: border-box;
  border-right: 1px solid var(--col-border);
  background: #fff;
  z-index: 1;
}
.cal-grid__alldaylabel {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 3px;
  text-align: center;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Heads y allday: flex sin bordes en hijos.
   Las líneas verticales vienen del background-image del padre. */
.cal-grid__heads,
.cal-grid__allday {
  flex: 1;
  display: flex;
  min-width: 0;
  /* líneas verticales generadas con gradiente — se actualizan por JS si es necesario */
  /* se dejan sin background aquí; las líneas las pone .cal-grid__body-cols */
}
.cal-col__head {
  flex: 1;
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  box-sizing: border-box;
  min-width: 0;
  /* sin border: el contenedor padre pone las líneas */
  border-right: 1px solid var(--col-border);
}
.cal-col__head:last-child { border-right: none; }
.cal-col__head.is-today { background: transparent; }
.cal-col__head.is-today .cal-col__num {
  background: var(--navy-deep, #1a3a5c);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-col__dow { display: block; color: var(--text-muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
.cal-col__num { font-weight: 700; color: var(--navy-deep); font-size: 15px; }

.cal-allday__cell {
  flex: 1;
  padding: 2px;
  box-sizing: border-box;
  min-height: 28px;
  min-width: 0;
  border-right: 1px solid var(--col-border);
}
.cal-allday__cell:last-child { border-right: none; }

/* ---- Zona scrolleable ---- */
.cal-grid__scroll {
  flex: 1;
  overflow: hidden;
  display: flex;
  position: relative;
}

.cal-grid__heads,
.cal-grid__allday {
  overflow: hidden;
  /* --scrollbar-w se calcula en JS y refleja el ancho real del scrollbar */
  padding-right: var(--scrollbar-w, 15px);
  box-sizing: border-box;
}

/* body-wrap: el único elemento que scrollea verticalmente */
.cal-grid__body-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  min-width: 0;
  position: relative;
}

.cal-grid__gutter {
  flex: 0 0 var(--gutter-w);
  width: var(--gutter-w);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--col-border);
  z-index: 2;
}
.cal-hour-label {
  height: 46px;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  padding-right: 6px;
  box-sizing: border-box;
  transform: translateY(-8px);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}
.cal-hour-label:first-child { visibility: hidden; }

.cal-grid__body {
  flex: 1;
  display: flex;
  position: relative;
  min-width: 0;
}

/* Cada columna de día: flex:1 SIN border para que flex divida igual */
.cal-col {
  flex: 1;
  position: relative;
  height: 1104px;
  box-sizing: border-box;
  min-width: 0;
  border-right: 1px solid var(--col-border);
}
.cal-col:last-child { border-right: none; }

.cal-hour-cell {
  height: 46px;
  border-bottom: 1px solid var(--col-border);
  box-sizing: border-box;
}
.cal-biz {
  position: absolute;
  left: 0; right: 0;
  background: rgba(26,26,71,.035);
  pointer-events: none;
}
.cal-now {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--danger, #c0392b);
  z-index: 5;
}
.cal-now::before {
  content: '';
  position: absolute;
  left: -4px; top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--danger, #c0392b);
}

/* ---- Eventos ---- */
.cal-event {
  position: absolute;
  border-radius: 4px;
  padding: 3px 5px;
  overflow: hidden;
  cursor: pointer;
  font-size: 11px;
  z-index: 3;
  color: #fff;
  transition: filter .15s;
  box-sizing: border-box;
}
.cal-event:hover { filter: brightness(0.88); }
.cal-event__t { font-weight: 600; font-size: 10px; opacity: .85; display: block; }
.cal-event__n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; display: block; }



/* Mini calendario del dashboard */
.dwk__dow { display: grid; grid-template-columns: repeat(7,1fr); text-align: center; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.dwk__grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.dwk-day { position: relative; border: none; background: none; padding: 8px 0; border-radius: 6px; font-size: 12px; color: var(--navy-deep); cursor: pointer; }
.dwk-day:hover { background: var(--gray-light); }
.dwk-day--off { color: var(--gray-mid); }
.dwk-day.is-today { background: var(--navy); color: #fff; }
.dwk-day.has-ev::after { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }
.dwk-day.is-today.has-ev::after { background: #fff; }

/* Items de listas laterales (calendario/dashboard) */
.side-item {
  display: block;
  padding: 7px 10px;
  border-radius: 0 6px 6px 0;
  border-left: 3px solid var(--navy-deep, #1a3a5c);
  background: var(--gray-light, #f8f9fa);
  margin-bottom: 6px;
  transition: background .15s;
}
.side-item:last-child { border-bottom: none; }
.side-item:hover { background: #e8eef6; }
.side-item__t { display: block; font-size: 13px; font-weight: 600; color: var(--navy-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item__s { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Mini calendario */
.mini-cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.mini-cal__dow { display: grid; grid-template-columns: repeat(7,1fr); text-align: center; font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.mini-cal__grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; }
.mini-day { border: none; background: none; font-size: 11px; padding: 5px 0; border-radius: 50%; color: var(--navy-deep); cursor: pointer; text-align: center; width: 100%; }
.mini-day:hover { background: var(--gray-light); }
.mini-day--off { color: var(--gray-mid); }
.mini-day.is-today { background: var(--navy-deep, #1a3a5c); color: #fff; font-weight: 700; }
.mini-day.is-sel:not(.is-today) { background: #dbeafe; color: var(--navy-deep); font-weight: 700; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown__menu { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; z-index: 40; min-width: 190px; }
.dd-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 13px; cursor: pointer; border-radius: 6px; }
.dd-item:hover { background: var(--gray-light); }
.dd-item input { width: auto; }

/* Paleta de colores */
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.palette__sw { width: 26px; height: 26px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.palette__sw.is-sel { border-color: var(--navy); box-shadow: 0 0 0 2px #fff inset; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar__toggle { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; }
}

/* ── Configuración › Datos ─────────────────────────────────── */
.settings-data__status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}
.settings-data__bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin: 0.75rem 0 0.25rem;
  overflow: hidden;
}
.settings-data__bar {
  height: 100%;
  background: var(--primary, #2e5fa3); /* Usa var(--primary) o el color teal por defecto */
  border-radius: 3px;
  transition: width 0.3s ease;
}
.settings-data__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.settings-data__table th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  background: var(--bg-secondary, #f5f7fa);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.settings-data__table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.settings-data__count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.settings-data__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.settings-data__warning {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}
.badge--cloud {
  background: #e0f2fe;
  color: #0369a1;
}
.badge--local {
  background: #e0f2f1;
  color: #004d40;
}
.badge--warn { background: #fef3c7; color: #92400e; }
.badge--danger { background: #fee2e2; color: #b91c1c; }
/* ── Markdown en bitácora ──────────────────────────────────────── */
.md-content h1,.md-content h2,.md-content h3 { color:#1b1464; margin:8px 0 4px; font-size:13px; border-bottom:1px solid #e5e7eb; padding-bottom:3px; }
.md-content h3 { font-size:12px; border-bottom:none; }
.md-content p { margin:4px 0; line-height:1.5; }
.md-content strong { color:#1b1464; }
.md-content em { color:#505050; }
.md-content a { color:#1a3b7a; }
.md-content ul,.md-content ol { margin:4px 0; padding-left:18px; }
.md-content li { margin-bottom:2px; font-size:12px; }
.md-content hr { border:none; border-top:1px solid #e5e7eb; margin:8px 0; }
.md-content code { background:#f0f0f8; padding:1px 4px; border-radius:3px; font-size:11px; font-family:monospace; }
.md-content blockquote { border-left:3px solid #1a3b7a; margin:6px 0; padding:4px 10px; background:#f8f8fc; color:#555; font-size:12px; }
/* Preview pane en el modal */
#bfPreviewPane h1,#bfPreviewPane h2,#bfPreviewPane h3 { color:#1b1464; margin:8px 0 4px; }
#bfPreviewPane h3 { font-size:13px; }
#bfPreviewPane strong { color:#1b1464; }
#bfPreviewPane a { color:#1a3b7a; }
#bfPreviewPane hr { border:none; border-top:1px solid #ddd; margin:8px 0; }
#bfPreviewPane code { background:#f0f0f8; padding:1px 4px; border-radius:3px; font-size:11px; font-family:monospace; }
#bfPreviewPane blockquote { border-left:3px solid #1a3b7a; margin:6px 0; padding:4px 10px; background:#f8f8fc; }

/* ── Notas colapsables en bitácora ─────────────────────────────── */
.note-collapse { border:none; }
.note-collapse__summary {
  cursor:pointer;
  list-style:none;
  padding:2px 0;
  color:#1b1464;
  font-size:13px;
  font-weight:500;
  display:flex;
  align-items:center;
  gap:6px;
  user-select:none;
}
.note-collapse__summary::-webkit-details-marker { display:none; }
.note-collapse__summary::before {
  content:'▶';
  font-size:10px;
  color:#1a3b7a;
  transition:transform .2s;
  flex-shrink:0;
}
details[open] .note-collapse__summary::before { transform:rotate(90deg); }
.note-collapse__body {
  margin-top:10px;
  padding:10px 12px;
  background:#f8f8fc;
  border-left:3px solid #1a3b7a;
  border-radius:0 6px 6px 0;
}

/* ── Notas estilo Notion: menú "/", bloques y tareas ─────────── */
.slash-menu { position:absolute; z-index:60; background:#fff; border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow); width:290px; max-height:330px; overflow-y:auto; padding:6px; }
.slash-menu__group { font-size:10px; letter-spacing:.6px; text-transform:uppercase; color:var(--text-muted); padding:8px 10px 2px; }
.slash-menu__item { display:flex; gap:10px; align-items:center; padding:7px 10px; border-radius:8px; cursor:pointer; }
.slash-menu__item.is-active { background:#eaf0f9; }
.slash-menu__icon { width:30px; height:30px; display:grid; place-items:center; background:var(--gray-light); border:1px solid var(--border); border-radius:6px; font-weight:700; color:var(--navy-deep); font-size:12px; flex-shrink:0; }
.slash-menu__t { font-weight:600; color:var(--navy-deep); font-size:13px; }
.slash-menu__d { font-size:11px; color:var(--text-muted); }

.notes-content h1 { font-size:24px; color:var(--navy-deep); margin:14px 0 6px; }
.notes-content h2 { font-size:19px; color:var(--navy-deep); margin:12px 0 5px; }
.notes-content h3 { font-size:15px; color:var(--navy-deep); margin:10px 0 4px; }
.notes-content blockquote { border-left:3px solid var(--sage); margin:8px 0; padding:6px 14px; background:#fdf9f0; color:#555; border-radius:0 6px 6px 0; }
.notes-content pre { background:#f4f4f8; border:1px solid var(--border); border-radius:8px; padding:10px 14px; font-family:ui-monospace, Menlo, Consolas, monospace; font-size:12px; overflow-x:auto; }
.notes-content hr { border:none; border-top:2px solid var(--border); margin:14px 0; }
.nt-callout { background:#f0f4fa; border:1px solid #d5e0f0; border-left:4px solid var(--teal); border-radius:8px; padding:10px 14px; margin:8px 0; }
.nt-table { width:100%; border-collapse:collapse; margin:10px 0; font-size:13px; }
.nt-table th { background:var(--gray-light); color:var(--navy-deep); text-align:left; }
.nt-table th, .nt-table td { border:1px solid var(--border); padding:7px 10px; min-width:60px; }
ul.nt-todos { list-style:none; padding-left:4px; margin:6px 0; }
ul.nt-todos li { display:flex; gap:8px; align-items:flex-start; margin:4px 0; }
ul.nt-todos li input[data-todo] { width:15px; height:15px; margin-top:3px; accent-color:var(--teal); cursor:pointer; }
ul.nt-todos li.is-done { text-decoration:line-through; color:var(--text-muted); }
.notes-stats { border-top:1px solid var(--border); margin-top:14px; padding-top:8px; font-size:11px; color:var(--text-muted); display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px; }
.nt-attach { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.nt-attach__chip { display:inline-flex; align-items:center; gap:6px; background:var(--gray-light); border:1px solid var(--border); border-radius:999px; padding:5px 8px 5px 12px; font-size:12px; color:var(--navy-deep); cursor:pointer; }
.nt-attach__chip small { color:var(--text-muted); }
.nt-attach__chip:hover { border-color:var(--teal); }
.nt-attach__x { border:none; background:#e3e3e8; border-radius:50%; width:18px; height:18px; line-height:1; cursor:pointer; color:#555; padding:0; }
.nt-attach__x:hover { background:var(--danger); color:#fff; }
