/* ===== estructura de la aplicación ===== */
#boot {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg);
  transition: opacity .4s var(--ease), visibility .4s;
}
#boot.is-gone { opacity: 0; visibility: hidden; }
.boot-wait { min-height: 40vh; }

.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
:root[data-collapsed="1"] .app { --side-w: 78px; }
.app { transition: grid-template-columns .25s var(--ease); }

/* --- lateral --- */
.side {
  position: sticky; top: 0; height: 100vh; z-index: 40; background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 14px 14px; gap: 14px; overflow: hidden auto;
}
.side__brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 2px 0; }
.side__logo { display: block; min-width: 0; }
.side__collapse { flex: none; border: 1px solid var(--line-2); background: var(--surface); }
.side__new {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-md); font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line-2); transition: .2s var(--ease);
  box-shadow: var(--shadow);
}
.side__new span { flex: 1; }
.side__new:hover { border-color: rgba(255, 122, 0, .55); background: var(--accent-bg); transform: translateY(-1px); }
.side__nav { display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; }
.side__sec { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 16px 12px 6px; }
.side__sec:first-child { padding-top: 6px; }
.nav__i {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-weight: 500; color: var(--text-2);
  width: 100%; text-align: left; transition: background .18s, color .18s, transform .18s var(--ease); position: relative;
}
.nav__i > span:not(.count) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__i:hover { background: var(--hover); color: var(--text); }
.nav__i.is-active { background: var(--grad); color: #fff; box-shadow: var(--glow); font-weight: 600; }
.nav__i .count {
  font-size: 11px; font-weight: 700; min-width: 22px; height: 20px; padding: 0 6px; display: grid; place-items: center;
  border-radius: 999px; background: var(--surface-3); color: var(--text-2);
}
.nav__i.is-active .count { background: rgba(255, 255, 255, .25); color: #fff; }
.count--warn { background: var(--warn-bg) !important; color: var(--warn-t) !important; }
.side__bottom { display: flex; flex-direction: column; gap: 3px; }
.widget {
  display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.widget__t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.widget__t small { color: var(--text-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget__t strong { font-size: 15px; font-weight: 700; }

:root[data-collapsed="1"] .side { padding-inline: 12px; }
:root[data-collapsed="1"] .side .brand__txt,
:root[data-collapsed="1"] .side .side__new span,
:root[data-collapsed="1"] .side .side__new kbd,
:root[data-collapsed="1"] .side .nav__i span,
:root[data-collapsed="1"] .side .nav__i .count,
:root[data-collapsed="1"] .side .side__sec,
:root[data-collapsed="1"] .side .widget__t { display: none; }
:root[data-collapsed="1"] .side .side__brand { flex-direction: column; }
:root[data-collapsed="1"] .side .side__new,
:root[data-collapsed="1"] .side .nav__i,
:root[data-collapsed="1"] .side .widget { justify-content: center; padding-inline: 0; }
:root[data-collapsed="1"] .side .sun-tile + .brand__txt { display: none; }

.scrim { display: none; }

/* --- columna principal --- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px) saturate(1.2);
}
.topbar .topbar__menu { display: none; border: 1px solid var(--line-2); background: var(--surface); }
.search {
  display: flex; align-items: center; gap: 10px; flex: 0 1 420px; min-width: 0; height: 42px; padding: 0 12px 0 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-3); text-align: left;
  transition: .2s var(--ease);
}
.search span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.search:hover { border-color: var(--line-2); color: var(--text-2); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.date-chip, .demo-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); white-space: nowrap;
}
.demo-pill { color: var(--accent-t); background: var(--accent-bg); border-color: rgba(255, 122, 0, .25); font-size: 12px; font-weight: 600; }
.demo-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
.date-chip .live { width: 7px; height: 7px; border-radius: 50%; background: var(--sun-3); box-shadow: 0 0 10px var(--sun-3); }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; color: var(--text-2);
  transition: .18s var(--ease); position: relative; flex: none;
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; }
.icon-btn--box { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.bell__n {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger);
  color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; animation: ping 2.4s infinite;
}
.pop-wrap { position: relative; }
.pop-scrim { position: fixed; inset: 0; z-index: 49; }
.pop {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; width: 340px; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 8px; animation: rise .22s var(--ease) both; transform-origin: top right;
}
.pop--notif { width: 380px; padding: 0; overflow: hidden; }
.pop__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pop__body { padding: 12px; }
.link { color: var(--accent-t); font-size: 12.5px; font-weight: 600; }
.link:hover { text-decoration: underline; }
.notifs { max-height: 380px; overflow: auto; }
.notifs li { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--line); transition: background .15s; }
.notifs li:hover { background: var(--hover); }
.notifs li.is-new { background: var(--accent-bg); }
.notifs__ico { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent-t); }
.notifs strong { font-size: 13px; display: block; }
.notifs p { font-size: 12.5px; color: var(--text-2); margin: 2px 0; }
.notifs small { color: var(--text-3); font-size: 11.5px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px 0 6px; border-radius: 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); transition: .2s var(--ease);
}
.user-chip:hover { border-color: var(--line-2); }
.user-chip__t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip__t strong { font-size: 13px; font-weight: 600; white-space: nowrap; }
.user-chip__t small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.pop--user { width: 300px; }
.pop__who { padding: 12px; display: flex; flex-direction: column; }
.pop__who small { color: var(--text-3); font-size: 12px; }
.pop__sec { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 10px 12px 4px; }
.pop__sep { height: 1px; background: var(--line); margin: 6px 0; }
.pop__item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 11px; font-size: 13.5px; text-align: left; transition: background .15s; }
.pop__item span { display: flex; flex-direction: column; line-height: 1.25; }
.pop__item small { color: var(--text-3); font-size: 11.5px; }
.pop__item:hover { background: var(--hover); }
.pop__item.is-current { background: var(--accent-bg); }
.pop__item--danger { color: var(--danger-t); }

/* --- contenido --- */
.page { width: 100%; max-width: 1480px; margin: 0 auto; padding: 8px 32px 72px; animation: rise .28s var(--ease) backwards; }

/* --- avisos --- */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--surface-2);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); cursor: pointer; animation: toastIn .38s var(--ease) both;
}
.toast strong { display: block; font-size: 13.5px; }
.toast span { font-size: 13px; color: var(--text-2); }
.toast .ico { flex: none; margin-top: 1px; }
.toast--ok .ico { color: var(--ok); } .toast--danger .ico { color: var(--danger); } .toast--warn .ico { color: var(--warn); } .toast--info .ico { color: var(--info); }
.toast--ok { border-left: 3px solid var(--ok); } .toast--danger { border-left: 3px solid var(--danger); } .toast--warn { border-left: 3px solid var(--warn); } .toast--info { border-left: 3px solid var(--info); }
.toast.is-leaving { animation: toastOut .26s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }

#blazor-error-ui {
  display: none; position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 400; padding: 12px 18px; border-radius: 14px;
  background: var(--danger); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg);
}
#blazor-error-ui .reload { text-decoration: underline; margin-left: 10px; }
#blazor-error-ui .dismiss { cursor: pointer; margin-left: 14px; }

/* --- responsive --- */
@media (max-width: 1279px) {
  .page { padding-inline: 24px; }
  .topbar { padding-inline: 24px; }
  .demo-pill { display: none; }
}
@media (max-width: 1023px) {
  .app, :root[data-collapsed="1"] .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); height: 100dvh; }
  :root[data-collapsed="1"] .side { padding-inline: 14px; }
  :root[data-collapsed="1"] .side .brand__txt, :root[data-collapsed="1"] .side .side__new span, :root[data-collapsed="1"] .side .side__new kbd,
  :root[data-collapsed="1"] .side .nav__i span, :root[data-collapsed="1"] .side .nav__i .count, :root[data-collapsed="1"] .side .side__sec,
  :root[data-collapsed="1"] .side .widget__t { display: revert; }
  :root[data-collapsed="1"] .side .side__brand { flex-direction: row; }
  :root[data-collapsed="1"] .side .side__new, :root[data-collapsed="1"] .side .nav__i, :root[data-collapsed="1"] .side .widget { justify-content: flex-start; padding-inline: 12px; }
  .nav-open .side { transform: none; }
  .side__collapse { display: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: var(--overlay); opacity: 0; visibility: hidden; transition: .25s; }
  .nav-open .scrim { opacity: 1; visibility: visible; }
  .topbar .topbar__menu { display: inline-grid; }
  .date-chip { display: none; }
}
@media (max-width: 639px) {
  .page { padding: 4px 16px 56px; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .user-chip { padding: 0 6px; } .user-chip__t, .user-chip > .ico { display: none; }
  .search { flex: 1; } .search kbd { display: none; }
  .topbar__right { gap: 8px; margin-left: 0; }
  .pop, .pop--notif, .pop--user { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
  .toasts { right: 16px; left: 16px; bottom: 16px; width: auto; }
}
