:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --text: #17201a;
  --muted: #66716a;
  --line: #d9ded8;
  --accent: #0f6b5d;
  --accent-strong: #0a4f45;
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--accent-strong);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.site-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 14px;
}

.site-nav a {
  text-decoration: none;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
}

.messages {
  width: min(1120px, calc(100vw - 32px));
  margin: 18px auto 0;
}

.message {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid #bed8cf;
  border-radius: 6px;
  background: #edf7f3;
  color: #244d44;
}

.profile-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 36px auto 64px;
}

.form-shell {
  width: min(720px, calc(100vw - 32px));
  margin: 48px auto 72px;
}

.compact {
  width: min(520px, calc(100vw - 32px));
}

.form-header {
  margin-bottom: 24px;
}

.form-header-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.editor-profile-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.editor-profile-photo {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #e8eee9;
  object-fit: cover;
}

.editor-profile-photo-placeholder {
  box-shadow: inset 0 0 0 12px #f7f7f4;
}

.form-header h1 {
  font-size: clamp(36px, 6vw, 56px);
}

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #bed8cf;
  border-radius: 6px;
  background: #edf7f3;
  color: #244d44;
  font-size: 14px;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(24px, 4vw, 48px);
  padding: clamp(24px, 5vw, 48px) 0;
}

.profile-header-text {
  min-width: 0;
  max-width: 760px;
}

.profile-photo {
  width: clamp(136px, 18vw, 196px);
  height: clamp(136px, 18vw, 196px);
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #e8eee9;
  box-shadow: 0 16px 34px rgba(23, 32, 26, 0.12);
  object-fit: cover;
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  margin: 24px 0 8px;
  font-size: 15px;
}

.subtitle {
  margin: 18px 0 0;
  max-width: 720px;
  color: #26302a;
  font-size: 21px;
}

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

.contact-hidden-note p {
  margin: 0;
}

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

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 18px;
}

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

.span-all {
  grid-column: 1 / -1;
}

.document-section {
  margin-top: 18px;
}

.stacked-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.field textarea {
  resize: vertical;
}

.photo-field-prominent {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.photo-field-prominent input[type="file"] {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.checkbox-field {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
}

.checkbox-field label {
  grid-column: 2;
  grid-row: 1;
}

.checkbox-field input {
  grid-column: 1;
  grid-row: 1;
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.checkbox-field .help-text,
.checkbox-field ul {
  grid-column: 2;
}

.help-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.field ul {
  margin: 0;
  padding-left: 18px;
  color: #9a3412;
  font-size: 13px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  background: var(--accent-strong);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.inline-button {
  width: fit-content;
}

.search-form {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

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

.search-form input[type="search"] {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.search-filters {
  min-width: 0;
  margin: 4px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-filters legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.filter-grid label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 14px;
}

.filter-grid input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
}

.search-results {
  display: grid;
  gap: 12px;
}

.result-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.result-main {
  display: flex;
  min-width: 0;
  gap: 14px;
}

.result-photo {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #e8eee9;
  object-fit: cover;
}

.result-photo-placeholder {
  box-shadow: inset 0 0 0 8px #f7f7f4;
}

.result-card h2 {
  margin-bottom: 6px;
}

.result-card p {
  margin: 0 0 6px;
}

dl {
  display: grid;
  grid-template-columns: minmax(90px, 0.35fr) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.tag-list,
.document-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8eee9;
  color: #20302a;
  font-size: 13px;
}

.document-list {
  display: grid;
  gap: 18px;
  margin-bottom: 0;
}

.document-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.document-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.document-card-header h3 {
  margin: 0 0 2px;
}

.document-card-header p {
  margin: 0;
}

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

.document-delete-form {
  display: inline-flex;
  margin: 0;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  background: var(--accent-strong);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.button-secondary {
  background: transparent;
  color: var(--accent-strong);
}

.button-danger {
  border-color: #b42318;
  background: transparent;
  color: #b42318;
}

.document-preview {
  display: block;
  width: 100%;
  height: min(70vh, 640px);
  min-height: 420px;
  border: 0;
  background: #eef1ee;
}

.document-preview-placeholder {
  margin: 0;
  padding: 20px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

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

  .editor-grid,
  .search-main,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .result-card {
    flex-direction: column;
  }

  .form-header-actions {
    flex-direction: column;
  }

  .editor-profile-summary {
    align-items: flex-start;
  }

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

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

  .document-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .button-link {
    width: 100%;
  }

  .document-delete-form {
    width: 100%;
  }

  .document-preview {
    height: 520px;
    min-height: 360px;
  }
}
