/* =====================================================================
   Dviaje RRHH — Hoja de estilos principal
   Colores institucionales: morado #672077, naranja #F89F37
   ===================================================================== */
:root {
  --primary: #672077;
  --primary-600: #5a1b68;
  --primary-700: #4a1556;
  --primary-50: #f6eef8;
  --primary-100: #ead9ef;
  --accent: #f89f37;
  --accent-600: #e5871a;
  --accent-50: #fff4e6;

  --bg: #f5f3f7;
  --surface: #ffffff;
  --surface-2: #faf8fb;
  --border: #e6e1ea;
  --text: #1f1724;
  --text-2: #5c5263;
  --muted: #8a8191;

  --success: #15803d; --success-bg: #e8f6ed;
  --warning: #b45309; --warning-bg: #fff4e0;
  --danger:  #c0262d; --danger-bg:  #fdeced;
  --info:    #1d5fbf; --info-bg:    #e8f0fc;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(40, 10, 50, .05), 0 4px 16px rgba(40, 10, 50, .06);
  --shadow-lg: 0 12px 40px rgba(40, 10, 50, .16);
  --sidebar-w: 260px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--text); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-primary { color: var(--primary); }

/* ---------- Estructura ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; position: fixed; inset: 0 auto 0 0; z-index: 40;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-700) 100%);
  color: #fff; display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-brand { background: #fff; padding: 18px 20px 14px; text-align: center; border-bottom: 4px solid var(--accent); }
.sidebar-brand img { height: 52px; width: auto; display: block; margin: 0 auto; }
.brand-tag { display: inline-block; margin-top: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); }
.nav { padding: 12px 12px 28px; }
.nav-section { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,.55); padding: 18px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.88); font-weight: 500; font-size: .94rem; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-link.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.nav-link.active .icon { color: var(--accent-600); }
.nav-count { margin-left: auto; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 68px; display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.3rem; margin: 0; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 12px; border: 1px solid var(--border); background: #fff; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary-100); text-decoration: none; }
.dot-count { position: absolute; top: -5px; right: -5px; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border: 2px solid #fff; }
.user-menu { position: relative; }
.user-chip { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 4px 14px 4px 4px; cursor: pointer; font: inherit; color: inherit; }
.user-chip-text { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-chip-text strong { font-size: .88rem; }
.user-chip-text small { font-size: .74rem; color: var(--muted); }
.dropdown { display: none; position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 50; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--primary-50); text-decoration: none; color: var(--primary); }
.content { padding: 26px 28px 40px; flex: 1; max-width: 1500px; width: 100%; }
.footer { padding: 16px 28px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); }
.only-mobile { display: none; }
.sidebar-backdrop { display: none; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card-header h2 .icon, .card-header h3 .icon { color: var(--primary); }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; }
.kpi-icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.kpi-icon .icon { width: 24px; height: 24px; }
.kpi-icon.accent { background: var(--accent-50); color: var(--accent-600); }
.kpi-icon.success { background: var(--success-bg); color: var(--success); }
.kpi-icon.danger { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.info { background: var(--info-bg); color: var(--info); }
.kpi > div:last-child { min-width: 0; }
.kpi-value { font-size: clamp(1.15rem, 1.5vw, 1.55rem); overflow-wrap: anywhere; font-weight: 800; line-height: 1.1; color: var(--text); }
.kpi-label { font-size: .84rem; color: var(--text-2); font-weight: 500; }
.kpi-sub { font-size: .78rem; color: var(--muted); }

.hero {
  border-radius: var(--radius); padding: 24px 26px; margin-bottom: 22px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(circle at 92% 20%, rgba(248,159,55,.55), transparent 38%), linear-gradient(120deg, var(--primary) 0%, #8a2f9e 100%);
  box-shadow: var(--shadow);
}
.hero h2 { color: #fff; font-size: 1.5rem; margin-bottom: 4px; }
.hero p { margin: 0; opacity: .9; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; position: relative; z-index: 1; }
.clock-box { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 14px; padding: 14px 18px; text-align: center; min-width: 240px; }
.clock-time { font-size: 2rem; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.clock-date { font-size: .85rem; opacity: .9; margin-bottom: 10px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  font: inherit; font-weight: 600; font-size: .92rem; border: 1px solid transparent; cursor: pointer; line-height: 1.2;
  transition: background .15s, box-shadow .15s, transform .05s; white-space: nowrap; text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); box-shadow: 0 4px 14px rgba(103,32,119,.3); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-600); box-shadow: 0 4px 14px rgba(248,159,55,.35); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-light { background: #fff; color: var(--text); border-color: var(--border); }
.btn-light:hover { border-color: var(--primary-100); color: var(--primary); background: var(--primary-50); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-50); }
.btn-white { background: #fff; color: var(--primary); }
.btn-white:hover { background: var(--accent-50); }
.btn-sm { padding: 6px 11px; font-size: .84rem; border-radius: 8px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; margin: 0; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 18px; }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-11 { grid-column: span 11; } .col-10 { grid-column: span 10; } .col-7 { grid-column: span 7; } .col-5 { grid-column: span 5; } .col-1 { grid-column: span 1; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field label, .label { display: block; font-weight: 600; font-size: .86rem; color: var(--text-2); margin-bottom: 6px; }
.field .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font: inherit; font-size: .95rem;
  color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(103,32,119,.12); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23672077' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-section { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--primary); grid-column: span 12; padding-top: 8px; border-bottom: 2px solid var(--primary-50); padding-bottom: 6px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; background: var(--surface-2); border: 1.5px solid var(--border); border-left: 0; border-radius: 0 10px 10px 0; color: var(--muted); font-weight: 600; }
.radio-cards { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card span { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .9rem; background: #fff; }
.radio-card input:checked + span { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.radio-card input:focus-visible + span { box-shadow: 0 0 0 4px rgba(103,32,119,.15); }

/* Filtros */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 260px; }
.filters .field label { font-size: .76rem; margin-bottom: 4px; }
.filters .input, .filters .select { padding: 8px 10px; font-size: .9rem; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 700; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: #fcfafd; }
.table tfoot td { font-weight: 700; background: var(--accent-50); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.table td.table-actions { display: table-cell; text-align: right; white-space: nowrap; }
.table td.table-actions > * + * { margin-left: 6px; }
.tabs.tabs-wrap { flex-wrap: wrap; overflow-x: visible; padding-top: 6px; }
.tabs.tabs-wrap .tab { padding: 10px 14px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-row a { font-size: .78rem; font-weight: 600; }
.person { display: flex; align-items: center; gap: 10px; }
.person-name { font-weight: 600; color: var(--text); }
.person-sub { font-size: .8rem; color: var(--muted); }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-100); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: .9rem; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; font-size: .8rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 1.8rem; border: 4px solid #fff; box-shadow: var(--shadow); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-50); color: var(--primary); }
.badge-accent { background: var(--accent-50); color: var(--accent-600); }
.badge-muted { background: #f0eef2; color: #6b6370; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ---------- Alertas ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.alert span { flex: 1; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #c7e9d3; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #f6c9cb; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #f8dfb5; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #c9dbf6; }
.alert-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; overflow-x: auto; }
.tab { padding: 14px 14px 12px; font-weight: 600; color: var(--text-2); border-bottom: 3px solid transparent; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; font: inherit; font-weight: 600; cursor: pointer; }
.tab:hover { color: var(--primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- Varios ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .icon { width: 46px; height: 46px; color: var(--primary-100); margin-bottom: 10px; }
.error-page { padding: 80px 20px; }
.error-code { font-size: 5rem; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.dl { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 10px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: .86rem; }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.progress { height: 10px; border-radius: 999px; background: var(--primary-50); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.stat-row:last-child { border-bottom: 0; }
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 230px; }
.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { margin-bottom: 2px; font-size: 1.4rem; }
.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-weight: 600; font-size: .88rem; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.announcement { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.announcement:last-child { border-bottom: 0; }
.announcement h4 { margin: 0 0 4px; font-size: .98rem; }
.announcement p { margin: 0; color: var(--text-2); white-space: pre-line; }
.rule-chip { display: inline-block; background: var(--primary-50); color: var(--primary); border-radius: 6px; padding: 2px 8px; font-size: .78rem; font-weight: 600; margin: 2px 2px 2px 0; }
.rate-big { font-size: 1.5rem; font-weight: 800; color: var(--accent-600); }
.notif-unread { background: var(--primary-50); }
.stars { color: var(--accent); letter-spacing: 2px; }
.score-input { display: flex; gap: 6px; }
.score-input label { position: relative; }
.score-input input { position: absolute; opacity: 0; }
.score-input span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--border); font-weight: 700; cursor: pointer; background: #fff; }
.score-input input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Calendario */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--border); border-top: 1px solid var(--border); }
.cal-head { padding: 8px; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.cal-day { min-height: 110px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fff; }
.cal-day.other { background: var(--surface-2); color: var(--muted); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day.holiday { background: var(--accent-50); }
.cal-num { font-weight: 700; font-size: .85rem; margin-bottom: 4px; display: flex; justify-content: space-between; }
.cal-ev { display: block; font-size: .74rem; padding: 2px 6px; border-radius: 6px; margin-bottom: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-hol { font-size: .7rem; color: var(--accent-600); font-weight: 700; }

/* Estado de cuenta tipo Excel */
.statement-head { display: grid; grid-template-columns: 1fr 1.2fr 1.2fr 1fr; border: 2px solid var(--primary); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.statement-head > div { padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; }
.statement-head .sh-period, .statement-head .sh-name { background: #8f73c3; color: #fff; font-weight: 800; font-size: 1.15rem; text-align: center; text-transform: uppercase; }
.statement-head .sh-name { background: #7d5fb6; }
.statement-head .sh-rates { background: #a58fd0; color: #fff; font-size: .85rem; }
.statement-head .sh-rates div { display: flex; justify-content: space-between; gap: 12px; }
.statement-head .sh-total { background: #ffd966; color: #3b2a00; text-align: center; font-weight: 800; }
.statement-head .sh-total .big { font-size: 1.5rem; }

/* ---------- Login ---------- */
body.guest { background: #fff; }
.guest-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.guest-art { background: radial-gradient(circle at 80% 15%, rgba(248,159,55,.7), transparent 40%), linear-gradient(140deg, var(--primary) 0%, #3d0f49 100%); color: #fff; display: flex; align-items: flex-end; padding: 60px; position: relative; overflow: hidden; }
.guest-art h2 { color: #fff; font-size: 2.6rem; font-weight: 800; margin-bottom: 10px; }
.guest-art p { font-size: 1.1rem; opacity: .9; max-width: 420px; }
.guest-plane { position: absolute; right: 60px; top: 70px; opacity: .25; }
.guest-plane .icon { width: 220px; height: 220px; stroke-width: 1; }
.guest-panel { display: grid; place-items: center; padding: 40px 24px; }
.guest-card { width: 100%; max-width: 410px; }
.guest-logo { display: block; height: 76px; width: auto; margin: 0 auto 26px; }
.guest-card h1 { font-size: 1.6rem; margin-bottom: 4px; }
.guest-card .field { margin-bottom: 16px; }

/* ---------- Impresión ---------- */
@media print {
  .sidebar, .topbar, .footer, .no-print, .filters, .form-actions, .btn, .alert { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; font-size: 12px; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-only { display: block !important; }
  .table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .statement-head > div, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.print-only { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(20,5,25,.45); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .user-chip-text { display: none; }
  .user-chip { padding: 4px; }
  .guest-wrap { grid-template-columns: 1fr; }
  .guest-art { display: none; }
  .statement-head { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .content { padding: 18px 14px 30px; }
  .topbar { padding: 0 14px; }
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .grid-4 { grid-template-columns: 1fr; }
  .page-title { font-size: 1.1rem; }
  .filters .field { max-width: none; }
}
.label-row { margin-bottom: 6px; }
.label-row label { margin-bottom: 0 !important; }
/* Constancia / documentos imprimibles */
.doc-sheet { max-width: 860px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 44px 52px; margin-bottom: 22px; }
.doc-sheet h1 { font-size: 1.35rem; text-align: center; margin: 18px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.doc-sheet .doc-sub { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 22px; }
.doc-sheet p { line-height: 1.7; text-align: justify; }
.doc-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--accent); padding-bottom: 12px; }
.doc-head img { height: 58px; }
.doc-box { border: 1.5px solid var(--primary-100); border-radius: 10px; padding: 14px 18px; margin: 16px 0; background: var(--surface-2); }
.doc-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 30px; margin: 10px 0 6px; }
.doc-line { border-bottom: 1px solid #555; min-height: 26px; padding: 2px 4px; font-size: .9rem; }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 70px; text-align: center; font-size: .88rem; }
.signatures div { border-top: 1px solid #333; padding-top: 8px; }
@media print { .doc-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; } }

/* ---------- Chat interno ---------- */
.chat { position: relative; display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 68px - 52px - 50px); min-height: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-side { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; background: var(--surface-2); }
.chat-side-head { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--border); }
.chat-side-head .input { padding: 8px 12px; }
.chat-list { flex: 1; overflow-y: auto; }
.chat-hint { padding: 24px 16px; text-align: center; color: var(--muted); font-size: .9rem; }
.chat-privacy { display: flex; gap: 8px; align-items: center; padding: 10px 14px; font-size: .74rem; color: var(--muted); border-top: 1px solid var(--border); }
.chat-privacy .icon { width: 15px; height: 15px; }
.chat-item, .chat-user { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.chat-item:hover, .chat-user:hover { background: var(--primary-50); }
.chat-item.active { background: #fff; box-shadow: inset 4px 0 0 var(--accent); }
.chat-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-item-top, .chat-item-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-item-top strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-top small, .chat-item-text > small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-bottom span:first-child { font-size: .82rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-bottom span:first-child { color: var(--text); font-weight: 600; }
.chat-group-av { background: var(--accent-50); color: var(--accent-600); }
.chat-group-av .icon { width: 18px; height: 18px; }
.chat-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #f8f5fa; }
.chat-empty { margin: auto; text-align: center; padding: 30px; }
.chat-empty .icon { width: 64px; height: 64px; color: var(--primary-100); }
.chat-pane { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--border); }
.chat-head .avatar .icon { width: 18px; height: 18px; }
.chat-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head-text small { color: var(--muted); font-size: .8rem; }
.chat-back { display: none; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: #fff; border: 1px solid var(--border); border-radius: 16px 16px 16px 4px; padding: 8px 12px 6px; box-shadow: 0 1px 2px rgba(40,10,50,.05); min-width: 70px; }
.msg.mine .bubble { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 16px 16px 4px 16px; }
.msg.mine .bubble a { color: #ffe3c2; }
.msg.deleted .bubble { background: transparent; color: var(--muted); border-style: dashed; }
.msg-author { font-size: .76rem; font-weight: 700; color: var(--accent-600); margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; word-break: break-word; font-size: .94rem; line-height: 1.45; }
.msg-meta { font-size: .7rem; opacity: .7; text-align: right; margin-top: 3px; display: flex; justify-content: flex-end; gap: 4px; align-items: center; }
.msg-del { display: none; background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 0 0 0 6px; }
.msg:hover .msg-del { display: inline; }
.msg-image img { display: block; max-width: 260px; max-height: 260px; border-radius: 10px; margin-bottom: 4px; }
.msg-file { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(103,32,119,.08); margin-bottom: 4px; color: inherit !important; text-decoration: none !important; }
.msg.mine .msg-file { background: rgba(255,255,255,.16); }
.msg-file span { display: flex; flex-direction: column; min-width: 0; }
.msg-file strong { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.msg-file small { font-size: .72rem; opacity: .8; }
.msg-date { text-align: center; margin: 12px 0 6px; }
.msg-date span { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; font-size: .74rem; font-weight: 600; color: var(--text-2); }
.chat-composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px; background: #fff; border-top: 1px solid var(--border); }
.chat-attach { cursor: pointer; flex: none; }
.chat-input-wrap { flex: 1; min-width: 0; }
.chat-input-wrap textarea { width: 100%; resize: none; border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: .95rem; max-height: 160px; line-height: 1.4; }
.chat-input-wrap textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(103,32,119,.12); }
.chat-file-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--accent-50); color: var(--accent-600); border-radius: 8px; padding: 4px 10px; font-size: .8rem; font-weight: 600; margin-bottom: 6px; }
.chat-file-chip button { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: inherit; }
.chat-send { height: 44px; width: 48px; padding: 0; flex: none; }
.chat-modal { position: absolute; inset: 0; background: rgba(20,5,25,.4); display: grid; place-items: center; z-index: 20; padding: 16px; }
.chat-modal-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; max-height: 90%; display: flex; flex-direction: column; padding: 16px; gap: 10px; }
.chat-modal-head { display: flex; justify-content: space-between; align-items: center; }
.chat-modal-head h3 { margin: 0; }
.chat-modal-list { overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; min-height: 120px; max-height: 380px; }
.chat-modal-list .chat-user input { width: 18px; height: 18px; accent-color: var(--primary); }
.chat-modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-toast { position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 30; box-shadow: var(--shadow-lg); }
@media (max-width: 960px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 68px - 36px - 50px); }
  .chat-main { display: none; }
  .chat.show-pane .chat-side { display: none; }
  .chat.show-pane .chat-main { display: flex; }
  .chat-back { display: inline-flex; }
  .msg { max-width: 92%; }
}

/* PWA: ayuda de instalación (iPhone/iPad) y modo app instalada */
.pwa-help { position: fixed; inset: 0; background: rgba(20, 10, 25, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 1000; padding: 16px; }
.pwa-help.hidden { display: none; }
.pwa-help-card { background: var(--surface); border-radius: 18px; padding: 22px; max-width: 420px; width: 100%; box-shadow: var(--shadow); margin-bottom: env(safe-area-inset-bottom); }
.pwa-help-card h3 { margin: 0 0 10px; color: var(--primary); }
.pwa-help-card ol { margin: 0 0 16px; padding-left: 20px; line-height: 1.6; }
@media (display-mode: standalone) {
  body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
}
