.pobg-panel {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.pobg-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px;
  overflow-x: visible;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-xs);
  scrollbar-width: thin;
}

.pobg-subnav button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  white-space: nowrap;
}

.pobg-subnav button:hover { color: var(--text); background: var(--surface-strong); }
.pobg-subnav button.active {
  color: #fff;
  background: linear-gradient(135deg, #1f67db, #3059c8 58%, #5945bb);
  box-shadow: 0 8px 18px rgb(31 103 219 / .22);
}

.pobg-overview { display: grid; gap: 18px; }
.pobg-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 94% 0, rgb(69 202 188 / .13), transparent 36%),
    var(--surface);
}
.pobg-source.is-empty { background: color-mix(in srgb, var(--warning) 68%, var(--surface)); }
.pobg-source > div { display: grid; gap: 4px; }
.pobg-source strong { color: var(--text); font-size: 16px; }
.pobg-source span { color: var(--muted); font-size: 13px; }
.pobg-source-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.pobg-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.pobg-metric {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 126px;
  padding: 19px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.pobg-metric::after {
  position: absolute;
  inset: auto -24px -36px auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgb(52 110 226 / .08);
  content: "";
}
.pobg-metric span { color: var(--muted); font-weight: 700; }
.pobg-metric strong { align-self: end; color: var(--text); font-size: clamp(26px, 3vw, 38px); line-height: 1; }
.pobg-metric small { color: var(--muted); }

.pobg-overview-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 14px; }
.pobg-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.pobg-card h2 { margin: 0 0 18px; font-size: 18px; }
.pobg-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.pobg-alert:first-of-type { border-top: 0; }
.pobg-alert > div { display: grid; gap: 3px; }
.pobg-alert span { color: var(--muted); font-size: 13px; }
.pobg-alert-value {
  max-width: 170px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--danger-text);
  background: var(--danger);
  font-size: 12px;
  text-align: center;
}
.pobg-route-step { display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; padding: 10px 0; }
.pobg-route-step > span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #28aaac, #3371d4);
  font-weight: 800;
}
.pobg-route-step small { color: var(--muted); }
.pobg-rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.pobg-rules h2 { grid-column: 1 / -1; }
.pobg-rules > div { display: grid; gap: 3px; padding: 12px 0; border-top: 1px solid var(--line); }
.pobg-rules span, .pobg-rules small { color: var(--muted); font-size: 12px; }
.pobg-rules strong { font-size: 15px; }
.pobg-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.pobg-heading-copy { display: grid; gap: 5px; }
.pobg-heading-copy h2 { margin-bottom: 0; }
.pobg-heading-copy p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.5; }
.pobg-quality-grid, .pobg-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.pobg-preview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pobg-preview-grid .pobg-metric { min-height: 104px; }

.pobg-list {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.pobg-list-head {
  display: grid;
  gap: 18px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}
.pobg-list-head h2 { margin: 5px 0 3px; font-size: 25px; }
.pobg-list-head p { margin: 0; color: var(--muted); }
.pobg-list-controls { display: grid; grid-template-columns: minmax(190px, 1.2fr) minmax(150px, 1fr) minmax(160px, 1fr) 132px auto; gap: 8px; width: 100%; min-width: 0; }
.pobg-list-controls input, .pobg-list-controls select { min-height: 42px; }
.pobg-table-wrap { max-width: 100%; overflow: auto; }
.pobg-table { width: 100%; min-width: 880px; border-collapse: collapse; }
.pobg-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 11px;
  letter-spacing: .045em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.pobg-table td { max-width: 300px; padding: 13px 14px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 13px; }
.pobg-table tr { transition: background-color .16s ease; }
.pobg-table tbody tr:hover { background: var(--surface-muted); cursor: pointer; }
.pobg-table .row-button { max-width: 270px; padding: 0; overflow: hidden; border: 0; color: var(--accent); background: transparent; font-weight: 800; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.pobg-pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 14px 20px; color: var(--muted); font-size: 13px; }
.pobg-empty { padding: 22px; color: var(--muted); text-align: center; }

.pobg-detail-dialog { display: grid; gap: 16px; }
.pobg-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.pobg-field-grid > div { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-muted); }
.pobg-field-grid dt { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.pobg-field-grid dd { margin: 0; overflow-wrap: anywhere; color: var(--text); line-height: 1.45; }
.pobg-related { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pobg-related section { display: grid; align-content: start; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
.pobg-related .row-button { width: fit-content; max-width: 100%; padding: 0; border: 0; color: var(--accent); background: transparent; text-align: left; }
.pobg-history { display: grid; gap: 8px; }
.pobg-history article, .pobg-import-card, .pobg-duplicate-card { display: grid; gap: 4px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
.pobg-history span, .pobg-history small, .pobg-import-card span, .pobg-import-card small, .pobg-duplicate-card span { color: var(--muted); }
.pobg-duplicate-card .row-button { justify-self: start; padding: 0; border: 0; color: var(--accent); background: transparent; }
.pobg-nav-entry small { margin-left: auto; color: currentColor; font-size: 10px; opacity: .62; }
.pobg-lessons { display: grid; gap: 10px; }
.pobg-lessons h3 { margin: 0 0 4px; }
.pobg-lessons p { margin: 0; color: var(--muted); }
.pobg-lesson-row { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
.pobg-lesson-row > div { display: grid; flex: 1; gap: 3px; min-width: 0; }
.pobg-lesson-row span { color: var(--muted); font-size: 12px; }
.pobg-lesson-photo { display: block; width: min(100%, 920px); max-height: 72vh; margin: auto; border-radius: 16px; object-fit: contain; }
.pobg-batch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto; align-items: center; gap: 18px; }
.pobg-batch h2 { margin: 4px 0; }
.pobg-batch p { margin: 0; color: var(--muted); }
.pobg-batch .pobg-metric { min-height: 96px; }

@media (max-width: 1180px) {
  .pobg-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pobg-overview-grid { grid-template-columns: 1fr; }
  .pobg-list-controls { min-width: 0; width: 100%; }
}

@media (max-width: 760px) {
  .pobg-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pobg-source, .pobg-list-head, .pobg-card-heading { align-items: stretch; flex-direction: column; }
  .pobg-list-controls { grid-template-columns: 1fr; min-width: 0; width: 100%; }
  .pobg-rules, .pobg-field-grid, .pobg-related, .pobg-quality-grid, .pobg-preview-grid { grid-template-columns: 1fr; }
  .pobg-rules h2 { grid-column: auto; }
  .pobg-pager { justify-content: space-between; }
  .pobg-lesson-row { align-items: stretch; flex-direction: column; }
  .pobg-lesson-row button { width: 100%; }
  .pobg-batch { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .pobg-subnav { flex-wrap: nowrap; overflow-x: auto; }
  .pobg-panel { gap: 14px; }
  .pobg-subnav { gap: 4px; padding: 5px; border-radius: 13px; scrollbar-width: none; }
  .pobg-subnav::-webkit-scrollbar { display: none; }
  .pobg-subnav button { min-height: 34px; padding: 0 11px; border-radius: 9px; font-size: 11px; }
  .pobg-source, .pobg-card { padding: 16px; border-radius: 15px; }
  .pobg-source-actions > button { flex: 1 1 auto; }
  .pobg-metrics { gap: 8px; }
  .pobg-metric { min-height: 98px; padding: 14px; border-radius: 14px; }
  .pobg-metric strong { font-size: 26px; }
  .pobg-card h2 { font-size: 16px; }
  .pobg-alert { align-items: flex-start; gap: 10px; }
  .pobg-alert-value { flex: none; max-width: 105px; }
  .pobg-list { overflow: visible; border-radius: 15px; }
  .pobg-list-head { gap: 16px; padding: 17px 14px; }
  .pobg-list-head h2 { font-size: 21px; }
  .pobg-list-controls { gap: 7px; }
  .pobg-table-wrap { overflow: visible; padding: 0 9px 2px; }
  .pobg-table, .pobg-table tbody { display: block; width: 100%; min-width: 0; }
  .pobg-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pobg-table tbody tr { display: block; margin: 10px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-xs); }
  .pobg-table tbody td { display: grid; grid-template-columns: minmax(86px, 35%) minmax(0, 1fr); gap: 10px; align-items: center; width: 100%; max-width: none; padding: 9px 11px; border: 0; border-bottom: 1px solid var(--line); white-space: normal; overflow-wrap: anywhere; }
  .pobg-table tbody td:last-child { border-bottom: 0; }
  .pobg-table tbody td::before { content: attr(data-label); color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
  .pobg-table .row-button { max-width: 100%; min-height: 26px; overflow: visible; text-overflow: clip; white-space: normal; }
  .pobg-table .pobg-empty { display: block; text-align: center; }
  .pobg-table .pobg-empty::before { content: none; }
  .pobg-pager { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 12px; font-size: 11px; text-align: center; }
  .pobg-pager button { min-height: 34px; padding: 6px 9px; }
}
