/* NoniMail Tools: pantallas de trabajo (Limpiar, Licencias). Tema «Dulce»: los colores
   salen de tema.css y la forma de site.css. Modo herramienta: escala fija, densidad media,
   movimiento solo para estados. Ver DESIGN.md. */
.nt [hidden] { display: none !important; }

/* Solo para lectores de pantalla. */
.nt-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.nt-shell {
  width: min(1180px, 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-bottom: 6rem;
}

/* ---------- Barra superior ---------- */

.nt-bar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: var(--topbar);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--hair);
}

.nt-bar-in {
  width: min(1180px, 100% - 2 * var(--gutter));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 60px;
}

.nt-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.012em;
  white-space: nowrap;
}

.nt-brand img { width: 28px; height: 28px; border-radius: 50%; background: var(--raise); box-shadow: 0 0 0 1px var(--hair); }
.nt-brand b { color: var(--accent); font-weight: 700; }

.nt-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nt-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--r-pill);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.nt-tabs a:hover { color: var(--text); background: rgba(var(--ink-rgb), 0.05); }
.nt-tabs a[aria-current="page"] { color: var(--text); background: var(--accent-tint); }
.nt-tabs a[aria-current="page"] svg { color: var(--accent); }
.nt-tabs svg { width: 18px; height: 18px; }

.nt-who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  min-width: 0;
}

.nt-who-mail {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 26ch;
}

/* ---------- Encabezado de página ---------- */

.nt-head {
  display: grid;
  gap: 0.5rem;
  padding: 2.5rem 0 1.75rem;
  max-width: 70ch;
}

.nt-head h1 {
  margin: 0;
  font-size: 1.875rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.nt-head p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.6; }

/* ---------- Bloques ---------- */

.nt-block {
  background: var(--panel);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-card);
  border-radius: var(--r-md);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.nt-block > h2 {
  margin: 0 0 0.35rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.012em;
}

.nt-block > .nt-sub { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.9375rem; max-width: 70ch; }

.nt-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem 1rem;
}

.nt-col-3 { grid-column: span 3; }
.nt-col-4 { grid-column: span 4; }
.nt-col-5 { grid-column: span 5; }
.nt-col-6 { grid-column: span 6; }

.nt-col-12 { grid-column: span 12; }

/* ---------- Campos ---------- */

.nt-field { display: grid; gap: 0.4rem; align-content: start; }
.nt-field > span { font-size: 0.8125rem; color: var(--muted); font-weight: 500; }

.nt-field input:not([type="checkbox"]),
.nt-field select {
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.8rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-control);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.nt-field input[type="text"],
.nt-field input[type="email"],
.nt-mono { font-family: var(--font-mono); font-size: 0.875rem; }

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

.nt-field input::placeholder { color: var(--placeholder); }

.nt-hint { font-size: 0.8125rem; color: var(--muted); margin: 0; }

/* ---------- Botones ---------- */

.nt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.55rem 1.15rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 120ms var(--ease-out), opacity 160ms;
}

.nt-btn:active:not(:disabled) { transform: scale(0.98); }
.nt-btn svg { width: 18px; height: 18px; }

.nt-btn--primary { background: var(--accent-fill); color: var(--on-accent); box-shadow: var(--accent-shadow); }
.nt-btn--primary:hover:not(:disabled) { background: var(--accent-press); }

.nt-btn--ghost { background: var(--panel); color: var(--text); border-color: var(--border); box-shadow: 0 1px 1px rgba(var(--shade-rgb), 0.05); }
.nt-btn--ghost:hover:not(:disabled) { background: var(--raise); border-color: var(--border2); }

.nt-btn--quiet { background: transparent; color: var(--muted); padding-inline: 0.6rem; }
.nt-btn--quiet:hover:not(:disabled) { color: var(--text); background: rgba(var(--ink-rgb), 0.05); }

.nt-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.nt-btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.nt-btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--on-accent) 35%, transparent);
  border-top-color: var(--on-accent);
  animation: nt-spin 700ms linear infinite;
}

.nt-btn--ghost[aria-busy="true"]::after { border-color: color-mix(in srgb, var(--text) 25%, transparent); border-top-color: var(--text); }

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

.nt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1.25rem; }

.nt-link { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- Estado de la cuenta (personal / comercial) ---------- */

.nt-status {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel2);
  font-size: 0.9375rem;
  line-height: 1.5;
  margin-top: 1rem;
}

.nt-status svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.nt-status p { margin: 0; }
.nt-status strong { font-weight: 600; }
.nt-status--ok { border-color: var(--green-line); background: var(--green-tint); }
.nt-status--ok svg { color: var(--green); }
.nt-status--lock { border-color: var(--accent-line); background: var(--accent-tint); }
.nt-status--lock svg { color: var(--accent); }
.nt-status--warn { border-color: var(--amber-line); background: var(--amber-tint); }
.nt-status--warn svg { color: var(--amber); }
.nt-status--err { border-color: var(--red-line); background: var(--red-tint); }
.nt-status--err svg { color: var(--red); }
.nt-status[hidden] { display: none; }

.nt-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 560;
  letter-spacing: 0.01em;
  border: 1px solid var(--border2);
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.nt-tag--ok { color: var(--green); border-color: var(--green-line); background: var(--green-tint); }
.nt-tag--red { color: var(--red); border-color: var(--red-line); background: var(--red-tint); }
.nt-tag--warn { color: var(--amber); border-color: var(--amber-line); background: var(--amber-tint); }

/* ---------- Progreso ---------- */

.nt-progress { display: grid; gap: 0.5rem; margin-top: 1rem; }
.nt-progress-track { height: 6px; border-radius: 6px; background: var(--chip); overflow: hidden; }
.nt-progress-fill { height: 100%; width: 0; border-radius: 6px; background: var(--accent-fill); transition: width 400ms var(--ease-out); }
.nt-progress-fill.is-indeterminate { width: 30%; animation: nt-slide 1.4s var(--ease-spring) infinite; }
.nt-progress-text { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }

@keyframes nt-slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* ---------- Tabla de remitentes ---------- */

.nt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.nt-slider { display: grid; gap: 0.3rem; min-width: 260px; flex: 1 1 280px; }
.nt-slider label { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--muted); }
.nt-slider output { font-family: var(--font-mono); color: var(--text); font-variant-numeric: tabular-nums; }
.nt-slider input[type="range"] { width: 100%; accent-color: var(--accent-fill); }

.nt-search { flex: 0 1 280px; position: relative; }
.nt-search svg { position: absolute; left: 0.75rem; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.nt-field.nt-search input:not([type="checkbox"]) { padding-left: 2.25rem; }

.nt-table-wrap {
  overflow: auto;
  max-height: min(64vh, 720px);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
}

.nt-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.nt-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel2);
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--ink3);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}

.nt-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.nt-table tbody tr:hover { background: var(--row-hover); }
.nt-table tbody tr.is-picked { background: var(--accent-tint); box-shadow: inset 2px 0 0 var(--accent); }
.nt-table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nt-table .who { min-width: 220px; }
.nt-table .who b { display: block; font-weight: 560; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch; }
.nt-table .who code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.nt-table .subj { color: var(--muted); max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent-fill); }
.nt-table code { font-family: var(--font-mono); }

.nt-score { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.nt-score i { display: inline-block; width: 44px; height: 5px; border-radius: 5px; background: var(--chip); overflow: hidden; position: relative; }
.nt-score i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--v, 0%); background: var(--ink3); }
.nt-score.is-high i::after { background: var(--accent); }

/* ---------- Barra de acción fija ---------- */

.nt-actionbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  padding: 0.75rem 0.75rem 0.75rem 1.1rem;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-pop);
}

.nt-actionbar-text { font-size: 0.9375rem; margin-right: auto; }
.nt-actionbar-text b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Registro ---------- */

.nt-log {
  margin: 1rem 0 0;
  max-height: 260px;
  overflow: auto;
  padding: 0.85rem 1rem;
  border-radius: var(--r-sm);
  background: var(--panel2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.nt-log:empty { display: none; }

/* ---------- Vacíos y cargando ---------- */

.nt-empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); font-size: 0.9375rem; }
.nt-empty b { display: block; color: var(--text); font-weight: 600; margin-bottom: 0.25rem; }

.nt-skel { display: grid; gap: 0.5rem; }
.nt-skel i { display: block; height: 38px; border-radius: 8px; background: linear-gradient(90deg, var(--panel2) 0%, var(--chip) 50%, var(--panel2) 100%); background-size: 200% 100%; animation: nt-shimmer 1.3s linear infinite; }

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

/* ---------- Precios ---------- */

.nt-prices { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.nt-prices th, .nt-prices td { padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--border); text-align: left; }
.nt-prices thead th { font-size: 0.8125rem; color: var(--muted); font-weight: 560; }
.nt-prices td.price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1rem; }
.nt-prices tbody th { font-weight: 560; }
.nt-prices tbody th small { display: block; color: var(--muted); font-weight: 400; font-size: 0.8125rem; margin-top: 0.15rem; }

/* ---------- Carrito de licencias ---------- */

.nt-cart { display: grid; gap: 0.6rem; }

.nt-cart-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr) 6.5rem 2.75rem;
  gap: 0.6rem;
  align-items: center;
}

.nt-cart-row .price { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.nt-cart-row .nt-row-msg { grid-column: 1 / -1; margin: -0.2rem 0 0.2rem; font-size: 0.8125rem; color: var(--accent); }
.nt-cart-row .nt-row-msg:empty { display: none; }
.nt-cart-row .nt-row-msg.is-ok { color: var(--green); }

.nt-total {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.nt-total span { color: var(--muted); font-size: 0.9375rem; }
.nt-total b { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.nt-key {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 26ch;
  max-width: 100%;
}

.nt-key code { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; color: var(--muted); }
.nt-key .nt-icon-btn { flex: none; }

.nt-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms, background-color 160ms;
}

.nt-icon-btn:hover { color: var(--text); background: var(--raise); border-color: var(--border2); }
.nt-icon-btn svg { width: 16px; height: 16px; }

/* ---------- Avisos breves ---------- */

.nt-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 90;
  transform: translate(-50%, 1rem);
  opacity: 0;
  padding: 0.65rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--text);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.nt-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsivo ---------- */

@media (max-width: 900px) {
  .nt-col-3, .nt-col-4, .nt-col-5, .nt-col-6 { grid-column: span 6; }
  .nt-tabs a span { display: none; }
  .nt-who-mail { display: none; }
}

@media (max-width: 640px) {
  .nt-grid > * { grid-column: span 12 !important; }
  .nt-bar-in { gap: 0.75rem; }
  .nt-brand span { display: none; }
  .nt-head { padding-top: 1.75rem; }
  .nt-head h1 { font-size: 1.5rem; }
  .nt-block { padding: 1.1rem; }
  .nt-cart-row { grid-template-columns: 1fr 1fr; }
  .nt-cart-row > :first-child { grid-column: 1 / -1; }
  .nt-actionbar { border-radius: var(--r-md); }
  .nt-actionbar-text { flex-basis: 100%; }
}

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