.berth-editor {
  margin-top: 1.25rem;
  padding: 1.15rem;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #f8fafc;
}

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

.berth-editor__head-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 0.85rem;
}

.berth-unit-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.berth-unit-control__label {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.berth-unit-segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.berth-unit-segment {
  min-width: 2.15rem;
  padding: 0.28rem 0.55rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.25;
}

.berth-unit-segment:hover,
.berth-unit-segment:focus-visible {
  color: #0f172a;
  background: #f1f5f9;
  outline: none;
}

.berth-unit-segment.is-active {
  background: #ecfdf5;
  box-shadow: inset 0 0 0 1px #0f766e;
  color: #0f766e;
}

.berth-editor__head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 1.05rem;
}

.berth-editor__head p {
  margin: 0.3rem 0 0;
  color: #64748b;
  font-size: 0.9rem;
}

.berth-quick-setup {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid #cbdbea;
  border-radius: 12px;
  background: #fff;
}

.berth-quick-setup[hidden],
.berth-editor__empty[hidden] {
  display: none !important;
}

.berth-quick-setup h4 {
  margin: 0;
  color: #0f172a;
  font-size: 0.98rem;
}

.berth-quick-setup p {
  margin: 0.25rem 0 0;
  color: #64748b;
  font-size: 0.86rem;
}

.berth-quick-setup__options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.berth-template {
  display: flex;
  min-height: 3.1rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.7rem;
  background: #f8fafc;
  color: #0f172a;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.berth-template:hover,
.berth-template:focus-visible {
  border-color: #0f766e;
  background: #f0fdfa;
  outline: none;
}

.berth-template.is-active {
  border-color: #0f766e;
  background: #ecfdf5;
  box-shadow: inset 0 0 0 1px #0f766e;
}

.berth-template strong {
  font-size: 0.9rem;
}

.berth-template span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.berth-template--setup {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 4.25rem;
}

.berth-template__action {
  display: block;
  color: #0f172a;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

.berth-template__detail {
  display: block;
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.berth-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #fff;
}

.berth-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.berth-table th,
.berth-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e5eaf0;
  text-align: left;
  vertical-align: middle;
}

.berth-table th {
  color: #475569;
  background: #f8fafc;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.berth-table tbody tr:last-child td {
  border-bottom: 0;
}

.berth-table tbody tr.is-saving {
  opacity: 0.65;
}

.berth-table tbody tr.has-error td {
  background: #fff4f2;
}

.berth-table tbody tr.has-error input[aria-invalid="true"] {
  border-color: #d92d20;
  box-shadow: 0 0 0 1px #d92d20;
}

.berth-table input {
  width: 100%;
  min-width: 88px;
  box-sizing: border-box;
}

.berth-length-input {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.berth-length-input span {
  color: #475569;
  font-weight: 600;
}

.berth-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  white-space: nowrap;
}

.berth-clear-all {
  padding: 0.45rem 0.65rem;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff;
  color: #b42318;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
}

.berth-clear-all:hover,
.berth-clear-all:focus-visible {
  background: #fef2f2;
  border-color: #f87171;
}

.berth-clear-all.is-armed {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}

.berth-remove {
  padding: 0.45rem 0.3rem;
  border: 0;
  background: transparent;
  color: #b42318;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
}

.berth-remove:hover,
.berth-remove:focus-visible {
  color: #7a271a;
  text-decoration: underline;
}

.berth-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #eef2f6;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.berth-status--available {
  background: #dcfae6;
  color: #067647;
}

.berth-status--limited {
  background: #fef0c7;
  color: #93370d;
}

.berth-status--unavailable {
  background: #fee4e2;
  color: #b42318;
}

.berth-editor__empty {
  margin: 0.9rem 0 0;
  color: #64748b;
}

.berth-editor__bulk-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.85rem;
}

.berth-editor__message {
  min-height: 1.35rem;
  margin-top: 0.65rem;
  color: #067647;
  font-size: 0.86rem;
  font-weight: 600;
}

.berth-editor__message.is-error {
  color: #b42318;
}

.public-berth-inventory {
  margin-top: 1.25rem;
}

.public-berth-inventory__intro {
  margin: 0 0 0.8rem;
  color: #64748b;
}

.public-berth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
}

.public-berth-card {
  padding: 0.85rem 0.9rem;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #fff;
}

.public-berth-card--availability-none {
  background: #fef3f2;
  border-color: #fecdca;
  box-shadow: inset 3px 0 0 #f97066;
}

.public-berth-card--availability-low {
  background: #fffaeb;
  border-color: #fedf89;
  box-shadow: inset 3px 0 0 #fdb022;
}

.public-berth-card--availability-open {
  background: #ecfdf3;
  border-color: #abefc6;
  box-shadow: inset 3px 0 0 #47cd89;
}

.public-berth-card__length {
  display: block;
  color: #0f172a;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
}

.public-berth-card__free {
  margin: 0.4rem 0 0;
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.public-berth-card--availability-none .public-berth-card__free {
  color: #b42318;
}

.public-berth-card--availability-low .public-berth-card__free {
  color: #b54708;
}

.public-berth-card--availability-open .public-berth-card__free {
  color: #067647;
}

.public-berth-card__free-count {
  font-variant-numeric: tabular-nums;
}

.public-berth-card__total {
  display: block;
  margin-top: 0.35rem;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
}

.public-berth-card__count {
  display: block;
  margin-top: 0.3rem;
  color: #475569;
  font-size: 0.86rem;
}

.public-berth-card .berth-status {
  margin-top: 0.65rem;
}

@media (max-width: 700px) {
  .berth-editor {
    padding: 0.9rem;
  }

  .berth-editor__head {
    align-items: stretch;
    flex-direction: column;
  }

  .berth-editor__head-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .berth-unit-control {
    justify-content: space-between;
  }

  .berth-editor__head-actions .btn {
    width: 100%;
  }

  .berth-quick-setup__options {
    grid-template-columns: 1fr;
  }

  .berth-table {
    min-width: 620px;
  }

  .berth-editor__bulk-actions .btn {
    width: 100%;
  }

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

@media (max-width: 420px) {
  .public-berth-grid {
    grid-template-columns: 1fr;
  }
}
