.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-heading {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mono {
  font-family: var(--font-mono);
}

/* Botón de ayuda "?" */
.help-btn {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.help-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Banner de Modo Guía */
.guide-tip {
  background: var(--info-bg);
  border: 1px solid #bae6fd;
  color: #0c4a6e;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

body.guide-hidden .guide-tip {
  display: none;
}

/* Barras de progreso sin castigo */
.progress-track {
  width: 100%;
  height: 10px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.progress-fill.is-done {
  background: var(--success);
}

.progress-fill.is-warn {
  background: var(--neutral-warn);
}

/* Insignias */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.badge-success {
  background: var(--success-bg);
  color: #065f46;
}

.badge-info {
  background: var(--info-bg);
  color: #075985;
}

.badge-warn {
  background: var(--neutral-warn-bg);
  color: #92400e;
}

/* Botones */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s, background 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

/* Formularios */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.field input, .field select, .field textarea {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 0.94rem;
  background: #fff;
  color: var(--text-main);
  width: 100%;
}

.field textarea {
  resize: vertical;
  min-height: 68px;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  border-color: var(--accent);
}

.field-hint {
  font-size: 0.77rem;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  max-width: 560px;
  width: 100%;
  max-height: calc(100dvh - 32px);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
}

.modal-box .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  border: none;
  background: var(--bg-subtle);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Toasts */
.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}

.toast.is-success {
  background: #065f46;
}

/* Íconos SVG limpios (cero emojis) */
.icon-wrap, .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-svg {
  width: 17px;
  height: 17px;
}

.label-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.modal-close {
  display: inline-grid;
  place-items: center;
  color: var(--text-main);
}

/* Sub-pestañas internas */
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.subtab-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  padding: 9px 15px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.subtab-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.subtab-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Botón de seguridad: Mantener 5 segundos */
.hold-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  background: #0f766e;
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hold-btn-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

.hold-btn-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-ghost-danger {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
}

.btn-ghost-danger:hover {
  border-color: #cbd5e1;
  color: #991b1b;
  background: #fef2f2;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.data-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  background: var(--bg-app);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg-app);
}

.auth-card {
  max-width: 410px;
  width: 100%;
  padding: 24px;
}

.phase-pill.is-synced {
  background: rgba(16, 185, 129, 0.22);
  color: #a7f3d0;
}

.phase-pill.is-saving {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
}