/*
 * Datalive TV · Estilos base del panel: variables de color y tipografía, botones, campos, tablas, tarjetas, ventanas modales, notificaciones y utilidades compartidas por todas las páginas.
 */

:root {
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --text-4: #98a2b3;
  --ink: #0f1728;

  
  --brand: #2a6fdb;
  --brand-hover: #1f5cc0;
  --brand-press: #1a4fa6;
  --brand-50: #eff5ff;
  --brand-100: #dbe8fe;
  --brand-ring: rgba(49, 128, 240, 0.28);

  
  --ok: #067647;
  --ok-dot: #17b26a;
  --ok-bg: #ecfdf3;
  --ok-border: #abefc6;
  --warn: #b54708;
  --warn-dot: #f79009;
  --warn-bg: #fffaeb;
  --warn-border: #fedf89;
  --danger: #c4320a;
  --danger-strong: #d92d20;
  --danger-bg: #fef3f2;
  --danger-border: #fecdca;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 16px -4px rgba(16, 24, 40, 0.1), 0 2px 6px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 24px 40px -12px rgba(16, 24, 40, 0.2), 0 6px 12px -4px rgba(16, 24, 40, 0.06);

  --sidebar-w: 244px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 120ms var(--ease);
  --t: 180ms var(--ease);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, ul, ol, figure {
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

ul, ol {
  list-style: none;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

img, video, canvas, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--brand-100);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.93em;
  letter-spacing: -0.01em;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-3);
}

.subtle {
  color: var(--text-4);
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ms {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  flex-shrink: 0;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  user-select: none;
}

.ms--fill {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20;
}

.ms--sm {
  font-size: 16px;
}

.ms--lg {
  font-size: 24px;
}

.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  padding: 0 20px;
  flex-shrink: 0;
}

.sidebar__brand img {
  height: 26px;
  width: auto;
}

.brand-word {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-word small {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 16px;
  scrollbar-width: thin;
}

.nav-group + .nav-group {
  margin-top: 18px;
}

.nav-group__label {
  padding: 0 10px 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 450;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}

.nav-item .ms {
  color: var(--text-3);
  transition: color var(--t-fast);
}

.nav-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--brand-50);
  color: var(--brand-press);
  font-weight: 500;
}

.nav-item.is-active .ms {
  color: var(--brand);
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20;
}

.nav-item__badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}

.sidebar__footer {
  flex-shrink: 0;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 8px;
  border-radius: var(--radius);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-press);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.user-chip__text {
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}

.user-chip__name {
  font-size: 13px;
  font-weight: 500;
}

.user-chip__org {
  font-size: 12px;
  color: var(--text-3);
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.topbar {
  display: none;
}

.page {
  padding: 28px 36px 64px;
  max-width: 1480px;
}

.page__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page__title {
  font-size: 22px;
  line-height: 30px;
}

.page__subtitle {
  margin-top: 2px;
  color: var(--text-3);
}

.page__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.toolbar__spacer {
  flex: 1;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 28px 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.section-title .count {
  font-weight: 400;
  color: var(--text-3);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row--wrap {
  flex-wrap: wrap;
}

.row--between {
  justify-content: space-between;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.btn {
  --h: 36px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--h);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  user-select: none;
}

.btn:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.btn:active {
  background: var(--surface-3);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.btn .ms {
  font-size: 18px;
  margin-left: -2px;
}

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #fff;
}

.btn--primary:active {
  background: var(--brand-press);
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
}

.btn--ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn--danger {
  color: var(--danger-strong);
}

.btn--danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-strong);
}

.btn--danger-solid {
  background: var(--danger-strong);
  border-color: var(--danger-strong);
  color: #fff;
}

.btn--danger-solid:hover {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}

.btn--sm {
  --h: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.btn--lg {
  --h: 42px;
  padding: 0 18px;
  font-size: 15px;
}

.btn--icon {
  width: var(--h);
  padding: 0;
}

.btn--icon .ms {
  margin: 0;
}

.btn--block {
  width: 100%;
}

.btn.is-busy {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-busy > * {
  visibility: hidden;
}

.btn.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: var(--text-3) transparent var(--text-3) var(--text-3);
  animation: spin 0.7s linear infinite;
}

.btn--primary.is-busy::after,
.btn--danger-solid.is-busy::after {
  border-color: #fff transparent #fff #fff;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 500;
}

.link-btn:hover {
  color: var(--brand-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field__label .optional {
  font-weight: 400;
  color: var(--text-4);
}

.field__hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-3);
}

.field__error {
  font-size: 12px;
  color: var(--danger-strong);
}

.input,
.select,
.textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.textarea {
  height: auto;
  min-height: 80px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.45;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-4);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
  border-color: var(--danger-strong);
}

.input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.18);
}

.input:disabled,
.select:disabled {
  background: var(--surface-3);
  color: var(--text-3);
}

.input[readonly] {
  background: var(--surface-2);
}

.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group > .ms {
  position: absolute;
  left: 10px;
  color: var(--text-4);
  pointer-events: none;
  font-size: 18px;
}

.input-group > .input {
  padding-left: 34px;
}

.input-group__suffix {
  position: absolute;
  right: 4px;
}

.input-affix {
  display: flex;
  align-items: stretch;
}

.input-affix .input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-affix__addon {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 13px;
  white-space: nowrap;
}

.search {
  width: 280px;
  max-width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-section + .form-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.form-section__title {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
}

.form-section__desc {
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-3);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.check input {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface) center / 12px no-repeat;
  flex-shrink: 0;
  transition: background-color var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
}

.check input:checked {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

.check input:indeterminate {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}

.check input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  appearance: none;
  position: relative;
  width: 34px;
  height: 20px;
  margin: 0;
  border-radius: 999px;
  background: var(--border-strong);
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--t);
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2);
  transition: transform var(--t);
}

.switch input:checked {
  background: var(--brand);
}

.switch input:checked::after {
  transform: translateX(14px);
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius);
  background: var(--surface-3);
  gap: 2px;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.segmented button .ms {
  font-size: 18px;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segmented--block {
  display: flex;
}

.segmented--block button {
  flex: 1;
  justify-content: center;
}

.days {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day {
  width: 38px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
}

.day:hover {
  border-color: var(--text-4);
}

.day.is-on {
  border-color: var(--brand);
  background: var(--brand-50);
  color: var(--brand-press);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
}

.card__title {
  font-size: 14px;
  font-weight: 600;
}

.card__body {
  padding: 16px 20px 20px;
}

.card--flush .card__body {
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1;
}

.badge .ms {
  font-size: 14px;
}

.badge--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--ok {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok);
}

.badge--ok.badge--dot::before {
  background: var(--ok-dot);
}

.badge--warn {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
}

.badge--warn.badge--dot::before {
  background: var(--warn-dot);
}

.badge--danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.badge--brand {
  border-color: var(--brand-100);
  background: var(--brand-50);
  color: var(--brand-press);
}

.badge--solid {
  border-color: transparent;
  background: rgba(15, 23, 40, 0.72);
  color: #fff;
  backdrop-filter: blur(4px);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-4);
  flex-shrink: 0;
}

.dot--ok {
  background: var(--ok-dot);
  box-shadow: 0 0 0 3px rgba(23, 178, 106, 0.15);
}

.dot--off {
  background: var(--border-strong);
}

.dot--warn {
  background: var(--warn-dot);
}

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.callout .ms {
  font-size: 18px;
  color: var(--text-3);
  margin-top: 1px;
}

.callout--info {
  border-color: var(--brand-100);
  background: var(--brand-50);
  color: #1d3f80;
}

.callout--info .ms {
  color: var(--brand);
}

.callout--warn {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: #7a2e0e;
}

.callout--warn .ms {
  color: var(--warn-dot);
}

.callout--danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: #7a271a;
}

.callout--danger .ms {
  color: var(--danger-strong);
}

.kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.table th {
  position: sticky;
  top: 0;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background var(--t-fast);
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-title {
  font-weight: 500;
  color: var(--text);
}

.cell-sub {
  font-size: 12px;
  color: var(--text-3);
}

.row-actions {
  display: inline-flex;
  gap: 2px;
  opacity: 0.65;
  transition: opacity var(--t-fast);
}

tr:hover .row-actions,
.row-actions:focus-within {
  opacity: 1;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-3);
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-3);
  box-shadow: var(--shadow-xs);
}

.empty__title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.empty__text {
  max-width: 380px;
  font-size: 13px;
}

.empty .btn {
  margin-top: 12px;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner--lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px;
  color: var(--text-3);
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-3) 0%, #eaedf1 40%, var(--surface-3) 80%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--brand);
  transition: width 240ms var(--ease);
}

.progress--ok > span {
  background: var(--ok-dot);
}

.progress--warn > span {
  background: var(--warn-dot);
}

.progress--danger > span {
  background: var(--danger-strong);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 40, 0.42);
  opacity: 0;
  transition: opacity 160ms var(--ease);
}

.overlay.is-open {
  opacity: 1;
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(0.99);
  transition: transform 200ms var(--ease);
}

.overlay.is-open .modal {
  transform: none;
}

.modal--sm { max-width: 420px; }
.modal--lg { max-width: 760px; }
.modal--xl { max-width: 1080px; }
.modal--full { max-width: 1320px; height: calc(100vh - 48px); }

.modal__header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 0 24px;
}

.modal__title {
  flex: 1;
  padding-top: 4px;
  font-size: 17px;
  line-height: 24px;
}

.modal__subtitle {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
}

.modal__body {
  flex: 1;
  padding: 16px 24px 24px;
  overflow-y: auto;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.modal__footer .spacer {
  flex: 1;
}

.overlay--drawer {
  justify-content: flex-end;
  padding: 0;
}

.drawer {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 580px;
  height: 100%;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(24px);
  transition: transform 220ms var(--ease);
}

.overlay.is-open .drawer {
  transform: none;
}

.drawer .modal__header {
  padding: 20px 20px 16px 24px;
  border-bottom: 1px solid var(--border);
}

.drawer .modal__body {
  padding: 24px;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger-strong);
}

.confirm-icon--brand {
  background: var(--brand-50);
  color: var(--brand);
}

.menu {
  position: fixed;
  z-index: 1100;
  min-width: 180px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: pop 120ms var(--ease);
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
}

.menu__item .ms {
  font-size: 18px;
  color: var(--text-3);
}

.menu__item:hover,
.menu__item:focus-visible {
  outline: none;
  background: var(--surface-3);
}

.menu__item--danger,
.menu__item--danger .ms {
  color: var(--danger-strong);
}

.menu__sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(-4px); }
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #f2f4f7;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 200ms var(--ease);
}

.toast .ms {
  font-size: 18px;
  margin-top: 1px;
}

.toast--success .ms { color: #47cd89; }
.toast--error .ms { color: #fd8d7e; }
.toast--warning .ms { color: #fdb022; }
.toast--info .ms { color: #84adff; }

.toast__close {
  margin: -2px -4px 0 auto;
  padding: 2px;
  border: 0;
  background: none;
  color: #98a2b3;
  line-height: 0;
}

.toast__close:hover {
  color: #fff;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: all 180ms var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 50;
  width: max-content;
  max-width: 260px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 2px);
  transition: opacity 120ms var(--ease), transform 120ms var(--ease);
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 300ms;
}

[data-tip-pos="bottom"]::after {
  top: calc(100% + 6px);
  bottom: auto;
}

[data-tip-pos="left"]::after {
  top: 50%;
  right: calc(100% + 6px);
  bottom: auto;
  left: auto;
  transform: translate(2px, -50%);
}

[data-tip-pos="left"]:hover::after {
  transform: translate(0, -50%);
}

.tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab {
  position: relative;
  padding: 0 0 10px;
  border: 0;
  background: none;
  color: var(--text-3);
  font-weight: 500;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--text);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.tab .count {
  margin-left: 4px;
  color: var(--text-4);
  font-weight: 400;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.boot img {
  width: 56px;
  height: auto;
  animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
  50% { opacity: 0.45; transform: scale(0.96); }
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 220ms var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: none;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(15, 23, 40, 0.4);
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .topbar img {
    height: 22px;
    width: auto;
  }

  .page {
    padding: 20px 16px 48px;
  }
}

@media (max-width: 720px) {
  .page__header {
    flex-direction: column;
    align-items: stretch;
  }

  .page__actions {
    flex-wrap: wrap;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid .span-2 {
    grid-column: auto;
  }

  .search {
    width: 100%;
  }

  .overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-width: none !important;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .drawer {
    max-width: none;
  }

  
  .toasts {
    top: 12px;
    bottom: auto;
    left: 12px;
    right: 12px;
    align-items: stretch;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  
  *:not(.stage, .stage *),
  *:not(.stage *)::before,
  *:not(.stage *)::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.row-actions .btn--danger {
  color: var(--text-3);
}

.row-actions .btn--danger:hover {
  color: var(--danger-strong);
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-danger { color: var(--danger-strong); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }
.w-full { width: 100%; }
