:root {
  --google-blue: #1a73e8;
  --google-blue-hover: #1557b0;
  --google-blue-surface: #e8f0fe;
  --google-red: #d93025;
  --google-red-surface: #fce8e6;
  --google-yellow: #f9ab00;
  --google-yellow-surface: #fef7e0;
  --google-green: #1e8e3e;
  --google-green-surface: #e6f4ea;

  --navy: #1a365d;
  --teal: #00796b;
  --slate: #202124;
  --muted: #5f6368;
  --light-bg: #f8f9fa;
  --card-bg: #ffffff;
  --border: #dadce0;
  --border-dark: #bdc1c6;

  --tag-b2b: #ede7f6;
  --tag-b2b-text: #5e35b1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--light-bg);
  color: var(--slate);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ================= HEADER ================= */
.google-header {
  background: white;
  color: var(--slate);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(60,64,67,0.08);
}

.google-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.google-waffle {
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.google-waffle:hover { background: #f1f3f4; }

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1a73e8, #00796b);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(26,115,232,0.3);
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
}

.brand-name span {
  font-weight: 400;
  color: var(--muted);
  font-size: 14px;
  margin-left: 6px;
}

.google-search {
  flex: 1;
  max-width: 520px;
  margin: 0 24px;
  position: relative;
}

.google-search input {
  width: 100%;
  background: #f1f3f4;
  border: 1px solid transparent;
  border-radius: 24px;
  padding: 10px 16px 10px 42px;
  color: var(--slate);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s;
}

.google-search input:focus {
  background: white;
  border-color: var(--border);
  box-shadow: 0 1px 4px rgba(60,64,67,0.18);
}

.google-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
}

.google-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.api-pill {
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.api-pill.live {
  background: var(--google-green-surface);
  color: var(--google-green);
  border-color: #a8dab5;
}

.api-pill.demo {
  background: var(--google-yellow-surface);
  color: #b06000;
  border-color: #fdd663;
}

.api-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.live .api-dot { background: var(--google-green); }
.demo .api-dot { background: var(--google-yellow); }

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}
.user-profile:hover { background: #f1f3f4; }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--google-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

/* ================= SUB-BAR NAVIGATION ================= */
.app-subbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-switcher {
  display: flex;
  gap: 4px;
}

.view-btn {
  background: none;
  border: none;
  padding: 14px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.view-btn:hover {
  color: var(--google-blue);
  background: #f8f9fa;
}

.view-btn.active {
  color: var(--google-blue);
  font-weight: 600;
  border-bottom-color: var(--google-blue);
}

.subbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.btn-sm-key {
  background: #f1f3f4;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.btn-sm-key:hover { background: #e8eaed; }

/* ================= MAIN CONTAINER ================= */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.screen {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= KPI GRID ================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(60,64,67,0.06);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.kpi-card.blue::before { background: var(--google-blue); }
.kpi-card.teal::before { background: var(--teal); }
.kpi-card.amber::before { background: var(--google-yellow); }
.kpi-card.green::before { background: var(--google-green); }

.kpi-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--slate);
  font-family: 'JetBrains Mono', monospace;
}

.kpi-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up {
  color: var(--google-green);
  font-weight: 600;
}

/* ================= FILTER BAR ================= */
.filter-bar {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(60,64,67,0.04);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-select {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--slate);
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--google-blue); background: white; }

.btn-action {
  background: var(--google-blue);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}
.btn-action:hover { background: var(--google-blue-hover); }

.btn-outline {
  background: white;
  color: var(--slate);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}
.btn-outline:hover { background: #f1f3f4; }

/* ================= TABLE CARD ================= */
.table-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(60,64,67,0.04);
  overflow: hidden;
}

.table-header-title {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-header-title h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: #f8f9fa;
  padding: 12px 18px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

tr:hover td {
  background-color: #f8f9fa;
  cursor: pointer;
}

.client-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--google-blue-surface);
  color: var(--google-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
}

.client-name {
  font-weight: 600;
  color: var(--slate);
}

.client-id {
  font-size: 11px;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
}

.tag-success { background: var(--google-green-surface); color: var(--google-green); }
.tag-warning { background: var(--google-yellow-surface); color: #b06000; }
.tag-danger { background: var(--google-red-surface); color: var(--google-red); }
.tag-b2b { background: var(--tag-b2b); color: var(--tag-b2b-text); }
.tag-drive { background: #e8f0fe; color: #1967d2; }

.progress-bar {
  width: 70px;
  height: 6px;
  background: #e8eaed;
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.progress-fill { height: 100%; border-radius: 3px; }
.fill-green { background: var(--google-green); }
.fill-amber { background: var(--google-yellow); }
.fill-red { background: var(--google-red); }

/* ================= SCREEN 2: SPLIT SCREEN WORKSPACE ================= */
.workspace-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  height: calc(100vh - 170px);
  min-height: 620px;
}

.viewer-panel, .analysis-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(60,64,67,0.06);
}

.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-btn {
  background: white;
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  font-weight: 500;
}
.ctrl-btn:hover { background: #e8eaed; }

.doc-preview-area {
  flex: 1;
  background: #5f6368;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

.doc-page {
  background: white;
  width: 100%;
  max-width: 520px;
  min-height: 640px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 24px;
  position: relative;
  font-size: 11.5px;
  color: #202124;
}

.doc-header-sim {
  border-bottom: 2px solid #202124;
  padding-bottom: 8px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
}

.doc-header-sim h2 { font-size: 14px; font-weight: 700; }

.ocr-box {
  border: 1.5px dashed var(--google-blue);
  background: rgba(26, 115, 232, 0.08);
  border-radius: 4px;
  padding: 5px 8px;
  margin: 4px 0;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.ocr-box:hover, .ocr-box.highlight {
  background: rgba(26, 115, 232, 0.2);
  border-color: #1557b0;
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.25);
}

.ocr-badge-tag {
  position: absolute;
  top: -9px;
  right: 6px;
  background: var(--google-blue);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

.analysis-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.gemini-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #e8f0fe;
  border: 1px solid #c2e7ff;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: #174ea6;
}

.btn-trigger-ai {
  background: var(--google-blue);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-trigger-ai:hover { background: var(--google-blue-hover); }

.field-group {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.field-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12.5px;
}

.field-label { color: var(--muted); }
.field-val-input {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--slate);
  background: #f8f9fa;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #e8eaed;
  width: 180px;
  text-align: right;
}

.action-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-approve {
  background: var(--google-green);
  color: white;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-approve:hover { background: #137333; }

.btn-reject {
  background: white;
  color: var(--google-red);
  border: 1px solid var(--google-red);
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}
.btn-reject:hover { background: var(--google-red-surface); }

/* ================= SCREEN 3: UPLOAD ================= */
.upload-container {
  max-width: 880px;
  margin: 0 auto;
}

.dropzone {
  background: white;
  border: 2px dashed #bdc1c6;
  border-radius: 14px;
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--google-blue);
  background: #f8f9fa;
}

.dropzone-icon {
  font-size: 48px;
  color: var(--google-blue);
  margin-bottom: 12px;
}

.upload-queue {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 24px;
  margin-top: 20px;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f4;
}

.queue-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.queue-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e8f0fe;
  color: var(--google-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* ================= SCREEN 4: GOBERNANZA ================= */
.governance-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.b2b-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 1px 3px rgba(60,64,67,0.06);
}

.b2b-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
}

.partner-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f4;
}

.partner-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.partner-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audit-log-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
}

.audit-time {
  font-weight: 600;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

.audit-user {
  color: var(--google-blue);
  font-weight: 600;
}

/* ================= MODAL ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(32,33,36,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.show { display: flex; }

.modal-content {
  background: white;
  border-radius: 14px;
  max-width: 520px;
  width: 90%;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 18px;
  color: var(--navy);
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate);
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
}
.form-group input:focus { border-color: var(--google-blue); }

.form-group input:user-invalid {
  border-color: var(--danger);
  border-width: 2px;
  background-color: #fef2f2;
}

.field-error-msg {
  display: none;
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 4px;
}

.form-group input:user-invalid + .field-error-msg {
  display: block;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ================= TOAST ================= */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #202124;
  color: white;
  padding: 14px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 9999;
  max-width: calc(100dvw - 32px);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ================= COMPONENTES LAYOUT RESPONSIVE ================= */
.doc-sim-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.dti-sliders-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.dti-summary-bar {
  margin-top: 10px;
  padding: 8px 10px;
  background: white;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
}

.action-footer-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-selector-bar {
  margin-bottom: 16px;
  background: white;
  padding: 14px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.upload-expediente-select {
  min-width: min(320px, 100%);
  flex: 1;
  max-width: 460px;
}

.sol-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.sol-header-status {
  text-align: right;
}

.sol-stepper-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0 10px 0;
}

.sol-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.sol-drive-banner {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.broker-header-top {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.broker-link-banner {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 18px 24px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.broker-share-input {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  width: min(380px, 100%);
  flex: 1;
  min-width: 200px;
  font-family: monospace;
}

.broker-drive-box {
  text-align: right;
}

.ocr-entities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ================= RESPONSIVE TABLES (@container) ================= */
.table-wrapper {
  overflow-x: auto;
  max-inline-size: 100%;
  container-type: inline-size;
  -webkit-overflow-scrolling: touch;
}

.responsive-data-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.responsive-data-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

@container (width < 760px) {
  .responsive-data-table,
  .responsive-data-table thead,
  .responsive-data-table tbody,
  .responsive-data-table tr,
  .responsive-data-table th,
  .responsive-data-table td {
    display: block;
  }

  .responsive-data-table thead {
    display: none;
  }

  .responsive-data-table tbody tr {
    margin: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
  }

  .responsive-data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f3f4;
    text-align: right;
  }

  .responsive-data-table tbody td:first-child {
    background: #f8fafc;
    text-align: left;
    justify-content: flex-start;
  }

  .responsive-data-table tbody td:last-child {
    border-bottom: none;
    justify-content: flex-end;
    background: #fcfcfd;
  }

  .responsive-data-table tbody td:nth-child(2)::before {
    content: var(--label-2) ": " / var(--label-2);
    font-weight: 600;
    color: var(--muted);
    font-size: 11.5px;
    text-align: left;
  }
  .responsive-data-table tbody td:nth-child(3)::before {
    content: var(--label-3) ": " / var(--label-3);
    font-weight: 600;
    color: var(--muted);
    font-size: 11.5px;
    text-align: left;
  }
  .responsive-data-table tbody td:nth-child(4)::before {
    content: var(--label-4) ": " / var(--label-4);
    font-weight: 600;
    color: var(--muted);
    font-size: 11.5px;
    text-align: left;
  }
  .responsive-data-table tbody td:nth-child(5)::before {
    content: var(--label-5) ": " / var(--label-5);
    font-weight: 600;
    color: var(--muted);
    font-size: 11.5px;
    text-align: left;
  }
  .responsive-data-table tbody td:nth-child(6)::before {
    content: var(--label-6) ": " / var(--label-6);
    font-weight: 600;
    color: var(--muted);
    font-size: 11.5px;
    text-align: left;
  }
  .responsive-data-table tbody td:nth-child(7)::before {
    content: var(--label-7) ": " / var(--label-7);
    font-weight: 600;
    color: var(--muted);
    font-size: 11.5px;
    text-align: left;
  }
}

/* ================= MEDIA QUERIES MULTI-DISPOSITIVO ================= */

/* Pantallas medianas / Laptops compactas y Tablets Horizontal (<= 1180px) */
@media (max-width: 1180px) {
  .google-header {
    height: auto;
    min-height: 64px;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .google-search {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    margin: 4px 0 0 0;
  }

  .app-subbar {
    padding: 0 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .view-switcher {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .view-btn {
    white-space: nowrap;
    padding: 12px 14px;
  }

  .subbar-right {
    width: 100%;
    justify-content: space-between;
    padding: 6px 0 10px 0;
    border-top: 1px solid #f1f3f4;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .workspace-split {
    grid-template-columns: 1fr;
    height: auto;
    min-height: unset;
  }

  .viewer-panel {
    min-height: 540px;
  }

  .governance-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablets Vertical y Móviles Grandes (<= 820px) */
@media (max-width: 820px) {
  .app-container {
    padding: 16px 12px;
  }

  .brand-name span {
    display: none;
  }

  .google-right {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .filter-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .filter-group .filter-select {
    flex: 1 1 calc(50% - 6px);
    min-width: 140px;
  }

  .table-header-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }

  .viewer-controls {
    flex-wrap: wrap;
    width: 100%;
  }

  .gemini-badge {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .btn-trigger-ai {
    width: 100%;
    justify-content: center;
  }

  .sol-stepper-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sol-header-status,
  .broker-drive-box {
    text-align: left;
  }
}

/* Smartphones Estándar y Compactos (<= 600px) */
@media (max-width: 600px) {
  .google-header {
    padding: 10px 12px;
  }

  .google-left {
    gap: 8px;
  }

  .google-waffle {
    display: none;
  }

  .user-profile > div:last-child {
    display: none;
  }

  .role-selector-box {
    max-width: 190px;
  }

  .role-selector-box select {
    max-width: 135px;
    text-overflow: ellipsis;
  }

  .api-pill {
    padding: 4px 8px;
    font-size: 11px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kpi-val {
    font-size: clamp(22px, 6vw, 26px);
  }

  .filter-group .filter-select,
  .filter-group .btn-outline,
  .filter-group .btn-action {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
  }

  .doc-preview-area {
    padding: 10px;
  }

  .doc-page {
    padding: 14px;
    min-height: auto;
  }

  .doc-header-sim {
    flex-direction: column;
    gap: 6px;
  }

  .doc-header-sim > div:last-child {
    text-align: left !important;
  }

  .doc-sim-grid-2,
  .dti-sliders-grid,
  .sol-stepper-grid,
  .sol-stats-grid,
  .ocr-entities-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #f1f3f4;
  }

  .field-label {
    flex: 1 1 100%;
  }

  .field-val-input {
    width: auto;
    flex: 1;
    text-align: left;
  }

  .action-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .action-footer .btn-reject,
  .action-footer-right,
  .action-footer-right button {
    width: 100%;
    justify-content: center;
  }

  .dropzone {
    padding: 28px 16px;
  }

  .queue-item,
  .partner-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .modal-content {
    width: 95dvw;
    max-height: 92dvh;
    padding: 16px;
    overflow-y: auto;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer button {
    width: 100%;
    justify-content: center;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}
