
/* ====================================================
   WooPanel — Fase 1: Limpeza Visual (Neutro)
   ==================================================== */

/* Reset and Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* Layout */
.woopanel-wrapper {
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: row;
}

/* Sidebar */
.woopanel-sidebar {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  background: #fff;
  border-right: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.woopanel-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 8px;
}

.woopanel-sidebar__brand-icon {
  width: 40px;
  height: 40px;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.woopanel-sidebar__logo {
  font-size: 20px;
  font-weight: 700;
}

.woopanel-sidebar__tag {
  font-size: 12px;
  color: #666;
}

.woopanel-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.woopanel-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.woopanel-module-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  color: #000;
  width: 100%;
  text-align: left;
}

.woopanel-module-btn.is-active {
  background: #eee;
  border-color: #ccc;
}

/* Main Content */
.woopanel-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.woopanel-module-content {
  display: none;
}

.woopanel-module-content:not(.hidden) {
  display: block;
}

/* Header */
.woopanel-page-header,
.woopanel-header {
  margin-bottom: 24px;
}

.woopanel-page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.woopanel-page-title {
  font-size: 24px;
  font-weight: 700;
  color: #000;
  margin: 0 0 8px 0;
}

.woopanel-page-description {
  font-size: 14px;
  color: #666;
  margin: 0;
}

/* Cards */
.woopanel-card {
  background: #fff;
  border: 1px solid #ccc;
  padding: 16px;
  margin-bottom: 16px;
}

.woopanel-cards-grid,
.woopanel-stats-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .woopanel-cards-grid,
  .woopanel-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .woopanel-cards-grid,
  .woopanel-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.woopanel-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  margin: 0 0 8px 0;
}

.woopanel-card-value {
  font-size: 24px;
  font-weight: 700;
  color: #000;
  margin: 0;
  line-height: 1.1;
}

.woopanel-card-icon {
  width: 48px;
  height: 48px;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

/* Toolbar */
.woopanel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.woopanel-toolbar-left,
.woopanel-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.woopanel-search-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #ccc;
  padding: 8px 12px;
}

.woopanel-filters-wrapper {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.woopanel-filter-select {
  padding: 8px 12px;
  border: 1px solid #ccc;
  background: #fff;
  font-size: 14px;
  color: #000;
}

/* Buttons */
.woopanel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.woopanel-btn-primary {
  background: #000;
  color: #fff;
  border-color: #000;
}

.woopanel-btn-secondary {
  background: #eee;
}

.woopanel-btn-outline {
  background: transparent;
}

/* Forms */
.woopanel-form-group {
  margin-bottom: 16px;
}

.woopanel-form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #000;
  margin-bottom: 8px;
}

.woopanel-input,
.woopanel-select,
.woopanel-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  background: #fff;
  font-size: 14px;
  color: #000;
  outline: none;
}

.woopanel-textarea {
  resize: vertical;
}

/* Tables */
.woopanel-table-container {
  background: #fff;
  border: 1px solid #ccc;
  overflow: hidden;
}

.woopanel-table-wrapper {
  overflow-x: auto;
}

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

.woopanel-table thead th {
  background: #eee;
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  border-bottom: 1px solid #ccc;
}

.woopanel-table tbody tr {
  border-bottom: 1px solid #ccc;
}

.woopanel-table tbody tr:last-child {
  border-bottom: none;
}

.woopanel-table tbody td {
  padding: 12px 16px;
  font-size: 14px;
  color: #000;
}

.woopanel-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #666;
  font-size: 14px;
}

/* Table Action Buttons */
.woopanel-table-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.woopanel-table-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #ccc;
  cursor: pointer;
  background: #fff;
  border-radius: 8px;
  transition: background-color .14s ease, color .14s ease, border-color .14s ease;
}

.woopanel-table-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.woopanel-table-btn.btn-view {
  border-color: #fde68a;
  background: #fef3c7;
  color: #b45309;
}
.woopanel-table-btn.btn-view:hover {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.woopanel-table-btn.btn-edit {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #15803d;
}
.woopanel-table-btn.btn-edit:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.woopanel-table-btn.btn-delete {
  border-color: #fecaca;
  background: #fee2e2;
  color: #b91c1c;
}
.woopanel-table-btn.btn-delete:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

/* Badges */
.woopanel-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid #ccc;
  font-size: 12px;
  font-weight: 500;
}

/* Modal */
.woopanel-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
}

.woopanel-modal-backdrop:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.woopanel-modal-panel {
  background: #fff;
  border: 1px solid #ccc;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.woopanel-modal-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ccc;
}

.woopanel-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #000;
  margin: 0;
}

.woopanel-modal-close {
  width: 40px;
  height: 40px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.woopanel-modal-close--danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
  border-radius: 0.5rem;
}

.woopanel-modal-close--danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.woopanel-modal-body {
  padding: 16px;
  overflow-y: auto;
}

.woopanel-modal-footer {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid #ccc;
}

/* Modal de Progresso (otimização de imagens / salvamento do produto) */
.woopanel-progress-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Precisa ficar acima do modal de edição de produto (z-index: 9999) */
  z-index: 100000;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.woopanel-progress-modal-backdrop:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.woopanel-progress-modal-panel {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 340px;
  padding: 32px 28px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.woopanel-progress-modal-spinner {
  width: 36px;
  height: 36px;
  color: #2563eb;
}

/* Photo Uploader */
.woopanel-photo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border: 1px dashed #ccc;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.woopanel-photo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.woopanel-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #666;
}

.woopanel-photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pagination */
.woopanel-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid #ccc;
}

.woopanel-pagination-info {
  font-size: 14px;
  color: #666;
}

.woopanel-pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.woopanel-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid #ccc;
  background: #fff;
  color: #000;
  cursor: pointer;
}

.woopanel-pagination-btn.is-active {
  background: #000;
  color: #fff;
  border-color: #000;
}

.woopanel-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}



/* Utilities */
.hidden {
  display: none !important;
}

/* ============================================================
   Modal grande (2 colunas) — usado pelo cadastro de Devedores.
   ============================================================ */

.woopanel-modal-panel--wide {
  max-width: 1180px;
  width: 95vw;
  max-height: 92vh;
}

.woopanel-modal-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #666;
}

.woopanel-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 28px;
}

.woopanel-form-span-2 {
  grid-column: 1 / -1;
}

.woopanel-form-subtitle {
  font-size: 15px;
  font-weight: 700;
  margin: 4px 0 14px;
  padding-top: 18px;
  border-top: 1px solid #e5e5e5;
}

.woopanel-form-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #777;
  margin: 8px 0 16px;
}

@media (max-width: 760px) {
  .woopanel-form-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Resumo de pagamentos */

.woopanel-payment-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.woopanel-payment-stat {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fafafa;
}

.woopanel-payment-stat__label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #888;
  margin-bottom: 4px;
}

.woopanel-payment-stat__value {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #111;
}

.woopanel-payment-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e5e5e5;
  overflow: hidden;
  margin-bottom: 4px;
}

.woopanel-payment-progress__bar {
  height: 100%;
  background: #16a34a;
  transition: width .3s ease;
}

/* Histórico de pagamentos */

.woopanel-payment-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 220px;
  overflow-y: auto;
}

.woopanel-payment-history__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 10px 12px;
}

.woopanel-payment-history__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.woopanel-payment-history__amount {
  font-weight: 700;
  color: #15803d;
}

.woopanel-payment-history__meta {
  font-size: 12px;
  color: #888;
}

.woopanel-payment-history__remove {
  border: none;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
}

.woopanel-payment-history__remove:hover {
  color: #dc2626;
  background: #fef2f2;
}

.woopanel-empty-state-inline {
  font-size: 13px;
  color: #999;
  text-align: center;
  padding: 16px 0;
  margin: 0;
}

/* Linha para adicionar um novo pagamento */

.woopanel-payment-add-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr auto;
  gap: 10px;
  align-items: center;
}

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

/* ================================================================== 
   View Debt Modal — Redesign (layout 2 colunas, quase tela cheia) 
   ================================================================== */ 
.woopanel-modal-panel--invoice { 
    width: 94vw; 
    max-width: 1240px; 
    height: 90vh; 
    max-height: 90vh; 
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 24px 64px -12px rgba(15, 23, 42, .28), 0 0 0 1px rgba(15, 23, 42, .05); 
    border: none; 
} 

.vd-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 18px 28px; 
    border-bottom: 1px solid #e5e7eb; 
    background: #fff; 
    flex-shrink: 0; 
} 

.vd-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; } 

.vd-header-eyebrow { 
    font-size: 11px; 
    font-weight: 600; 
    letter-spacing: .06em; 
    text-transform: uppercase; 
    color: #94a3b8; 
    margin: 0 0 3px 0; 
} 

.vd-header-title { 
    font-size: 17px; 
    font-weight: 600; 
    color: #0f172a; 
    margin: 0; 
    line-height: 1.3; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
} 

.vd-header-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; } 

.vd-close-btn { 
    width: 32px; 
    height: 32px; 
    border-radius: 8px; 
    border: 1px solid #e5e7eb; 
    background: #fff; 
    color: #64748b; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    font-size: 16px; 
    line-height: 1; 
    transition: background .12s ease, color .12s ease; 
} 
.vd-close-btn:hover { background: #f8fafc; color: #0f172a; } 

.vd-status-pill { 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    padding: 5px 12px; 
    border-radius: 100px; 
    font-size: 12px; 
    font-weight: 600; 
    white-space: nowrap; 
} 
.vd-status-pill::before { 
    content: ''; 
    width: 6px; 
    height: 6px; 
    border-radius: 50%; 
    background: currentColor; 
} 
.vd-status-open    { background: #fee2e2; color: #b91c1c; } 
.vd-status-partial { background: #fef3c7; color: #b45309; } 
.vd-status-paid     { background: #dcfce7; color: #15803d; } 

.vd-body { 
    flex: 1; 
    min-height: 0; 
    display: grid; 
    grid-template-columns: 1fr 320px; 
    overflow: hidden; 
} 

.vd-main { 
    overflow-y: auto; 
    padding: 24px 28px; 
} 

.vd-sidebar { 
    overflow-y: auto; 
    background: #f8fafc; 
    border-left: 1px solid #e5e7eb; 
    padding: 24px; 
} 

.vd-section { margin-bottom: 28px; } 
.vd-section:last-child { margin-bottom: 0; } 

.vd-section-title { 
    font-size: 11px; 
    font-weight: 600; 
    letter-spacing: .06em; 
    text-transform: uppercase; 
    color: #94a3b8; 
    margin: 0 0 14px 0; 
} 

/* Sidebar: resumo financeiro */ 
.vd-balance-label { 
    font-size: 11px; 
    font-weight: 600; 
    letter-spacing: .05em; 
    text-transform: uppercase; 
    color: #94a3b8; 
    margin: 0 0 6px 0; 
} 
.vd-balance-amount { 
    font-size: 30px; 
    font-weight: 700; 
    color: #0f172a; 
    font-variant-numeric: tabular-nums; 
    letter-spacing: -.02em; 
    line-height: 1.1; 
    margin-bottom: 16px; 
} 
.vd-mini-stats { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid #e2e8f0; } 
.vd-mini-stat { display: flex; align-items: center; justify-content: space-between; } 
.vd-mini-stat-label { font-size: 12.5px; color: #64748b; } 
.vd-mini-stat-value { font-size: 13.5px; font-weight: 600; color: #334155; font-variant-numeric: tabular-nums; } 

/* Sidebar: campos info (cliente / venda) */ 
.vd-info-item + .vd-info-item { margin-top: 14px; } 
.vd-info-label { font-size: 12px; color: #94a3b8; margin: 0 0 3px 0; } 
.vd-info-value { font-size: 14px; font-weight: 500; color: #1e293b; } 

/* Coluna principal: tabela de produtos */ 
.vd-items-table { width: 100%; border-collapse: collapse; } 
.vd-items-table thead th { 
    text-align: left; 
    font-size: 10.5px; 
    font-weight: 600; 
    letter-spacing: .04em; 
    text-transform: uppercase; 
    color: #94a3b8; 
    padding: 0 0 10px 0; 
    border-bottom: 1px solid #e2e8f0; 
} 
.vd-items-table thead th.vd-num { text-align: right; } 
.vd-items-table tbody td { 
    padding: 13px 0; 
    font-size: 14px; 
    color: #1e293b; 
    border-bottom: 1px solid #f1f5f9; 
} 
.vd-items-table tbody tr:last-child td { border-bottom: none; } 
.vd-items-table td.vd-num { text-align: right; font-variant-numeric: tabular-nums; color: #334155; } 
.vd-item-name { font-weight: 500; } 

/* Coluna principal: histórico de pagamentos */ 
.vd-payments-list { display: flex; flex-direction: column; } 
.vd-payment-row { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 13px 0; 
    border-bottom: 1px solid #f1f5f9; 
} 
.vd-payment-row:last-child { border-bottom: none; } 
.vd-payment-left { display: flex; flex-direction: column; gap: 2px; } 
.vd-payment-method { font-size: 14px; font-weight: 500; color: #1e293b; } 
.vd-payment-meta { font-size: 12.5px; color: #94a3b8; } 
.vd-payment-amount { font-size: 14.5px; font-weight: 600; color: #15803d; font-variant-numeric: tabular-nums; } 

.vd-empty { font-size: 13px; color: #94a3b8; padding: 12px 0; text-align: center; } 

.vd-footer { 
    display: flex; 
    justify-content: flex-end; 
    gap: 10px; 
    padding: 16px 28px; 
    background: #fff; 
    border-top: 1px solid #e5e7eb; 
    flex-shrink: 0; 
} 

@media (max-width: 900px) { 
    .woopanel-modal-panel--invoice { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; } 
    .vd-body { grid-template-columns: 1fr; overflow-y: auto; } 
    .vd-sidebar { border-left: none; border-top: 1px solid #e5e7eb; } 
    .vd-balance-amount { font-size: 26px; } 
}
