:root {
  --green: #114b2e;
  --gold: #c89d3c;
  --charcoal: #333333;
  --muted: #66736c;
  --line: #d6ddd9;
  --soft: #eef5f1;
  --gold-soft: #f8f1e4;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7faf8;
  color: var(--charcoal);
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  min-width: 320px;
}

html,
body {
  overflow-x: hidden;
}

a {
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  min-height: 70px;
  padding: 12px 36px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  color: var(--green);
  font-size: 18px;
  font-weight: 800;
  min-width: 0;
}

.brand img {
  height: 46px;
  width: auto;
}

nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: flex-end;
}

.inline {
  display: inline;
}

button,
.button {
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 6px;
  color: var(--white);
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-weight: 800;
  padding: 10px 16px;
}

button:hover,
.button:hover {
  filter: brightness(0.96);
  text-decoration: none;
}

.button.secondary {
  background: var(--white);
  color: var(--green);
}

.button.danger {
  background: #8a1f1f;
  border-color: #8a1f1f;
  color: var(--white);
}

main {
  margin: 0 auto;
  max-width: 1240px;
  padding: clamp(18px, 3vw, 34px);
  width: 100%;
}

.hero {
  background: linear-gradient(180deg, var(--soft), var(--white));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(30px, 5vw, 58px);
  min-width: 0;
}

.eyebrow {
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  color: var(--green);
  line-height: 1.18;
  margin: 0 0 14px;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  max-width: 1040px;
  overflow-wrap: break-word;
}

h2 {
  font-size: 22px;
}

p {
  margin: 0 0 14px;
}

.hero p:not(.eyebrow) {
  font-size: clamp(17px, 1.8vw, 21px);
  max-width: min(100%, 1060px);
  overflow-wrap: break-word;
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.grid.three {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 22px;
}

.intro-panel {
  align-items: stretch;
  background: var(--white);
  border: 2px solid var(--green);
  border-radius: 8px;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  margin-top: 22px;
  padding: clamp(22px, 3vw, 34px);
}

.intro-panel h2 {
  font-size: clamp(24px, 3vw, 34px);
  max-width: 880px;
}

.intro-panel p {
  color: #405149;
  font-size: 17px;
  max-width: 920px;
}

.intro-panel aside {
  background: var(--soft);
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  padding: 20px;
}

.intro-panel aside p {
  font-size: 16px;
  margin-bottom: 0;
}

.position-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 22px;
}

.position-grid article {
  border-top: 5px solid var(--gold);
  min-height: 190px;
}

article,
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 2.5vw, 24px);
  min-width: 0;
}

.panel + .panel {
  margin-top: 22px;
}

.panel.narrow {
  margin: 40px auto;
  max-width: 460px;
}

.stack,
.grid-form {
  display: grid;
  gap: 14px;
}

.grid-form {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid-form .wide {
  grid-column: 1 / -1;
}

label {
  color: var(--green);
  display: grid;
  font-size: 13px;
  font-weight: 900;
  gap: 5px;
}

input,
select,
textarea {
  border: 1px solid #c8d2cd;
  border-radius: 6px;
  color: var(--charcoal);
  font: inherit;
  padding: 10px 11px;
  width: 100%;
}

textarea {
  resize: vertical;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
  width: 100%;
}

th {
  background: var(--green);
  color: var(--white);
  font-weight: 900;
  text-align: left;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: #f8fbf9;
}

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

.pill {
  background: var(--gold-soft);
  border: 1px solid #ead9b4;
  border-radius: 999px;
  color: #6d520f;
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 9px;
}

.error {
  background: #fff1f1;
  border: 1px solid #e5bbbb;
  border-radius: 6px;
  color: #8a1f1f;
  padding: 10px;
}

.success {
  background: #eef8f1;
  border: 1px solid #b9dbc4;
  border-radius: 6px;
  color: var(--green);
  font-weight: 700;
  padding: 10px;
}

.form-help {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 0;
}

.scheduler-form {
  gap: 22px;
}

.scheduler-subsection {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.section-heading-row h2 {
  margin-bottom: 4px;
}

.scheduler-rows {
  display: grid;
  gap: 12px;
}

.scheduler-row {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 12px;
}

.check-label,
.table-check {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.check-label input,
.table-check input {
  width: auto;
}

.copy-list {
  display: grid;
  gap: 10px;
}

.copy-list code {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--charcoal);
  display: block;
  overflow-wrap: anywhere;
  padding: 10px;
}

.timezone-form {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 0;
}

.timezone-form label {
  min-width: min(100%, 320px);
}

.slot-card {
  align-items: start;
  border-left: 6px solid var(--gold);
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr);
  margin-top: 14px;
}

.slot-rank {
  background: var(--green);
  border-radius: 999px;
  color: var(--white);
  font-weight: 900;
  min-width: 46px;
  padding: 8px 10px;
  text-align: center;
}

.slot-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin: 12px 0 0;
}

.slot-detail-grid div {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.slot-detail-grid dt {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.slot-detail-grid dd {
  margin: 4px 0 0;
}

.decision-panel {
  border-top: 6px solid var(--gold);
}

.decision-panel.final {
  border-top-color: var(--green);
}

.decision-panel h2 {
  color: var(--green);
  margin-bottom: 8px;
}

.profile-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 0;
}

.profile-list div {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.profile-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-list dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.email-preview {
  background: #eef5f1;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 18px 0;
  max-height: 720px;
  overflow: auto;
  padding: 12px;
}

.admin-home {
  border-top: 6px solid var(--green);
}

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

.admin-card {
  background: linear-gradient(180deg, var(--gold-soft), var(--white));
  border: 2px solid var(--green);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(17, 75, 46, 0.08);
  color: var(--charcoal);
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 20px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.admin-card:hover,
.admin-card:focus {
  border-color: var(--gold);
  box-shadow: 0 18px 34px rgba(17, 75, 46, 0.16);
  text-decoration: none;
  transform: translateY(-3px);
}

.admin-card span {
  color: var(--green);
  font-size: 22px;
  font-weight: 900;
}

.admin-card small {
  color: #44534b;
  font-size: 15px;
  line-height: 1.45;
}

.docs-panel {
  display: grid;
  gap: 20px;
}

.docs-heading {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.result-count {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  margin: 2px 0 0;
  padding: 7px 12px;
  white-space: nowrap;
}

.search-form {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.search-label {
  font-size: 14px;
}

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

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

.doc-card {
  background:
    linear-gradient(180deg, rgba(248, 241, 228, 0.72), rgba(255, 255, 255, 0) 92px),
    var(--white);
  border: 3px solid var(--green);
  box-shadow: 0 10px 22px rgba(17, 75, 46, 0.08);
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-height: 300px;
  outline: none;
  padding: 20px;
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.doc-card::before {
  background: var(--gold);
  border-radius: 999px;
  content: "";
  height: 7px;
  left: 20px;
  position: absolute;
  right: 20px;
  top: -5px;
}

.doc-card:hover,
.doc-card:focus,
.doc-card:focus-within {
  border-color: var(--gold);
  box-shadow: 0 18px 34px rgba(17, 75, 46, 0.16);
  transform: translateY(-3px);
}

.doc-card h2 {
  font-size: 21px;
  margin: 0;
  overflow-wrap: anywhere;
}

.doc-card-top {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.file-chip {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
  display: inline-block;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 9px;
}

.doc-synopsis {
  color: #44534b;
  flex: 1;
  font-size: 15.5px;
  margin: 0;
}

.doc-meta {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
}

.doc-meta div {
  display: grid;
  gap: 2px;
}

.doc-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.doc-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.doc-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 0;
  padding-top: 12px;
}

.button.compact {
  padding: 8px 12px;
}

.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding-top: 4px;
}

.page-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green);
  display: inline-block;
  font-weight: 900;
  min-width: 38px;
  padding: 8px 11px;
  text-align: center;
}

.page-link.current {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}

.page-link.disabled {
  color: #9aa6a0;
}

.empty-state {
  background: #f8fbf9;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
}

.viewer-panel {
  display: grid;
  gap: 18px;
}

.document-detail-layout {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
}

.viewer-heading {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.viewer-heading p {
  color: #405149;
  max-width: 760px;
}

.doc-detail-grid {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin: 0;
  padding: 14px;
}

.doc-detail-grid div {
  display: grid;
  gap: 3px;
}

.doc-detail-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.doc-detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.preview-unavailable {
  background:
    linear-gradient(180deg, rgba(248, 241, 228, 0.72), rgba(255, 255, 255, 0) 130px),
    #ffffff;
  border: 3px solid var(--green);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 320px;
  place-content: center;
  text-align: center;
}

.preview-unavailable h2,
.preview-unavailable p {
  margin: 0;
}

.docx-preview {
  background: #ffffff;
  border: 3px solid var(--green);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(17, 75, 46, 0.08);
  color: var(--charcoal);
  display: grid;
  font-family: "Gentium Plus", "Charis SIL", "Noto Serif", serif;
  font-size: 17px;
  gap: 12px;
  line-height: 1.62;
  max-height: min(82vh, 980px);
  min-height: 680px;
  overflow: auto;
  padding: 46px 54px;
}

.docx-preview h2,
.docx-preview h3,
.docx-preview h4,
.docx-preview p {
  margin: 0;
  overflow-wrap: anywhere;
}

.docx-preview h2 {
  color: var(--green);
  font-size: 28px;
  line-height: 1.18;
  margin-top: 10px;
}

.docx-preview h2:first-child,
.docx-preview .docx-title:first-child {
  margin-top: 0;
}

.docx-preview h3 {
  color: var(--green);
  font-size: 22px;
  line-height: 1.25;
  margin-top: 8px;
}

.docx-preview h4 {
  color: var(--charcoal);
  font-size: 18px;
  line-height: 1.3;
  margin-top: 6px;
}

.docx-preview .docx-title {
  border-bottom: 2px solid var(--gold);
  padding-bottom: 10px;
}

.docx-preview .bold {
  font-weight: 900;
}

.docx-preview .italic {
  font-style: italic;
}

.docx-preview .underline {
  text-decoration: underline;
}

.docx-preview .align-center {
  text-align: center;
}

.docx-preview .align-right {
  text-align: right;
}

.docx-list {
  margin: 0 0 0 24px;
  padding: 0;
}

.docx-table-wrap {
  max-width: 100%;
  overflow: visible;
}

.docx-table {
  border-collapse: collapse;
  display: table;
  font-size: 15px;
  min-width: 100%;
  table-layout: auto;
  white-space: normal;
  width: 100%;
}

.docx-table tr {
  display: table-row;
}

.docx-table td {
  border: 1px solid var(--line);
  display: table-cell;
  min-width: 130px;
  overflow-wrap: anywhere;
  padding: 11px 12px;
  vertical-align: top;
  white-space: normal;
}

.docx-table tr:first-child td {
  background: #f8fbf9;
  color: var(--green);
  font-weight: 900;
}

.docx-table p {
  margin: 0;
}

.xlsx-preview {
  background: #ffffff;
  border: 3px solid var(--green);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(17, 75, 46, 0.08);
  color: var(--charcoal);
  display: grid;
  font-family: "Gentium Plus", "Charis SIL", "Noto Serif", serif;
  gap: 18px;
  max-height: min(82vh, 980px);
  min-height: 680px;
  overflow: auto;
  padding: 28px;
}

.xlsx-preview-note {
  background: #f7f0df;
  border-left: 5px solid var(--gold);
  border-radius: 6px;
  color: #4c3f20;
  font-size: 14px;
  line-height: 1.45;
  padding: 12px 14px;
}

.xlsx-sheet {
  display: grid;
  gap: 10px;
}

.xlsx-sheet h2 {
  color: var(--green);
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}

.xlsx-table-wrap {
  border: 1px solid var(--line);
  border-radius: 7px;
  max-width: 100%;
  overflow: auto;
}

.xlsx-table {
  border-collapse: collapse;
  font-family: "Gentium Plus", "Charis SIL", "Noto Serif", serif;
  font-size: 14px;
  min-width: 100%;
}

.xlsx-table th,
.xlsx-table td {
  border: 1px solid var(--line);
  line-height: 1.35;
  max-width: 360px;
  min-width: 96px;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

.xlsx-table tr:first-child th {
  background: var(--green);
  color: #ffffff;
  font-weight: 900;
  position: sticky;
  top: 0;
  z-index: 1;
}

.xlsx-table tr:nth-child(even) td {
  background: #f8fbf9;
}

.relationship-panel {
  background: #ffffff;
  border: 3px solid var(--green);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(17, 75, 46, 0.09);
  display: grid;
  gap: 14px;
  padding: 18px;
  position: sticky;
  top: 104px;
}

.relationship-heading {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
}

.relationship-heading h2 {
  font-size: 22px;
  margin: 0;
}

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

.relationship-item {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.relationship-title {
  color: var(--green);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.relationship-meta,
.relationship-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.relationship-meta {
  color: #506158;
  font-size: 13px;
}

.relationship-chip {
  background: var(--gold);
  border-radius: 999px;
  color: #1f221f;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 8px;
}

.relationship-actions a {
  font-size: 13px;
  font-weight: 900;
}

.relationship-empty {
  background: #f8fbf9;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.relationship-empty p {
  margin: 0;
}

.relationship-editor {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding-top: 14px;
}

.relationship-editor h2 {
  font-size: 20px;
  margin: 0;
}

.relationship-edit-row {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(160px, 0.35fr) minmax(260px, 1fr);
  padding: 12px;
}

.pdf-viewer {
  background: #1f2522;
  border: 3px solid var(--green);
  border-radius: 8px;
  height: min(82vh, 980px);
  min-height: 680px;
  width: 100%;
}

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

  .topbar {
    padding: 12px 18px;
    position: static;
  }

  nav {
    justify-content: flex-start;
    gap: 14px;
  }

  .brand img {
    height: 40px;
  }

  .hero p:not(.eyebrow) {
    max-width: 100%;
  }

  .intro-panel,
  .position-grid {
    grid-template-columns: 1fr;
  }

  .position-grid article {
    min-height: 0;
  }

  table:not(.docx-table):not(.xlsx-table) {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .docs-heading,
  .search-row {
    grid-template-columns: 1fr;
  }

  .docs-heading {
    display: grid;
  }

  .document-detail-layout,
  .doc-detail-grid,
  .relationship-edit-row {
    grid-template-columns: 1fr;
  }

  .relationship-panel {
    position: static;
  }

  .viewer-heading {
    display: grid;
  }

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

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

  .result-count {
    justify-self: start;
    white-space: normal;
  }
}

@media (max-width: 480px) {
  main {
    padding: 14px;
  }

  .hero {
    border-radius: 6px;
    padding: 26px 20px;
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
  }

  .eyebrow {
    font-size: 12px;
    letter-spacing: 0.04em;
    line-height: 1.35;
  }

  .hero h1,
  .hero .eyebrow,
  .hero p:not(.eyebrow),
  .actions {
    max-width: calc(100vw - 96px);
  }

  .actions {
    width: 100%;
  }

  .actions .button {
    width: 100%;
  }

  nav a,
  nav button {
    font-size: 15px;
  }

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

  .doc-card {
    min-height: 0;
    padding: 16px;
  }

  .pdf-viewer {
    min-height: 560px;
  }

  .docx-preview {
    font-size: 16px;
    max-height: none;
    min-height: 420px;
    padding: 24px 20px;
  }

  .search-row .button {
    text-align: center;
    width: 100%;
  }

  th,
  td {
    padding: 9px;
  }
}
