:root {
  --red: #b91c2b;
  --red-dark: #921522;
  --ink: #202630;
  --ink-soft: #59616d;
  --line: #e5e7eb;
  --surface: #ffffff;
  --canvas: #f4f5f7;
  --green: #26845a;
  --green-soft: #e8f5ee;
  --yellow: #b77600;
  --yellow-soft: #fff4d7;
  --danger: #c53535;
  --danger-soft: #fdeaea;
  --shadow: 0 18px 44px rgb(15 23 42 / 10%);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.router-page { display: flex; flex-direction: column; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .4rem; font-size: clamp(1.8rem, 5vw, 2.55rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { font-size: 1.15rem; }
a { color: inherit; }

.muted { color: var(--ink-soft); }
.eyebrow { margin-bottom: .5rem; color: var(--red); font-size: .76rem; font-weight: 800; letter-spacing: .12em; }
.helper { color: var(--ink-soft); font-size: .9rem; }

.auth-page {
  display: grid;
  min-height: 100vh;
  background: linear-gradient(145deg, #15191f 0 48%, #2d333c 48% 100%);
}
.auth-shell { display: grid; place-items: center; padding: 24px; }
.auth-card {
  display: grid;
  width: min(920px, 100%);
  overflow: hidden;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgb(0 0 0 / 30%);
}
.brand-panel { display: grid; align-content: center; gap: 20px; min-height: 240px; padding: 42px; color: white; background: #050505; }
.brand-logo { width: min(100%, 470px); height: auto; }
.branch-label { width: fit-content; padding: 7px 12px; border: 1px solid rgb(255 255 255 / 35%); border-radius: 999px; color: #ddd; font-size: .85rem; }
.auth-content { padding: 38px; }
.operator-card {
  position: relative;
  width: min(530px, 100%);
  overflow: hidden;
  padding: 42px;
  border-radius: 24px;
  background: white;
  box-shadow: 0 30px 80px rgb(0 0 0 / 30%);
}
.modal-accent { position: absolute; inset: 0 0 auto; height: 7px; background: var(--red); }

.stack-form { display: grid; gap: 18px; margin-top: 26px; }
label { display: grid; gap: 7px; color: #444c57; font-size: .85rem; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #cfd3d9;
  border-radius: 11px;
  outline: none;
  background: white;
  color: var(--ink);
}
input:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgb(185 28 43 / 13%); }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  text-decoration: none;
  font-weight: 750;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.button:active { transform: scale(.98); }
.button-primary { color: white; background: var(--red); box-shadow: 0 8px 20px rgb(185 28 43 / 20%); }
.button-primary:hover { background: var(--red-dark); }
.button-secondary { border-color: #d7dbe0; color: #3e4651; background: white; }
.button-secondary:hover { border-color: #aeb5bd; background: #f9fafb; }
.button-block { width: 100%; }
.text-button { padding: 8px; border: 0; color: #d9dde2; background: transparent; text-decoration: underline; text-underline-offset: 3px; }

.alert { margin: 18px 0; padding: 12px 14px; border-radius: 10px; font-size: .9rem; }
.alert-error { border: 1px solid #f1b8bd; color: #8d1823; background: #fff0f1; }

.topbar { position: sticky; z-index: 20; top: 0; color: white; background: #11151a; box-shadow: 0 1px 0 rgb(255 255 255 / 8%); }
.topbar-inner { display: flex; min-height: 67px; align-items: center; gap: 14px; width: min(1180px, 100%); margin: auto; padding: 10px 20px; }
.topbar-logo { width: 155px; max-height: 36px; object-fit: contain; object-position: left center; }
.operator-pill { margin-left: auto; color: #d3d7dc; font-size: .88rem; }
.operator-pill strong { color: white; }

.page-shell { width: min(1180px, 100%); margin: auto; padding: 30px 20px 80px; }
.router-shell { width: min(860px, 100%); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 0; }

.connection-status { margin-bottom: 15px; padding: 9px 13px; border-radius: 10px; color: #6b4b00; background: var(--yellow-soft); font-size: .85rem; text-align: center; }
.priority-banner { margin-bottom: 16px; padding: 15px 17px; border-left: 5px solid var(--red); border-radius: 12px; color: #64111a; background: #fff0f1; font-weight: 650; box-shadow: 0 4px 16px rgb(0 0 0 / 5%); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; color: var(--ink-soft); font-size: .82rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot-green { background: var(--green); }
.dot-yellow { background: #d99a18; }
.dot-red { background: var(--danger); }

.advisor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.advisor-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 18px;
  overflow: hidden;
  min-height: 138px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 7px 22px rgb(15 23 42 / 6%);
}
.advisor-card::before { position: absolute; inset: 0 auto 0 0; width: 5px; content: ""; }
.advisor-card.level-green::before { background: var(--green); }
.advisor-card.level-yellow::before { background: #d99a18; }
.advisor-card.level-red::before { background: var(--danger); }
.advisor-meta { min-width: 0; }
.advisor-name { margin: 0 0 6px; overflow: hidden; font-size: 1.06rem; text-overflow: ellipsis; white-space: nowrap; }
.advisor-team { color: var(--ink-soft); font-size: .78rem; }
.last-time { align-self: end; color: var(--ink-soft); font-size: .78rem; }
.counter-block { display: grid; justify-items: center; align-content: center; gap: 8px; }
.count { font-size: 2.4rem; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; }
.counter-actions { display: flex; gap: 7px; }
.counter-button { display: grid; width: 45px; height: 42px; place-items: center; border: 0; border-radius: 12px; color: white; background: var(--red); font-size: 1.65rem; font-weight: 500; line-height: 1; }
.counter-button:hover { background: var(--red-dark); }
.counter-button.minus { color: #8d1823; background: #fee9eb; }
.counter-button:disabled { opacity: .5; cursor: wait; }
.priority-tag { grid-column: 1 / -1; width: fit-content; padding: 4px 8px; border-radius: 999px; color: #9a1b27; background: var(--danger-soft); font-size: .72rem; font-weight: 800; }
.empty-state { padding: 60px 20px; border: 1px dashed #c9ced5; border-radius: var(--radius); color: var(--ink-soft); background: white; text-align: center; }

.router-page .router-shell { flex: 1; padding-bottom: 36px; }
.router-footer { width: 100%; margin-top: auto; color: #f7f8fa; background: radial-gradient(circle at 84% -90%, #81303b 0, transparent 46%), linear-gradient(115deg, #12161c, #202730); border-top: 1px solid rgb(255 255 255 / 8%); box-shadow: 0 -12px 34px rgb(15 23 42 / 8%); }
.router-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: min(860px, 100%); margin: auto; padding: 20px; }
.footer-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.footer-mark { display: grid; width: 38px; height: 38px; padding: 3px; place-items: center; border: 1px solid rgb(255 255 255 / 18%); border-radius: 11px; background: linear-gradient(145deg, #cb3242, #8f1724); box-shadow: 0 8px 18px rgb(0 0 0 / 20%); }
.footer-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.footer-identity strong, .footer-identity span { display: block; }
.footer-identity strong { color: white; font-size: .89rem; letter-spacing: -.01em; }
.footer-identity div > span { margin-top: 2px; color: #adb5c0; font-size: .72rem; }
.footer-logout { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 7px 12px 7px 8px; border: 1px solid rgb(255 255 255 / 14%); border-radius: 14px; color: white; background: rgb(255 255 255 / 7%); font: inherit; text-align: left; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.footer-logout:hover { border-color: rgb(255 255 255 / 28%); background: rgb(255 255 255 / 13%); transform: translateY(-1px); }
.footer-logout:focus-visible { outline: 3px solid rgb(255 255 255 / 32%); outline-offset: 3px; }
.footer-logout-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; color: #ffc6cd; background: rgb(185 28 43 / 28%); }
.footer-logout-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.footer-logout strong, .footer-logout small { display: block; }
.footer-logout strong { font-size: .8rem; }
.footer-logout small { margin-top: 1px; color: #b9c1ca; font-size: .68rem; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgb(15 23 42 / 62%); backdrop-filter: blur(4px); }
.confirm-modal { position: relative; width: min(460px, 100%); overflow: hidden; padding: 30px; border-radius: 20px; background: white; box-shadow: 0 28px 70px rgb(0 0 0 / 35%); }
.confirm-modal p { color: var(--ink-soft); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.toast { position: fixed; z-index: 70; right: 20px; bottom: 22px; max-width: min(390px, calc(100% - 40px)); padding: 13px 16px; border-radius: 12px; color: white; background: #222831; box-shadow: var(--shadow); }
.toast.error { background: #8e1b26; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 20px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.tab { min-width: max-content; padding: 9px 15px; border: 0; border-radius: 9px; color: var(--ink-soft); background: transparent; font-weight: 700; }
.tab.active { color: white; background: #252b33; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.filter-bar label { min-width: 145px; }
.quick-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; }
.chip { padding: 8px 12px; border: 1px solid #d9dde2; border-radius: 999px; color: #505965; background: white; font-weight: 650; }
.chip.active { border-color: #222831; color: white; background: #222831; }
.metric-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 11px; margin-bottom: 18px; }
.metric-card { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.metric-label { color: var(--ink-soft); font-size: .76rem; font-weight: 700; }
.metric-value { margin-top: 5px; font-size: 1.8rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.admin-grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.bar-list { display: grid; gap: 11px; }
.bar-item { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; align-items: center; gap: 10px; font-size: .86rem; }
.bar-track { height: 9px; overflow: hidden; border-radius: 99px; background: #edf0f3; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--red); }
.hourly-chart { display: flex; min-height: 210px; align-items: end; gap: 7px; padding-top: 20px; }
.hour-column { display: grid; flex: 1; height: 190px; grid-template-rows: 1fr auto; align-items: end; gap: 7px; color: var(--ink-soft); font-size: .69rem; text-align: center; }
.hour-bar { width: 100%; min-height: 2px; border-radius: 5px 5px 2px 2px; background: var(--red); }

.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: white; }
.schedule-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.schedule-table th, .schedule-table td { padding: 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; }
.schedule-table th { position: sticky; z-index: 2; top: 0; background: #f2f3f5; font-size: .8rem; }
.schedule-table th:first-child, .schedule-table td:first-child { position: sticky; z-index: 1; left: 0; min-width: 190px; background: white; }
.schedule-table th:first-child { z-index: 3; background: #f2f3f5; }
.schedule-table select { min-width: 105px; min-height: 38px; padding: 6px; font-size: .78rem; }
.advisor-cell small { display: block; color: var(--ink-soft); }

.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 16px; }
.people-list { display: grid; gap: 8px; }
.person-row { display: grid; grid-template-columns: 1fr minmax(90px, 130px) auto; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; }
.person-row.inactive { opacity: .58; }
.switch-button { min-width: 78px; padding: 7px 9px; border: 1px solid #d5d9de; border-radius: 9px; background: white; }
.audit-list { display: grid; gap: 9px; margin-bottom: 15px; }
.audit-item { padding: 13px; border-left: 4px solid #c5cad0; border-radius: 8px; background: #f7f8f9; }
.audit-item strong { display: block; margin-bottom: 4px; }
.audit-item small { color: var(--ink-soft); }
.detail-panel { margin-top: 16px; }
.attention-detail { display: grid; gap: 8px; max-height: 480px; overflow: auto; }
.attention-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
.attention-row.inactive { opacity: .58; background: #f5f6f7; }
.attention-row small { display: block; margin-top: 3px; color: var(--ink-soft); }

@media (min-width: 740px) {
  .auth-card { grid-template-columns: 1.1fr .9fr; }
}

@media (max-width: 820px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid-two { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar-inner { padding-inline: 14px; }
  .topbar-logo { width: 112px; }
  .operator-pill { overflow: hidden; max-width: 165px; text-overflow: ellipsis; white-space: nowrap; }
  .page-shell { padding: 22px 13px 70px; }
  .router-page .router-shell { padding-bottom: 28px; }
  .router-footer-inner { padding: 16px 13px; }
  .page-heading { align-items: center; }
  .page-heading h1 { font-size: 1.7rem; }
  .advisor-grid { grid-template-columns: 1fr; }
  .advisor-card { min-height: 124px; }
  .legend { gap: 10px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
  .filter-bar { align-items: stretch; }
  .filter-bar > * { width: 100%; }
  .quick-filters { width: 100%; }
  .quick-filters .chip { width: auto; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .inline-form { grid-template-columns: 1fr; }
  .person-row { grid-template-columns: 1fr auto; }
  .person-row input:nth-child(2) { grid-row: 2; }
  .auth-shell { padding: 14px; }
  .auth-content, .operator-card { padding: 30px 22px; }
  .brand-panel { min-height: 170px; padding: 28px 22px; }
}


/* Atajo a presentaciones desde las pantallas comerciales y de acceso. */
.presentation-shortcut{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;padding:8px 12px;border-radius:9px;border:1px solid #444955;background:#22262e;color:#fff;text-decoration:none;font-size:13px;font-weight:700;white-space:nowrap}
.presentation-shortcut:hover{border-color:#e75d60;background:#34343c}
.presentation-shortcut:focus-visible,.presentation-login-link:focus-visible{outline:3px solid #e96a70;outline-offset:3px}
.presentation-login-link{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:14px;padding:10px;color:#a71f2b;text-decoration:none;font-size:13px;font-weight:750;border:1px solid #e9dadd;border-radius:10px}
.presentation-login-link:hover{background:#fff3f4}
@media(max-width:620px){.topbar-inner{flex-wrap:wrap;row-gap:6px}.presentation-shortcut{order:3;flex:1 0 100%;font-size:12px}.topbar-inner .operator-pill{margin-left:auto}}
