.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap th:last-child,
.table-wrap td:last-child {
  text-align: center;
  width: 110px;
}

.btn-excel {
  background: linear-gradient(135deg, var(--verde), var(--verde-claro));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  box-shadow: 0 4px 14px rgba(30,122,74,0.25);
  cursor: pointer;
  transition: all .2s ease;
}

.btn-excel:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(30,122,74,0.3);
}

.fila-vencida {
  background: #f8d7da !important;
}

.fila-por-vencer {
  background: #fff3cd !important;
}

.table-wrap tbody tr:hover {
  background: #e8f3fb;
}

.table-wrap tbody tr.fila-vencida:hover {
  background: #f1b7bd !important;
}

.table-wrap tbody tr.fila-por-vencer:hover {
  background: #f6df9b !important;
}

.msg {
  position: relative;
  padding-right: 42px;
}

.msg-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.proveedores-toolbar {
  margin-bottom: 16px;
}

.action-panel {
  align-items: flex-end;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: #f8fbfd;
  box-shadow: 0 8px 22px rgba(26, 58, 92, 0.06);
}

.toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toolbar-field label {
  font-size: 12px;
  font-weight: 800;
  color: #52677a;
}

.toolbar-search {
  flex: 1 1 280px;
}

.segmented-actions {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid #c9d8e7;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.segmented-actions .btn {
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

.segmented-actions .btn + .btn {
  border-left: 1px solid #d9e4ee;
}

.segmented-actions .btn:hover {
  transform: none;
  box-shadow: none;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.search-wrap input {
  height: 48px;
}

.btn-excel {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.proveedor-import-input,
.proveedores-empty-state {
  display: none;
}

.proveedores-vista-filtrada .proveedores-import-field,
.proveedores-vista-filtrada #importInput {
  display: none;
}

.proveedores-modo-alta header,
.proveedores-modo-alta .container,
.proveedores-modo-alta footer {
  display: none;
}

.proveedores-modo-alta .modal-overlay.open {
  background: #f4f7fb;
}

.proveedores-modo-alta .modal {
  box-shadow: 0 14px 44px rgba(26, 58, 92, 0.18);
}

.proveedores-empty-state.show {
  display: block;
}

.proveedor-actions-cell {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  min-width: 230px;
  white-space: nowrap;
}

.proveedores-table th:nth-child(2),
.proveedores-table td:nth-child(2) {
  min-width: 120px;
}

.proveedores-table th:nth-child(3),
.proveedores-table td:nth-child(3) {
  min-width: 240px;
}

.proveedores-table th:nth-child(4),
.proveedores-table td:nth-child(4) {
  min-width: 180px;
}

.proveedores-table th:nth-child(5),
.proveedores-table td:nth-child(5) {
  min-width: 72px;
  text-align: center;
}

.row-delete-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #8a98a8;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.row-delete-btn:hover {
  background: #fdecea;
  color: var(--rojo);
  border-color: rgba(192,57,43,.2);
}

.row-delete-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.escuelas-toolbar .search-wrap {
  flex: 1;
  min-width: 280px;
}

.escuelas-filter {
  height: 48px;
  min-width: 150px;
}

.escuelas-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(170px, .7fr) minmax(170px, .7fr) auto auto;
  align-items: end;
}

.escuelas-toolbar .toolbar-field,
.proveedores-toolbar .toolbar-field {
  min-width: 0;
}

.escuelas-toolbar .segmented-actions,
.proveedores-toolbar .segmented-actions {
  min-height: 42px;
}

.btn-small {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
}

.escuelas-actions {
  min-width: 90px;
}

.pagos-toolbar {
  display: grid;
  grid-template-columns: minmax(130px, .6fr) minmax(120px, .55fr) minmax(190px, .8fr) minmax(240px, 1.2fr) auto auto auto;
  align-items: end;
}

.pagos-toolbar .filter-group,
.pagos-toolbar select,
.pagos-toolbar input {
  min-width: 0;
  width: 100%;
}

.escuelas-modal {
  max-width: 880px;
}

.escuela-edicion-limitada .modal-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.escuela-edicion-limitada .field {
  display: none;
}

.escuela-edicion-limitada .field-editable {
  display: flex;
}

.escuela-tipo-select {
  min-width: 130px;
  height: 34px;
  padding: 5px 8px;
  font-size: 12px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.header-title {
  min-width: 0;
}

.header-title h1,
.header-left h1 {
  margin: 0;
}

.header-title p,
.header-left p {
  margin-top: 2px;
}

.btn-volver-header {
  background: rgba(255,255,255,0.12);
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.18);
  transition: .2s ease;
}

.btn-volver-header:hover {
  background: rgba(255,255,255,0.20);
}

.detalle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(300px,1fr));
  gap: 20px;
}

.detalle-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 20px;
}

.detalle-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
}

.detalle-item {
  margin-bottom: 10px;
}

.detalle-label {
  font-size: 12px;
  color: #666;
  font-weight: bold;
}

.detalle-card .estado {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.detalle-card .estado-ok {
  background: #d4edda;
  color: #155724;
}

.detalle-card .estado-vencido {
  background: #f8d7da;
  color: #721c24;
}

.detalle-card .estado-proximo {
  background: #fff3cd;
  color: #856404;
}

.btn-volver {
  background: rgba(192,57,43,0.14);
  color: white;
  padding: 7px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  transition: .2s ease;
  border: 1px solid rgba(255,255,255,0.26);
}

.btn-volver:hover {
  background: rgba(192,57,43,0.28);
}

.documentos-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.documentos-upload {
  margin-bottom: 20px;
}

.documentos-upload.is-collapsed {
  display: none;
}

.documentos-upload input[type="file"],
.documentos-upload input[type="text"],
.documentos-upload input[type="date"] {
  min-height: 42px;
}

.impuestos-card {
  margin-top: 20px;
}

.impuestos-form {
  margin-top: 16px;
  margin-bottom: 0;
}

.payment-tax-detail summary {
  cursor: pointer;
  color: var(--azul);
  font-weight: 700;
  white-space: nowrap;
}

.payment-tax-detail div {
  margin-top: 6px;
  min-width: 220px;
  color: #555;
  font-size: 12px;
  line-height: 1.45;
}

.documento-card {
  background: white;
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}

.documento-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.documento-main {
  min-width: 0;
}

.documento-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.documento-tipo {
  font-size: 15px;
  font-weight: 700;
  color: var(--azul);
  overflow-wrap: anywhere;
}

.documento-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.documento-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.documento-card .estado {
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.documento-card .estado-ok {
  background: #d1fae5;
  color: #065f46;
}

.documento-card .estado-vencido {
  background: #fee2e2;
  color: #991b1b;
}

.documento-card .estado-alerta {
  background: #fef3c7;
  color: #92400e;
}

.btn-doc {
  width: 100%;
  margin-top: 12px;
  border: none;
  padding: 12px;
  border-radius: 8px;
  background: #1d4ed8;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.btn-doc:hover {
  background: #1e40af;
}

.proveedor-page-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.proveedor-page-actions.center {
  justify-content: center;
}

@media (max-width: 700px) {
  .page-header {
    align-items: stretch;
  }

  .btn-volver-header,
  .btn-volver {
    justify-content: center;
    width: 100%;
  }

  .search-wrap,
  .search-wrap input,
  .btn-excel,
  .toolbar-field,
  .segmented-actions,
  .escuelas-toolbar,
  .proveedores-toolbar,
  .pagos-toolbar {
    width: 100%;
  }

  .escuelas-toolbar,
  .pagos-toolbar {
    display: flex;
  }

  .segmented-actions .btn {
    flex: 1;
  }

  .proveedor-actions-cell {
    min-width: 280px;
    flex-wrap: wrap;
  }

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

  .documento-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .documento-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}
