:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d7dde5;
  --line-strong: #b8c2cf;
  --primary: #176b54;
  --primary-dark: #0f513f;
  --danger: #a83232;
  --warn-bg: #fff7df;
  --warn-text: #775700;
  --success: #176b54;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.profile-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.profile-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.back-link {
  color: var(--primary);
  font-size: 14px;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.profile-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 650;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

input {
  height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 10px 12px;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: wait;
  opacity: .58;
}

.search-row {
  margin: 0 0 20px;
}

.search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

.store-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.store-facts div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.store-facts dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.store-facts dd {
  margin: 0;
  min-height: 22px;
  overflow-wrap: anywhere;
}

.alert {
  margin: 14px 0 18px;
  border-radius: 6px;
  padding: 10px 12px;
  background: #eef1f5;
  color: var(--muted);
  font-size: 14px;
  white-space: pre-line;
}

.alert.success {
  background: #e9f6f1;
  color: var(--success);
}

.alert.error {
  background: #fdecec;
  color: var(--danger);
}

.warning {
  margin-bottom: 14px;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 14px;
}

.create-area {
  margin: 0 0 18px;
}

.secondary-action {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--primary);
}

.secondary-action:hover {
  background: #f1f5f4;
}

.create-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.form-actions button,
.create-area > button {
  min-width: 112px;
  height: 40px;
  padding: 0 14px;
}

.change-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  margin-bottom: 18px;
}

.change-preview div:not(.arrow) {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.change-preview span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.change-preview strong,
.change-preview p {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
}

.change-preview p {
  margin-top: 6px;
  color: var(--muted);
}

.arrow {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 20px;
}

.confirm-form {
  display: grid;
  gap: 10px;
}

.confirm-form button {
  width: 140px;
  height: 40px;
  margin-top: 4px;
}

@media (max-width: 680px) {
  .profile-shell {
    width: calc(100% - 20px);
    padding-top: 18px;
  }

  .profile-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-panel {
    padding: 16px;
  }

  .search-controls,
  .store-facts,
  .change-preview {
    grid-template-columns: 1fr;
  }

  .arrow {
    min-height: 24px;
  }
}
