:root {
  --pmq-green: #16a34a;
  --pmq-green-hover: #15803d;
  --pmq-green-soft: #dcfce7;
  --pmq-black: #0f172a;
  --pmq-muted: #64748b;
  --pmq-border: #e2e8f0;
  --pmq-bg: #f8fafc;
  --pmq-card: #ffffff;
  --pmq-sidebar: #0f172a;
  --pmq-sidebar-text: #e2e8f0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --font: "Source Sans 3", system-ui, sans-serif;
  --display: "Bebas Neue", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--pmq-bg);
  color: var(--pmq-black);
  min-height: 100vh;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}

.sidebar {
  background: var(--pmq-sidebar);
  color: var(--pmq-sidebar-text);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.15);
}

.brand-mark {
  font-family: var(--display);
  font-size: 1.75rem;
  letter-spacing: 0.04em;
  background: var(--pmq-green);
  color: #fff;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-sub {
  font-size: 0.75rem;
  opacity: 0.75;
}

.sidebar-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.sidebar-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.folder-tree {
  flex: 1;
  overflow-y: auto;
  font-size: 0.9rem;
}

.folder-item {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.folder-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.folder-item.active {
  background: var(--pmq-green);
  color: #fff;
}

.folder-item .depth-1 {
  padding-left: 1rem;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.main {
  padding: 1.5rem 2rem 3rem;
  max-width: 1600px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.topbar h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 2rem;
  letter-spacing: 0.02em;
  font-weight: 400;
  color: var(--pmq-black);
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  font-family: var(--font);
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--pmq-green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--pmq-green-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: var(--pmq-sidebar-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-ghost {
  background: transparent;
  color: inherit;
}

.sidebar .btn-ghost {
  color: var(--pmq-sidebar-text);
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.06);
}

.sidebar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Op lichte achtergrond: donkere tekst + duidelijke rand (dialogs staan buiten .main) */
.main .btn-secondary,
.modal .btn-secondary {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #94a3b8;
  font-weight: 600;
}

.main .btn-secondary:hover,
.modal .btn-secondary:hover {
  background: #e2e8f0;
  border-color: #64748b;
  color: #020617;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.table-toolbar {
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--pmq-border);
}

.table-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.table-toolbar-search {
  flex: 1;
  min-width: min(100%, 220px);
}

.table-toolbar-search .input {
  margin-top: 0;
}

.table-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}

.table-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.input-inline {
  margin-top: 0;
  min-width: 7.5rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.88rem;
}

.table-summary {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--pmq-border);
  padding: 0;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.product-table thead th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  background: var(--pmq-bg);
  border-bottom: 2px solid var(--pmq-border);
  font-weight: 700;
  color: var(--pmq-black);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition: background 0.12s;
}

.product-table thead th:hover {
  background: #eef2f7;
}

.product-table thead th:focus-visible {
  outline: 2px solid var(--pmq-green);
  outline-offset: -2px;
}

.product-table thead th.th-actions {
  cursor: default;
  width: 1%;
}

.product-table thead th.th-actions:hover {
  background: var(--pmq-bg);
}

.product-table tbody tr {
  border-bottom: 1px solid var(--pmq-border);
  transition: background 0.1s;
}

.product-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.65);
}

.product-table tbody tr:hover {
  background: var(--pmq-green-soft);
  cursor: pointer;
}

.product-table td {
  padding: 0.55rem 0.75rem;
  vertical-align: middle;
}

.product-table td.num,
.product-table th.th-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.product-table .cell-name {
  font-weight: 600;
  color: var(--pmq-black);
  max-width: 14rem;
}

.product-table .cell-category {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--pmq-muted);
}

.product-table .cell-url a {
  color: #047857;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(4, 120, 87, 0.45);
  text-underline-offset: 0.15em;
}

.product-table .cell-url a:hover {
  color: #065f46;
  text-decoration-color: rgba(6, 95, 70, 0.85);
}

.product-table .cell-mono {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-table .badge-ok {
  color: var(--pmq-green-hover);
  font-weight: 700;
}

.product-table .badge-warn {
  color: #b45309;
  font-weight: 700;
}

/* Verkoopprijs t.o.v. laagste concurrent */
.product-table .retail-cell {
  text-align: right;
}

.product-table .price-pill {
  display: inline-block;
  padding: 0.22em 0.6em;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.product-table .price-pill--low {
  background: var(--pmq-green-soft);
  color: var(--pmq-green-hover);
  border: 1px solid rgba(22, 163, 74, 0.35);
}

.product-table .price-pill--high {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid rgba(234, 88, 12, 0.4);
}

.table-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  padding: 0.5rem 0;
}

.table-pagination .pagination-status {
  font-size: 0.9rem;
  color: var(--pmq-muted);
}

.table-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card {
  background: var(--pmq-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--pmq-border);
}

.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--pmq-muted);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.2rem;
  background: var(--pmq-black);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 100;
  max-width: min(420px, calc(100vw - 2rem));
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.toast.error {
  background: #b91c1c;
}

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #14532d 100%);
}

.gate-card {
  max-width: 400px;
  width: 100%;
  padding: 2rem;
}

.gate-logo {
  font-family: var(--display);
  font-size: 3rem;
  margin: 0 0 0.5rem;
  letter-spacing: 0.06em;
  color: var(--pmq-green);
}

.input,
.textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--pmq-border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

.textarea {
  resize: vertical;
  min-height: 80px;
}

.field {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pmq-muted);
}

.field span {
  display: block;
  margin-bottom: 0.15rem;
}

.field-hint {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.textarea-context {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  min-height: 200px;
}

/* Rich example: <hr>, headings, etc. stay visible (contenteditable), unlike a plain textarea */
.textarea-html-editable {
  display: block;
  position: relative;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 200px;
  max-height: min(50vh, 28rem);
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  cursor: text;
}

.textarea-html-editable:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(4, 120, 87, 0.35);
}

.textarea-html-editable[data-show-placeholder]:not(:focus)::before {
  content: attr(data-placeholder);
  color: var(--pmq-muted);
  pointer-events: none;
  white-space: pre-wrap;
}

.textarea-html-editable hr {
  border: none;
  border-top: 1px solid rgba(15, 23, 42, 0.2);
  margin: 0.75rem 0;
}

.product-wizard-prompt-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 960px) {
  .product-wizard-prompt-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
    align-items: start;
  }
}

.product-wizard {
  position: relative;
}

.product-wizard-error {
  background: #fef2f2;
  color: #991b1b;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.product-wizard-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  border-radius: var(--radius);
}

.product-wizard-loading p {
  margin: 0;
  max-width: 22rem;
  font-weight: 600;
  color: var(--pmq-black);
}

.product-wizard-review-intro {
  font-size: 0.9rem;
  margin: 0 0 1rem;
  line-height: 1.45;
}

.product-review-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .product-review-columns {
    grid-template-columns: 1fr;
  }
}

.product-review-card {
  border: 1px solid var(--pmq-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: var(--pmq-bg);
  min-width: 0;
}

.product-review-card-title {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pmq-muted);
}

.product-review-dl {
  margin: 0;
  font-size: 0.88rem;
}

.product-review-dl dt {
  font-weight: 700;
  color: var(--pmq-muted);
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.product-review-dl dt:first-child {
  margin-top: 0;
}

.product-review-dl dd {
  margin: 0.15rem 0 0;
  word-break: break-word;
}

.product-review-warnings {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: #b45309;
}

.product-review-html-label {
  font-size: 0.78rem;
  margin: 0.65rem 0 0.35rem;
}

.review-body-iframe {
  width: 100%;
  min-height: 280px;
  height: 36vh;
  border: 1px solid var(--pmq-border);
  border-radius: 8px;
  background: #fff;
}

.muted {
  color: var(--pmq-muted);
  font-size: 0.9rem;
}

.detail-section-label {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pmq-muted);
}

/* Tekstlinks: donkergroen + onderstreping (ook op grijze/muted achtergrond goed leesbaar) */
a.text-link,
.main a:not(.btn),
.detail-body a:not(.btn) {
  color: #047857;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(4, 120, 87, 0.45);
  text-underline-offset: 0.18em;
}

a.text-link:hover,
.main a:not(.btn):hover,
.detail-body a:not(.btn):hover {
  color: #065f46;
  text-decoration-color: rgba(6, 95, 70, 0.85);
}

a.text-link:focus-visible,
.main a:not(.btn):focus-visible,
.detail-body a:not(.btn):focus-visible {
  outline: 2px solid var(--pmq-green);
  outline-offset: 2px;
  border-radius: 2px;
}

.muted a:not(.btn) {
  color: #0f766e;
  text-decoration-color: rgba(15, 118, 110, 0.5);
}

.muted a:not(.btn):hover {
  color: #115e59;
  text-decoration-color: rgba(17, 94, 89, 0.85);
}

code {
  font-size: 0.85em;
  background: var(--pmq-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.modal {
  border: none;
  padding: 0;
  max-width: calc(100vw - 2rem);
  background: transparent;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.modal-wide {
  width: min(720px, 100%);
}

.modal-inner {
  padding: 1.5rem;
  margin: 2rem auto;
}

.modal-inner h3 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 400;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.detail-head h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  font-size: 0.9rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-actions-jobs {
  margin-bottom: 0.25rem;
  align-items: flex-start;
}

.detail-action-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  max-width: 12.5rem;
}

.detail-action-meta {
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--pmq-muted);
}

.detail-action-never {
  font-style: italic;
  opacity: 0.9;
}

.detail-external-top {
  margin-bottom: 0.35rem;
}

.btn-external-disabled {
  cursor: not-allowed;
  pointer-events: none;
}

/* Detailmodal: uitgeschakelde knoppen leesbaar houden (geen doorzichtige opacity) */
.modal .btn.btn-external-disabled {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}

.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

.competitor-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--pmq-border);
  font-size: 0.88rem;
}

.competitor-row:last-child {
  border-bottom: none;
}

/* Admin batch page */
.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.admin-sync-pill {
  font-size: 0.8rem;
  color: var(--pmq-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--pmq-bg);
  border: 1px solid var(--pmq-border);
}

.admin-sync-pill.is-busy {
  color: #b45309;
  background: #fffbeb;
  border-color: #fcd34d;
}
