:root {
  --black: #0b0b0c;
  --panel: #151517;
  --panel2: #1b1b1d;
  --gold: #c9a227;
  --gold2: #e3c65f;
  --beige: #e7dfc7;
  --bone: #f7f4ec;
  --on-dark: #f7f4ec;
  --muted: #929093;
  --line: rgba(247, 244, 236, 0.1);
  --green: #62c88e;
  --red: #dc7272;
  --amber: #c8862a;
  --surface: #fffdf8;
  --surface-2: #f2eee3;
  --border: #e3ddcf;
  --text: #1a1917;
  --subtext: #817c70;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
}
html.dark {
  --amber: #e0a44a;
  --bone: #111113;
  --surface: #19191b;
  --surface-2: #242426;
  --border: #2d2d30;
  --text: #f7f4ec;
  --subtext: #aaa59c;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bone);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.app-shell { display: flex; min-height: 100vh; }
.app-shell.visible { display: flex; }

.sidebar {
  background: var(--black);
  color: var(--on-dark);
  width: 260px;
  flex: 0 0 260px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  z-index: 5;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.brand { height: 55px; display: flex; align-items: center; padding: 0 12px; margin-bottom: 18px; }
.brand img { width: 175px; height: auto; }
.workspace {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 12px;
  color: #c5c1b8;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.workspace i { margin-left: auto; color: var(--gold); font-style: normal; font-size: 16px; }
.status-dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 3px rgba(98, 200, 142, 0.14); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.7px; color: #68666a; margin: 12px 12px 7px; }
.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #a4a1a5;
  text-align: left;
  border-radius: 9px;
  padding: 11px 12px;
  font: 600 14px 'Nunito', sans-serif;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: 0.2s;
  text-decoration: none;
}
.nav-item span { font-size: 17px; color: #79767b; width: 18px; text-align: center; }
.nav-item:hover, .nav-item.active { background: rgba(201, 162, 39, 0.13); color: var(--on-dark); }
.nav-item.active { box-shadow: inset 3px 0 var(--gold); }
.nav-item.active span { color: var(--gold); }
.nav-item b { margin-left: auto; background: var(--gold); color: var(--black); font-size: 10px; padding: 2px 6px; border-radius: 10px; }
.sidebar-footer { margin-top: auto; }
.profile-mini { border-top: 1px solid var(--line); margin-top: 15px; padding: 16px 8px 4px; display: flex; align-items: center; gap: 9px; }
.profile-mini strong, .top-profile strong { display: block; font-size: 12px; color: #fff; }
.profile-mini small, .top-profile small { font-size: 11px; color: var(--muted); display: block; }
.profile-mini > span { margin-left: auto; color: #79767b; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  min-height: 74px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 34px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.breadcrumb { color: var(--subtext); font-size: 13px; display: flex; gap: 9px; align-items: center; }
.breadcrumb span:last-child { color: var(--text); font-weight: 700; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  color: var(--subtext);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }
.top-profile { display: flex; align-items: center; gap: 10px; border-left: 1px solid var(--border); padding-left: 16px; margin-left: 8px; cursor: pointer; }
.menu-btn { display: none; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex: 0 0 auto;
}
.avatar.gold { background: linear-gradient(135deg, #c9a227, #e3c65f); color: #151515; }
.avatar.gray { background: #2b2b2e; color: #c5c1b8; }

.content { padding: 34px; flex: 1; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--gold); margin: 0 0 8px; font-weight: 700; }
.page-title { font-family: 'Nunito', sans-serif; font-weight: 800; letter-spacing: -0.035em; font-size: 32px; margin: 0 0 6px; }
.page-subtitle { color: var(--subtext); margin: 0; font-size: 14px; }
.head-actions { display: flex; gap: 10px; }

.btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 700 13px 'Nunito', sans-serif;
  padding: 11px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: 0.2s;
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--black); border-color: var(--black); color: var(--on-dark); }
.btn.primary:hover { background: var(--gold); border-color: var(--gold); color: var(--black); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-top: 17px;
}
.card.kpi { position: relative; }
.kpi-icon {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(201, 162, 39, 0.12);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.kpi-label { font: 600 12px 'Nunito', sans-serif; color: var(--subtext); margin: 0 0 10px; }
.kpi-value { font: 800 30px 'Nunito', sans-serif; letter-spacing: -0.04em; margin: 0; }
.kpi-change { font: 700 12px 'Nunito', sans-serif; color: var(--green); display: block; margin-top: 10px; }
.kpi-change.down { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-title { font: 800 17px 'Nunito', sans-serif; margin: 0; letter-spacing: -0.02em; }
.card-meta { font: 500 12px 'Nunito', sans-serif; color: var(--subtext); margin: 4px 0 0; }
.select {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: 600 12px 'Nunito', sans-serif;
  padding: 9px 12px;
}
.range-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.range-label { display: flex; flex-direction: column; gap: 5px; font: 700 11px 'Nunito', sans-serif; color: var(--subtext); }
.range-label .select { width: auto; line-height: 1.2; }
.chart { height: 220px; margin-top: 18px; position: relative; }
.chart canvas { width: 100% !important; }

.ranking { padding: 22px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.rank-item:last-child { border-bottom: 0; }
.rank-num { font: 800 15px 'Nunito', sans-serif; color: var(--gold); width: 20px; }
.rank-info { flex: 1; min-width: 0; }
.rank-info strong { display: block; font-size: 14px; }
.rank-info small { color: var(--subtext); font-size: 11px; }
.rank-score { text-align: right; }
.rank-score strong, .rank-score b { display: block; font-size: 14px; }
.rank-score small { color: var(--subtext); font-size: 11px; }
.rank-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.15);
  color: var(--gold);
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.wide-card { padding: 22px; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font: 700 11px 'Nunito', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--subtext);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font: 700 11px 'Nunito', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--subtext);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.model-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 11px 'Nunito', sans-serif;
  padding: 5px 10px;
  border-radius: 20px;
}
.pill.online, .pill.activo { background: rgba(98, 200, 142, 0.14); color: #2e8b57; }
.pill.offline, .pill.inactivo { background: rgba(128, 128, 128, 0.14); color: var(--subtext); }
.pill.warn { background: rgba(220, 114, 114, 0.14); color: #b04a4a; }

.progress { display: inline-flex; background: rgba(201, 162, 39, 0.18); border-radius: 20px; height: 7px; width: 90px; margin-right: 8px; overflow: hidden; vertical-align: middle; }
.progress i { display: block; background: var(--gold); border-radius: 20px; }

.empty-note { color: var(--subtext); font-size: 13px; margin: 14px 0 0; }

.link-pill {
  font: 700 12px 'Nunito', sans-serif;
  color: var(--gold, #c9a227);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-pill:hover { opacity: .8; }
.link-pill.active { text-decoration: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 12, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  overflow: auto;
  padding: 20px 22px;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.modal-title { font: 800 18px 'Nunito', sans-serif; margin: 0; letter-spacing: -0.02em; }
.modal-close {
  background: none;
  border: none;
  color: var(--subtext);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
}
.modal-close:hover { color: var(--text); background: rgba(128, 128, 128, 0.12); }
.detail-list {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-gap: 0 16px;
  margin: 0;
  font: 500 13px 'Nunito', sans-serif;
}
.detail-list dt {
  color: var(--subtext);
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.detail-list dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.detail-list dd.gold { color: var(--gold); }
.detail-list dd.neg { color: #d2506c; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.pager-info { font: 600 12px 'Nunito', sans-serif; color: var(--subtext); }
.pager .btn { min-width: 0; padding: 8px 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: flex; flex-direction: column; gap: 7px; font: 700 12px 'Nunito', sans-serif; color: var(--subtext); }
label.field input, label.field select {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 500 14px 'Nunito', sans-serif;
  padding: 12px 14px;
  outline: none;
  transition: 0.2s;
}
label.field input:focus, label.field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12); }

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}
.inline-form input {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 500 13px 'Nunito', sans-serif;
  padding: 9px 12px;
  outline: none;
  min-width: 0;
  transition: 0.2s;
}
.inline-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12); }
.inline-form input[name="quantity"] { width: 96px; }
.hint { font: 500 11px 'Nunito', sans-serif; color: var(--subtext); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.form-label { display: block; font: 700 12px 'Nunito', sans-serif; color: var(--subtext); margin-bottom: 7px; }
.input {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 500 14px 'Nunito', sans-serif;
  padding: 11px 14px;
  outline: none;
  min-width: 0;
  transition: 0.2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12); }
select.input { font: 600 12px 'Nunito', sans-serif; padding: 9px 12px; }

.error-box {
  background: rgba(220, 114, 114, 0.1);
  border: 1px solid rgba(220, 114, 114, 0.4);
  color: #b04a4a;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 0; }
.alert {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 12px;
}
.alert.ok { border-left: 3px solid var(--green); }
.alert.err { border-left: 3px solid var(--red); }
.alert.warn { border-left: 3px solid var(--amber); }
.alert.info { border-left: 3px solid var(--gold); }
.alert > span { font-size: 18px; }
.alert strong { font-size: 13px; display: block; }
.alert small { color: var(--subtext); font-size: 12px; }

.hero-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* Login */
.login-screen {
  min-height: 100vh;
  background: radial-gradient(circle at 18% 70%, #252015 0, #101012 38%, #070708 78%);
  color: var(--on-dark);
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 32px 6vw;
  overflow: auto;
}
.login-screen.hidden { display: none; }
.login-art { position: relative; overflow: hidden; padding: 60px 7vw; flex: 1; }
.login-art > img { width: 220px; filter: drop-shadow(0 0 18px rgba(201, 162, 39, 0.12)); }
.login-art-glow { position: absolute; width: 450px; height: 450px; border: 1px solid rgba(201, 162, 39, 0.2); border-radius: 50%; left: -180px; bottom: -170px; }
.login-quote { margin-top: 90px; }
.login-quote > span, .login-art-footer { font: 500 10px 'Manrope', sans-serif; letter-spacing: 2px; color: #99865a; }
.login-quote h1 { font: 800 60px/0.95 'Nunito', sans-serif; letter-spacing: -0.05em; margin: 24px 0; color: var(--on-dark); }
.login-quote h1 i { color: var(--gold2); font-style: italic; }
.login-quote p { font: 400 12px 'Manrope', sans-serif; color: #817b6e; }
.login-panel {
  align-self: center;
  width: min(430px, 90vw);
  background: rgba(247, 244, 236, 0.97);
  color: var(--text);
  padding: 45px 42px;
  box-shadow: 0 25px 100px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(201, 162, 39, 0.5);
  position: absolute;
  right: 7vw;
  top: 50%;
  transform: translateY(-50%);
}
.login-panel:before { content: ''; position: absolute; inset: 9px; border: 1px solid rgba(201, 162, 39, 0.2); pointer-events: none; }
.login-mobile-brand { display: none; }
.login-copy { position: relative; }
.login-copy .eyebrow { margin-bottom: 10px; }
.login-copy h2 { font: 800 32px/1.05 'Nunito', sans-serif; letter-spacing: -0.03em; margin: 0 0 10px; }
.login-copy p { color: var(--subtext); font-size: 13px; margin: 0 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; position: relative; }
.login-form label { display: flex; flex-direction: column; gap: 7px; font: 700 12px 'Nunito', sans-serif; color: var(--text); }
.login-form input {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: 500 14px 'Nunito', sans-serif;
  padding: 13px 14px;
  outline: none;
}
.login-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12); }
.login-form .field-error { color: #b04a4a; font-size: 12px; font-weight: 600; }
.password-field { position: relative; display: block; }
.password-field input { width: 100%; }
.password-field button {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--gold); font: 700 12px 'Nunito', sans-serif;
  cursor: pointer;
}
.login-options { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.login-options a { color: var(--gold); text-decoration: none; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600 !important; color: var(--text) !important; }
.login-submit {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--black);
  color: var(--on-dark);
  font: 700 14px 'Nunito', sans-serif;
  padding: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.login-submit:hover { background: var(--gold); color: var(--black); }
.login-security { display: flex; gap: 11px; align-items: flex-start; margin-top: 22px; padding-top: 20px; border-top: 1px solid rgba(27, 27, 29, 0.08); }
.login-security > span { color: var(--gold); }
.login-security strong { display: block; font-size: 12px; }
.login-security small { color: var(--subtext); font-size: 11px; }
.login-help { text-align: center; font-size: 12px; color: var(--subtext); margin-top: 20px; }
.login-help a { color: var(--gold); text-decoration: none; }
.auth-error {
  background: rgba(220, 114, 114, 0.1);
  border: 1px solid rgba(220, 114, 114, 0.4);
  color: #b04a4a;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
}

.stat-card { padding: 20px; }
.stat-card span, .stat-card small { font: 600 12px 'Manrope', sans-serif; color: var(--subtext); display: block; }
.stat-card strong { font: 800 24px 'Nunito', sans-serif; display: block; color: var(--text); margin: 8px 0 2px; letter-spacing: -0.03em; }
.positive { color: #2e8b57 !important; }
.negative { color: #b04a4a !important; }
.text-gold { color: var(--gold); }
.text-right { text-align: right; }

.overlay { display: none; }
.footer-note { margin-top: 26px; color: var(--subtext); font-size: 12px; }

@media (max-width: 1100px) {
  .sidebar { width: 225px; flex-basis: 225px; }
  .content, .topbar { padding-left: 24px; padding-right: 24px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .sidebar { position: fixed; left: -270px; top: 0; bottom: 0; transition: left 0.25s; width: 260px; }
  .sidebar.open { left: 0; }
  .menu-btn { display: inline-flex; }
  .overlay.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 4; }
  .top-profile > div:not(.avatar), .top-profile > span { display: none; }
  .content { padding: 25px 18px 36px; }
  .page-title { font-size: 27px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { position: static; transform: none; margin: auto; width: 100%; }
  .login-screen { padding: 24px; justify-content: center; }
  .login-mobile-brand { display: block; margin-bottom: 22px; }
  .login-mobile-brand img { width: 190px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 21px; }
  .kpi-icon { display: none; }
  .page-head { display: block; }
  .head-actions { margin-top: 18px; flex-wrap: wrap; }
}

/* Notificador global del chat (badge del menú + toast) */
.nav-item b.nav-badge[hidden] { display: none; }

.notif-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  max-width: 360px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.notif-toast[hidden] { display: none; }
.notif-toast-icon { font-size: 24px; line-height: 1; }
.notif-toast strong { display: block; font-size: 13px; }
.notif-toast small { color: var(--subtext); font-size: 12px; }
.notif-toast .btn { margin-left: auto; white-space: nowrap; }
#cafe-toast { flex-wrap: wrap; row-gap: 8px; }
#cafe-toast-sound { flex-shrink: 0; font-size: 17px; }
@media (max-width: 700px) { .notif-toast { left: 14px; right: 14px; max-width: none; } }

/* Burbujas de chat: patrón claro y letra oscura */
.message {
  align-self: flex-start;
  background: #ffffff;
  color: #1a1917;
  border: 1px solid #e7e2d4;
  padding: 10px 13px;
  border-radius: 12px;
  max-width: 70%;
  word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}
.message > span { display: inline; white-space: pre-wrap; overflow-wrap: break-word; }
.message.mine { align-self: flex-end; background: #e9dba3; border-color: #dccd8c; }
.message small { display: block; color: #6f6a58; font-size: 10px; margin-top: 4px; text-align: right; font-weight: 600; }

/* Widget global de chat (WhatsApp-like, en todas las páginas) */
.chat-fab { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.chat-sound-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: inherit; font-size: 15px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.chat-sound-btn:hover { border-color: var(--gold); }
.chat-fab-btn {
  position: relative; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #c9a227, #e3c65f); color: #15151a;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); transition: transform 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.chat-fab-btn:hover { transform: translateY(-2px) scale(1.03); }
.chat-fab-icon { font-size: 25px; line-height: 1; }
.chat-fab-badge {
  position: absolute; top: -4px; right: -4px; background: #d2506c; color: #fff;
  font: 800 11px 'Nunito', sans-serif; min-width: 20px; height: 20px; border-radius: 12px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.chat-fab-badge[hidden] { display: none; }
.chat-fab-panel {
  position: fixed; right: 20px; bottom: 92px; width: min(430px, calc(100vw - 32px));
  height: auto; max-height: min(570px, calc(100vh - 130px)); background: var(--bone); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; overflow: hidden; z-index: 91;
}
.chat-fab-panel[hidden] { display: none; }
.chat-fab-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--border); background: var(--black); color: var(--on-dark);
}
.chat-fab-head strong { display: block; font-size: 15px; color: var(--on-dark); }
.chat-fab-head small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.chat-fab-close {
  border: 0; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer;
  padding: 4px 9px; border-radius: 8px;
}
.chat-fab-close:hover { color: var(--on-dark); background: rgba(255, 255, 255, 0.08); }
.chat-fab-body { flex: 1; display: flex; min-height: 0; }
.chat-fab-contacts { max-height: 340px; overflow-y: auto; padding: 8px; }
.chat-fab-contact {
  width: 100%; display: flex; gap: 8px; align-items: center; padding: 9px 8px;
  border: 0; background: transparent; color: inherit; border-radius: 10px; cursor: pointer;
  text-align: left; font: inherit; transition: 0.15s; position: relative; margin-bottom: 2px;
}
.chat-fab-contact:hover, .chat-fab-contact.active { background: var(--surface-2); }
.chat-fab-contact.active { box-shadow: inset 3px 0 var(--gold); }
.chat-fab-contact .avatar { width: 30px; height: 30px; font-size: 11px; }
.chat-fab-cinfo { flex: 1; min-width: 0; }
.chat-fab-cinfo strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-fab-cpresence { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--subtext); }
.chat-fab-cpresence::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #6b6b70; flex: 0 0 auto; }
.chat-fab-cpresence.online { color: #2e8b57; }
.chat-fab-cpresence.online::before { background: #41b883; }
.chat-fab-cpresence.typing { color: #c9a227; }
.chat-fab-cpresence.typing::before { background: #c9a227; }
.chat-fab-cunread {
  position: absolute; top: 8px; right: 8px; background: var(--gold); color: #15151a;
  font: 800 10px 'Nunito', sans-serif; min-width: 16px; height: 16px; border-radius: 10px;
  padding: 0 4px; display: flex; align-items: center; justify-content: center;
}
.chat-fab-thread { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-fab-thread[hidden] { display: none; }
.chat-fab-thread-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.chat-fab-back { border: 0; background: transparent; color: var(--subtext); font-size: 16px; cursor: pointer; padding: 2px 7px; border-radius: 8px; }
.chat-fab-back:hover { color: var(--text); background: var(--surface-2); }
.chat-fab-load-more {
  border: 1px solid var(--border); background: var(--surface); color: var(--gold);
  border-radius: 999px; padding: 5px 12px; font: 700 11px 'Nunito', sans-serif; cursor: pointer; white-space: nowrap;
}
.chat-fab-load-more[hidden] { display: none; }
.chat-fab-thread-meta { flex: 1; min-width: 0; }
.chat-fab-thread-meta strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-fab-thread-meta small { display: block; color: var(--subtext); font-size: 10px; }
.chat-fab-messages {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px;
  background: var(--bone);
}
.chat-fab-compose { position: relative; display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--bone); }
.chat-fab-compose input {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: 500 14px 'Nunito', sans-serif; padding: 10px 13px; outline: none; transition: 0.2s;
}
.chat-fab-compose input::placeholder { color: var(--subtext); font-weight: 500; }
.chat-fab-emoji { flex: 0 0 42px; width: 42px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 19px; cursor: pointer; transition: 0.2s; }
.chat-fab-emoji:hover { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12); }
.chat-fab-emoji-panel { position: absolute; left: 14px; bottom: calc(100% - 4px); width: 246px; max-height: 190px; overflow-y: auto; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18); z-index: 4; }
.chat-fab-emoji-panel[hidden] { display: none; }
.chat-fab-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.chat-fab-emoji-grid button { border: 0; background: transparent; border-radius: 7px; padding: 5px 2px; font-size: 19px; line-height: 1.2; cursor: pointer; }
.chat-fab-emoji-grid button:hover { background: var(--surface-2); }

.chat-fab-compose input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12); }
.chat-fab-send { border: 0; background: var(--gold); color: #15151a; border-radius: 10px; width: 44px; cursor: pointer; font-size: 16px; transition: 0.2s; }
  .chat-fab-send:hover { background: var(--gold2); }

  .chat-fab-push {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.12), rgba(201, 162, 39, 0.04));
  }
  .chat-fab-push[hidden] { display: none; }
  .chat-fab-push-icon { font-size: 20px; flex: 0 0 auto; }
  .chat-fab-push div { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
  .chat-fab-push strong { font-size: 12px; color: var(--text); }
  .chat-fab-push small { font-size: 11px; color: var(--subtext); line-height: 1.3; }
  .chat-fab-push button {
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    background: var(--gold);
    color: #15151a;
    font-weight: 700;
    font-size: 12px;
    padding: 7px 12px;
    cursor: pointer;
    transition: 0.2s;
  }
  .chat-fab-push button:hover { background: var(--gold2); }

  /* Ventanas de chat en el dock (estilo Messenger) */
  .chat-wins {
    position: fixed; right: 88px; bottom: 20px; z-index: 89;
    display: flex; align-items: flex-end; gap: 12px;
  }
  .chat-win {
    width: 320px; height: 440px; background: var(--bone);
    border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 -8px 34px rgba(0, 0, 0, 0.3);
    display: flex; flex-direction: column; overflow: hidden;
  }
  .chat-win.min { height: auto; }
  .chat-win.min .chat-win-body { display: none; }
  .chat-win-head {
    display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 12px;
    background: var(--black); color: var(--on-dark); cursor: pointer; flex: 0 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .chat-win.min .chat-win-head { border-bottom: 0; }
  .chat-win-head .avatar { width: 30px; height: 30px; font-size: 11px; }
  .chat-win-meta { flex: 1; min-width: 0; }
  .chat-win-meta strong { display: block; font-size: 12px; color: var(--on-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-win-presence { display: block; font-size: 10px; color: var(--muted); }
  .chat-win-presence.online { color: #41b883; }
  .chat-win-presence.typing { color: var(--gold); }
  .chat-win-unread {
    flex: 0 0 auto; background: var(--gold); color: #15151a; font: 800 10px 'Nunito', sans-serif;
    min-width: 18px; height: 18px; border-radius: 10px; padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
  }
  .chat-win-unread[hidden] { display: none; }
  .chat-win-actions { display: flex; flex: 0 0 auto; }
  .chat-win-actions button {
    border: 0; background: transparent; color: var(--muted); cursor: pointer;
    font-size: 15px; line-height: 1; padding: 4px 7px; border-radius: 7px;
  }
  .chat-win-actions button:hover { color: var(--on-dark); background: rgba(255, 255, 255, 0.12); }
  .chat-win-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .chat-win-body > .chat-fab-load-more { align-self: center; margin: 8px; flex: 0 0 auto; }
.chat-fab-loading { color: var(--subtext); font-size: 12px; padding: 10px; margin: 0; }

@media (max-width: 700px) {
  .chat-fab { right: 14px; bottom: 14px; }
  .chat-fab-panel { left: 14px; right: 14px; bottom: 86px; width: auto; height: auto; max-height: min(560px, calc(100vh - 110px)); }
  .chat-wins { left: 12px; right: 12px; bottom: 84px; }
  .chat-win { width: auto; flex: 1; height: min(68vh, 540px); }
  .chat-win-actions [data-role="min"] { display: none; }
  .message { max-width: 82%; }
}

/* ===== Cafetería y stock ===== */
.btn.small { padding: 7px 12px; font-size: 12px; border-radius: 8px; }
.btn.danger { color: #b04a4a; border-color: rgba(220, 114, 114, 0.45); }
.btn.danger:hover { border-color: var(--red); background: rgba(220, 114, 114, 0.08); color: #b04a4a; }

.pill.success { background: rgba(98, 200, 142, 0.14); color: #2e8b57; }
.pill.pending { background: rgba(201, 162, 39, 0.16); color: var(--gold); }
.pill.danger { background: rgba(220, 114, 114, 0.14); color: #b04a4a; }
.pill.neutral { background: rgba(128, 128, 128, 0.14); color: var(--subtext); }

.data-table td small.sub {
  display: block;
  color: var(--subtext);
  font: 600 11px 'Nunito', sans-serif;
  margin-top: 3px;
}
.data-table .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.data-table .actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; white-space: nowrap; }

.stock-chip {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font: 600 12px 'Nunito', sans-serif;
  border-radius: 8px;
  padding: 4px 9px;
  margin: 0 6px 6px 0;
}

.movement-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 12px 'Nunito', sans-serif;
  border-radius: 8px;
  padding: 4px 9px;
}
.movement-badge.entry { background: rgba(98, 200, 142, 0.14); color: #2e8b57; }
.movement-badge.request { background: rgba(201, 162, 39, 0.16); color: var(--gold); }

.kpi-mini {
  font: 700 12px 'Nunito', sans-serif;
  color: var(--subtext);
  margin: 10px 0 0;
}
.kpi-mini.warn { color: #b04a4a; }
.muted { color: var(--subtext); }

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font: 700 13px 'Nunito', sans-serif;
  color: var(--subtext);
  padding: 11px 16px;
  cursor: pointer;
  transition: 0.18s;
  border-radius: 9px 9px 0 0;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--gold);
  background: rgba(201, 162, 39, 0.08);
}
.tab-panel[hidden] { display: none; }
.tab-panel .card { margin-top: 17px; }

.form-toggle {
  margin-top: 16px;
  margin-bottom: 4px;
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.form-toggle[hidden] { display: none; }

.kpi-grid { margin-bottom: 24px; }

.mini-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: block;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 16px;
  margin-top: 17px;
}
.store-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s, transform 0.18s;
}
.store-card:hover { box-shadow: 0 9px 22px rgba(0, 0, 0, 0.09); transform: translateY(-2px); }
.store-img {
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.store-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-img .fb { font-size: 42px; opacity: 0.6; }
.store-body { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.store-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.store-name { font-size: 14px; line-height: 1.3; }
.store-avail { font-size: 11px; font-weight: 700; color: #2f8f5b; white-space: nowrap; }
.store-avail.soldout { color: #b04a4a; }
.store-meta { font-size: 12px; color: var(--subtext); }
.store-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.store-price { font-size: 16px; font-weight: 800; }
.stepper { display: flex; align-items: center; gap: 2px; }
.step-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: 0.15s;
}
.step-btn:hover { background: rgba(201, 162, 39, 0.14); border-color: var(--gold); }
.step-input {
  width: 42px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
  font: 700 14px 'Nunito', sans-serif;
  color: var(--text);
  appearance: textfield;
  -moz-appearance: textfield;
}
.step-input::-webkit-outer-spin-button, .step-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.store-cart {
  position: sticky;
  bottom: 16px;
  z-index: 30;
  margin-top: 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.92));
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.store-cart-info { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--subtext); }
.store-cart-total strong { font-size: 17px; color: var(--text); }
#cart-submit:disabled { opacity: 0.45; cursor: not-allowed; }
.cart-detail { flex-basis: 100%; font-size: 12.5px; color: var(--subtext); line-height: 1.6; padding-top: 8px; border-top: 1px dashed var(--border); }
.cart-detail .cart-sec { color: var(--text); }
.cart-detail .cart-sep { opacity: 0.6; margin: 0 6px; }

.store-tabs {
  display: flex;
  gap: 6px;
  margin-top: 17px;
  border-bottom: 1px solid var(--border);
}
.subtab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font: 700 12.5px 'Nunito', sans-serif;
  color: var(--subtext);
  padding: 9px 14px;
  cursor: pointer;
  transition: 0.18s;
  border-radius: 8px 8px 0 0;
}
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: var(--gold); background: rgba(201, 162, 39, 0.08); }
.store-panel[hidden] { display: none; }

.store-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.pill.info { background: rgba(96, 130, 219, 0.16); color: #3b5bb5; }

.section-toggles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-pill {
  flex: 1;
  min-width: 180px;
}
.section-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition: 0.18s;
}
.section-pill.on .section-toggle-btn { border-color: rgba(98, 200, 142, 0.5); background: rgba(98, 200, 142, 0.08); }
.section-pill.off .section-toggle-btn { border-color: rgba(176, 74, 74, 0.45); background: rgba(220, 114, 114, 0.07); }
.section-toggle-btn:hover { transform: translateY(-1px); }
.section-dot { width: 10px; height: 10px; border-radius: 50%; background: #2e8b57; box-shadow: 0 0 0 3px rgba(98, 200, 142, 0.25); }
.section-pill.off .section-dot { background: #b04a4a; box-shadow: 0 0 0 3px rgba(220, 114, 114, 0.22); }
.section-name { flex: 1; font: 800 13.5px 'Nunito', sans-serif; color: var(--text); }
.section-toggle-btn small { font-size: 11px; font-weight: 700; color: var(--subtext); }
.section-pill.off .section-toggle-btn small { color: #b04a4a; }

@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .store-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

.money { font-variant-numeric: tabular-nums; }
.strong { font-weight: 800; }
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.radio-pill input { accent-color: var(--gold); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-block { margin-top: 22px; }
.advance-form { display: inline-flex; gap: 6px; align-items: center; }

.payslip {
  max-width: 860px; margin: 0 auto 30px; background: #fff; color: #141414;
  border: 1px solid var(--border); border-radius: 14px; padding: 30px 36px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  font-family: 'Nunito', system-ui, sans-serif;
}
.payslip-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 2px solid var(--gold); }
.payslip-brand img { height: 58px; display: block; }
.payslip-title { text-align: center; }
.payslip-title strong { display: block; font-size: 19px; letter-spacing: 0.06em; }
.payslip-title span { font-weight: 800; color: var(--gold); letter-spacing: 0.12em; font-size: 12px; }
.payslip-period { text-align: right; font-size: 13px; }
.payslip-period span { display: block; color: #777; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.payslip-worker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; padding: 18px 0; border-bottom: 1px dashed #bbb; }
.payslip-label { display: block; font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.06em; }
.payslip-worker strong { font-size: 14px; color: #141414; }
.payslip-body { padding: 18px 0; }
.payslip-section { margin: 0 0 12px; font-size: 14px; letter-spacing: 0.04em; color: #333; }
.payslip-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.payslip-table th { text-align: left; color: #777; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 8px; border-bottom: 1px solid #ddd; }
.payslip-table td { padding: 8px; border-bottom: 1px solid #eee; color: #222; }
.payslip-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px; background: #faf6ea; border: 1px solid var(--gold); border-radius: 10px; padding: 14px 18px; font-size: 13px; }
.payslip-summary div { display: flex; justify-content: space-between; gap: 12px; }
.payslip-summary span { color: #666; }
.payslip-totals { margin-top: 18px; border-top: 1px solid #ddd; padding-top: 10px; }
.payslip-totals div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.payslip-totals .less { color: #b04a4a; }
.payslip-net { border-top: 2px solid #141414; margin-top: 8px; padding-top: 10px; font-size: 17px; }
.payslip-net strong { font-size: 20px; color: var(--gold); }
.payslip-note { margin-top: 16px; font-size: 11.5px; color: #888; line-height: 1.5; }
.payslip-signs { display: flex; justify-content: space-between; gap: 40px; margin-top: 36px; }
.payslip-signs div { flex: 1; }
.payslip-sign-line { display: block; height: 28px; border-bottom: 1px solid #888; margin-bottom: 6px; }
.payslip-signs small { color: #555; font-size: 12px; }

@media print {
  body * { visibility: hidden; }
  .payslip, .payslip * { visibility: visible; }
  .no-print { display: none !important; }
  .payslip { position: absolute; inset: 0; width: 100%; max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 22px; }
  @page { margin: 14mm; }
}

/* ===== Contabilidad: ingresos, egresos y balance ===== */
.acct-period {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.acct-period .input { width: auto; min-width: 128px; }
.acct-period-label {
  font: 800 11px 'Nunito', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--subtext);
}
.acct-period-note { font: 600 12px 'Nunito', sans-serif; color: var(--text); }

.acct-hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.acct-hero-main {
  background: var(--black);
  color: var(--on-dark);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
html.dark .acct-hero-main { background: var(--surface-2); }
.acct-hero-label {
  font: 800 11px 'Nunito', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--gold2);
}
.acct-hero-value { font: 800 34px 'Nunito', sans-serif; line-height: 1.1; }
.acct-hero-value.positive { color: var(--green) !important; }
.acct-hero-value.negative { color: var(--red) !important; }
.acct-hero-value.muted { color: var(--on-dark) !important; }
.acct-hero-main small { font: 500 12px 'Nunito', sans-serif; color: rgba(247, 244, 236, 0.62); }
.acct-hero-side { display: flex; }
.acct-hero-mini {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.acct-hero-mini > span {
  font: 800 11px 'Nunito', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--subtext);
}
.acct-hero-mini strong { font: 800 24px 'Nunito', sans-serif; }
.acct-hero-mini small { font: 500 11.5px 'Nunito', sans-serif; color: var(--subtext); }

.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.acct-grid .card { min-width: 0; }
.acct-field-full { grid-column: 1 / -1; }

.acct-rows { display: flex; flex-direction: column; }
.acct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.acct-row:last-child { border-bottom: 0; }
.acct-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-row strong { font-weight: 800; }
.acct-row small { font: 500 11.5px 'Nunito', sans-serif; }
.acct-row.is-split { opacity: 0.72; }
.acct-row.is-result { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.acct-row.is-sub strong { font-weight: 700; }
.acct-row.is-total {
  margin-top: 8px;
  padding: 16px 14px;
  background: var(--black);
  color: var(--on-dark);
  border-radius: 12px;
  border-bottom: 0;
}
html.dark .acct-row.is-total { background: var(--surface-2); }
.acct-row.is-total strong { color: var(--on-dark); }
.acct-row.is-total .positive { color: var(--green) !important; }
.acct-row.is-total .negative { color: var(--red) !important; }
.acct-row.is-total .muted { color: var(--on-dark) !important; }

@media (max-width: 1100px) {
  .acct-hero, .acct-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .acct-hero-value { font-size: 28px; }
  .acct-row { flex-direction: column; align-items: flex-start; gap: 4px; }
}

.acct-readonly {
  background: var(--surface-2);
  border-style: dashed;
  color: var(--subtext);
  font-weight: 700;
  cursor: default;
}
.acct-readonly:focus { border-color: var(--border); box-shadow: none; }

/* ==========================================================================
   Campana de notificaciones
   ========================================================================== */

.notif-bell { position: relative; }

.notif-bell .icon-btn { position: relative; }

.notif-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font: 800 10px/18px 'Nunito', sans-serif;
  text-align: center;
  border: 2px solid var(--surface);
}

.notif-badge[hidden] { display: none; }

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-height: 420px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 60;
}

.notif-panel[hidden] { display: none; }

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  font: 800 12px 'Nunito', sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--subtext);
}

.notif-link {
  background: none;
  border: 0;
  color: var(--gold);
  font: 700 11px 'Nunito', sans-serif;
  cursor: pointer;
  padding: 0;
}
.notif-link:hover { text-decoration: underline; }

.notif-panel-body { overflow-y: auto; }

.notif-panel-foot {
  display: block;
  padding: 11px 15px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--gold);
  font: 700 12px 'Nunito', sans-serif;
  text-decoration: none;
}
.notif-panel-foot:hover { background: var(--surface-2); }

.notif-empty, .notif-loading {
  margin: 0;
  padding: 26px 16px;
  text-align: center;
  color: var(--subtext);
  font: 500 13px 'Nunito', sans-serif;
}

.notif-row {
  display: flex;
  gap: 11px;
  width: 100%;
  padding: 12px 15px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.notif-row:hover { background: var(--surface-2); }
.notif-row.is-unread { background: rgba(201, 162, 39, .07); }
.notif-row.is-unread .notif-row-title { font-weight: 800; }

.notif-row-icon { font-size: 17px; line-height: 1.4; flex: none; }
.notif-row-body { min-width: 0; flex: 1; }
.notif-row-title { display: block; font: 700 13px 'Nunito', sans-serif; color: var(--text); }
.notif-row-text {
  margin: 2px 0 3px;
  font: 500 12px 'Nunito', sans-serif;
  color: var(--subtext);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.notif-row-ago { font: 600 10px 'Nunito', sans-serif; color: var(--muted); }
.notif-row-dot {
  align-self: center;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}

/* --- Pagina completa ---------------------------------------------------- */

.notif-list { list-style: none; margin: 0; padding: 0; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-item.is-unread { background: rgba(201, 162, 39, .07); }

.notif-item-icon { font-size: 19px; line-height: 1.3; flex: none; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  display: block;
  color: var(--text);
  text-decoration: none;
  font: 800 14px 'Nunito', sans-serif;
}
.notif-item-title:hover { color: var(--gold); }
.notif-item-text { margin: 3px 0 4px; font: 500 13px 'Nunito', sans-serif; color: var(--subtext); }
.notif-item-ago { font: 600 11px 'Nunito', sans-serif; color: var(--muted); }
.notif-item-mark { flex: none; }

@media (max-width: 640px) {
  .notif-panel { width: min(340px, calc(100vw - 32px)); }
}
