/* ============================================================
   IRPF Admin Panel – styles.css
   ============================================================ */

/* ========================= Design Tokens ========================= */
:root {
  --accent-indigo: #4f46e5;
  --accent-indigo-hover: #4338ca;
  --accent-indigo-light: #e0e7ff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --font-sans: 'DM Sans', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --transition: 0.18s ease;
}

/* ========================= Reset & Base ========================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}
.hidden { display: none !important; }

/* ========================= SVG Icon System ========================= */
.ico { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; stroke: currentColor; fill: none; flex-shrink: 0; }
.ico--sm { width: 0.85em; height: 0.85em; }
.ico--lg { width: 1.25em; height: 1.25em; }
.ico--xl { width: 1.5em; height: 1.5em; }
.ico--2x { width: 2em; height: 2em; }
.ico--3x { width: 3em; height: 3em; }

/* ========================= Header Bar ========================= */
.header-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-home {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.header-home:hover {
  background: var(--accent-indigo-light);
  color: var(--accent-indigo);
}
.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-user {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-page);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* ========================= Page Content ========================= */
.page-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 72px 24px 40px;
}

/* ========================= Controls Bar ========================= */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.controls-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 400px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.filter-select {
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition);
}
.filter-select:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

/* ========================= Stats Line ========================= */
.stats-line {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 500;
}

/* ========================= Data Table ========================= */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  white-space: nowrap;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
  position: sticky;
  top: 0;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}
.data-table tbody tr:hover td {
  background: #f1f5f9;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.text-center { text-align: center; }
.td-name {
  font-weight: 600;
  color: var(--text-primary);
}
.td-email {
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.td-date {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Progress bar in table */
.progress-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.progress-mini-bar {
  width: 80px;
  height: 6px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
}
.progress-mini-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-indigo);
  transition: width 0.3s ease;
}
.progress-mini-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
}

/* Action buttons in table */
.action-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.95rem;
}
.btn-icon:hover {
  background: var(--accent-indigo-light);
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}
.btn-icon--danger:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #dc2626;
}

/* ========================= Status Badges ========================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge--en_curso {
  background: #fef9c3;
  color: #92400e;
  border: 1px solid #fde047;
}
.badge--enviado {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
.badge--revisado {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

/* ========================= Empty & Loading States ========================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.table-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-indigo);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================= Pagination ========================= */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  padding: 12px 0;
}
.pagination-info {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ========================= Buttons ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-sm {
  padding: 7px 14px;
  font-size: 0.82rem;
}
.btn-primary {
  background: var(--accent-indigo);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-indigo-hover);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-page);
  border-color: #cbd5e1;
}
.btn-danger {
  background: #dc2626;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

/* ========================= Back Button ========================= */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 8px 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-indigo);
  cursor: pointer;
  font-family: var(--font-sans);
  margin-bottom: 16px;
  transition: opacity var(--transition);
}
.btn-back:hover { opacity: 0.75; }

/* ========================= Detail Header Card ========================= */
.detail-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.detail-client-info { flex: 1; min-width: 0; }
.detail-client-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.detail-client-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.detail-meta-sep {
  color: var(--border);
}
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========================= Inmueble Tabs ========================= */
.inmueble-tabs-wrapper {
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.inmueble-tabs-wrapper::-webkit-scrollbar {
  height: 4px;
}
.inmueble-tabs-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.inmueble-tabs-wrapper::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
.inmueble-tabs {
  display: flex;
  gap: 4px;
  min-width: max-content;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.inmueble-tab {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.inmueble-tab:hover {
  background: var(--bg-page);
}
.inmueble-tab.active {
  background: var(--accent-indigo);
  color: #fff;
}

/* ========================= Inmueble Content ========================= */
.inmueble-content {
  margin-bottom: 24px;
}

/* Section cards */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.section-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Key-value pairs */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px 24px;
}
.kv-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kv-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.kv-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-word;
}
.kv-item--bold .kv-label,
.kv-item--bold .kv-value {
  font-weight: 700;
  color: var(--text-primary);
}
.kv-value--empty {
  color: var(--text-muted);
  font-style: italic;
}

/* Mini tables (arrendatarios, reparaciones, mobiliario) */
.mini-table-wrapper {
  overflow-x: auto;
  margin-top: 8px;
}
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.mini-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
}
.mini-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.mini-table tbody tr:last-child td {
  border-bottom: none;
}
.mini-table tbody tr:hover td {
  background: #f8fafc;
}

/* ========================= Notas Internas ========================= */
.notas-section {
  margin-top: 8px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.nota-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.nota-textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  resize: vertical;
  min-height: 60px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.nota-textarea::placeholder { color: var(--text-muted); }
.nota-textarea:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.notas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nota-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  position: relative;
}
.nota-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.nota-author {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-indigo);
}
.nota-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.nota-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}
.nota-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
}
.nota-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ========================= Toast ========================= */
.toast-container {
  position: fixed;
  top: 68px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  max-width: 380px;
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.toast-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.toast-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* ========================= Modal ========================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-msg {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ========================= Send Email Modal ========================= */
.se-modal {
  max-width: 780px !important;
  padding: 0 !important;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.se-modal .modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.se-modal-body {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}
.se-row-2 {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.se-attach-row {
  display: flex;
  gap: 12px;
}
.se-attach-col {
  flex: 1;
  min-width: 0;
}
@media (max-width: 640px) {
  .se-modal { max-width: 98vw !important; }
  .se-row-2, .se-attach-row { flex-direction: column; }
}

/* ========================= Email Dropzone ========================= */
#seDropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #f8fafc;
}
#seDropzone:hover, #seDropzone:focus-visible {
  border-color: #818cf8;
  background: #eef2ff;
}
#seDropzone.dragover {
  border-color: #4f46e5;
  background: #e0e7ff;
}

#seFileList {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.se-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  animation: seFileIn 0.2s ease;
}
@keyframes seFileIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.se-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
}
.se-file-icon.pdf { background: #ef4444; }
.se-file-icon.doc { background: #2563eb; }
.se-file-icon.xls { background: #16a34a; }
.se-file-icon.img { background: #f59e0b; }
.se-file-icon.zip { background: #8b5cf6; }
.se-file-icon.other { background: #64748b; }
.se-file-info {
  flex: 1;
  min-width: 0;
}
.se-file-name {
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.se-file-size {
  color: #94a3b8;
  font-size: 11px;
}
.se-file-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.se-file-remove:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ========================= Responsive ========================= */
@media (max-width: 768px) {
  .header-bar {
    padding: 0 16px;
    height: 52px;
  }
  .header-title {
    font-size: 1rem;
  }
  .page-content {
    padding: 62px 14px 32px;
  }
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .controls-left {
    flex-direction: column;
  }
  .search-wrapper {
    max-width: none;
    min-width: 0;
  }
  .filter-select {
    width: 100%;
  }
  .controls-right {
    justify-content: flex-end;
  }
  .table-wrapper {
    border-radius: var(--radius-sm);
  }
  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }
  .detail-header-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }
  .detail-actions {
    flex-wrap: wrap;
  }
  .detail-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .kv-grid {
    grid-template-columns: 1fr;
  }
  .nota-form {
    flex-direction: column;
    align-items: stretch;
  }
  .nota-form .btn {
    align-self: flex-end;
  }
  .section-card {
    padding: 16px;
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 480px) {
  .header-user { display: none; }
  .pagination { gap: 8px; }
  .pagination-info { font-size: 0.78rem; }
  .detail-client-name { font-size: 1.1rem; }
  .detail-actions .btn { font-size: 0.78rem; }
}

/* Edit email button */
.btn-edit-email { background:none; border:none; cursor:pointer; font-size:0.85em; padding:2px 4px; opacity:0.6; transition:opacity 0.2s; }
.btn-edit-email:hover { opacity:1; }

/* ========================= Sub-module Navigation ========================= */
.submodule-nav {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 99;
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.submodule-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.submodule-tab:hover { color: var(--text-secondary); }
.submodule-tab.active {
  color: var(--accent-indigo);
  border-bottom-color: var(--accent-indigo);
}
.submodule-tab .ico { font-size: 1.1em; }

/* Offset page-content for sub-nav */
#moduleCampana .page-content,
#moduleInmuebles .page-content,
#moduleCoverLetter .page-content {
  padding-top: 110px;
}

/* Campaña controls allow wrapping */
#moduleCampana .controls-bar {
  flex-wrap: wrap;
  gap: 10px;
}
#moduleCampana .controls-left {
  flex-wrap: wrap;
  gap: 8px;
}
#moduleCampana .page-content {
  max-width: 1500px;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* ========================= Campaña Stats Cards ========================= */
.stats-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  min-width: 100px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.1); }
.stat-card--active { box-shadow: 0 0 0 2px var(--accent-indigo); }
.stat-card--total.stat-card--active { box-shadow: 0 0 0 2px var(--accent-indigo), inset 0 0 0 1px rgba(255,255,255,.3); }
.stat-card--total {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: #fff;
}
.stat-card--total .stat-label { color: rgba(255,255,255,0.8); }
.stat-number { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

/* ========================= Campaña Table ========================= */
.campana-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 0 1 auto;
  min-height: 300px;
}
.campana-table {
  min-width: 1200px;
  border-collapse: separate;
  border-spacing: 0;
}
.campana-table th {
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-page);
}
.campana-table th,
.campana-table td {
  white-space: nowrap;
}
.campana-table .td-name { max-width: 150px; white-space: normal; line-height: 1.3; }
.campana-table .td-email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.campana-table .td-importe { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; }
.campana-table .td-notas { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campana-table .th-actions,
.campana-table .td-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--bg-card);
  box-shadow: -2px 0 4px rgba(0,0,0,0.06);
}
.campana-table .th-actions {
  z-index: 3;
  background: var(--bg-page);
}
.campana-table tbody tr:nth-child(even) .td-actions { background: #f8fafc; }
.campana-table tbody tr:hover .td-actions { background: #f1f5f9; }
.campana-table .td-enc-click {
  color: var(--accent-indigo);
  cursor: pointer;
}
.campana-table .td-enc-click:hover {
  background: rgba(99,102,241,0.06);
}
.campana-table .td-sup-click {
  color: #0d9488;
  cursor: pointer;
}
.campana-table .td-sup-click:hover {
  background: rgba(13,148,136,0.06);
}
.campana-table .action-btns { flex-wrap: wrap; width: 104px; }
.campana-table tr.vinc-group > td:first-child { border-left: 3px solid #93c5fd; }
.campana-table tr.vinc-padre_hijo > td:first-child { border-left: 3px solid #a5b4fc; }
.vinc-separator td { padding: 0 16px !important; height: 18px; border: none !important; background: transparent !important; }
.vinc-separator:hover td { background: transparent !important; }
.vinc-sep-icon { font-size: 11px; color: #60a5fa; letter-spacing: 0.5px; }
.vinc-sep-icon--padre_hijo { color: #818cf8; }

/* Vinculo chips */
.vinc-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:12px;font-size:12px;margin:2px 4px 2px 0;background:#eff6ff;color:#1e40af;border:1px solid #bfdbfe}
.vinc-chip--padre_hijo{background:#f5f3ff;color:#5b21b6;border-color:#ddd6fe}
.vinc-chip-label{font-weight:600;font-size:11px;text-transform:uppercase;opacity:.7}
.vinc-chip-x{background:none;border:none;cursor:pointer;font-size:16px;line-height:1;color:#94a3b8;padding:0 0 0 2px}
.vinc-chip-x:hover{color:#ef4444}

/* Vinculo search dropdown */
.vinc-search-results{position:absolute;top:100%;left:0;right:0;background:#fff;border:1px solid #e2e8f0;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.1);max-height:200px;overflow-y:auto;z-index:50}
.vinc-search-item{padding:8px 12px;cursor:pointer;font-size:13px}
.vinc-search-item:hover{background:#f1f5f9}
.vinc-search-item[data-id]:active{background:#e0e7ff}

/* ========================= Inmuebles Table ========================= */
#moduleInmuebles .page-content {
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.inmuebles-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 0 1 auto;
  min-height: 300px;
}
.inmuebles-table {
  border-collapse: separate;
  border-spacing: 0;
}
.inmuebles-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-page);
}
.inmuebles-table .th-actions,
.inmuebles-table .td-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--bg-card);
  box-shadow: -2px 0 4px rgba(0,0,0,0.06);
}
.inmuebles-table .th-actions {
  z-index: 3;
  background: var(--bg-page);
}
.inmuebles-table tbody tr:nth-child(even) .td-actions { background: #f8fafc; }
.inmuebles-table tbody tr:hover .td-actions { background: #f1f5f9; }

/* ========================= Campaña Badges ========================= */
.badge--campana-estado,
.badge--campana-fact {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ========================= Inline Select Dropdown ========================= */
.inline-select-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}
.inline-select-option {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  transition: background var(--transition);
}
.inline-select-option:hover { background: var(--accent-indigo-light); }
.inline-select-option.active {
  background: var(--accent-indigo);
  color: #fff;
}

/* ========================= Edit Cliente Modal ========================= */
.modal-box--lg {
  width: 700px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}
.modal-header .btn-icon {
  width: auto;
  height: auto;
  border: none;
  font-size: 1.4rem;
}
.modal-form {
  padding: 20px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group--wide { grid-column: 1 / -1; }
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: border-color var(--transition);
  background: var(--bg-card);
  color: var(--text-primary);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
textarea.form-input { resize: vertical; }
.modal-form .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ========================= Facturar Autocomplete ========================= */
.fac-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1001;
}
.fac-ac-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background var(--transition);
}
.fac-ac-item:hover { background: var(--accent-indigo-light); }
.fac-ac-item.selected { background: var(--accent-indigo); color: #fff; }
.fac-ac-nif { font-size: 0.78rem; color: var(--text-muted); }
.fac-ac-item.selected .fac-ac-nif { color: rgba(255,255,255,0.7); }
.fac-ac-empty { padding: 10px 14px; font-size: 0.85rem; color: var(--text-muted); }

.form-input.has-selection {
  background: var(--accent-indigo-light);
  border-color: var(--accent-indigo);
  font-weight: 600;
}

/* Nuevo cliente sub-form */
.nuevo-cliente-form {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}
.nc-contacto-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.nc-contacto-row select { width: 120px; }
.nc-contacto-row input { flex: 1; }
.nc-contacto-row .btn-icon { flex-shrink: 0; }

/* ========================= Documentos Modal ========================= */
.modal-box--xl {
  width: 95vw;
  max-width: 1400px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.docs-section {
  margin-bottom: 16px;
}
.docs-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}
.doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-page);
  margin-bottom: 4px;
}
.doc-row-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 160px;
}
.doc-row-file {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-row-empty {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}
.doc-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.doc-row-actions .btn { font-size: 0.75rem; padding: 4px 10px; }
.doc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.doc-dot--ok { background: #48bb78; }
.doc-dot--empty { background: var(--border); }

/* Docs layout: list left, viewer right */
.docs-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.docs-list-panel {
  flex: 0 0 auto;
  width: 100%;
  overflow-y: auto;
  transition: width 0.2s ease;
}
.docs-layout .doc-viewer:not(.hidden) ~ .docs-list-panel,
.docs-layout .docs-list-panel:has(~ .doc-viewer:not(.hidden)) {
  width: 420px;
  min-width: 420px;
  flex-shrink: 0;
}

/* Doc viewer (PDF inline, side panel) */
.doc-viewer {
  border-left: 1px solid var(--border);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.doc-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-page);
  flex-shrink: 0;
}
.doc-viewer-frame {
  flex: 1;
  border: none;
  width: 100%;
  min-height: 0;
}

@media (max-width: 900px) {
  .docs-layout { flex-direction: column; }
  .docs-layout .docs-list-panel:has(~ .doc-viewer:not(.hidden)) { width: 100%; min-width: 0; }
  .doc-viewer { border-left: none; border-top: 1px solid var(--border); min-height: 400px; }
}

/* Indicator dot on Docs button */
.btn-icon-with-dot { position: relative; }
.btn-icon-with-dot .dot-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #48bb78;
  border: 1px solid var(--bg-card);
}

/* ========================= Sortable Column Headers ========================= */
.campana-table th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 20px;
}
.campana-table th.sortable:hover { color: var(--accent-indigo); }
.sort-arrow {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  opacity: 0.3;
}
.campana-table th.sort-active .sort-arrow { opacity: 1; color: var(--accent-indigo); }

/* ========================= Column Config Modal ========================= */
.col-config-list { max-height: 400px; overflow-y: auto; }
.col-config-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  cursor: grab;
  transition: background var(--transition);
}
.col-config-item:hover { background: var(--bg-page); }
.col-config-item.dragging { opacity: 0.5; background: var(--accent-indigo-light); }
.col-config-item .drag-handle {
  color: var(--text-muted);
  font-size: 1rem;
  cursor: grab;
  flex-shrink: 0;
}
.col-config-item label {
  flex: 1;
  font-size: 0.88rem;
  cursor: pointer;
}
.col-config-item input[type="checkbox"] { flex-shrink: 0; }

/* ========================= Cover-Letter Wizard ========================= */
.cl-stepper {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
}
.cl-step {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-page);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}
.cl-step.active { background: var(--accent-indigo); color: #fff; border-color: var(--accent-indigo); }
.cl-step.done { background: var(--accent-indigo-light); color: var(--accent-indigo); border-color: var(--accent-indigo); }
.cl-step-num {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  font-size: 0.75rem;
  margin-right: 4px;
}
.cl-phase h3 { font-size: 1.05rem; margin-bottom: 16px; }
.cl-client-info {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-top: 12px;
  max-width: 500px;
}
.cl-docs-check {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 500px;
}
.cl-doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-page);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}
.cl-doc-item .doc-dot { flex-shrink: 0; }
.cl-doc-item .cl-doc-label { flex: 1; font-weight: 600; }
.cl-doc-item .cl-doc-status { font-size: 0.8rem; color: var(--text-muted); }
.cl-doc-item.missing { border-color: #e53e3e; background: #fff5f5; }
.cl-doc-item.missing .cl-doc-status { color: #e53e3e; font-weight: 600; }
.cl-contrib-summary {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.cl-sections-list { max-width: 600px; }
.cl-section-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.cl-section-item label { flex: 1; font-size: 0.88rem; cursor: pointer; }

/* Cover-Letter: doc selection with checkboxes */
.cl-doc-item input[type="checkbox"] { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.cl-doc-item .cl-doc-name { flex: 1; font-size: 0.82rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.cl-doc-item .cl-doc-size { font-size: 0.75rem; color: var(--text-muted); }
.cl-doc-item .cl-doc-delete { background: none; border: none; color: #e53e3e; cursor: pointer; font-size: 0.85rem; padding: 2px 6px; border-radius: 4px; }
.cl-doc-item .cl-doc-delete:hover { background: #fff5f5; }

/* Cover-Letter: Editor topbar */
.cl-editor-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--bg-page); border: 1px solid var(--border);
  border-radius: var(--radius-xs); margin-bottom: 8px;
}

/* Cover-Letter: Collabora iframe */
.cl-collabora-frame { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: var(--radius-xs); }

/* Cover-Letter: Chat FAB */
.cl-chat-toggle {
  position: fixed; bottom: 80px; right: 24px; height: 44px;
  border-radius: 22px; background: var(--accent-indigo); color: #fff;
  border: none; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.15);
  display: flex; align-items: center; gap: 8px; z-index: 200;
  padding: 0 18px; font-size: 13px; font-weight: 600; transition: transform .15s;
}
.cl-chat-toggle:hover { transform: scale(1.05); }
.cl-chat-toggle.hidden { display: none; }
.cl-chat-toggle.attention { animation: cl-fab-attention .6s ease; }
@keyframes cl-fab-attention { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }

/* Cover-Letter: Chat overlay */
.cl-chat-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 300; justify-content: flex-end;
}
.cl-chat-overlay.open { display: flex; }
.cl-chat-panel {
  width: 520px; max-width: 100vw; height: 100%;
  background: var(--bg-page); display: flex; flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,.1);
}
.cl-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.cl-chat-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.cl-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.cl-chat-msg {
  max-width: 85%; padding: 10px 14px; border-radius: 12px;
  font-size: 0.88rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.cl-chat-msg.user { align-self: flex-end; background: var(--accent-indigo); color: #fff; border-bottom-right-radius: 4px; }
.cl-chat-msg.assistant { align-self: flex-start; background: var(--bg-secondary, #f1f5f9); color: var(--text-primary); border-bottom-left-radius: 4px; }
.cl-chat-msg.assistant.loading { opacity: .6; font-style: italic; }
.cl-chat-input-row {
  display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end;
}
.cl-chat-input {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 0.88rem; font-family: inherit; max-height: 120px;
  outline: none; transition: border-color .15s;
}
.cl-chat-input:focus { border-color: var(--accent-indigo); }
.cl-chat-send {
  background: var(--accent-indigo); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.cl-chat-send:disabled { opacity: .5; cursor: not-allowed; }

/* ========================= Responsive: Campaña ========================= */
@media (max-width: 768px) {
  .submodule-nav { padding: 0 12px; }
  .submodule-tab { padding: 8px 12px; font-size: 0.82rem; }
  .stats-cards { gap: 6px; }
  .stat-card { padding: 8px 10px; min-width: 70px; }
  .stat-number { font-size: 1.1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-box--lg { width: 95vw; }
  #moduleCampana .page-content,
  #moduleInmuebles .page-content { padding-top: 100px; }
}

/* Renta Web dialog */
.rw-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:flex;align-items:center;justify-content:center;z-index:9999;opacity:0;transition:opacity .2s}
.rw-overlay.show{opacity:1}
.rw-dialog{background:#fff;border-radius:10px;padding:24px 28px;max-width:420px;width:90vw;box-shadow:0 8px 30px rgba(0,0,0,.18)}
.rw-btn{padding:8px 20px;border-radius:6px;border:none;font-size:14px;font-weight:600;cursor:pointer;transition:background .15s}
.rw-cancel{background:#e5e7eb;color:#374151}.rw-cancel:hover{background:#d1d5db}
.rw-ok{background:#2563eb;color:#fff}.rw-ok:hover{background:#1d4ed8}

/* ============ Styled Dialogs ============ */
.dlgOverlay{position:fixed;inset:0;background:rgba(15,23,42,.6);display:flex;align-items:center;justify-content:center;z-index:10001;padding:20px;animation:dlgFade .15s ease}
.dlgBox{background:#fff;border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,.25);padding:28px 32px;max-width:400px;width:100%;text-align:center;animation:dlgSlide .2s ease}
.dlgMsg{font-size:15px;color:#374151;line-height:1.5;margin-bottom:20px;word-break:break-word}
.dlgActions{display:flex;gap:10px;justify-content:center}
.dlgBtn{padding:10px 24px;border-radius:10px;font-size:14px;font-weight:600;cursor:pointer;border:none;transition:all .15s ease}
.dlgBtn--cancel{background:#f3f4f6;color:#374151;border:1px solid #e5e7eb}
.dlgBtn--cancel:hover{background:#e5e7eb}
.dlgBtn--danger{background:#dc2626;color:#fff}.dlgBtn--danger:hover{background:#b91c1c}
@keyframes dlgFade{from{opacity:0}to{opacity:1}}
@keyframes dlgSlide{from{transform:translateY(8px);opacity:0}to{transform:translateY(0);opacity:1}}

/* ============ Email Template Chooser ============ */
.etChooserBox{background:#fff;border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,.25);padding:28px 32px;max-width:540px;width:100%;animation:dlgSlide .2s ease}
.etTitle{font-size:1.05rem;font-weight:700;color:var(--text-primary);margin:0 0 4px}
.etSubtitle{font-size:.85rem;color:var(--text-muted);margin:0 0 20px}
.etOptions{display:flex;gap:12px;margin-bottom:16px}
.etOption{flex:1;display:flex;flex-direction:column;align-items:center;gap:8px;padding:20px 12px;border:2px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-card);cursor:pointer;transition:all var(--transition);text-align:center}
.etOption:hover{border-color:var(--accent-indigo);background:var(--accent-indigo-light)}
.etOption .ico{width:28px;height:28px;color:var(--accent-indigo)}
.etOption-label{font-size:.85rem;font-weight:600;color:var(--text-primary)}
.etOption-desc{font-size:.73rem;color:var(--text-muted);line-height:1.4}
.etForm{animation:dlgSlide .2s ease}
.etFormTitle{font-size:.95rem;font-weight:700;color:var(--accent-indigo);margin:0 0 16px;padding-bottom:12px;border-bottom:1px solid var(--border)}
.etFormFields{display:flex;flex-direction:column;gap:14px}
.etFormFields .form-group{margin:0}
.etFormFields label{font-size:.8rem;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:.03em;margin-bottom:4px;display:block}
.etRadioGroup{display:flex;gap:16px}
.etRadio{display:flex;align-items:center;gap:6px;font-size:.9rem;cursor:pointer;color:var(--text-primary)}
.etRadio input[type="radio"]{accent-color:var(--accent-indigo)}
.etImporteWrap{display:flex;align-items:center;gap:8px}
.etImporteWrap .form-input{flex:1}
.etImporteSuffix{font-size:.85rem;font-weight:600;color:var(--text-muted)}
.etActions{display:flex;gap:10px;justify-content:flex-end;margin-top:20px}
.etBtn--generate{padding:10px 24px;border-radius:10px;font-size:14px;font-weight:600;cursor:pointer;border:none;background:var(--accent-indigo);color:#fff;transition:all .15s ease}
.etBtn--generate:hover{background:var(--accent-indigo-hover)}
.etCancelRow{display:flex;justify-content:center;border-top:1px solid var(--border);padding-top:16px}
@media(max-width:540px){.etOptions{flex-direction:column}.etChooserBox{max-width:95vw;padding:20px 16px}}
