:root {
  --toyota-red: #eb0a1e;
  --toyota-red-dark: #c40014;
  --toyota-red-soft: rgba(235, 10, 30, 0.08);
  --bg-page: #f4f6f9;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.14);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-title: 'Outfit', 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   LOGIN OVERLAY
   ========================================================================== */
.login-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(circle at top right, rgba(235, 10, 30, 0.12), transparent 50%),
              linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
  width: 100%;
  max-width: 450px;
  background: #ffffff;
  border-radius: 20px;
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.login-brand-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--toyota-red) 0%, #ff4b5c 100%);
}

.login-logos {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.dual-logo-img {
  max-height: 54px;
  width: auto;
  object-fit: contain;
}

.login-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--toyota-red);
  background: var(--toyota-red-soft);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.login-title {
  font-family: var(--font-title);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.login-subtitle {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.login-subtitle code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--text-primary);
}

.login-field-group {
  text-align: left;
  margin-bottom: 1.25rem;
}

.login-field-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
}

.emp-input-wrapper {
  display: flex;
  align-items: center;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  overflow: hidden;
  transition: all 0.2s ease;
}

.emp-input-wrapper:focus-within {
  border-color: var(--toyota-red);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(235, 10, 30, 0.12);
}

.emp-prefix {
  padding: 0 0.9rem 0 1.1rem;
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--toyota-red);
}

.emp-input-wrapper input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.9rem 1rem 0.9rem 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  outline: none;
}

.login-preview-box {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.preview-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #dcfce7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.preview-info {
  flex: 1;
  min-width: 0;
}

.preview-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: #14532d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-meta {
  font-size: 0.73rem;
  color: #166534;
  font-weight: 600;
}

.preview-branch-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #15803d;
  color: #ffffff;
  white-space: nowrap;
}

.login-error-msg {
  margin-top: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-login-submit {
  width: 100%;
  padding: 0.95rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--toyota-red);
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 8px 20px rgba(235, 10, 30, 0.25);
}

.btn-login-submit:hover {
  background: var(--toyota-red-dark);
  transform: translateY(-1px);
}

.login-sync-footer {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   HEADER Y LAYOUT PRINCIPAL
   ========================================================================== */
.top-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.header-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--toyota-red);
}

.header-main-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.header-user-area {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.advisor-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.advisor-badge-num {
  background: var(--toyota-red);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.76rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.advisor-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-primary);
}

.advisor-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.btn-header-admin {
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #ffffff;
  transition: opacity 0.2s;
}

.btn-header-admin:hover {
  opacity: 0.9;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-logout:hover {
  border-color: var(--toyota-red);
  color: var(--toyota-red);
}

.main-container {
  max-width: 1080px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.25rem;
}

/* ==========================================================================
   TARJETAS DEL FORMULARIO
   ========================================================================== */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.35rem;
  box-shadow: var(--shadow-sm);
}

.card-section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.step-badge {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--toyota-red);
  color: #ffffff;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-section-header h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-section-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.req {
  color: var(--toyota-red);
  font-weight: 800;
}

.req-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--toyota-red-soft);
  color: var(--toyota-red);
}

/* Sucursal y Tipo de Solicitud */
.branch-Operation-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.25rem;
}

.section-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.55rem;
}

.branch-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.branch-option-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  cursor: pointer;
  background: var(--bg-subtle);
  transition: all 0.2s ease;
  position: relative;
  display: block;
}

.branch-option-card input {
  display: none;
}

.branch-option-card.active {
  border-color: var(--toyota-red);
  background: rgba(235, 10, 30, 0.04);
  box-shadow: 0 6px 16px rgba(235, 10, 30, 0.12);
}

.branch-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.branch-card-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.branch-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: transparent;
}

.branch-option-card.active .branch-check {
  background: var(--toyota-red);
  border-color: var(--toyota-red);
  color: #ffffff;
}

.branch-card-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.branch-card-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.type-Segment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.type-option-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  cursor: pointer;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  transition: all 0.2s ease;
}

.type-option-card input {
  display: none;
}

.type-option-card.active {
  border-color: var(--toyota-red);
  background: rgba(235, 10, 30, 0.04);
  box-shadow: 0 6px 16px rgba(235, 10, 30, 0.1);
}

.type-icon {
  font-size: 1.35rem;
}

.type-title {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.type-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Inputs y Grids */
.fields-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.fields-grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
}

.span-full {
  grid-column: 1 / -1;
}

.span-2 {
  grid-column: span 2;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  background: #ffffff;
  transition: all 0.18s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--toyota-red);
  box-shadow: 0 0 0 3px rgba(235, 10, 30, 0.12);
}

/* Sub-bloques de Responsables */
.btn-copy-all {
  margin-left: auto;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(235, 10, 30, 0.3);
  background: var(--toyota-red-soft);
  color: var(--toyota-red);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-all:hover {
  background: var(--toyota-red);
  color: #ffffff;
}

.roles-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.role-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
}

.role-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.role-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.role-icon {
  font-size: 1.15rem;
}

.role-title-wrap h4 {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-quick-copy {
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-quick-copy:hover {
  border-color: var(--toyota-red);
  color: var(--toyota-red);
}

/* Dropzone de Constancia */
.upload-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 1.6rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--toyota-red);
  background: rgba(235, 10, 30, 0.03);
}

.upload-dropzone.has-file {
  border-style: solid;
  border-color: #16a34a;
  background: #f0fdf4;
  cursor: default;
}

.upload-icon-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  margin: 0 auto 0.65rem;
  box-shadow: var(--shadow-sm);
}

.upload-main-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.upload-sub-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.btn-select-file {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--toyota-red);
  background: #ffffff;
  color: var(--toyota-red);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
}

.upload-loaded-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  flex-wrap: wrap;
}

.file-preview-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.file-badge-icon {
  font-size: 2rem;
}

.file-loaded-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: #14532d;
  word-break: break-all;
}

.file-loaded-meta {
  font-size: 0.78rem;
  color: #15803d;
  font-weight: 600;
}

.file-preview-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-file-preview,
.btn-file-change {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid #86efac;
  background: #ffffff;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.btn-file-remove {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #dc2626;
  font-weight: 800;
  cursor: pointer;
}

/* Error y Envío */
.form-error-banner {
  background: #fef2f2;
  border: 1.5px solid #f87171;
  color: #991b1b;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
}

.submit-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.btn-clear-form {
  padding: 0.9rem 1.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-submit-primary {
  padding: 0.95rem 1.85rem;
  border-radius: var(--radius-md);
  border: none;
  background: var(--toyota-red);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 24px rgba(235, 10, 30, 0.25);
  transition: all 0.2s;
}

.btn-submit-primary:hover:not(:disabled) {
  background: var(--toyota-red-dark);
  transform: translateY(-1px);
}

.btn-submit-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Historial del Asesor */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.history-header h3 {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 800;
}

.history-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-refresh-history {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.table-responsive {
  overflow-x: auto;
}

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

.history-table th {
  text-align: left;
  padding: 0.75rem;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.history-table td {
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pendiente {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.status-en_proceso {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.status-completado {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.status-rechazado {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Footer */
.app-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Modales */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  overflow: hidden;
}

.success-dialog {
  max-width: 440px;
  padding: 2rem 1.75rem;
  text-align: center;
}

.success-icon-ring {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
}

.success-dialog h3 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.success-dialog p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.1rem;
}

.folio-box {
  background: var(--bg-subtle);
  border: 1.5px dashed var(--toyota-red);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.folio-box span {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
}

.folio-box strong {
  font-family: var(--font-title);
  font-size: 1.35rem;
  color: var(--toyota-red);
}

.success-summary {
  text-align: left;
  background: #f8fafc;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.preview-dialog {
  max-width: 880px;
  height: 85vh;
  display: flex;
  flex-direction: column;
}

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

.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  cursor: pointer;
  font-weight: 800;
}

.preview-modal-body {
  flex: 1;
  background: #0f172a;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive */
@media (max-width: 820px) {
  .branch-Operation-grid,
  .fields-grid-3,
  .fields-grid-2 {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 520px) {
  .branch-cards-grid,
  .type-Segment-grid {
    grid-template-columns: 1fr;
  }
  .form-card {
    padding: 1.15rem;
  }
}

/* =========================================================
   ESTILOS DE ESTRUCTURA HOJA DE EXCEL / GOOGLE DRIVE EN VIVO
   ========================================================= */
.btn-sheet-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  background: #f0fdf4;
  color: #166534;
  border: 1.5px solid #86efac;
  transition: all 0.2s ease;
}

.btn-sheet-badge:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

.profile-header-badge {
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffffff;
  flex-shrink: 0;
}

.p1-badge { background: #1d4ed8; }
.p2-badge { background: #b45309; }
.p3-badge { background: #15803d; }
.p4-badge { background: #6d28d9; }
.p-doc-badge { background: #991b1b; }

.role-p2 { border-left: 4px solid #d97706; }
.role-p3 { border-left: 4px solid #16a34a; }
.role-p4 { border-left: 4px solid #7c3aed; }

.role-profile-tag {
  font-size: 0.68rem;
  font-weight: 900;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.tag-p2 { background: #d97706; }
.tag-p3 { background: #16a34a; }
.tag-p4 { background: #7c3aed; }

.history-actions-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-open-drive-sheet {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-sm);
  background: #16a34a;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.2);
  transition: all 0.2s;
}

.btn-open-drive-sheet:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.excel-sheet-wrapper {
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  overflow-x: auto;
  background: #ffffff;
}

.excel-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 1350px;
}

.excel-sheet-table th,
.excel-sheet-table td {
  border: 1px solid #cbd5e1;
  padding: 0.55rem 0.65rem;
  vertical-align: middle;
}

.excel-group-row th {
  text-align: center;
  font-family: var(--font-title);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #ffffff;
  padding: 0.5rem 0.65rem;
  text-transform: uppercase;
}

.excel-group-row .group-control { background: #1e293b; }
.excel-group-row .group-p1 { background: #1d4ed8; }
.excel-group-row .group-p2 { background: #b45309; }
.excel-group-row .group-p3 { background: #15803d; }
.excel-group-row .group-p4 { background: #6d28d9; }
.excel-group-row .group-doc { background: #991b1b; }

.excel-cols-row th {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.73rem;
  text-transform: none;
  white-space: nowrap;
  border-bottom: 2px solid #94a3b8;
}

.excel-sheet-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.excel-sheet-table tbody tr:hover {
  background: #f0fdf4;
}

