:root {
  --ink: #141B2B;
  --ink-2: #333C4E;
  --muted: #5B6475;
  --line: #E3E6EC;
  --line-2: #ECEEF2;
  --field: #D5DAE2;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --navy: #0F1B2D;
  --navy-2: #1C2A42;
  --navy-line: #24324A;
  --accent: #C2410C;
  --accent-dark: #9A3412;
  --accent-soft: #FCE9DC;
  --blue: #1D4ED8; --blue-soft: #DBE7FE; --blue-ink: #1E40AF; --blue-bar: #C7D7FB;
  --green: #15803D; --green-soft: #DCFCE7; --green-ink: #166534;
  --amber: #B45309; --amber-soft: #FEF0D7; --amber-ink: #92400E;
  --red: #B91C1C; --red-soft: #FDE2E2; --red-ink: #991B1B;
  --gray-soft: #EEF1F5;
  --radius: 12px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-head: "Space Grotesk", Inter, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 236px; flex: none; background: var(--navy); color: #C9D3E3; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { padding: 4px 10px 22px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; }
.side .brand img { width: 150px; height: auto; display: block; }
.side .brand span { font-family: var(--font-head); color: #FFFFFF; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.85; }
.side a.nav {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 8px;
  color: #C9D3E3; text-decoration: none; font-weight: 500;
}
.side a.nav:hover { background: var(--navy-2); color: #FFFFFF; }
.side a.nav.on { background: var(--accent); color: #FFFFFF; }
.side a.nav .count { margin-left: auto; background: var(--red); color: #FFF; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.side .sep { height: 1px; background: var(--navy-line); margin: 14px 6px; }
.side .me { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--navy-line); display: flex; align-items: center; gap: 10px; }
.side .me .who { min-width: 0; flex: 1; }
.side .me .who b { display: block; color: #FFF; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .me .who small { color: #9FB0CA; }
.side .me button { background: transparent; border: 1px solid var(--navy-line); color: #C9D3E3; border-radius: 8px; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.side .me button:hover { background: var(--navy-2); color: #FFF; }

.main { flex: 1; min-width: 0; padding: 26px 34px 56px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.page-head .eyebrow { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.crumbs { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi p { margin: 0; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { margin-top: 6px; font-family: var(--font-head); font-size: 30px; font-weight: 600; line-height: 1.1; }
.kpi .value.sm { font-size: 21px; }
.kpi .sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-3 { flex: 3 1 540px; min-width: 0; }
.col-2 { flex: 2 1 320px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--field); background: #FFF; color: var(--ink); font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #F7F8FA; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #FFF; font-weight: 600; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #FFF; }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #FFF; font-weight: 600; }
.btn.dark:hover { background: var(--navy-2); }
.btn.danger { color: var(--red); border-color: #F3C2C2; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--gray-soft); }
.btn.icon { width: 42px; padding: 0; }
.btn.icon.sm { width: 34px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--field); background: #FFF; cursor: pointer; font-size: 13px; }
.pill.on { background: var(--navy); border-color: var(--navy); color: #FFF; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-blue { background: var(--blue-soft); color: var(--blue-ink); }
.b-green { background: var(--green-soft); color: var(--green-ink); }
.b-amber { background: var(--amber-soft); color: var(--amber-ink); }
.b-red { background: var(--red-soft); color: var(--red-ink); }
.b-gray { background: var(--gray-soft); color: var(--ink-2); }
.b-accent { background: var(--accent-soft); color: var(--accent-dark); }

.bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--blue); }
.avatar { width: 32px; height: 32px; border-radius: 16px; flex: none; color: #FFF; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #FFF; }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -8px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; padding: 9px 8px; }
.tbl td { padding: 11px 8px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #FAFBFC; }
.tbl .done td { color: var(--muted); }
.tbl .done .t-title { text-decoration: line-through; }
.scroll-x { overflow-x: auto; }
.empty { padding: 26px 10px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--ink-2); }
.field input, .field select, .field textarea, .input {
  height: 42px; border: 1px solid var(--field); border-radius: 8px; padding: 0 12px; background: #FFF; font-size: 14px; font-weight: 400; color: var(--ink); width: 100%;
}
.field textarea, textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid #F3B48E; outline-offset: 0; border-color: var(--accent); }
.field .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--field); border-radius: 8px; min-height: 42px; max-height: 190px; overflow-y: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 16px; background: var(--gray-soft); font-size: 13px; cursor: pointer; border: 1px solid transparent; user-select: none; }
.chip.on { background: var(--navy); color: #FFF; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:focus-within { outline: 2px solid #F3B48E; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--field); }
.tab { height: 44px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-weight: 500; }
.tab.on { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 27, 45, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--bg); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 24px 60px rgba(0,0,0,0.3); overflow: hidden; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; background: var(--navy); color: #FFF; border-bottom: 4px solid var(--accent); }
.modal-head h2 { color: #FFF; font-size: 19px; }
.modal-head.danger { background: #7F1D1D; border-bottom-color: #F87171; }
.modal-sub { margin: 4px 0 0; font-size: 13px; color: #C9D3E3; }
.modal-x { flex: none; width: 38px; height: 38px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.25); background: transparent; color: #FFF; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.modal-x:hover { background: rgba(255,255,255,0.12); }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; background: var(--bg); }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #FFF; }
.modal-foot .right { display: flex; gap: 10px; margin-left: auto; }
/* Bloques de formulario dentro de ventanas */
.fsec { background: #FFF; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.fsec-h { display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 14px; font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-dark); background: #FFF6F0; border-bottom: 1px solid #F6DCCB; }
.fsec.blue .fsec-h { color: var(--blue-ink); background: #EFF4FF; border-bottom-color: #D6E2FD; }
.fsec.green .fsec-h { color: var(--green-ink); background: #EEFBF2; border-bottom-color: #CDEFD8; }
.fsec.gray .fsec-h { color: var(--ink-2); background: #F3F5F8; border-bottom-color: var(--line); }
.fsec.red .fsec-h { color: var(--red-ink); background: #FEF2F2; border-bottom-color: #F7CFCF; }
.fsec-b { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.fsec-b.form-grid, .fsec-b .form-grid { display: grid; }
/* Selector con colores (prioridad, rol) */
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt > span { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--field); background: #FFF; cursor: pointer; font-size: 13px; font-weight: 500; }
.opt input:checked + span { border-width: 2px; padding: 0 13px; font-weight: 700; }
.opt input:focus-visible + span { outline: 2px solid #F3B48E; }
.opt.p-baja input:checked + span { border-color: #8A94A6; background: var(--gray-soft); }
.opt.p-media input:checked + span { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-ink); }
.opt.p-alta input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--red-ink); }
.opt.r-responsable input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.opt.r-editor input:checked + span { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-ink); }
.opt.r-participante input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green-ink); }
.opt.r-lector input:checked + span { border-color: #8A94A6; background: var(--gray-soft); }
.dot-i { width: 9px; height: 9px; border-radius: 5px; display: inline-block; flex: none; }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--navy); color: #FFF; padding: 12px 16px; border-radius: 10px; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); font-size: 14px; }
.toast.err { background: var(--red); }

/* Notificaciones */
.notif-wrap { position: relative; }
.notif-dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #FFF; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; padding: 0 4px; }
.notif-panel { position: absolute; right: 0; top: 50px; width: 380px; max-width: calc(100vw - 32px); background: #FFF; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px rgba(0,0,0,0.15); z-index: 40; }
.notif-panel header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.notif-list { max-height: 420px; overflow-y: auto; list-style: none; margin: 0; padding: 0; }
.notif-list a { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.notif-list a:hover { background: #FAFBFC; }
.notif-list a.unread { background: #FFF8F3; }
.notif-list b { display: block; font-weight: 600; font-size: 13px; }
.notif-list span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; background: #FFF; border: 1px solid var(--field); border-radius: 8px; min-width: 240px; }
.search input { border: 0; outline: 0; flex: 1; background: transparent; min-width: 0; }

/* Tablero */
.agenda-item { display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: var(--ink); }
.agenda-date { width: 58px; flex: none; text-align: center; padding: 6px 0; border-radius: 8px; background: var(--gray-soft); }
.agenda-date.today { background: var(--accent-soft); color: var(--accent-dark); }
.agenda-date small { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.agenda-date b { font-family: var(--font-head); font-size: 16px; }
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.alerts li { display: flex; gap: 10px; }
.alerts .dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 4px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.proj-card { display: block; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.proj-card:hover { border-color: #C6CCD6; box-shadow: 0 4px 14px rgba(15,27,45,0.06); color: var(--ink); }
.proj-card .name { margin: 8px 0 14px; font-weight: 600; font-size: 15px; }

/* Encabezado de proyecto */
.proj-head { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; justify-content: space-between; }
.proj-head .stats { display: flex; flex-wrap: wrap; gap: 26px; align-items: center; }
.stat small { display: block; font-size: 12px; color: var(--muted); }
.stat b { font-family: var(--font-head); font-size: 24px; font-weight: 600; }

/* Gantt */
.gantt { min-width: 760px; position: relative; }
.g-row { display: grid; grid-template-columns: 270px minmax(0, 1fr); align-items: center; border-bottom: 1px solid #F1F2F5; min-height: 46px; }
.g-head { border-bottom: 1px solid var(--line-2); min-height: 0; align-items: stretch; }
.g-label { padding: 6px 12px 6px 0; min-width: 0; cursor: pointer; }
.g-label b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-label small { color: var(--muted); font-size: 12px; }
.g-track { position: relative; height: 46px; }
.g-scale { position: relative; height: 44px; }
.g-scale div { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-2); padding: 4px 6px; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; }
.g-scale .minor { top: 22px; font-weight: 400; font-size: 11px; }
.g-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #EEF0F3; pointer-events: none; }
.g-bar { position: absolute; top: 12px; height: 22px; border-radius: 5px; background: var(--blue-bar); overflow: hidden; cursor: pointer; border: 0; padding: 0; min-width: 6px; }
.g-bar > i { display: block; height: 100%; background: var(--blue); }
.g-bar > span { position: absolute; left: 8px; top: 0; line-height: 22px; font-size: 11px; font-weight: 700; color: #FFF; text-shadow: 0 0 2px rgba(0,0,0,0.25); white-space: nowrap; }
.g-bar.zero > span { color: #1E3A8A; text-shadow: none; }
.g-bar.done { background: var(--green); }
.g-bar.done > i { background: var(--green); }
.g-bar.late { background: #F6C9C9; }
.g-bar.late > i { background: var(--red); }
.g-bar.late.zero > span { color: var(--red-ink); }
.g-bar:focus-visible { outline: 3px solid #F3B48E; }
.g-ms { position: absolute; top: 15px; width: 16px; height: 16px; background: var(--accent); transform: rotate(45deg); cursor: pointer; border: 0; padding: 0; margin-left: -8px; }
.g-ms.done { background: var(--green); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.g-today::before { content: 'Hoy'; position: absolute; top: -2px; left: 4px; font-size: 10px; font-weight: 700; color: var(--accent); background: #FFF; padding: 0 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }

/* Bitácora */
.composer { border: 1px solid var(--field); border-radius: 10px; padding: 12px 14px; }
.composer textarea { width: 100%; border: 0; outline: 0; resize: vertical; min-height: 54px; line-height: 1.5; }
.composer .bar-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 8px; }
.composer .attached { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.feed { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.feed li { display: flex; gap: 12px; }
.feed .meta { margin: 0; font-size: 13px; color: var(--muted); }
.feed .meta b { color: var(--ink); }
.feed .text { margin: 4px 0 0; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.feed .status-box { flex: 1; min-width: 0; background: #FFF8EC; border: 1px solid #F6DDB0; border-radius: 10px; padding: 10px 14px; }
.feed .sys { font-size: 13px; color: var(--muted); }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; text-decoration: none; color: var(--ink); max-width: 100%; }
.file-chip:hover { background: #FAFBFC; color: var(--ink); }
.file-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftype { display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; font-weight: 700; font-size: 10px; padding: 1px 5px; flex: none; }
.ftype.big { width: 42px; height: 42px; border-radius: 8px; font-size: 11px; }
.t-pdf { background: var(--red-soft); color: var(--red-ink); }
.t-img { background: var(--green-soft); color: var(--green-ink); }
.t-doc { background: var(--blue-soft); color: var(--blue-ink); }
.t-xls { background: #DCF5E8; color: #14532D; }
.t-ppt { background: var(--accent-soft); color: var(--accent-dark); }
.t-other { background: var(--gray-soft); color: var(--ink-2); }
.drop { border: 2px dashed var(--field); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: #FFF8F3; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--ink); display: block; background: #FFF; }
.thumb .img { height: 110px; background: var(--gray-soft) center/cover no-repeat; display: flex; align-items: center; justify-content: center; }
.thumb .cap { padding: 8px 10px; font-size: 12px; }
.thumb .cap b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Calendario */
.cal { min-width: 680px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: #F7F8FA; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 112px; padding: 8px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); min-width: 0; background: #FFF; cursor: pointer; }
.cal-cell:hover { background: #FCFCFD; }
.cal-cell.weekend { background: #FAFBFC; }
.cal-cell.today { background: #FFF6F0; }
.cal-cell .n { font-size: 13px; font-weight: 600; }
.cal-cell.out .n { color: #6B7486; font-weight: 500; }
.cal-cell.today .n { display: inline-flex; width: 26px; height: 26px; border-radius: 13px; background: var(--accent); color: #FFF; align-items: center; justify-content: center; }
.ev { display: block; width: 100%; text-align: left; margin-top: 4px; padding: 3px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; cursor: pointer; }
.ev.meet { background: var(--blue-soft); color: #1E3A8A; }
.ev.due { background: var(--red-soft); color: var(--red-ink); }
.ev.due.ok { background: var(--green-soft); color: var(--green-ink); }
.ev.ms { background: var(--accent-soft); color: var(--accent-dark); }

/* Minuta */
.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.point { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid #F1F2F5; }
.point:first-child { padding-top: 0; }
.num { flex: none; width: 28px; height: 28px; border-radius: 14px; background: var(--navy); color: #FFF; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.att { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.att li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--field); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #FFF; height: 32px; padding: 0 10px; font-size: 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--field); }
.seg button.on.yes { background: var(--green-soft); color: var(--green-ink); font-weight: 700; }
.seg button.on.no { background: var(--red-soft); color: var(--red-ink); font-weight: 700; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: stretch; flex-wrap: wrap; }
.login-art { flex: 1 1 420px; background: var(--navy); color: #C9D3E3; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; gap: 40px; }
.login-art img { width: 260px; max-width: 80%; }
.login-art h2 { color: #FFF; font-size: 30px; line-height: 1.2; max-width: 440px; }
.login-art p { max-width: 440px; font-size: 15px; line-height: 1.6; }
.login-form { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #FFF; }
.login-form form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.login-form .logo-dark { width: 180px; margin-bottom: 8px; }
.error-box { background: var(--red-soft); color: var(--red-ink); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.info-box { background: var(--amber-soft); color: var(--amber-ink); padding: 10px 12px; border-radius: 8px; font-size: 13px; }

/* Imprimir minuta */
.print-only { display: none; }
@media print {
  .side, .topbar, .no-print, .toasts, .modal-back { display: none !important; }
  .main { padding: 0; }
  .card { border: 0; padding: 0 0 12px; }
  body { background: #FFF; }
  .print-only { display: block; }
}

/* Móvil */
@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,0.3); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--navy); padding: 10px 14px; position: sticky; top: 0; z-index: 30; }
  .topbar img { height: 30px; }
  .topbar button { background: transparent; border: 0; color: #FFF; width: 44px; height: 44px; cursor: pointer; }
  .main { padding: 18px 16px 48px; }
  h1 { font-size: 23px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .search { min-width: 0; flex: 1; }
  .login-art { padding: 28px; flex-basis: 100%; }
  .login-art .lead { display: none; }
}

.ag-grid { margin-top: 14px; grid-template-columns: 2fr 1.3fr 1fr auto; align-items: end; }
@media (max-width: 900px) { .ag-grid { grid-template-columns: minmax(0, 1fr); } }


/* ---------- v2 ---------- */
.demo-band { background: #FEF3C7; color: #78350F; text-align: center; font-size: 13px; font-weight: 600; padding: 7px 12px; border-bottom: 1px solid #FCD34D; }

/* Proyectos agrupados por marca */
.brand-group { border: 0; margin: 0; }
.brand-group > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #FFF; border: 1px solid var(--line); border-left: 6px solid var(--bc, #8A94A6); border-radius: 10px; cursor: pointer; margin-bottom: 14px; }
.brand-group > summary::-webkit-details-marker { display: none; }
.brand-group > summary h2 { font-size: 17px; }
.brand-group > summary .chev { margin-left: auto; transition: transform .15s; color: var(--muted); display: inline-flex; }
.brand-group:not([open]) > summary .chev { transform: rotate(-90deg); }
.brand-group > summary .cnt { font-size: 12px; font-weight: 700; color: #FFF; background: var(--bc, #8A94A6); border-radius: 10px; padding: 2px 9px; }
.brand-group + .brand-group { margin-top: 10px; }
.brand-group .proj-grid { margin-bottom: 18px; }
.proj-card { border-top: 4px solid var(--bc, var(--line)); }
.tbl tr.grp td { background: #F7F8FA; font-weight: 700; border-left: 5px solid var(--bc, #8A94A6); }

/* Kanban de tareas */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: #EEF1F5; border-radius: 12px; display: flex; flex-direction: column; min-height: 220px; border-top: 5px solid var(--kc); }
.kcol-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.kcol-h h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.kcol-h .cnt { background: var(--kc); color: #FFF; font-size: 12px; font-weight: 700; border-radius: 10px; padding: 1px 9px; }
.kcol-b { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; border-radius: 0 0 12px 12px; transition: background .12s; }
.kcol-b.over { background: #E2E8F0; outline: 2px dashed var(--kc); outline-offset: -6px; }
.kcard { background: #FFF; border: 1px solid var(--line); border-left: 5px solid var(--pc, var(--blue)); border-radius: 10px; padding: 12px 12px 10px; cursor: grab; box-shadow: 0 1px 2px rgba(15,27,45,0.05); display: flex; flex-direction: column; gap: 8px; }
.kcard:hover { box-shadow: 0 6px 16px rgba(15,27,45,0.1); }
.kcard.dragging { opacity: 0.5; }
.kcard .kt { font-weight: 600; line-height: 1.35; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: inherit; font-size: 14px; }
.kcard .kp { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kcard .kmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kcard .kfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kcard .kfoot select { height: 30px; font-size: 12px; padding: 0 6px; border: 1px solid var(--field); border-radius: 6px; background: #FFF; }
.chipx { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--gray-soft); color: var(--ink-2); }
.chipx.red { background: var(--red-soft); color: var(--red-ink); }
.chipx.amber { background: var(--amber-soft); color: var(--amber-ink); }
.chipx.green { background: var(--green-soft); color: var(--green-ink); }
.chipx.blue { background: var(--blue-soft); color: var(--blue-ink); }
.viewtog { display: inline-flex; border: 1px solid var(--field); border-radius: 8px; overflow: hidden; background: #FFF; }
.viewtog button { height: 38px; padding: 0 12px; border: 0; background: transparent; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.viewtog button + button { border-left: 1px solid var(--field); }
.viewtog button.on { background: var(--navy); color: #FFF; }

/* Equipo del proyecto */
.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #F1F2F5; }
.member-row:first-child { border-top: 0; }
.route-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; align-self: flex-start; display: inline-block; }
.route-directo { background: var(--green-soft); color: var(--green-ink); }
.route-persona { background: var(--blue-soft); color: var(--blue-ink); }
.route-lider { background: var(--amber-soft); color: var(--amber-ink); }
.inv-card { border: 1px solid var(--line); border-left: 5px solid var(--amber); border-radius: 10px; padding: 12px 14px; background: #FFF; display: flex; flex-direction: column; gap: 8px; }

/* Administración: matriz de permisos y organigrama */
.matrix th { text-align: center; font-size: 11px; vertical-align: bottom; line-height: 1.25; text-transform: none; letter-spacing: 0; max-width: 110px; }
.matrix th:first-child { text-align: left; }
.matrix td { text-align: center; }
.matrix td:first-child { text-align: left; white-space: nowrap; }
.matrix input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--accent); cursor: pointer; }
.matrix .grp-h { background: var(--navy); color: #FFF; }
.matrix .grp-h.adm { background: var(--accent-dark); }
.org { display: flex; flex-direction: column; gap: 14px; }
.org-node { position: relative; }
.org-children { margin: 10px 0 0 26px; padding-left: 18px; border-left: 2px dashed #C6CCD6; display: flex; flex-direction: column; gap: 12px; }
.org-team { background: #FFF; border: 1px solid var(--line); border-top: 4px solid var(--tc, var(--navy)); border-radius: 10px; padding: 12px 14px; }
.org-team .th { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.org-team h3 { font-size: 15px; }
.org-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.person { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 16px; background: var(--gray-soft); font-size: 13px; }
.person.leader { background: var(--navy); color: #FFF; }
.person .lv { font-size: 10px; font-weight: 700; opacity: 0.75; }
.person .avatar { width: 24px; height: 24px; font-size: 10px; border: 0; }
.level-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.level-list li { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #FFF; border: 1px solid var(--line); border-radius: 8px; }
.level-list .rank { width: 26px; height: 26px; border-radius: 13px; background: var(--navy); color: #FFF; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; border: 3px solid #FFF; box-shadow: 0 0 0 1px var(--field); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px 16px; }

/* Minuta v2 */
.m-hero { background: var(--navy); color: #FFF; border-radius: var(--radius); overflow: hidden; }
.m-hero .in { padding: 22px 24px; display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; justify-content: space-between; }
.m-hero h1 { color: #FFF; }
.m-hero .eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #F3B48E; }
.m-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; color: #C9D3E3; font-size: 13px; }
.m-hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.m-hero .bar-b { height: 5px; background: var(--accent); }
.m-hero .btn { background: transparent; color: #FFF; border-color: rgba(255,255,255,0.35); }
.m-hero .btn:hover { background: rgba(255,255,255,0.1); color: #FFF; }
.m-hero .btn.primary { background: var(--accent); border-color: var(--accent); }
.m-hero .btn.primary:hover { background: var(--accent-dark); }
.m-hero .btn.icon { width: 42px; }
.m-hero .notif-wrap .btn { color: #FFF; }
.m-hero #saved { color: #C9D3E3; }
.msec { background: #FFF; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.msec-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; color: #FFF; background: var(--mc, var(--navy)); }
.msec-h h2 { color: #FFF; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.msec-h .sub { font-size: 12px; color: rgba(255,255,255,0.85); margin: 0; }
.msec-b { padding: 16px 18px; }
.mpoint { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line); border-left: 6px solid var(--sc); border-radius: 10px; background: #FFF; }
.mpoint + .mpoint { margin-top: 10px; }
.mpoint .num { background: var(--sc); }
.mpoint.st-cerrado { --sc: var(--green); background: #FAFEFB; }
.mpoint.st-en_seguimiento { --sc: var(--blue); }
.mpoint.st-pendiente { --sc: var(--amber); background: #FFFDF7; }
.ag-row td:first-child { border-left: 5px solid var(--uc, transparent); }
.urg { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 10px; white-space: nowrap; }
.urg.vencido { background: var(--red-soft); color: var(--red-ink); }
.urg.pronto { background: var(--amber-soft); color: var(--amber-ink); }
.urg.tiempo { background: var(--green-soft); color: var(--green-ink); }
.urg.cumplido { background: var(--gray-soft); color: var(--ink-2); }
.urg.sinfecha { background: var(--gray-soft); color: var(--muted); }
.legend-m { display: flex; flex-wrap: wrap; gap: 8px; }
.att-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; background: #F7F8FA; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .msec, .mpoint, .m-hero { break-inside: avoid; }
  .demo-band { display: none; }
}
@media (max-width: 900px) {
  .kanban { grid-template-columns: repeat(3, 85vw); }
  .org-children { margin-left: 8px; padding-left: 10px; }
}

.level-list .small { white-space: nowrap; }

/* Deslizador de avance en tarjetas */
.kprog { display: flex; align-items: center; gap: 10px; }
.kprog input[type=range] { flex: 1; min-width: 0; height: 22px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.kprog input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--kp) var(--pv), #E3E6EC var(--pv)); }
.kprog input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: #E3E6EC; }
.kprog input[type=range]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--kp); }
.kprog input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -5px; border-radius: 50%; background: #FFF; border: 3px solid var(--kp); box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.kprog input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #FFF; border: 3px solid var(--kp); }
.kprog input[type=range]:focus-visible { outline: 2px solid #F3B48E; outline-offset: 2px; border-radius: 4px; }
.kprog output { font-size: 12px; font-weight: 700; min-width: 38px; text-align: right; color: var(--ink); }
.bulkbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; margin-bottom: 12px; background: var(--navy); color: #FFF; border-radius: 10px; }
.bulkbar .input { height: 36px; width: auto; }
.bulkbar .btn { height: 36px; }
