:root {
  color-scheme: light;
  --bg: #eef2f3;
  --panel: #ffffff;
  --text: #172026;
  --muted: #64727d;
  --line: #d9e1e5;
  --accent: #126b5f;
  --accent-dark: #0d5148;
  --error: #a5282c;
}

* {
  box-sizing: border-box;
}

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 16px 50px rgba(23, 32, 38, 0.08);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #f7faf9;
}

.login-status {
  margin: 12px 0 0;
}

.review-form,
.local-login {
  display: grid;
  gap: 18px;
}

.local-login {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.secondary-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.admin-panel {
  display: grid;
  gap: 24px;
}

.add-user {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.admin-actions {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.user-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.user-table th,
.user-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.user-table th {
  color: var(--muted);
  font-size: 13px;
}

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

.danger-button {
  background: #f1dddd;
  color: var(--error);
}

.danger-button:hover {
  background: #e8caca;
}

.admin-section {
  display: grid;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
}

.section-heading span {
  color: var(--accent);
  font-weight: 800;
}

.table-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.table-actions button,
.user-table button {
  padding: 8px 10px;
}

.doctor-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7faf9;
}

.doctor-card img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.doctor-card div {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.doctor-card span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  resize: vertical;
}

.autocomplete {
  position: relative;
  display: block;
}

.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(23, 32, 38, 0.14);
}

.suggestions button {
  display: block;
  width: 100%;
  border-radius: 0;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  text-align: left;
}

.suggestions button:hover {
  background: #eef7f4;
  color: var(--accent-dark);
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

legend {
  margin: 0 0 8px;
  font-weight: 650;
}

.rating-field {
  display: grid;
  gap: 8px;
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.rating-options label {
  display: block;
}

.rating-options input,
.tag-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-options span {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.rating-options b {
  color: #d1a72e;
  font-size: 22px;
  line-height: 1;
}

.rating-options small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rating-options input:checked + span {
  border-color: var(--accent);
  background: #e6f3ef;
  color: var(--accent-dark);
}

.rating-options input:checked + span b,
.rating-options input:checked + span small {
  color: var(--accent-dark);
}

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

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-option {
  display: inline-flex;
}

.tag-option span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.tag-option span::before {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.tag-option.plus span::before {
  content: "+";
  background: #dff1e6;
  color: #1f6f45;
}

.tag-option.minus span::before {
  content: "-";
  background: #f3dddd;
  color: var(--error);
}

.tag-option input:checked + span {
  border-color: var(--accent);
  background: #f3faf7;
}

.tag-option.minus input:checked + span {
  border-color: #cc8b8e;
  background: #fff6f6;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

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

#logout-button {
  background: #dfe8e6;
  color: var(--text);
}

.ok {
  color: var(--accent);
}

.error {
  color: var(--error);
}

@media (max-width: 720px) {
  .topbar,
  .header-actions,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .tag-grid {
    grid-template-columns: 1fr;
  }

  .add-user {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 20px;
  }

  h1 {
    font-size: 24px;
  }
}
