/* Modal animation */
.modal.is-active .modal-card {
  animation: popIn 0.25s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.file.has-name .file-name {
  max-width: 240px;
}

.toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(420px, 90%);
}

.toast {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  opacity: 0.98;
  transition: opacity 0.2s ease-in;
}

.toast.fade-out {
  opacity: 0;
}

.live-status {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f3f7ff 0%, #eef2ff 50%, #f9fbff 100%);
  border: 1px solid #dfe7ff;
  box-shadow: 0 6px 20px rgba(25, 64, 159, 0.08);
}

.live-status.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.08), transparent 40%),
              radial-gradient(circle at 85% 40%, rgba(59, 130, 246, 0.08), transparent 45%);
  pointer-events: none;
}

.spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(50, 115, 220, 0.18);
  border-top-color: #3273dc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.is-paused {
  animation-play-state: paused;
  opacity: 0.35;
}

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

.activity-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #1e293b;
  color: #fff;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  z-index: 1100;
}

.activity-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.activity-toggle.is-open {
  background: #0f172a;
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.15);
}

.activity-dot.has-alert {
  background: #ef4444;
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.2);
}

.activity-drawer {
  position: fixed;
  right: 18px;
  bottom: 70px;
  width: min(420px, 90vw);
  max-height: 60vh;
  background: #0b1221;
  color: #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform: translateY(120%);
  transition: transform 0.2s ease;
  z-index: 1090;
}

.activity-drawer.is-open {
  transform: translateY(0);
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, #111827, #0f172a);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-header .delete {
  background: transparent;
  color: #cbd5e1;
}

.activity-body {
  padding: 12px;
  max-height: 48vh;
  overflow-y: auto;
}

.activity-item {
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-item:last-child {
  margin-bottom: 0;
}

.activity-item.is-success {
  border-color: rgba(16, 185, 129, 0.35);
}

.activity-item.is-warning {
  border-color: rgba(245, 158, 11, 0.35);
}

.activity-item.is-danger {
  border-color: rgba(239, 68, 68, 0.35);
}

.stats-card {
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stats-card.is-warning {
  background: linear-gradient(135deg, #fff7ed, #fffbeb);
}

.stats-card.is-link {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}

.stats-card.is-success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

tr.is-busy-row {
  opacity: 0.55;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper table {
  min-width: 900px;
}

.table-wrapper-unid table {
  min-width: 1100px;
}

.table-wrapper-unid th,
.table-wrapper-unid td {
  white-space: nowrap;
}

/* Clamp table text to two lines; native title tooltip shows full value on hover */
.text-clip {
  position: relative;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: clamp(180px, 25vw, 380px);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  cursor: help;
  max-height: 2.6em;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.text-clip:hover {
  -webkit-line-clamp: unset;
  line-clamp: unset;
  max-height: none;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
  z-index: 5;
}

.table-compact td,
.table-compact th {
  font-size: 0.9rem;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.page-input {
  font-weight: 600;
  text-align: center;
}

.pagination-link.is-current {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pagination-link.is-current .page-input-inline {
  width: auto !important;
  min-width: 2.4ch;
  max-width: 5ch;
  flex: 0 0 auto;
  display: inline-block;
  padding: 0.05em 0.15em;
  margin: 0;
  background: rgba(15, 23, 42, 0.4);
  color: inherit;
  border: none;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  font-weight: 600;
  font-size: 0.85em;
  line-height: 1.35;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: box-shadow 0.18s ease, background 0.18s ease;
  appearance: textfield;
  -moz-appearance: textfield;
}

.pagination-link.is-current .page-input-inline:focus,
.pagination-link.is-current .page-input-inline:hover {
  outline: none;
  background: rgba(15, 23, 42, 0.65);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 0 0 2px rgba(59, 130, 246, 0.3);
}

.page-input-inline::-webkit-outer-spin-button,
.page-input-inline::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-input-inline[type=number] {
  -moz-appearance: textfield;
}

/* Recency chips (reused by YT Processing UIs) */
.tag.cms-recency {
  font-weight: 600;
  border-radius: 999px;
}

.tag.cms-overdue {
  background: #ff3860;
  color: #fff;
}

.tag.cms-critical {
  background: #b10f2e;
  color: #fff;
}

/* ============================================================
   SistemaYT — Dirección "Ámbar"
   Tokens + componentes (drop-in para Frappe System)
   ============================================================ */

:root {
  --yt-bg:            #FBF6EE;
  --yt-surface:       #FFFFFF;
  --yt-surface-alt:   #FBF6EE;
  --yt-ink:           #221D16;
  --yt-muted:         #7C7263;
  --yt-faint:         #9A917F;
  --yt-border:        #ECE3D4;
  --yt-border-soft:   #F2ECE0;
  --yt-accent:        #BE7A14;
  --yt-accent-press:  #A66B11;
  --yt-accent-ink:    #8A5E12;
  --yt-accent-deep:   #A07419;
  --yt-accent-soft:   #FAEFD8;
  --yt-accent-softln: #EFDFBE;
  --yt-ghost-bg:      #F3EBDC;
  --yt-ghost-ink:     #6B6151;
  --yt-ok-bg:         #E7F2E2;
  --yt-ok-fg:         #3E7A2E;
  --yt-ok-dot:        #5AA13F;
  --yt-warn-bg:       #FAEFD8;
  --yt-warn-fg:       #A07419;
  --yt-warn-dot:      #BE7A14;
  --yt-danger-bg:     #FBE6E2;
  --yt-danger-fg:     #B4432B;
  --yt-danger-dot:    #D9542F;
  --yt-neutral-bg:    #EEE9E0;
  --yt-neutral-fg:    #6B6151;
  --yt-neutral-dot:   #A89A82;
  --yt-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --yt-mono: ui-monospace, 'SF Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --yt-r-pill:    999px;
  --yt-r-card:    14px;
  --yt-r-card-lg: 16px;
  --yt-r-control: 10px;
  --yt-r-row:     12px;
  --yt-shadow-sm:   0 1px 2px rgba(80,60,30,.05);
  --yt-shadow-card: 0 1px 2px rgba(80,60,30,.05), 0 18px 40px -24px rgba(90,70,30,.18);
  --yt-container: 1180px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--yt-font);
  color: var(--yt-ink);
  background: var(--yt-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.yt-container { max-width: var(--yt-container); margin: 0 auto; padding: 36px 32px 72px; }

.yt-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--yt-accent); margin: 0; }
.yt-h1 { font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.05; margin: 0; color: var(--yt-ink); }
.yt-h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin: 0; color: var(--yt-ink); }
.yt-h3 { font-size: 16px; font-weight: 600; margin: 0; color: var(--yt-ink); }
.yt-lead { font-size: 15px; color: var(--yt-muted); margin: 0; line-height: 1.4; }
.yt-mono { font-family: var(--yt-mono); font-size: 12.5px; color: var(--yt-accent-ink); }
.yt-num { font-variant-numeric: tabular-nums; }

.yt-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; height: 64px; gap: 30px; padding: 0 32px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid #EFE6D6;
}
.yt-nav__brand {
  font-size: 17px; font-weight: 700; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 9px; cursor: pointer; text-decoration: none;
  color: var(--yt-ink);
}
.yt-nav__brand::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--yt-accent); flex-shrink: 0; }
.yt-nav__brand--with-logo::before { display: none; }
.yt-nav__brand--with-logo svg { flex-shrink: 0; }
.yt-nav__menu { display: flex; gap: 5px; align-items: center; }
.yt-nav__item {
  font-size: 13.5px; font-weight: 500; color: var(--yt-muted);
  padding: 7px 11px; border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.yt-nav__item:hover { color: var(--yt-ink); }
.yt-nav__item.is-active { color: var(--yt-accent-ink); font-weight: 600; background: var(--yt-accent-soft); padding: 7px 13px; }
.yt-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--yt-accent-soft); color: var(--yt-accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; flex-shrink: 0;
}

.yt-btn {
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  padding: 9px 17px; border-radius: var(--yt-r-control); border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; text-decoration: none;
  transition: background .15s ease, filter .15s ease, box-shadow .15s ease;
}
.yt-btn--primary { background: var(--yt-accent); color: #fff; }
.yt-btn--primary:hover { background: var(--yt-accent-press); }
.yt-btn--primary:active { filter: brightness(.9); }
.yt-btn--soft { background: var(--yt-accent-soft); color: var(--yt-accent-ink); }
.yt-btn--soft:hover { background: var(--yt-accent-softln); }
.yt-btn--ghost { background: var(--yt-ghost-bg); color: var(--yt-ghost-ink); }
.yt-btn--ghost:hover { filter: brightness(.97); }
.yt-btn--sm { padding: 7px 14px; font-size: 12.5px; border-radius: 9px; }
.yt-btn:disabled { opacity: .5; cursor: not-allowed; }

.yt-card { background: var(--yt-surface); border: 1px solid var(--yt-border); border-radius: var(--yt-r-card-lg); padding: 24px; }
.yt-card--raised { box-shadow: var(--yt-shadow-card); }
.yt-card > .yt-tile:first-child { margin-bottom: 12px; }
.yt-card > .yt-h2:first-of-type { margin-bottom: 4px; }
.yt-card > .yt-lead { margin-bottom: 16px; }
.yt-card > .yt-btn { margin-top: 12px; }

.yt-tile {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--yt-accent-soft); color: var(--yt-accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.yt-navrow {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 16px; border: 1px solid var(--yt-border); border-radius: var(--yt-r-row);
  cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.yt-navrow:hover { background: #FFFBF5; border-color: var(--yt-accent-softln); }
.yt-navrow.is-active { background: var(--yt-accent-soft); border-color: var(--yt-accent-softln); }
.yt-navrow__title { font-size: 14.5px; font-weight: 600; color: var(--yt-ink); }
.yt-navrow__sub { font-size: 12px; color: var(--yt-muted); margin-top: 2px; }

.yt-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: var(--yt-r-pill); }
.yt-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.yt-badge--ok { background: var(--yt-ok-bg); color: var(--yt-ok-fg); }
.yt-badge--warn { background: var(--yt-warn-bg); color: var(--yt-warn-fg); }
.yt-badge--danger { background: var(--yt-danger-bg); color: var(--yt-danger-fg); }
.yt-badge--neutral { background: var(--yt-neutral-bg); color: var(--yt-neutral-fg); }

.yt-input {
  font-family: inherit; font-size: 13px; color: var(--yt-ink);
  background: var(--yt-surface); border: 1px solid var(--yt-border);
  border-radius: var(--yt-r-control); padding: 9px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.yt-input::placeholder { color: var(--yt-faint); }
.yt-input:focus { outline: none; border-color: var(--yt-accent); box-shadow: 0 0 0 3px rgba(190, 122, 20, .12); }

.yt-chip {
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--yt-ghost-ink); background: var(--yt-ghost-bg);
  border: 1px solid transparent; border-radius: var(--yt-r-control);
  padding: 9px 15px; cursor: pointer; transition: filter .15s ease;
}
.yt-chip:hover { filter: brightness(.95); }

.yt-table { background: var(--yt-surface); border: 1px solid var(--yt-border); border-radius: var(--yt-r-card-lg); overflow: hidden; }
.yt-table__head, .yt-table__row { display: grid; gap: 14px; align-items: center; padding: 15px 20px; }
.yt-table__head {
  background: var(--yt-surface-alt); border-bottom: 1px solid var(--yt-border);
  padding-top: 14px; padding-bottom: 14px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--yt-faint);
}
.yt-table__row { border-top: 1px solid var(--yt-border-soft); transition: background .15s ease; }
.yt-table__row:hover { background: #FCF8F1; }
.yt-table__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--yt-border); background: var(--yt-surface-alt); gap: 14px;
}
.yt-cell-title { font-size: 13.5px; font-weight: 500; color: var(--yt-ink); }
.yt-cell { font-size: 13px; color: var(--yt-muted); }

.yt-stat { background: var(--yt-surface); border: 1px solid var(--yt-border); border-radius: var(--yt-r-card); padding: 20px; }
.yt-stat__label { font-size: 12px; color: var(--yt-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.yt-stat__value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--yt-ink); }
.yt-stat__value--danger { color: var(--yt-danger-fg); }

.yt-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--yt-border); overflow-x: auto; }
.yt-tab {
  font-size: 14px; font-weight: 500; color: var(--yt-muted);
  padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; white-space: nowrap; transition: color .15s ease, border-color .15s ease;
}
.yt-tab:hover { color: var(--yt-ink); }
.yt-tab.is-active { color: var(--yt-accent-ink); font-weight: 600; border-bottom-color: var(--yt-accent); }

.yt-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--yt-accent-soft); border: 1px solid var(--yt-accent-softln);
  border-radius: 12px; padding: 14px 18px;
  font-size: 13.5px; font-weight: 500; color: var(--yt-accent-ink);
}

.yt-empty {
  background: var(--yt-surface); border: 1px dashed #D9CBB2;
  border-radius: var(--yt-r-card-lg); padding: 56px 24px; text-align: center;
}
.yt-empty .yt-h2 { margin-bottom: 8px; }
.yt-empty .yt-lead { margin: 8px auto; }

.yt-grid { display: grid; gap: 16px; }
.yt-flex { display: flex; align-items: center; gap: 12px; }
.yt-mt { margin-top: 16px; }
.yt-mb { margin-bottom: 16px; }
.yt-text-center { text-align: center; }

/* ============================================================
   Notification System — Professional Toast
   ============================================================ */

.notification-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999; max-width: 420px; pointer-events: none;
}

.notification {
  animation: slideIn 0.35s cubic-bezier(0.65, 0, 0.35, 1) forwards;
  background: #FFFFFF; border: 1px solid #ECE3D4; border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex; gap: 12px; margin-bottom: 12px;
  overflow: hidden; padding: 14px 16px; pointer-events: auto; user-select: none;
  backdrop-filter: blur(10px); border-left: 4px solid transparent;
  transition: all 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}
.notification:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); transform: translateX(-4px); }

.notification__icon-bg { border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; }
.notification__icon { width: 20px; height: 20px; stroke-width: 2; }

.notification__content { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.notification__title { font-size: 13px; font-weight: 700; color: #221D16; margin: 0; }
.notification__message { font-size: 13px; color: #7C7263; margin: 0; line-height: 1.4; white-space: pre-line; }

.notification__close {
  background: none; border: none; color: #9A917F; cursor: pointer;
  flex-shrink: 0; padding: 0; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s ease;
}
.notification__close:hover { color: #7C7263; }

.notification--success { border-left-color: #5AA13F; background: linear-gradient(135deg, #E7F2E2 0%, #F2F8EE 100%); }
.notification--success .notification__icon-bg { background: #E7F2E2; color: #5AA13F; }
.notification--success .notification__title { color: #3E7A2E; }

.notification--error { border-left-color: #D9542F; background: linear-gradient(135deg, #FBE6E2 0%, #FEF0ED 100%); }
.notification--error .notification__icon-bg { background: #FBE6E2; color: #D9542F; }
.notification--error .notification__title { color: #B4432B; }

.notification--warning { border-left-color: #BE7A14; background: linear-gradient(135deg, #FAEFD8 0%, #FCF5EB 100%); }
.notification--warning .notification__icon-bg { background: #FAEFD8; color: #BE7A14; }
.notification--warning .notification__title { color: #A07419; }

.notification--info { border-left-color: #3B82F6; background: linear-gradient(135deg, #EFF6FF 0%, #F5FAFF 100%); }
.notification--info .notification__icon-bg { background: #EFF6FF; color: #3B82F6; }
.notification--info .notification__title { color: #1E40AF; }

.notification--deleting { animation: slideOut 0.35s cubic-bezier(0.65, 0, 0.35, 1) forwards; pointer-events: none; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(420px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(420px); }
}

.notification__progress {
  position: absolute; bottom: 0; left: 0;
  height: 3px; background: currentColor; opacity: 0.4;
  animation: progress linear forwards;
}
@keyframes progress {
  from { width: 100%; }
  to { width: 0%; }
}
