/* SAA/ASA Translation KB - Modern Minimalistic Design */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-alt: #f5f6f8;
  --border: #e5e8ed;
  --border-light: #eef1f5;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --accent-subtle: #e0e7ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  /* Pastel palette for softer look */
  --pastel-blue: #dbeafe;
  --pastel-blue-text: #3b82f6;
  --pastel-green: #d1fae5;
  --pastel-green-text: #059669;
  --pastel-amber: #fef3c7;
  --pastel-amber-text: #d97706;
  --pastel-rose: #ffe4e6;
  --pastel-rose-text: #e11d48;
  --pastel-violet: #ede9fe;
  --pastel-violet-text: #7c3aed;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -4px rgba(0,0,0,0.04);
  --transition: 0.15s ease;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== HEADER ========== */
.sticky-top-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.header {
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
}

.header-left { display: flex; align-items: center; gap: 0.75rem; }
.header-icon { width: 1.75rem; height: 1.75rem; color: var(--accent); }
.header h1 { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.subtitle { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; letter-spacing: 0.01em; }
.header-right { display: flex; align-items: center; gap: 0.75rem; }

/* Search */
.search-box { position: relative; }
.search-box input {
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font);
  width: 260px;
  transition: var(--transition);
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.search-icon { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); width: 0.95rem; height: 0.95rem; color: var(--text-muted); }

/* Auth */
#auth-area { display: flex; align-items: center; gap: 0.5rem; }
.user-info { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; background: var(--surface-alt); padding: 0.35rem 0.75rem; border-radius: var(--radius); border: 1px solid var(--border); }
.user-avatar { width: 1.35rem; height: 1.35rem; color: var(--text-muted); }
.user-avatar svg { width: 100%; height: 100%; }
#user-name { font-weight: 500; color: var(--text-secondary); }

/* ========== BUTTONS ========== */
.btn {
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
  font-family: var(--font);
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { background: var(--surface-alt); border-color: var(--text-muted); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }
.btn-login { background: var(--accent); color: white; font-size: 0.78rem; }
.btn-login:hover { background: var(--accent-hover); }
.btn-logout { background: var(--surface-alt); color: var(--text-secondary); border: 1px solid var(--border); font-size: 0.75rem; }
.btn-logout:hover { background: var(--border); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.72rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { width: 0.9rem; height: 0.9rem; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Glossary action buttons - always show all 3 */
.btn-action {
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
}
.btn-action-icon { width: 0.8rem; height: 0.8rem; flex-shrink: 0; }

.btn-confirm {
  background: #f1f5f9;
  color: #b0b8c4;
  border: none;
}
.btn-confirm:hover, .btn-confirm.btn-action-active {
  background: #ecfdf5;
  color: #10b981;
  border: none;
  box-shadow: none;
}

.btn-pending {
  background: #f1f5f9;
  color: #b0b8c4;
  border: none;
}
.btn-pending:hover, .btn-pending.btn-action-active {
  background: #fef9ee;
  color: #f59e0b;
  border: none;
  box-shadow: none;
}

.btn-deprecate {
  background: #f1f5f9;
  color: #b0b8c4;
  border: none;
}
.btn-deprecate:hover, .btn-deprecate.btn-action-active {
  background: #fff1f2;
  color: #f87171;
  border: none;
  box-shadow: none;
}

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  position: relative;
  z-index: 99;
  background: rgba(255,255,255,0.95);
}
.tab {
  padding: 0.75rem 1.15rem;
  border: none;
  background: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font);
}
.tab-icon { width: 0.9rem; height: 0.9rem; opacity: 0.5; }
.tab:hover { color: var(--text-secondary); }
.tab:hover .tab-icon { opacity: 0.7; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab.active .tab-icon { opacity: 1; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 0.2rem;
}

/* ========== CONTENT ========== */
.content { padding: 1.5rem 2rem; max-width: 1400px; margin: 0 auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-header { margin-bottom: 1.25rem; }
.tab-header h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.15rem; }
.tab-description { font-size: 0.82rem; color: var(--text-muted); }

.tab-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; }
.filter-group label { color: var(--text-muted); font-weight: 500; font-size: 0.78rem; }
.filter-group select, .filter-input {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  background: var(--surface);
  font-family: var(--font);
  transition: var(--transition);
  color: var(--text);
}
.filter-group select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}
.filter-input { width: 240px; }

.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.loading-msg { text-align: center; padding: 3rem 1rem; color: var(--text-muted); font-size: 0.85rem; }
.loading-msg.error { color: var(--danger); }

/* ========== DASHBOARD ========== */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-total::before { background: var(--pastel-blue-text); }
.stat-complete::before { background: var(--pastel-green-text); }
.stat-ai-clean::before { background: var(--pastel-green-text); }
.stat-ai-changes::before { background: var(--pastel-amber-text); }
.stat-glossary::before { background: var(--pastel-violet-text); }
.stat-confirmed::before { background: var(--pastel-green-text); }
.stat-pending::before { background: var(--pastel-amber-text); }

.stat-number { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1.2; letter-spacing: -0.02em; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; margin-top: 0.15rem; letter-spacing: 0.01em; }

.dashboard-filter {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
}
.dashboard-filter label { color: var(--text-muted); font-weight: 500; font-size: 0.78rem; }
.dashboard-filter select {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  background: var(--surface);
  font-family: var(--font);
  color: var(--text);
}

#dashboard-table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
}
.dashboard-table thead th {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.dashboard-table tbody td {
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.dashboard-table tbody tr:hover { background: var(--surface-alt); }
.dashboard-table tbody tr:last-child td { border-bottom: none; }

.td-num { text-align: center; color: var(--text-muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.td-title { font-weight: 500; max-width: 220px; font-size: 0.78rem; line-height: 1.4; }
.td-center { text-align: center; }

.doc-type-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 500;
  background: #f1f5f9;
  color: #64748b;
  white-space: nowrap;
}

/* Stage tags - softer pastel colors */
.stage-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}
.stage-complete { background: #d1fae5; color: #059669; }
.stage-ai-clean { background: #d1fae5; color: #059669; }
.stage-ai-changes { background: #fef3c7; color: #d97706; }
.stage-review { background: #ede9fe; color: #7c3aed; }
.stage-pending { background: #f1f5f9; color: #94a3b8; }
.stage-ai-translated { background: #fef3c7; color: #b45309; }

/* Cambios badge - hidden by default now */
.cambios-badge {
  display: none;
}

.check-icon { color: var(--success); font-weight: 700; font-size: 0.85rem; }
.cross-icon { color: var(--text-muted); font-weight: 400; opacity: 0.4; font-size: 0.85rem; }

/* Drive links - EN/ES buttons matching glossary colors */
.td-links { white-space: nowrap; }
.drive-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  letter-spacing: 0.02em;
}
/* EN button - soft blue matching glossary EN label */
.drive-link-en {
  background: #eef2ff;
  color: #6366f1;
}
.drive-link-en:hover { background: #e0e7ff; color: #4f46e5; }
/* ES button - soft amber/warm matching glossary ES label */
.drive-link-es {
  background: #fef9ee;
  color: #d97706;
}
.drive-link-es:hover { background: #fef3c7; color: #b45309; }

/* ========== GLOSSARY ========== */
.glossary-stats-row {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.glossary-table-header {
  display: grid;
  grid-template-columns: 28px 1.2fr 1.2fr minmax(140px, auto) auto;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  margin-top: 0.5rem;
}
.glossary-th {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.glossary-list { display: flex; flex-direction: column; gap: 0; }

.glossary-letter-header {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  margin-top: 0.75rem;
  margin-bottom: 1px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.glossary-letter-header:first-child { margin-top: 0; }

.glossary-card {
  background: var(--surface);
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border);
}
.glossary-card:hover { background: #f9fafb; }
.glossary-card.expanded {
  background: var(--surface);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
  margin: 4px 0;
  z-index: 1;
  position: relative;
  border-right: 1px solid var(--border);
}

.glossary-card.status-confirmed { border-left-color: var(--success); }
.glossary-card.status-pending_review { border-left-color: var(--warning); }
.glossary-card.status-deprecated { border-left-color: var(--danger); opacity: 0.7; }
.glossary-card.status-deprecated:hover { opacity: 1; }

.glossary-row {
  display: grid;
  grid-template-columns: 28px 1.2fr 1.2fr minmax(140px, auto) auto;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  align-items: center;
}
.glossary-col { font-size: 0.82rem; }
.glossary-expand-col { display: flex; align-items: center; justify-content: center; }
.expand-icon { font-size: 0.55rem; color: var(--text-muted); width: 0.85rem; flex-shrink: 0; transition: var(--transition); }

/* EN/ES columns with language labels */
.glossary-en-col {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text);
}
.glossary-es-col {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}
/* Glossary EN label - soft indigo/blue */
.glossary-lang-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.08rem 0.3rem;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  background: #eef2ff;
  color: #6366f1;
}
/* Glossary ES label - amber/yellow */
.glossary-lang-label.glossary-lang-es {
  background: #fef9ee;
  color: #d97706;
}

.glossary-source-col {}
.glossary-status-col {}

.source-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.status-confirmed { background: #d1fae5; color: #059669; }
.status-badge.status-pending_review { background: #fef3c7; color: #d97706; }
.status-badge.status-deprecated { background: #ffe4e6; color: #e11d48; }

/* Glossary detail (expanded) */
.glossary-detail {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--border-light);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* EN → ES pair at top of detail */
.glossary-detail-pair {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.glossary-detail-term {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}
.glossary-detail-lang-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  background: #eef2ff;
  color: #6366f1;
}
.glossary-detail-lang-tag.glossary-detail-lang-es {
  background: #fef9ee;
  color: #d97706;
}
.glossary-detail-term-text {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}
.glossary-detail-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.detail-context-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.detail-context-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.1rem;
}
.detail-context-doc {
  font-size: 0.78rem;
  color: var(--text);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-light);
}
.detail-context-sentence {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
}
.doc-link {
  color: #6366f1;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: #eef2ff;
  transition: background 0.2s;
}
.doc-link:hover {
  background: #e0e7ff;
  text-decoration: underline;
}
.doc-link-es {
  color: #d97706;
  background: #fef9ee;
}
.doc-link-es:hover {
  background: #fef3c7;
}
.lang-tag {
  display: inline-block;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  font-style: normal;
  flex-shrink: 0;
  margin-top: 0.1rem;
  background: #eef2ff;
  color: #6366f1;
}
.lang-tag.lang-es { background: #fef9ee; color: #d97706; }

.detail-section { padding: 0.3rem 0; }
.detail-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}
.detail-value { font-size: 0.82rem; color: var(--text); }

.detail-notes {
  background: #fef9ee;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.78rem;
  border-left: 3px solid var(--warning);
}
.detail-sentence {
  font-style: italic;
  color: var(--text-secondary);
  background: var(--accent-light);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}
.detail-no-context {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.78rem;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-light);
}

.detail-login-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

/* ========== SUBTABS ========== */
.subtabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: var(--surface-alt);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  width: fit-content;
  border: 1px solid var(--border);
}
.subtab {
  padding: 0.45rem 0.85rem;
  border: none;
  background: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
  font-family: var(--font);
}
.subtab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ========== DUDA CARDS ========== */
.duda-group {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.duda-group-header {
  padding: 0.75rem 0.85rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.duda-group-icon { width: 0.9rem; height: 0.9rem; color: var(--text-muted); }
.duda-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: auto;
}

.duda-item {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid var(--border);
  transition: var(--transition);
}
.duda-item:last-child { border-bottom: none; }
.duda-item.decided { border-left-color: var(--accent); background: var(--accent-light); }
.duda-item.processed { border-left-color: var(--success); background: #f0fdf4; }

.duda-header { display: flex; align-items: flex-start; gap: 0.4rem; margin-bottom: 0.4rem; }
.duda-info { flex: 1; }
.duda-badge {
  font-size: 0.62rem;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 0.1rem;
  flex-shrink: 0;
}
.duda-badge-pending { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border); }
.duda-badge-decided { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent-subtle); }
.duda-badge-processed { background: var(--success-light); color: var(--success); }

.duda-question { font-size: 0.82rem; font-weight: 500; line-height: 1.4; }
.duda-section { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }

/* Citations EN/ES */
.duda-citations {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.6rem;
  background: var(--surface-alt);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.duda-citation {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.4;
}
.citation-label {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.duda-citation-en .citation-label {
  background: #e0e7ff;
  color: #4f46e5;
}
.duda-citation-es .citation-label {
  background: #fef9ee;
  color: #d97706;
}
.citation-text {
  color: var(--text-secondary);
  font-style: italic;
}

.duda-options { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.4rem; }
.duda-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  background: var(--surface);
  transition: var(--transition);
  font-family: var(--font);
  line-height: 1.4;
}
.duda-option:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-light); }
.duda-option.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent-hover);
  font-weight: 500;
  box-shadow: 0 0 0 1px var(--accent);
}
.duda-option.selected:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}
.duda-option:disabled, .duda-option.disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== EXPORT ========== */
.export-controls { margin-bottom: 1rem; }
.export-text {
  background: #1a1a2e;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.78rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 600px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  border: 1px solid #2d2d44;
}
.export-actions { margin-bottom: 0.75rem; }

.info-box {
  padding: 1rem;
  background: var(--accent-light);
  border: 1px solid var(--accent-subtle);
  border-radius: var(--radius-lg);
  font-size: 0.82rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.info-icon { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }

/* ========== MODAL ========== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--surface);
  padding: 1.75rem;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  border: 1px solid var(--border);
}
.modal-content h2 { margin-bottom: 0.4rem; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.modal-content p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1.15rem; line-height: 1.5; }

.form-group { margin-bottom: 0.85rem; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text); }
.form-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font);
  transition: var(--transition);
  color: var(--text);
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.error-msg { color: var(--danger); font-size: 0.78rem; margin-bottom: 0.65rem; background: var(--danger-light); padding: 0.45rem 0.65rem; border-radius: 6px; }

.hidden { display: none !important; }

.spinner {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== ANALYSIS TAB ========== */
.analysis-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.analysis-nav {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  gap: 0;
  overflow-x: auto;
}

.analysis-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: var(--font);
  border-radius: 0;
}

.analysis-group-btn:hover {
  color: var(--text-secondary);
  border-bottom-color: var(--border);
  background: transparent;
}

.analysis-group-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
  font-weight: 600;
}

.analysis-group-btn.active .cat-count {
  background: var(--accent);
  color: white;
}

.cat-icon { font-size: 0.9rem; }

.cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.analysis-filter {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.analysis-filter .filter-input {
  flex: 1;
  min-width: 200px;
}

.analysis-filter .filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.analysis-filter select {
  max-width: 260px;
}

.analysis-subsection {
  margin-bottom: 1.5rem;
}

.analysis-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
}

.analysis-subsection-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.analysis-subsection-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

.analysis-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.analysis-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.analysis-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  transition: var(--transition);
}

.analysis-item:hover {
  border-color: var(--accent-subtle);
  box-shadow: var(--shadow-sm);
}

.analysis-doc-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-pair {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.4rem 0;
}

.analysis-en, .analysis-es {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.analysis-en .lang-tag, .analysis-es .lang-tag {
  flex-shrink: 0;
}

.analysis-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  line-height: 1.5;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
}

.analysis-pattern-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.analysis-type-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  margin-top: 0.35rem;
}

/* Fixed translation rules */
.analysis-rule-box {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  margin-top: 0.25rem;
}

.analysis-rule-always {
  font-size: 0.85rem;
  color: var(--success);
  margin-bottom: 0.25rem;
}
.analysis-rule-always strong { color: var(--text); }

.analysis-rule-never {
  font-size: 0.85rem;
  color: var(--danger);
  margin-bottom: 0.25rem;
}
.analysis-rule-never strong { color: var(--text); }

.analysis-rule-reason {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid #fde68a;
}

/* Sacred phrases */
.analysis-sacred-box {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}
.analysis-sacred-box .analysis-en,
.analysis-sacred-box .analysis-es { font-style: italic; }

/* Pending decisions */
.analysis-pending-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}

.analysis-pending-issue { font-size: 0.88rem; margin-bottom: 0.4rem; }

.analysis-pending-options {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.4rem 0;
}

.analysis-pending-option {
  font-size: 0.82rem;
  padding: 0.3rem 0.65rem;
  background: white;
  border: 1px solid #fed7aa;
  border-radius: 4px;
}

/* Change history */
.analysis-change-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}

.analysis-change-what {
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.analysis-change-from {
  font-size: 0.82rem;
  color: var(--danger);
  margin-bottom: 0.2rem;
  padding: 0.3rem 0.5rem;
  background: var(--danger-light);
  border-radius: 4px;
  text-decoration: line-through;
}
.analysis-change-to {
  font-size: 0.82rem;
  color: var(--success);
  margin-bottom: 0.3rem;
  padding: 0.3rem 0.5rem;
  background: var(--success-light);
  border-radius: 4px;
  font-weight: 500;
}

.analysis-label {
  font-weight: 600;
  margin-right: 0.3rem;
}

.analysis-raw {
  font-size: 0.75rem;
  background: var(--surface-alt);
  padding: 0.65rem;
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
}

/* ========== Published / Not Published buttons with icons ========== */
.btn-publish-toggle {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.btn-publish-toggle:hover {
  transform: scale(1.02);
}
.btn-publish-toggle:disabled {
  opacity: 0.6;
  cursor: wait;
}
/* Published state - soft green with checkmark icon */
.btn-published {
  background: #d1fae5;
  color: #059669;
}
.btn-published:hover {
  background: #a7f3d0;
}
/* Not Published state - soft gray */
.btn-not-published {
  background: #f1f5f9;
  color: #94a3b8;
}
.btn-not-published:hover {
  background: #e2e8f0;
  color: #64748b;
}

/* Sortable column headers */
.dashboard-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.2rem;
}
.dashboard-table th.sortable:hover {
  background: var(--surface-alt);
}
.dashboard-table th.sortable::after {
  content: '\21C5';
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
}
.dashboard-table th.sortable.sort-asc::after {
  content: '\2191';
  opacity: 1;
  color: var(--accent);
}
.dashboard-table th.sortable.sort-desc::after {
  content: '\2193';
  opacity: 1;
  color: var(--accent);
}

/* ========== PROCESO DE REVISIÓN TAB ========== */
.proceso-priority-banner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #93c5fd;
  border-left: 5px solid #3b82f6;
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
}
.proceso-priority-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}
.proceso-priority-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text);
}
.proceso-priority-1 { color: #dc2626; font-weight: 700; }
.proceso-priority-2 { color: #2563eb; font-weight: 600; }
.proceso-priority-3 { color: #059669; font-weight: 600; }

.proceso-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.proceso-step:hover {
  box-shadow: var(--shadow-md);
}
.proceso-step-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--border-light);
}
.proceso-step-num {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.proceso-step-title-area {
  flex: 1;
}
.proceso-step-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.proceso-step-objective {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.proceso-step-body {
  padding: 1.2rem 1.5rem;
}
.proceso-method {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.8rem;
  background: #eff6ff;
  border-radius: var(--radius);
}
.proceso-method-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: #1d4ed8;
  white-space: nowrap;
}
.proceso-method-text {
  font-size: 0.84rem;
  color: #1e40af;
  line-height: 1.5;
}
.proceso-checklist {
  margin-bottom: 1rem;
}
.proceso-checklist-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.proceso-check-item {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.3rem 0;
  padding-left: 0.3rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.5;
}
.proceso-check-box {
  color: var(--accent);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.proceso-example {
  font-size: 0.82rem;
  padding: 0.6rem 0.8rem;
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 0.8rem;
  color: #166534;
  line-height: 1.5;
}
.proceso-example-label {
  font-weight: 600;
}
.proceso-warning {
  font-size: 0.8rem;
  padding: 0.6rem 0.8rem;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #92400e;
  line-height: 1.5;
}
.proceso-warning-icon {
  margin-right: 0.3rem;
}
.proceso-final-note {
  margin-top: 1.5rem;
  padding: 1rem 1.2rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== FRAMEWORK STEPS (8-Step Review) ========== */
.framework-step-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #f0f9ff 100%);
  border: 1px solid #bbf7d0;
  border-left: 4px solid #22c55e;
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.5rem;
}
.framework-step-title {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.framework-step-action {
  font-size: 0.84rem;
  color: #1e40af;
  font-weight: 500;
  margin-bottom: 0.6rem;
  padding: 0.4rem 0.6rem;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 4px;
  line-height: 1.5;
}
.framework-checkpoints {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(34, 197, 94, 0.2);
}
.framework-checkpoint-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.4;
}
.framework-check-icon {
  color: #22c55e;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header { padding: 0.75rem 1rem; flex-direction: column; align-items: flex-start; }
  .header-right { width: 100%; flex-direction: column; align-items: stretch; }
  .search-box input { width: 100%; }
  .content { padding: 1rem; }
  .tabs { padding: 0 1rem; }
  .tab-controls { flex-direction: column; align-items: stretch; }
  .filter-input { width: 100%; }
  .glossary-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .glossary-table-header { display: none; }
  .glossary-detail { padding-left: 0.85rem; }
  .glossary-detail-pair { flex-direction: column; gap: 0.4rem; }
  .glossary-detail-arrow { transform: rotate(90deg); text-align: center; }
  .detail-actions { flex-wrap: wrap; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  .dashboard-table { font-size: 0.75rem; }
  .dashboard-table thead th, .dashboard-table tbody td { padding: 0.45rem; }
  .analysis-nav { flex-wrap: nowrap; overflow-x: auto; }
  .analysis-group-btn { font-size: 0.72rem; padding: 0.4rem 0.5rem; }
  .cat-icon { font-size: 0.8rem; }
  .analysis-filter { flex-direction: column; }
  .analysis-filter .filter-input { min-width: 100%; }
  .analysis-filter select { max-width: 100%; width: 100%; }
}
