/* Site list — same desk as the other list / detail pages. Tokens stay in main.css. */

.hub-main:has(#site-database-panel:not([hidden])) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hub-main:has(#site-database-panel:not([hidden])) > .subnav {
  flex: 0 0 auto;
}

.hub-main:has(#site-database-panel:not([hidden])) > .stage {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#site-database-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.site-db-screen {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  gap: 6px;
}

.site-db-screen > .list-head,
.site-db-screen > .error,
.site-db-screen > .due {
  flex: 0 0 auto;
  margin: 0;
}

#site-database-panel .ord-po-workspace {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
}

#site-database-panel .ord-po-layout,
#site-database-panel .ord-po-list,
#site-database-panel .ord-po-detail-pane {
  min-width: 0;
  min-height: 0;
}

#site-database-panel .ord-po-list {
  overflow: auto;
}

#site-database-panel .ord-po-table {
  display: grid;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  align-content: start;
  overflow: auto;
}

#site-database-panel .cat-list-sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  align-self: start;
  background: var(--surface-2);
  width: max-content;
  min-width: 100%;
}

#site-database-panel .cat-list-sticky .ord-po-list-tools,
#site-database-panel .cat-list-sticky .ord-po-filters {
  position: static;
  background: var(--surface-2);
}

#site-database-panel .ord-po-filters,
#site-database-panel .ord-po-row {
  width: 100%;
  min-width: var(--ord-po-min, 0px);
}

#site-database-panel .ord-po-filters input {
  height: var(--list-row-height);
  min-height: var(--list-row-height);
  max-height: var(--list-row-height);
  padding: 0 12px 0 6px;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  box-sizing: border-box;
}

#site-database-panel .ord-po-filters .ord-sort-head {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#site-database-panel .ord-po-row,
#site-database-panel .ord-po-row .ord-po-col {
  font-size: 0.96rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

#site-database-panel .ord-po-row .ord-po-col,
#site-database-panel .ord-po-row .ord-po-col strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#site-database-panel .ord-po-row .ord-po-col strong {
  display: block;
  font-weight: 600;
}

#site-database-panel .ord-po-row .ord-po-col:has(.ord-pill) {
  display: flex;
  align-items: center;
  justify-content: center;
}

#site-database-panel .ord-po-row .ord-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#site-database-panel .ord-po-row.is-inactive {
  opacity: 0.6;
}

#site-database-panel .site-db-detail {
  padding: var(--nav-gap) var(--nav-gap) var(--nav-gap) 0;
  overflow: auto;
  height: 100%;
  align-content: start;
  box-sizing: border-box;
  background: var(--bg);
  gap: var(--nav-gap);
}

#site-database-panel .site-db-detail .ord-po-number {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand);
}

.site-db-form {
  display: grid;
  gap: var(--nav-gap);
  margin-top: 0;
}

.site-db-section {
  border: 0;
  background: var(--surface);
  border-radius: var(--radius);
}

.site-db-section-title {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border-bottom: 0;
}

.site-db-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 10px;
}

.site-db-fields .field {
  min-width: 0;
  margin: 0;
}

.site-db-fields .field.is-wide {
  grid-column: 1 / -1;
}

.site-db-fields .field span {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.site-db-fields select {
  width: 100%;
}

.site-db-fields .field em {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
}

.site-db-fields select:disabled {
  color: var(--ink);
  background-color: var(--bg);
  cursor: not-allowed;
}

.site-db-warn {
  margin: 0;
  padding: 0 0 1rem;
  color: var(--ink);
}

@media (max-width: 980px) {
  .hub-main:has(#site-database-panel:not([hidden])),
  .hub-main:has(#site-database-panel:not([hidden])) > .stage {
    overflow: auto;
  }

  #site-database-panel:not([hidden]),
  #site-database-panel .site-db-screen,
  #site-database-panel .ord-po-workspace,
  #site-database-panel .ord-po-layout {
    height: auto;
    overflow: visible;
  }

  #site-database-panel .ord-po-list {
    max-height: 42vh;
  }

  #site-database-panel .ord-po-detail-pane,
  #site-database-panel .site-db-detail {
    height: auto;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .site-db-fields {
    grid-template-columns: 1fr;
  }
}
