/* Zipol ERP — customer panel pages.
   Colors and radii follow the Zipol Kala theme tokens (--zk-*) when present, so every page
   matches the rest of the site; the old values stay as fallbacks for other themes. */
.woocommerce-MyAccount-content, .zipol-page {
  --zp-ink: var(--zk-ink, #232933);
  --zp-text: var(--zk-text, #3f4550);
  --zp-muted: var(--zk-faint, #81858b);
  --zp-line: var(--zk-line, #eceef1);
  --zp-line-soft: var(--zk-line-soft, #f1f5f9);
  --zp-soft: var(--zk-soft, #f7f8fa);
  --zp-accent: var(--zk-accent, #ef4056);
  --zp-ok: var(--zk-ok, #0a8a5a);
  --zp-danger: var(--zk-danger, #d42a3f);
  --zp-r: var(--zk-r, 9px);
  --zp-r-lg: var(--zk-r-lg, 14px);
}

.zipol-bom-container { display: grid; gap: 15px; }
.zipol-bom-card {
  background: var(--zp-soft); padding: 15px; border-radius: var(--zp-r-lg); border: 1px solid var(--zp-line);
}
.zipol-bom-card summary {
  font-weight: bold; font-size: 16px; color: var(--zp-ink); cursor: pointer; margin-bottom: 10px;
}
.zipol-bom-table input { width: 100%; padding: 5px; }
.zipol-btn-save { margin-top: 10px; }
.zipol-btn-delete { background: var(--zp-danger) !important; color: #fff !important; border: none; }
.zipol-notice {
  padding: 8px 12px; border-radius: 6px; margin: 10px 0;
}
.zipol-success { background: #d1fae5; color: #065f46; }
.zipol-error { background: #fee2e2; color: #b91c1c; }
.zipol-empty { text-align: center; color: var(--zp-muted); }

/* Shared search and column filter shown above every non-materials table. */
.woocommerce-MyAccount-content .zipol-table-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 7px;
  padding: 9px;
  border: 1px solid var(--zp-line);
  border-radius: var(--zp-r);
  background: var(--zp-soft);
}

.woocommerce-MyAccount-content .zipol-table-tools input,
.woocommerce-MyAccount-content .zipol-table-tools select {
  min-height: 36px;
  margin: 0 !important;
  background: #fff;
}

.woocommerce-MyAccount-content .zipol-table-tools input {
  min-width: 210px;
  flex: 1;
}

.woocommerce-MyAccount-content .zipol-table-result-count {
  color: var(--zp-muted);
  font-size: 12px;
  white-space: nowrap;
}

/*
 * Excel-like freeze panes for every table in the Zipol account pages.
 * The wrapper is added by zipol.js so both sticky axes use the same
 * horizontal/vertical scrolling container.
 */
.woocommerce-MyAccount-content .zipol-freeze-pane {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--zp-line);
  border-radius: var(--zp-r-lg);
  background: #fff;
}

.woocommerce-MyAccount-content .zipol-freeze-table {
  margin: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  min-width: 100%;
}

/* Freeze the header row while the table pane scrolls vertically. */
.woocommerce-MyAccount-content .zipol-freeze-table thead th {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 30;
  background: var(--zp-soft) !important;
  background-clip: padding-box;
  box-shadow: 0 1px 0 var(--zp-line), 0 3px 7px rgba(15, 23, 42, 0.12);
}

/* In RTL tables the first column is the right-hand column. */
.woocommerce-MyAccount-content .zipol-freeze-table tr > th:first-child,
.woocommerce-MyAccount-content .zipol-freeze-table tbody tr > td:first-child:not([colspan]) {
  position: -webkit-sticky !important;
  position: sticky !important;
  right: 0 !important;
  z-index: 25;
  background: #fff !important;
  background-clip: padding-box;
  box-shadow: -1px 0 0 var(--zp-line), -4px 0 7px rgba(15, 23, 42, 0.08);
}

.woocommerce-MyAccount-content .zipol-freeze-table tbody tr:nth-child(even) > td:first-child:not([colspan]) {
  background: var(--zp-soft) !important;
}

/* The corner cell must stay above both the frozen row and column. */
.woocommerce-MyAccount-content .zipol-freeze-table thead tr > th:first-child {
  top: 0 !important;
  right: 0 !important;
  z-index: 50;
  background: var(--zp-soft) !important;
}

@media screen and (max-width: 782px) {
  .woocommerce-MyAccount-content .zipol-freeze-pane {
    max-height: 68vh;
  }
}

/* ===== 1.10: unified, minimal look for every ERP page (same tokens as the Zipol UI kit) ===== */

.zipol-page {
  color: var(--zp-text);
  font-size: 14px;
}
.zipol-page > h2, .zipol-page > div > h2, .zipol-page .zipol-materials-page > h2 { font-size: 20px; color: var(--zp-ink); margin: 0 0 14px; font-weight: 700; }
.zipol-page h3 { font-size: 15px; color: var(--zp-ink); margin: 18px 0 10px; }

/* tables */
.woocommerce-MyAccount-content .zipol-page table { border: 0; border-collapse: separate; border-spacing: 0; font-size: 13px; background: #fff; }
.woocommerce-MyAccount-content .zipol-page table thead th { background: var(--zp-soft) !important; color: var(--zp-muted); font-weight: 600; font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--zp-line); text-align: right; }
.woocommerce-MyAccount-content .zipol-page table td { padding: 9px 12px; border-bottom: 1px solid var(--zp-line); vertical-align: middle; }
.woocommerce-MyAccount-content .zipol-page table.striped > tbody > :nth-child(odd),
.woocommerce-MyAccount-content .zipol-page table.widefat tr:nth-child(odd) td { background: #fff; }
.woocommerce-MyAccount-content .zipol-page .zipol-freeze-pane { border-color: var(--zp-line); border-radius: var(--zp-r-lg); }

/* form controls */
.zipol-page input[type="text"], .zipol-page input[type="number"], .zipol-page input[type="search"], .zipol-page input[type="date"], .zipol-page select, .zipol-page textarea {
  min-height: 36px; padding: 6px 10px; border: 1px solid var(--zp-line); border-radius: var(--zp-r); background: #fff; color: var(--zp-ink); font: inherit; font-size: 13px; box-shadow: none;
}
.zipol-page input:focus, .zipol-page select:focus, .zipol-page textarea:focus { outline: none; border-color: var(--zp-line); box-shadow: 0 0 0 3px rgba(239, 64, 86, .08); }
.zipol-page .button, .zipol-page .button-primary, .zipol-page input[type="submit"] { border-radius: var(--zp-r); min-height: 36px; font-size: 13px; font-weight: 600; }
.zipol-page .button-primary, .zipol-page input[type="submit"].button-primary { background: var(--zp-accent); border-color: var(--zp-accent); color: #fff; }

/* shared search bar added by zipol.js */
.woocommerce-MyAccount-content .zipol-page .zipol-table-tools { background: var(--zp-soft); border-color: var(--zp-line); border-radius: var(--zp-r-lg); padding: 10px 12px; }

/* BOM cards */
.woocommerce-MyAccount-content .zipol-bom-card { background: #fff; border: 1px solid var(--zp-line, var(--zp-line)); border-radius: var(--zp-r-lg); padding: 0; transition: box-shadow .15s, border-color .15s; }
.woocommerce-MyAccount-content .zipol-bom-card + .zipol-bom-card { margin-top: 10px; }
.woocommerce-MyAccount-content .zipol-bom-card[open] { box-shadow: 0 6px 20px rgba(35, 41, 51, .05); border-color: var(--zp-line); }
.woocommerce-MyAccount-content .zipol-bom-card > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; padding: 14px 16px; font-size: 14px; color: var(--zp-ink); list-style: none; }
.woocommerce-MyAccount-content .zipol-bom-card[open] > summary { border-bottom: 1px solid var(--zp-line); }
.woocommerce-MyAccount-content .zipol-bom-card > form { padding: 12px 16px 16px; }
.zipol-bom-code { color: var(--zp-muted); font-size: 12px; }
.zipol-bom-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.zipol-bom-page .zipol-tree-wrapper { border-color: var(--zp-line) !important; border-radius: var(--zp-r); }

/* ===== 1.0.2 (Zipol ERP): same notices, pager, forms and charts as the Zipol Kala theme ===== */
.zipol-page .updated, .zipol-page .notice, .zipol-page .error, .zipol-alert {
  margin: 0 0 14px; padding: 10px 14px; border: 0; border-radius: var(--zp-r); font-size: 13px;
  background: #e7f6ef; color: var(--zp-ok); box-shadow: none;
}
.zipol-page .updated p, .zipol-page .notice p, .zipol-page .error p { margin: 0; }
.zipol-page .error, .zipol-page .notice-error, .zipol-alert.is-danger { background: #fdecee; color: var(--zp-danger); }
.zipol-alert.is-warning { background: #fff4e0; color: #8a5300; }
.zipol-alert.is-info { background: #eaf2fd; color: #1d5fb8; }
.zipol-muted { color: var(--zp-muted); }
.zipol-strong { color: var(--zp-ink); font-weight: 700; }

/* pager (BOM, forecasts) */
.zipol-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 16px 0 4px; }
.zipol-pager a, .zipol-pager span { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--zp-line); border-radius: var(--zp-r); background: #fff; color: var(--zp-text); font-size: 13px; text-decoration: none; }
.zipol-pager a:hover { background: var(--zp-soft); color: var(--zp-ink); }
.zipol-pager .current { background: var(--zp-accent); border-color: var(--zp-accent); color: #fff; font-weight: 700; }
.zipol-pager .gap { border: 0; background: none; min-width: 16px; padding: 0; }
.zipol-pager-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.zipol-pager-bar .zipol-pager { margin: 0; }
.zipol-pager-bar label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--zp-muted); }
.zipol-pager-bar select { min-height: 34px; }

/* form cards (semi-products …) */
.zipol-form-card { margin-bottom: 18px; }
.zipol-form-card h3 { margin-top: 0; }
.zipol-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.zipol-form-grid .is-wide { grid-column: 1 / -1; }
.zipol-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.zipol-field > span { font-size: 12px; color: var(--zp-muted); }
.zipol-field input, .zipol-field select, .zipol-field textarea { width: 100%; }
.zipol-semi-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 16px 0; color: var(--zp-muted); font-size: 13px; }
.zipol-semi-meta strong { color: var(--zp-ink); }

/* buttons: plain WordPress classes look like the theme's secondary/primary buttons */
.woocommerce-MyAccount-content .zipol-page .button:not(.button-primary) { background: #fff; border: 1px solid var(--zp-line); color: var(--zp-ink); }
.woocommerce-MyAccount-content .zipol-page .button:not(.button-primary):hover { background: var(--zp-soft); }

/* status chart (inline SVG) */
.zipol-chart { margin: 8px 0 0; padding: 16px; border: 1px solid var(--zp-line); border-radius: var(--zp-r-lg); background: #fff; }
.zipol-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.zipol-chart .grid { stroke: var(--zp-line-soft); }
.zipol-chart .axis-label { fill: var(--zp-muted); font-size: 11px; }
.zipol-chart .area { fill: var(--zp-accent); opacity: .08; }
.zipol-chart .line { fill: none; stroke: var(--zp-accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.zipol-chart .dot { fill: #fff; stroke: var(--zp-accent); stroke-width: 2; }
.zipol-chart-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; color: var(--zp-muted); font-size: 12px; }
.zipol-chart-legend strong { color: var(--zp-ink); font-size: 15px; }

@media (max-width: 600px) {
  .zipol-form-grid { grid-template-columns: minmax(0, 1fr); }
}
.zipol-reorder-hint { background: var(--zp-soft) !important; color: var(--zp-muted); font-size: 12px; }
.zipol-token-page { max-width: 720px; }
.zipol-token-box strong { display: block; margin-bottom: 6px; }
.zipol-token-box code { display: block; margin-bottom: 10px; padding: 8px 10px; border-radius: var(--zp-r); background: #fff; color: var(--zp-ink); font-size: 14px; word-break: break-all; }
