.places-header,
.places-page {
  max-width: 1480px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 4rem);
}

.places-header {
  padding-top: 2rem;
  padding-bottom: 1.5rem;
}

.places-header h1 {
  margin-top: 1.4rem;
}

.back-link {
  color: var(--teal-dark);
  font-weight: 750;
  text-decoration: none;
}

.places-toolbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 254, 250, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 0.62rem 0.95rem;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--teal);
  background: var(--teal);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.local-warning {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: #fff0d8;
  color: #684a16;
}

.place-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.place-stats article {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.place-stats strong,
.place-stats span {
  display: block;
}

.place-stats strong {
  color: var(--teal-dark);
  font-size: 1.8rem;
}

.place-stats span,
#save-indicator,
.result-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.room-section,
.container-section {
  margin-bottom: 1.5rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.section-heading h2 {
  margin-bottom: 1rem;
}

.section-help {
  margin: -0.65rem 0 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.room-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.65rem;
}

.room-card {
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  padding: 0.85rem;
}

.room-card.inactive {
  opacity: 0.56;
}

.room-card.selected-room {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.room-filter-button {
  display: grid;
  justify-self: stretch !important;
  gap: 0.35rem;
  width: 100%;
  border-radius: 9px !important;
  color: inherit !important;
  text-align: left;
  cursor: pointer;
}

.room-filter-button:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

.room-filter-button span,
.room-filter-button small {
  font-weight: 400;
}

.room-card strong {
  font-size: 1rem;
}

.room-card small {
  color: var(--muted);
}

.room-card button,
.container-card button {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  padding: 0;
  font-weight: 750;
}

.place-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(2, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.container-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.75rem;
}

.container-card {
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  padding: 1rem;
}

.container-card.retired {
  opacity: 0.62;
  background: #f3f3f0;
}

.container-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.container-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.container-card-actions [data-content-container] {
  border-radius: 999px;
  background: var(--teal-soft);
  padding: 0.35rem 0.55rem;
}

.content-count-detail {
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}

.container-code {
  display: inline-flex;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
}

.container-code.provisional {
  background: var(--amber-soft);
  color: #715820;
}

.container-card h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.container-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.container-detail {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.lifecycle-badge {
  justify-self: start;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #315764;
  padding: 0.27rem 0.52rem;
  font-size: 0.7rem;
  font-weight: 750;
}

.edit-dialog {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 30px 100px rgba(14, 54, 49, 0.3);
}

.small-dialog {
  width: min(500px, calc(100vw - 2rem));
}

.edit-dialog::backdrop {
  background: rgba(16, 35, 32, 0.68);
}

.content-dialog {
  width: min(960px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  padding: clamp(1rem, 4vw, 2rem);
  box-shadow: 0 30px 100px rgba(14, 54, 49, 0.3);
}

.content-dialog::backdrop {
  background: rgba(16, 35, 32, 0.68);
}

.content-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-block: 1rem;
}

.content-stats article {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 0.75rem;
}

.content-stats strong,
.content-stats span {
  display: block;
}

.content-stats strong {
  color: var(--teal-dark);
  font-size: 1.4rem;
}

.content-stats span,
.content-group-heading p,
.content-product-card p,
.content-empty {
  color: var(--muted);
  font-size: 0.75rem;
}

.content-group {
  margin-top: 1rem;
}

.content-group-heading h3,
.content-group-heading p {
  margin-bottom: 0.25rem;
}

.content-product-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.content-product-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 0.55rem;
}

.content-product-card img {
  width: 64px;
  height: 64px;
  border-radius: 9px;
  object-fit: cover;
}

.content-product-card h4,
.content-product-card p {
  margin: 0;
}

.content-product-card h4 {
  font-size: 0.84rem;
}

.content-status {
  display: inline-flex;
  margin-top: 0.3rem;
  border-radius: 999px;
  padding: 0.2rem 0.42rem;
  font-size: 0.65rem;
  font-weight: 800;
}

.content-status.confirmed {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.content-status.inferred {
  background: var(--amber-soft);
  color: #715820;
}

.content-product-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.content-product-actions button,
.content-product-actions a {
  min-height: 34px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: white;
  color: var(--teal-dark);
  padding: 0.42rem 0.58rem;
  font-size: 0.68rem;
  font-weight: 750;
  text-decoration: none;
}

.content-product-actions button {
  background: var(--teal);
  color: white;
}

.edit-dialog form {
  display: grid;
  gap: 0.85rem;
  padding: clamp(1rem, 4vw, 2rem);
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-heading h2 {
  margin-bottom: 0;
}

.dialog-x {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  font-size: 1.5rem;
}

.dialog-fields {
  display: grid;
  gap: 0.75rem;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.edit-dialog textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.7rem;
  font: inherit;
}

.content-rules {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
}

.content-rules legend {
  padding-inline: 0.35rem;
  font-weight: 750;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.content-rules select[multiple] {
  min-height: 9.5rem;
  padding: 0.35rem;
}

.content-rules select[multiple] option {
  padding: 0.28rem 0.4rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

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

.toast {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: 1rem;
  transform: translateY(140%);
  border-radius: 12px;
  background: var(--ink);
  color: white;
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow);
  transition: transform 170ms ease;
}

.toast.visible {
  transform: translateY(0);
}

@media (max-width: 760px) {
  .places-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .place-stats,
  .place-filters,
  .two-columns {
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .place-stats,
  .place-filters,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .content-product-card {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .content-product-card img {
    width: 54px;
    height: 54px;
  }

  .content-product-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}
