.location-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.location-title-row h1 {
  min-width: 0;
  max-width: none;
  margin-bottom: 0;
  overflow: hidden;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.04;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-context {
  max-width: 780px;
  margin: 13px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-manage-button,
.dialog-close-button {
  margin-bottom: 0;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}

.location-manage-button:hover,
.dialog-close-button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.location-dialog {
  width: min(720px, calc(100% - 32px));
  max-height: min(780px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(21, 51, 73, 0.3);
}

.location-dialog:not([open]) {
  display: none;
}

.location-dialog[open] {
  position: fixed;
  z-index: 100;
  inset: 0;
  margin: auto;
}

.location-dialog::backdrop {
  background: rgba(21, 35, 45, 0.54);
  backdrop-filter: blur(7px);
}

.location-dialog-shell {
  max-height: min(780px, calc(100vh - 32px));
  padding: 30px;
  overflow-y: auto;
}

.location-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.location-dialog-header h2 {
  font-size: clamp(30px, 5vw, 46px);
}

.dialog-close-button {
  margin: 0;
}

.location-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 24px 0;
}

.location-action-button {
  display: flex;
  min-height: 92px;
  flex-direction: column;
  gap: 7px;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.location-action-button:hover {
  border-color: var(--ink);
}

.location-action-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.location-action-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.location-action-button span {
  font-family: var(--display);
  font-size: 20px;
}

.location-action-button small {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.5;
}

.location-action-primary small {
  color: rgba(243, 239, 228, 0.68);
}

.location-search-form {
  padding: 5px 0 20px;
}

.location-search-form label,
.location-list-section h3 {
  display: block;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.location-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.location-search-row input,
.location-search-row button {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  font: inherit;
}

.location-search-row input {
  min-width: 0;
  padding: 0 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  outline: none;
}

.location-search-row input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(116, 183, 202, 0.2);
}

.location-search-row button {
  padding: 0 20px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.location-search-row button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.location-dialog-status {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--sky);
  background: rgba(116, 183, 202, 0.1);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.location-dialog-status[data-state="error"] {
  border-color: var(--heat);
  color: #983e22;
}

.location-list-section {
  padding-top: 24px;
}

.location-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.location-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 68px;
  padding: 11px 13px 11px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.3);
}

.location-list-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.location-list-copy strong {
  overflow: hidden;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-list-copy small,
.location-empty {
  color: var(--ink-soft);
  font-size: 10px;
}

.location-list-actions {
  display: flex;
  gap: 7px;
}

.location-list-actions button {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 10px;
}

.location-list-actions button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.location-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
}

@media (max-width: 760px) {
  .location-title-row {
    gap: 12px;
  }

  .location-title-row h1 {
    font-size: clamp(28px, 7.5vw, 38px);
  }

  .location-manage-button {
    margin-left: auto;
  }

  .location-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100vh - 24px);
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 26px 26px 0 0;
  }

  .location-dialog[open] {
    inset: auto 0 0;
    margin: 0;
  }

  .location-dialog-shell {
    max-height: calc(100vh - 24px);
    padding: 24px 20px max(24px, env(safe-area-inset-bottom));
  }

  .location-primary-actions {
    grid-template-columns: 1fr;
  }

  .location-list-item {
    align-items: start;
  }

  .location-list-actions {
    flex-direction: column;
  }
}
