/* =================================
   COMPONENTS.CSS
   DeloneTech Design System v2
   ================================= */

/* Hide number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* =================================
   Buttons
   ================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.52rem 1.1rem;
  font-size: 0.855rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none !important;
  line-height: 1.4;
  white-space: nowrap;
  font-family: var(--font);
  letter-spacing: -0.01em;
  position: relative;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — crisp, high contrast */
.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.btn-primary:hover:not(:disabled) {
  background: var(--btn-primary-hover-bg);
  border-color: var(--btn-primary-hover-bg);
  color: var(--btn-primary-text);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

/* Google OAuth — botón secundario con icono */
.btn-google {
  background: var(--bg-elevated, #2a2a2e);
  color: var(--text-primary, #f0f0f0);
  border: 1px solid var(--border-default, #444);
}
.btn-google:hover {
  background: var(--bg-hover, #353539);
  border-color: var(--border-bright, #555);
  color: var(--text-primary, #f0f0f0);
}
.btn-google .btn-google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Divisor "o inicia sesión con email" en auth */
.auth-divider {
  text-align: center;
  margin: 0.75rem 0 1rem;
  font-size: 0.8rem;
  color: var(--text-tertiary, #888);
}
.auth-divider span {
  padding: 0 0.5rem;
}

/* Secondary — bordered ghost */
.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border-color: var(--btn-secondary-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--btn-secondary-hover-bg);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

/* Accent — the orange CTA */
.btn-accent {
  background: var(--gradient-accent);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(212,118,44,0.3);
}
.btn-accent:hover:not(:disabled) {
  box-shadow: var(--accent-glow), 0 4px 16px rgba(212,118,44,0.3);
  transform: translateY(-1px);
  color: white;
}
.btn-accent:active:not(:disabled) { transform: translateY(0); }

/* Danger */
.btn-danger {
  background: transparent;
  color: var(--color-error);
  border-color: rgba(239,68,68,0.25);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.5);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Sizes */
.btn-xs {
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  border-radius: var(--radius-xs);
}
.btn-xs svg { width: 11px; height: 11px; }

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.775rem;
}
.btn-sm svg { width: 12px; height: 12px; }

/* Segment cards: botones y texto contenidos en la card, botones alineados abajo */
.segment-card {
  display: flex;
  flex-direction: column;
  min-width: 0; /* permite que el contenido no desborde en grid */
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.segment-card .btn-segment-action {
  margin-top: auto; /* ancla el botón al fondo para que todos queden a la misma altura */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-decoration: none;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.segment-card .btn-segment-action:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--accent);
}
.segment-card .btn-segment-action svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.btn-lg {
  padding: 0.7rem 1.5rem;
  font-size: 0.9375rem;
  border-radius: var(--radius);
}

.btn-xl {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius);
}

/* =================================
   Forms
   ================================= */
.form-section { margin-bottom: 1.75rem; }

.form-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: 0.01em;
}

.form-group { margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.875rem;
  font-size: 0.875rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--input-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
  appearance: none;
  line-height: 1.45;
}

.form-control:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px rgba(212, 118, 44, 0.12);
}

.form-control::placeholder { color: var(--input-placeholder); }

select.form-control {
  background-image: 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='%23606058' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 88px;
}

.form-error {
  font-size: 0.775rem;
  color: var(--color-error);
  margin-top: 0.25rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

/* =================================
   Cards
   ================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-header-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.015em;
}

.card-body { padding: 1.5rem; }

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* =================================
   Modals
   ================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  overflow-y: auto;
}

/* Animated modal overlay (form modals) */
.modal-overlay.modal-animated {
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  opacity: 0;
  visibility: hidden;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, opacity 0.01s linear 0.35s, visibility 0.01s linear 0.35s;
}
.modal-overlay.modal-animated.is-visible {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  opacity: 1;
  visibility: visible;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, opacity 0.01s linear 0s, visibility 0.01s linear 0s;
}

dialog.modal:not([open]) {
  display: none;
}

.modal {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  margin: auto;
  animation: fade-in 0.2s ease both;
}

/* Form modal animations */
.modal-animated > .modal {
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  animation: none;
}
.modal-animated.is-visible > .modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.modal-animated.is-closing > .modal {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.modal-animated.is-closing {
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  transition: background 0.2s ease, backdrop-filter 0.2s ease, opacity 0.01s linear 0.22s, visibility 0.01s linear 0.22s;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-bright);
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.modal-body {
  padding: 1.25rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-body .form-group {
  margin-bottom: 1rem;
}

.modal-body .form-group:last-child {
  margin-bottom: 0;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-bright);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

/* =================================
   Badges
   ================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.badge-warning { background: rgba(245,158,11,0.12); color: #fbbf24; border-color: rgba(245,158,11,0.2); }
.badge-success { background: rgba(34,197,94,0.12); color: #4ade80; border-color: rgba(34,197,94,0.2); }
.badge-info    { background: rgba(59,130,246,0.12); color: #60a5fa; border-color: rgba(59,130,246,0.2); }
.badge-danger  { background: rgba(239,68,68,0.12); color: #f87171; border-color: rgba(239,68,68,0.2); }

/* Status badges */
.badge-nuevo,
.badge-abierto      { background: rgba(59,130,246,0.12); color: #60a5fa; border-color: rgba(59,130,246,0.2); }
.badge-contactado,
.badge-en_progreso  { background: var(--accent-muted); color: var(--accent); border-color: rgba(212,118,44,0.25); }
.badge-propuesta,
.badge-enviado,
.badge-media        { background: rgba(245,158,11,0.12); color: #fbbf24; border-color: rgba(245,158,11,0.2); }
.badge-ganado,
.badge-pagada,
.badge-aceptado,
.badge-resuelto     { background: rgba(34,197,94,0.12); color: #4ade80; border-color: rgba(34,197,94,0.2); }
.badge-perdido,
.badge-vencida,
.badge-rechazado,
.badge-urgente      { background: rgba(239,68,68,0.12); color: #f87171; border-color: rgba(239,68,68,0.2); }
.badge-cerrado,
.badge-cancelada,
.badge-borrador,
.badge-baja         { background: var(--bg-elevated); color: var(--text-tertiary); border-color: var(--border-color); }
.badge-alta         { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: rgba(245,158,11,0.3); }
.badge-primary      { background: var(--accent-muted); color: var(--accent); border-color: rgba(212,118,44,0.25); }
.badge-neutral      { background: var(--bg-elevated); color: var(--text-secondary); border-color: var(--border-color); }

[data-theme="light"] .badge-nuevo,
[data-theme="light"] .badge-abierto      { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
[data-theme="light"] .badge-contactado,
[data-theme="light"] .badge-en_progreso  { background: #fff7ed; color: #c46d28; border-color: #fed7aa; }
[data-theme="light"] .badge-propuesta,
[data-theme="light"] .badge-enviado,
[data-theme="light"] .badge-media        { background: #fffbeb; color: #b45309; border-color: #fde68a; }
[data-theme="light"] .badge-ganado,
[data-theme="light"] .badge-pagada,
[data-theme="light"] .badge-aceptado,
[data-theme="light"] .badge-resuelto     { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
[data-theme="light"] .badge-perdido,
[data-theme="light"] .badge-vencida,
[data-theme="light"] .badge-rechazado,
[data-theme="light"] .badge-urgente      { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
[data-theme="light"] .badge-cerrado,
[data-theme="light"] .badge-cancelada,
[data-theme="light"] .badge-borrador,
[data-theme="light"] .badge-baja         { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
[data-theme="light"] .badge-alta         { background: #fffbeb; color: #d97706; border-color: #fde68a; }
[data-theme="light"] .badge-primary      { background: #fff7ed; color: #c46d28; border-color: #fed7aa; }
[data-theme="light"] .badge-neutral      { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
[data-theme="light"] .badge-warning      { background: #fffbeb; color: #b45309; border-color: #fde68a; }
[data-theme="light"] .badge-success      { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
[data-theme="light"] .badge-info         { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
[data-theme="light"] .badge-danger       { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

/* Inline code / slug — usa variables para modo oscuro y claro */
.code-inline {
  font-size: 0.78rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono, ui-monospace, monospace);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
[data-theme="light"] .code-inline {
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-primary, #0f172a);
  border-color: var(--border-color, #e2e8f0);
}

/* =================================
   Tables
   ================================= */
.table-wrapper { overflow-x: auto; }

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

.table th {
  padding: 0.75rem 1rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-elevated); }

.table-link {
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
}
.table-link:hover { color: var(--accent); text-decoration: none; }

/* =================================
   Pagination
   ================================= */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  justify-content: space-between;
}

.pagination-info {
  font-size: 0.775rem;
  color: var(--text-tertiary);
}

.pagination-links { display: flex; gap: 0.2rem; }

.page-btn {
  min-width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
  padding: 0 0.4rem;
}
.page-btn:hover { border-color: var(--border-bright); color: var(--text-primary); text-decoration: none; }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn.disabled { opacity: 0.3; pointer-events: none; }

/* =================================
   Alerts
   ================================= */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.855rem;
  margin-bottom: 1rem;
  position: relative;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

.alert-close {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-tertiary);
  line-height: 1;
}
.alert-close:hover { color: var(--text-primary); }
.alert-close svg { width: 13px; height: 13px; }

.alert-success { border-color: rgba(34,197,94,0.25);  background: rgba(34,197,94,0.07); }
.alert-danger  { border-color: rgba(239,68,68,0.25);  background: rgba(239,68,68,0.07); }
.alert-warning { border-color: rgba(245,158,11,0.25); background: rgba(245,158,11,0.07); }
.alert-info    { border-color: rgba(59,130,246,0.25); background: rgba(59,130,246,0.07); }

/* =================================
   Empty state
   ================================= */
.empty-state {
  text-align: center;
  padding: 3rem 2rem 3.5rem;
  color: var(--text-tertiary);
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg { width: 22px; height: 22px; stroke: var(--text-tertiary); }

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.empty-state p {
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  max-width: 28em;
  margin-left: auto;
  margin-right: auto;
}

.empty-state .btn { margin-top: 0.25rem; }

.empty-state-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 1rem;
  line-height: 1.4;
}

/* =================================
   Filter bar
   ================================= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.filter-bar .form-control { width: auto; min-width: 180px; }

.filter-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.filter-pill {
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}

.filter-pill:hover {
  border-color: var(--border-bright);
  color: var(--text-primary);
  text-decoration: none;
}

.filter-pill.active {
  background: var(--accent-muted);
  border-color: rgba(212,118,44,0.35);
  color: var(--accent);
}

/* =================================
   Avatar
   ================================= */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 0.6rem; }
.avatar-lg { width: 38px; height: 38px; font-size: 0.82rem; }

/* =================================
   Input group
   ================================= */
.input-group { display: flex; }
.input-group .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
}
.input-group .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* =================================
   Section
   ================================= */
.section { margin-bottom: 1.75rem; }

.section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
}

/* =================================
   Detail grid
   ================================= */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .form-row    { grid-template-columns: 1fr; }
}

/* Meta list */
.meta-list { list-style: none; padding: 0; margin: 0; }

.meta-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  gap: 0.75rem;
  min-height: 2.4rem;
}

.meta-list li:last-child { border-bottom: none; }

.meta-list .meta-label {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  font-weight: 500;
  flex-shrink: 0;
}

.meta-list .meta-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.meta-list .meta-value.highlight {
  font-weight: 700;
  color: var(--text-primary);
}

/* =================================
   Help text
   ================================= */
.help-text {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin-top: 0.25rem;
}

.help-inline {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-left: 0.35rem;
}

/* =================================
   Landing page
   ================================= */
.landing { background: var(--bg-primary); color: var(--text-primary); }

.landing-container { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }

.landing-hero {
    padding: 6rem 0 4rem;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}
.landing-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}
.landing-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}
.landing-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.landing-cta .btn-lg { padding: .875rem 2rem; font-size: 1.05rem; border-radius: var(--radius-lg); }
.landing-cta .btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.landing-cta .btn-outline:hover { background: var(--bg-secondary); }

.landing-trust {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.landing-trust-text { color: var(--text-secondary); font-size: .9rem; margin: 0; }

.landing-features { padding: 5rem 0; }
.landing-section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: .5rem;
}
.landing-section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}
.landing-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.landing-feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: border-color .2s, transform .2s;
}
.landing-feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.landing-feature-icon {
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-muted, rgba(99,102,241,.12));
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    color: var(--accent);
}
.landing-feature-card h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.landing-feature-card p { color: var(--text-secondary); font-size: .95rem; line-height: 1.5; margin: 0; }

.landing-how { padding: 5rem 0; background: var(--bg-secondary); }
.landing-steps { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }
.landing-step { text-align: center; max-width: 280px; }
.landing-step-number {
    width: 48px; height: 48px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.2rem;
    margin: 0 auto 1rem;
}
.landing-step h3 { margin-bottom: .5rem; }
.landing-step p { color: var(--text-secondary); font-size: .95rem; }

.landing-pricing-preview { padding: 5rem 0; text-align: center; }

.landing-final-cta {
    padding: 5rem 0;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}
.landing-final-cta h2 { font-size: 2rem; margin-bottom: .5rem; }
.landing-final-cta p { color: var(--text-secondary); margin-bottom: 2rem; font-size: 1.1rem; }

.landing-footer {
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border-color);
}
.landing-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}
.landing-footer-brand p { color: var(--text-secondary); font-size: .9rem; margin-top: .25rem; }
.landing-footer-links { display: flex; gap: 1.5rem; }
.landing-footer-links a { color: var(--text-secondary); text-decoration: none; font-size: .9rem; }
.landing-footer-links a:hover { color: var(--text-primary); }
.landing-footer-copy { color: var(--text-secondary); font-size: .8rem; text-align: center; }

/* =================================
   Skeleton loading
   ================================= */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-tertiary) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text {
  height: 0.9rem;
  width: 80%;
  margin-bottom: 0.5rem;
}
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 60%; }
.skeleton-heading {
  height: 1.4rem;
  width: 50%;
  margin-bottom: 0.75rem;
}
.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
}
.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.skeleton-btn {
  height: 36px;
  width: 100px;
  border-radius: var(--radius-sm);
}

/* ── Password strength indicator ──────────── */
.password-strength { height: 4px; border-radius: 2px; margin-top: .25rem; transition: width .3s, background .3s; }
.password-strength.weak { width: 33%; background: var(--color-danger, #ef4444); }
.password-strength.medium { width: 66%; background: var(--color-warning, #f59e0b); }
.password-strength.strong { width: 100%; background: var(--color-success, #22c55e); }

/* ── Responsive tables ────────────────────── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Scroll shadow to indicate overflow */
    background:
        linear-gradient(to right, var(--bg-card) 30%, transparent) left center,
        linear-gradient(to left, var(--bg-card) 30%, transparent) right center,
        radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.2), transparent) left center,
        radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.2), transparent) right center;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}
@media (max-width: 768px) {
    .card > .table,
    .card .table-wrapper > .table {
        min-width: 600px;
    }
    .form-row { flex-direction: column; }
    .page-header { flex-direction: column; gap: 1rem; align-items: flex-start !important; }
}

/* ── Touch-friendly buttons on mobile ─────── */
@media (max-width: 768px) {
    .btn { min-height: 44px; min-width: 44px; }
    .btn-sm { min-height: 36px; }
}

/* ── Notification badge pulse ─────────────── */
.notif-badge {
    animation: pulse-glow 2.5s ease-in-out infinite;
}

/* ── Table row hover highlight ────────────── */
.table tbody tr {
    transition: background var(--transition);
}
.table tbody tr:hover {
    background: var(--bg-elevated);
}

/* ── Card entrance animation ──────────────── */
.card {
    animation: fade-in 0.2s ease both;
}

/* ── Input focus ring override (more visible) */
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

/* ── Empty state animation ────────────────── */
.empty-state {
    animation: fade-in 0.3s ease both;
}

/* ── Page header animate ──────────────────── */
.page-header {
    animation: fade-in 0.18s ease both;
}

/* ── Drag-over state for file inputs ─────── */
.drop-zone {
    border: 2px dashed var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    transition: all var(--transition);
    cursor: pointer;
}
.drop-zone.drag-over,
.drop-zone:hover {
    border-color: var(--accent);
    background: var(--accent-muted);
    color: var(--accent);
}


/* =================================
   AI Topbar Button
   ================================= */
.ai-topbar-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, var(--color-accent), #8b5cf6);
  border: none;
  border-radius: 999px;
  padding: 0.3rem 0.85rem 0.3rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.ai-topbar-btn:hover { opacity: 0.85; }

/* =================================
   Chat Widget
   ================================= */
#chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1040;
  font-family: var(--font);
}

#chat-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, #e07b30 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(196,109,40,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
#chat-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(196,109,40,0.55); }
#chat-toggle.open { background: var(--bg-elevated); color: var(--text-secondary); box-shadow: 0 2px 8px rgba(0,0,0,0.25); }

#chat-window {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 360px;
  height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  flex-direction: column;
  overflow: hidden;
  animation: chat-pop 0.18s ease;
}
@keyframes chat-pop {
  from { opacity:0; transform: scale(0.95) translateY(8px); }
  to   { opacity:1; transform: scale(1)    translateY(0); }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 0.6rem; }
.chat-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #e07b30);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.chat-header-title { font-size: 0.875rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.chat-header-status { font-size: 0.72rem; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; margin-top: 1px; }
.chat-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-success); display: inline-block; }
.chat-header-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 4px; border-radius: var(--radius-sm);
  display: flex; align-items: center;
  transition: color 0.15s, background 0.15s;
}
.chat-header-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }

.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-base);
  flex-shrink: 0;
}
.chat-tab {
  flex: 1; padding: 0.5rem; font-size: 0.78rem; font-weight: 600;
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.chat-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.chat-tab:hover:not(.active) { color: var(--text-primary); }

.chat-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  scroll-behavior: smooth;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.bot  { justify-content: flex-start; }
.chat-bubble {
  max-width: 82%;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.bot .chat-bubble {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Typing animation */
.chat-typing-bubble { display: flex; align-items: center; gap: 4px; padding: 0.55rem 0.75rem !important; }
.chat-typing-bubble span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-tertiary);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.chat-typing-bubble span:nth-child(1) { animation-delay: 0s; }
.chat-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat-chips {
  padding: 0 0.75rem 0.5rem;
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  flex-shrink: 0;
}
.chat-chip {
  font-size: 0.75rem; padding: 0.28rem 0.65rem;
  border: 1px solid var(--border-color); border-radius: 20px;
  background: var(--bg-elevated); color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
  white-space: nowrap;
}
.chat-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }

.chat-input-area {
  display: flex; align-items: flex-end; gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-base);
  flex-shrink: 0;
}
.chat-input {
  flex: 1; resize: none; border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 0.5rem 0.65rem;
  font-size: 0.82rem; font-family: var(--font);
  background: var(--bg-elevated); color: var(--text-primary);
  outline: none; transition: border-color 0.15s;
  min-height: 36px; max-height: 120px; line-height: 1.4;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  border: none; border-radius: var(--radius-md);
  background: var(--accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.chat-send-btn:hover { background: #b5621f; }
.chat-send-btn:active { transform: scale(0.94); }

/* Help list */
.chat-help-list { display: flex; flex-direction: column; gap: 2px; }
.chat-help-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.65rem; border-radius: var(--radius-md);
  font-size: 0.81rem; color: var(--text-primary);
  background: none; border: none; text-align: left;
  font-family: inherit; width: 100%;
  cursor: pointer; transition: background 0.15s;
  text-decoration: none;
}
.chat-help-item:hover { background: var(--bg-elevated); color: var(--accent); }
.chat-help-item svg { flex-shrink: 0; color: var(--text-tertiary); }

@media (max-width: 480px) {
  #chat-window { width: calc(100vw - 24px); right: 0; bottom: 60px; }
}

/* =================================
   Responsive tables → card layout on mobile
   ================================= */
@media (max-width: 600px) {
  .table-responsive table:not(.no-card-layout),
  .table-wrapper table:not(.no-card-layout) {
    border: 0;
  }
  .table-responsive table:not(.no-card-layout) thead,
  .table-wrapper table:not(.no-card-layout) thead {
    display: none;
  }
  .table-responsive table:not(.no-card-layout) tr,
  .table-wrapper table:not(.no-card-layout) tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    background: var(--bg-card);
  }
  .table-responsive table:not(.no-card-layout) td,
  .table-wrapper table:not(.no-card-layout) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border: none;
    font-size: 0.85rem;
  }
  .table-responsive table:not(.no-card-layout) td::before,
  .table-wrapper table:not(.no-card-layout) td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 0.5rem;
    flex-shrink: 0;
  }
}
