.role-entry {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pet-cost-workspace[hidden],
.pet-cost-compare-bar[hidden] {
  display: none !important;
}

.app-shell.role-pet-cost > .store-selector,
.app-shell.role-pet-cost > .upload-test-section,
.app-shell.role-pet-cost > .logic-panel,
.app-shell.role-pet-cost > .feedback-section,
.app-shell.role-pet-cost > .adjustment-section,
.app-shell.role-pet-cost > .store-summary,
.app-shell.role-pet-cost > .monitor-section,
.app-shell.role-pet-cost > .action-section,
.app-shell.role-pet-cost > .operator-record-entry,
.app-shell.role-pet-cost > .operator-records-section,
.app-shell.role-pet-cost > .purchase-workspace {
  display: none;
}

.pet-cost-workspace {
  margin-top: 12px;
}

.pet-cost-head,
.pet-cost-form-actions,
.pet-cost-result-bar,
.pet-cost-dialog-head,
.pet-cost-compare-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pet-cost-head {
  margin-bottom: 12px;
}

.pet-cost-head h2,
.pet-cost-head p,
.pet-cost-dialog h3,
.pet-cost-dialog p {
  margin: 0;
}

.pet-cost-head h2 {
  font-size: 22px;
}

.pet-cost-head p,
.pet-cost-status,
.pet-cost-dialog p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.pet-cost-operator {
  min-width: 172px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: right;
}

.pet-cost-operator span,
.pet-cost-operator strong {
  display: block;
}

.pet-cost-operator span {
  color: var(--muted);
  font-size: 11px;
}

.pet-cost-operator strong {
  margin-top: 2px;
  color: var(--brand);
  font-size: 14px;
}

.pet-cost-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.pet-cost-metrics > div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.pet-cost-metrics > div:last-child {
  border-right: 0;
}

.pet-cost-metrics span,
.pet-cost-metrics strong {
  display: block;
}

.pet-cost-inbound-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-top: 0;
  background: #f8faf9;
}

.pet-cost-inbound-summary > strong {
  flex: 0 0 auto;
  font-size: 12px;
}

.pet-cost-inbound-summary > div {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.pet-cost-inbound-summary span {
  color: #43504c;
  font-size: 12px;
}

.pet-cost-inbound-summary span b {
  margin-right: 3px;
  color: var(--brand);
  font-size: 14px;
}

.pet-cost-inbound-summary em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.pet-cost-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pet-cost-metrics strong {
  margin-top: 3px;
  font-size: 22px;
  line-height: 1;
}

.pet-cost-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pet-cost-panel + .pet-cost-panel {
  margin-top: 12px;
}

.pet-cost-query-panel {
  padding: 14px;
}

.pet-cost-filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(6, minmax(132px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.pet-cost-filter-grid label,
.pet-cost-search-wrap {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.pet-cost-filter-grid label > span,
.pet-cost-search-wrap > span {
  color: #384742;
  font-size: 11px;
  font-weight: 800;
}

.pet-cost-filter-grid select,
.pet-cost-search,
.pet-cost-field input,
.pet-cost-field textarea {
  width: 100%;
  border: 1px solid #b8c4c0;
  border-radius: 7px;
  outline: none;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.pet-cost-filter-grid select,
.pet-cost-search,
.pet-cost-field input {
  height: 38px;
  padding: 0 10px;
}

.pet-cost-filter-grid select:focus,
.pet-cost-search:focus,
.pet-cost-field input:focus,
.pet-cost-field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 99, .11);
}

.pet-cost-result-bar {
  min-height: 46px;
  margin-top: 11px;
  padding: 8px 0 10px;
  border-top: 1px solid #edf1ef;
}

.pet-cost-result-bar strong {
  font-size: 13px;
}

.pet-cost-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--brand);
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.pet-cost-button:hover:not(:disabled) {
  filter: brightness(.96);
}

.pet-cost-button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.pet-cost-button.danger {
  border-color: #d7a59a;
  background: #fff;
  color: var(--red);
}

.pet-cost-button:disabled {
  cursor: not-allowed;
  opacity: .52;
}

.pet-cost-list-shell {
  max-height: min(680px, 70vh);
  border: 1px solid var(--line);
  overflow: auto;
}

.pet-cost-list-header,
.pet-cost-row {
  display: grid;
  grid-template-columns: 38px minmax(260px, 1.8fr) 132px 150px 140px 200px 130px 150px 112px 148px;
  min-width: 1510px;
  align-items: center;
}

.pet-cost-list-header {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  background: #f5f8f7;
  color: #56645f;
  font-size: 11px;
  font-weight: 900;
}

.pet-cost-list-header span,
.pet-cost-row > div {
  min-width: 0;
  padding: 8px 9px;
}

.pet-cost-row {
  min-height: 76px;
  border-bottom: 1px solid #e8eeeb;
  font-size: 12px;
}

.pet-cost-row:nth-child(even) {
  background: #fbfcfc;
}

.pet-cost-row:hover {
  background: #f0f7f5;
}

.pet-cost-row:last-child {
  border-bottom: 0;
}

.pet-cost-row > div {
  overflow-wrap: anywhere;
}

.pet-cost-select {
  display: flex;
  justify-content: center;
}

.pet-cost-select input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.pet-cost-product strong,
.pet-cost-product span,
.pet-cost-cell-title,
.pet-cost-cell-sub,
.pet-cost-price strong,
.pet-cost-price span,
.pet-cost-compare-shell td span {
  display: block;
}

.pet-cost-product strong,
.pet-cost-cell-title {
  line-height: 1.45;
}

.pet-cost-product span,
.pet-cost-cell-sub,
.pet-cost-price span,
.pet-cost-compare-shell td span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.pet-cost-price strong {
  color: var(--brand);
  font-size: 15px;
  line-height: 1.25;
}

.pet-cost-inbound strong,
.pet-cost-inbound span {
  display: block;
}

.pet-cost-inbound strong {
  color: #24463d;
  font-size: 13px;
  line-height: 1.3;
}

.pet-cost-inbound span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.pet-cost-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.pet-cost-status-pill.direct {
  border-color: #9acdbf;
  background: var(--brand-soft);
  color: var(--brand);
}

.pet-cost-status-pill.reference {
  border-color: #b8c9e8;
  background: var(--blue-soft);
  color: var(--blue);
}

.pet-cost-status-pill.missing {
  border-color: #e6cb8e;
  background: var(--amber-soft);
  color: var(--amber);
}

.pet-cost-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pet-cost-actions .pet-cost-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.pet-cost-empty {
  min-width: 1510px;
  padding: 42px 16px;
  color: var(--muted);
  text-align: center;
}

.pet-cost-editor {
  overflow: hidden;
}

.pet-cost-editor summary {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  list-style: none;
  cursor: pointer;
}

.pet-cost-editor summary::-webkit-details-marker {
  display: none;
}

.pet-cost-editor summary::after {
  margin-left: auto;
  color: var(--brand);
  content: "+";
  font-size: 22px;
  font-weight: 700;
}

.pet-cost-editor[open] summary::after {
  content: "-";
}

.pet-cost-editor summary span,
.pet-cost-editor summary strong,
.pet-cost-editor summary em {
  display: block;
}

.pet-cost-editor summary em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.pet-cost-editor form {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.pet-cost-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.pet-cost-field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.pet-cost-field.full {
  grid-column: 1 / -1;
}

.pet-cost-field > span {
  color: #384742;
  font-size: 12px;
  font-weight: 800;
}

.pet-cost-field textarea {
  min-height: 70px;
  padding: 10px;
  resize: vertical;
}

.pet-cost-form-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.pet-cost-form-actions .pet-cost-status {
  margin-right: auto;
}

.pet-cost-compare-bar {
  position: sticky;
  z-index: 4;
  bottom: 10px;
  width: min(760px, calc(100% - 24px));
  margin: 12px auto 0;
  padding: 10px 12px;
  border: 1px solid #8dbbae;
  border-radius: 8px;
  background: #f4fbf9;
  box-shadow: 0 10px 30px rgba(22, 33, 30, .14);
}

.pet-cost-compare-bar span {
  color: var(--muted);
  font-size: 11px;
}

.pet-cost-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 24px 70px rgba(12, 24, 20, .28);
}

.pet-cost-dialog::backdrop {
  background: rgba(12, 24, 20, .46);
}

.pet-cost-dialog-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.pet-cost-dialog h3 {
  font-size: 17px;
}

.pet-cost-icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.pet-cost-compare-shell {
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.pet-cost-compare-shell table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.pet-cost-compare-shell th,
.pet-cost-compare-shell td {
  padding: 11px 12px;
  border-bottom: 1px solid #e8eeeb;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

.pet-cost-compare-shell th {
  position: sticky;
  top: 0;
  background: #f5f8f7;
  color: #56645f;
  font-size: 11px;
}

@media (max-width: 1260px) {
  .pet-cost-filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pet-cost-search-wrap {
    grid-column: span 2;
  }
}

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

  .pet-cost-form-grid,
  .pet-cost-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pet-cost-search-wrap {
    grid-column: 1 / -1;
  }

  .pet-cost-head,
  .pet-cost-form-actions,
  .pet-cost-compare-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pet-cost-operator {
    width: 100%;
    text-align: left;
  }

  .pet-cost-inbound-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .pet-cost-form-actions .pet-cost-status {
    margin-right: 0;
  }

  .pet-cost-form-actions .pet-cost-button,
  .pet-cost-compare-bar .pet-cost-button {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .pet-cost-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pet-cost-metrics > div,
  .pet-cost-metrics > div:last-child {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .pet-cost-inbound-summary > div {
    gap: 6px 12px;
  }

  .pet-cost-metrics > div:nth-child(even) {
    border-right: 0;
  }

  .pet-cost-metrics > div:last-child {
    border-bottom: 0;
  }

  .pet-cost-form-grid,
  .pet-cost-filter-grid {
    grid-template-columns: 1fr;
  }

  .pet-cost-search-wrap,
  .pet-cost-field.full {
    grid-column: auto;
  }

  .pet-cost-query-panel {
    padding: 10px;
  }

  .pet-cost-result-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pet-cost-result-bar .pet-cost-button {
    width: 100%;
  }
}
