:root {
  --bg: #ffd23f;
  --surface: #fffdf6;
  --ink: #1e1f24;
  --muted: #4f5570;
  --line: #e3c042;
  --brand-purple: #6d3ac6;
  --brand-cyan: #1db9d2;
  --danger: #b23838;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Onest", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.topbar {
  background: #f5e8b5;
  border-bottom: 1px solid rgba(67, 49, 12, 0.2);
}

.topbar-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-logo {
  height: 52px;
  width: auto;
}

.topbar-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--muted);
}

.card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
}

h1,
h2 {
  margin: 0 0 10px;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

h2 {
  font-size: 1.35rem;
}

p {
  margin: 0;
}

.auth-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-row.signed-in #signInBtn {
  display: none;
}

#authState {
  font-weight: 700;
  color: var(--brand-purple);
}

.identity-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.identity-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.identity-value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
}

.photo-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.profile-photo {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e0cb75;
  background: #fff;
}

.grid {
  display: grid;
  gap: 12px;
}

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

.field {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  margin-top: 6px;
  width: 100%;
  border: 1px solid #e0cb75;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(29, 185, 210, 0.18);
}

.profile-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-actions button {
  width: auto;
}

.profile-save-state {
  min-height: 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-purple);
}

.profile-save-state.error {
  color: var(--danger);
}

.directory-note {
  color: var(--muted);
}

.directory-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.directory-state {
  margin-top: 10px;
  min-height: 18px;
  font-size: 14px;
  color: var(--muted);
}

.directory-state.error {
  color: var(--danger);
  font-weight: 600;
}

.directory-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: 460px;
  overflow: auto;
}

.directory-item {
  border: 1px solid #ecd785;
  border-radius: 10px;
  background: #fff8dd;
  padding: 10px 12px;
}

.directory-name {
  margin: 0;
  font-weight: 700;
}

.directory-meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  background: var(--brand-purple);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.signout-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.signout-btn {
  padding: 8px 12px;
  width: auto;
  min-height: 0;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  border: 1px solid #c7b57a;
  border-radius: 999px;
}

@media (max-width: 720px) {
  .topbar-title {
    font-size: 18px;
  }

  .brand-logo {
    height: 42px;
  }

  .auth-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .identity-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .photo-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-photo {
    width: 76px;
    height: 76px;
  }

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

  .profile-actions button {
    width: 100%;
  }

  .directory-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  button {
    width: 100%;
    min-height: 48px;
  }

  .signout-btn {
    width: auto;
    min-height: 0;
  }
}
