:root {
  --ink: #202522;
  --muted: #626a65;
  --line: #d9dedb;
  --paper: #f4f6f5;
  --panel: #ffffff;
  --cedar: #315b45;
  --moss: #315b45;
  --gold: #b9852f;
  --header: #202824;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: var(--cedar);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
  padding: 0.55rem clamp(1rem, 3vw, 2rem);
  background: var(--header);
  color: #f7faf8;
  position: relative;
  z-index: 10;
}

.brand {
  color: inherit;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.brand-logo { width: 2.15rem; height: 2.15rem; object-fit: contain; }
.brand > span:last-child { display: grid; }

.brand-title {
  font-weight: 700;
  font-size: 0.88rem;
}

.brand-subtitle,
.eyebrow,
.meta,
.privacy-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.site-header .brand-subtitle {
  color: #b8c3bd;
  font-size: 0.75rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.site-nav a,
.site-nav button,
.nav-menu summary {
  color: #eef3f0;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.88rem;
}

.nav-link, .nav-menu summary { display: block; padding: 0.48rem 0.6rem; border-radius: 4px; }
.nav-link:hover, .nav-menu summary:hover, .nav-menu[open] summary { background: #35413b; }
.sign-in-link { border: 1px solid #687a70; margin-left: 0.25rem; }
.nav-menu { position: relative; }
.nav-menu summary { cursor: pointer; list-style: none; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after { content: ""; display: inline-block; width: 0.35rem; height: 0.35rem; margin: 0 0 0.2rem 0.45rem; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); }
.nav-menu-panel { position: absolute; top: calc(100% + 0.35rem); left: 0; display: grid; width: max-content; min-width: 13rem; padding: 0.35rem; border: 1px solid #d8dedb; border-radius: 6px; background: #fff; box-shadow: 0 12px 32px rgb(20 30 24 / 18%); }
.nav-menu-panel a, .nav-menu-panel button { width: 100%; padding: 0.55rem 0.65rem; border-radius: 4px; color: var(--ink); text-align: left; }
.nav-menu-panel a:hover, .nav-menu-panel button:hover { background: #edf2ef; }
.nav-menu-right { right: 0; left: auto; min-width: 8rem; }

.page {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.35rem auto 2.5rem;
}

.hero {
  min-height: min(64vh, 42rem);
  display: grid;
  grid-template-columns: minmax(14rem, 25rem) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem);
}

.hero-logo { width: 100%; max-height: 25rem; object-fit: contain; }
.hero-copy { max-width: 38rem; }

.hero h1,
.panel h1 {
  max-width: 760px;
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
}

.panel h1 {
  font-size: 1.65rem;
  line-height: 1.2;
}

.hero p {
  max-width: 650px;
}

.location-brands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.location-brand { display: grid; place-items: center; min-height: 12rem; padding: 1.25rem 2rem; }
.location-brand + .location-brand { border-left: 1px solid var(--line); }
.location-brand img { display: block; width: 100%; height: 10rem; object-fit: contain; }
.black-chasm { background: #f8f8f7; }
.california-cavern { background: #343836; }
.login-brand { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.login-brand img { width: 6rem; height: 6rem; object-fit: contain; }
.login-brand h1, .login-brand p { margin: 0; }

.actions,
.section-header,
.choice-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-header {
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.48rem 0.8rem;
  border: 1px solid var(--cedar);
  border-radius: 6px;
  background: var(--cedar);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

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

.button.danger {
  border-color: #8a2f2f;
  background: #8a2f2f;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.panel.narrow {
  max-width: 680px;
}

.resource-list {
  display: grid;
  gap: 0.65rem;
}

.resource-item,
.choice {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.85rem;
  background: #fff;
}

.resource-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.resource-item h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.resource-item p {
  margin: 0.15rem 0;
}

.resource-row-meta {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
  max-width: 24rem;
}

.resource-row-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.resource-summary {
  margin-top: -0.5rem;
}

.choice {
  flex: 1 1 240px;
  color: inherit;
  text-decoration: none;
}

.stacked-form p {
  display: grid;
  gap: 0.35rem;
}

.stacked-form label { color: #343b37; font-size: 0.86rem; font-weight: 650; }
.stacked-form .helptext { color: var(--muted); font-size: 0.78rem; font-weight: 400; }
.stacked-form ul.errorlist { margin: 0 0 0.25rem; padding: 0.5rem 0.65rem; border-left: 3px solid #a63d3d; background: #fff1f1; color: #762727; list-style: none; font-size: 0.84rem; }
.stacked-form ul:not(.errorlist) { margin: 0.25rem 0; padding-left: 1.2rem; color: var(--muted); font-size: 0.82rem; }

input,
select,
textarea {
  width: 100%;
  min-height: 2.3rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  background: #fff;
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #d4a64e; outline-offset: 2px; }

textarea {
  resize: vertical;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(11rem, 0.8fr) minmax(11rem, 0.8fr) auto;
  gap: 0.5rem;
  align-items: end;
}

.acknowledgement-form {
  margin-top: 1rem;
}

.meta-list div {
  display: flex;
  gap: 0.75rem;
}

.meta-list.compact {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0;
}

.meta-list dt {
  font-weight: 700;
}

.reply-code {
  padding: 0.75rem;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: #fff7e8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 0.7fr) minmax(0, 1.3fr);
  gap: 1.5rem;
  align-items: start;
}

.review-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

.review-form {
  min-width: 0;
}

.action-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.status-badge {
  display: inline-flex;
  margin: 0;
  padding: 0.25rem 0.55rem;
  border: 1px solid #cfd6d2;
  border-radius: 4px;
  background: #f2f5f3;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 650;
}
.status-new { border-color: #9fb7c8; background: #edf5fa; color: #284e68; }
.status-open { border-color: #b7c7bd; background: #eef5f0; color: #315b45; }
.status-progress { border-color: #d5bd82; background: #fff7df; color: #6b4e12; }
.status-waiting { border-color: #d7ac85; background: #fff2e8; color: #78431f; }
.status-complete { border-color: #a7c2ae; background: #ebf5ee; color: #28543a; }
.status-closed { border-color: #c8ceca; background: #f1f2f1; color: #626a65; }

.break-text {
  overflow-wrap: anywhere;
}

.doc-toolbar {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.75rem;
  border-block: 1px solid var(--line);
}

.document-workspace { min-width: 0; }
.document-pane { display: none; }
.document-pane.active { display: block; }

.document-viewer {
  min-width: 0;
  overflow: hidden;
}

.document-viewer iframe {
  display: block;
  width: 100%;
  min-height: 78vh;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.document-text-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.85rem;
  background: #fff;
}

.section-header.tight {
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-header.tight h2 {
  margin: 0;
  font-size: 1.1rem;
}

.document-text {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  max-height: 78vh;
  margin: 0;
  padding: 0.75rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf9;
  color: var(--ink);
  font: 0.92rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.document-modes { display: inline-flex; width: fit-content; border: 1px solid var(--line); border-radius: 5px; padding: 2px; background: #edf1ef; }
.mode-button { min-height: 2rem; padding: 0.35rem 0.7rem; border: 0; border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.85rem; }
.mode-button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgb(20 30 24 / 12%); }

.library-search { display: grid; grid-template-columns: minmax(15rem, 1fr) minmax(10rem, 0.55fr) minmax(10rem, 0.55fr) auto auto; gap: 0.55rem; align-items: end; padding: 0.75rem; margin-bottom: 1.2rem; border: 1px solid var(--line); border-radius: 6px; background: #f7f9f8; }
.library-search label { display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.78rem; font-weight: 650; }
.result-count { color: var(--muted); font-size: 0.85rem; }
.library-groups { display: grid; gap: 1.25rem; }
.library-group-heading { display: flex; align-items: center; gap: 0.5rem; padding-bottom: 0.4rem; border-bottom: 2px solid #bec9c3; }
.library-group-heading h2 { margin: 0; font-size: 1rem; }
.library-group-heading span { color: var(--muted); font-size: 0.78rem; }
.document-rows { display: grid; }
.document-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, auto) 1rem; align-items: center; gap: 0.8rem; padding: 0.65rem 0.35rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.document-row:hover { background: #f5f8f6; }
.document-main { display: grid; min-width: 0; }
.document-main strong { font-size: 0.92rem; overflow-wrap: anywhere; }
.document-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-locations { display: flex; justify-content: flex-end; gap: 0.3rem; flex-wrap: wrap; }
.document-locations span { padding: 0.12rem 0.35rem; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 0.72rem; }
.row-arrow { color: var(--muted); font-size: 1.2rem; }

.report-search { margin-bottom: 1rem; }

.case-conversation { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.message-thread { display: grid; gap: 0.6rem; margin: 0.75rem 0 1rem; }
.message { max-width: 48rem; padding: 0.7rem 0.85rem; border-left: 3px solid var(--line); background: #fffdf9; }
.message.reviewer { border-left-color: var(--gold); }
.message p { margin: 0.2rem 0; }
.narrow-form { max-width: 48rem; }

.dashboard-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); margin-bottom: 1rem; }
.dashboard-summary a { display: grid; padding: 0.75rem; color: inherit; text-decoration: none; border-right: 1px solid var(--line); }
.dashboard-summary a:last-child { border-right: 0; }
.dashboard-summary strong { font-size: 1.4rem; }
.dashboard-summary span { color: var(--muted); font-size: 0.85rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dashboard-section { min-width: 0; border-top: 2px solid var(--line); padding-top: 0.6rem; }
.dashboard-section .section-header { align-items: center; }
.dashboard-section h2, .admin-queue h2 { margin: 0; font-size: 1.05rem; }
.work-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.work-row span { overflow-wrap: anywhere; }
.work-row small { color: var(--muted); text-align: right; }
.admin-queue { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.queue-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.queue-links a { padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; }
.empty-state { padding: 1.25rem; border: 1px dashed #cbd2ce; border-radius: 6px; background: #f8faf9; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }
.empty-state p { margin: 0.25rem 0 0; }
.empty-state.compact { padding: 0.7rem; }
.messages { margin-bottom: 0.75rem; }
.message-alert { margin: 0; padding: 0.65rem 0.8rem; border: 1px solid #a9c5b2; border-radius: 5px; background: #edf7f0; color: #28543a; }
.message-alert.error { border-color: #d6a5a5; background: #fff1f1; color: #762727; }

@media (max-width: 700px) {
  .dashboard-summary, .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-summary a:nth-child(2) { border-right: 0; }
  .dashboard-summary a:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

mark {
  background: #ffe08a;
  color: inherit;
}

.compact-list {
  margin-bottom: 1.5rem;
}

.inline-complete-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.resource-item.completed {
  opacity: 0.78;
}

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

  .hero { min-height: 0; grid-template-columns: 1fr; gap: 1.25rem; padding: 1.5rem 0.75rem 2rem; text-align: center; }
  .hero-logo { max-height: 15rem; }
  .hero-copy { margin: auto; }
  .hero .actions { justify-content: center; }
  .location-brands { grid-template-columns: 1fr; }
  .location-brand + .location-brand { border-top: 1px solid var(--line); border-left: 0; }

  .site-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-nav > .nav-link, .nav-menu summary { text-align: center; }
  .nav-menu { position: static; }
  .nav-menu-panel, .nav-menu-right { position: absolute; top: 100%; right: 1rem; left: 1rem; width: auto; }

  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .library-search { grid-template-columns: 1fr 1fr; }
  .library-search .search-field { grid-column: 1 / -1; }

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

  .resource-item,
  .inline-complete-form {
    grid-template-columns: 1fr;
  }

  .resource-row-meta {
    justify-content: flex-start;
    max-width: none;
  }

  .page { width: min(100% - 1rem, 1180px); margin-top: 0.5rem; }
  .panel { border-right: 0; border-left: 0; border-radius: 0; }
  .data-table th, .data-table td { padding: 0.55rem; }
  .document-row { grid-template-columns: minmax(0, 1fr) 1rem; }
  .document-locations { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .row-arrow { grid-column: 2; grid-row: 1 / 3; }
  .document-viewer iframe { min-height: 68vh; }
}

@media (max-width: 440px) {
  .library-search { grid-template-columns: 1fr; }
  .library-search .search-field { grid-column: auto; }
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.9rem;
}
.data-table tbody tr:hover { background: #f7f9f8; }
.data-table .status-badge { white-space: nowrap; }
.table-empty { padding: 1.5rem !important; color: var(--muted); text-align: center !important; }
.overdue-item { border-left: 3px solid #a63d3d; }
.overdue-badge { border: 1px solid #d6a5a5 !important; background: #fff1f1 !important; color: #842f2f !important; font-weight: 700; }
.overdue-row { color: #842f2f; }
.overdue-row small { color: #842f2f; font-weight: 650; }
.reminder-control { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 0.5rem; }
.reminder-control summary { width: fit-content; color: var(--cedar); cursor: pointer; font-size: 0.84rem; font-weight: 650; }
.reminder-form { display: grid; grid-template-columns: 8rem minmax(12rem, 1fr) auto; gap: 0.5rem; margin-top: 0.5rem; }
.reminder-inbox { margin-bottom: 1rem; padding: 0.8rem; border: 1px solid #d9b271; border-radius: 6px; background: #fffaf0; }
.reminder-list { display: grid; gap: 0.5rem; }
.reminder-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.65rem; border-left: 3px solid #b9852f; background: #fff; }
.reminder-item.escalation { border-left-color: #a63d3d; background: #fff5f5; }
.reminder-item h3, .reminder-item p { margin: 0.15rem 0; }
.reminder-item h3 { font-size: 0.95rem; }
.attachment-section { margin-bottom: 1rem; padding: 0.75rem; border-block: 1px solid var(--line); }
.attachment-section h2 { margin: 0; font-size: 1rem; }
.attachment-list { grid-column: 1 / -1; display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; }
.attachment-list a { padding: 0.25rem 0.45rem; border: 1px solid var(--line); border-radius: 4px; background: #f7f9f8; font-size: 0.8rem; text-decoration: none; }
.attachment-form { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(12rem, 1fr) auto; gap: 0.5rem; margin-top: 0.5rem; }
.evidence-complete-form { grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(10rem, 1fr) auto; }
.retention-actions { display: grid; grid-template-columns: 12rem auto minmax(20rem, 1fr); gap: 0.75rem; align-items: end; margin: 1rem 0; padding: 0.8rem; border: 1px solid var(--line); border-radius: 6px; background: #f7f9f8; }
.retention-window label { display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.78rem; font-weight: 650; }
.archive-confirm { display: grid; grid-template-columns: minmax(15rem, 1fr) auto; gap: 0.6rem; align-items: center; }
.archive-confirm label { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.82rem; }
.archive-confirm input[type="checkbox"] { width: auto; min-height: 0; margin-top: 0.2rem; }
.retention-history { margin-top: 1.5rem; }
.retention-history h2 { font-size: 1rem; }

@media (max-width: 720px) {
  .reminder-form { grid-template-columns: 1fr; }
  .reminder-item { align-items: stretch; flex-direction: column; }
  .attachment-form, .evidence-complete-form { grid-template-columns: 1fr; }
  .retention-actions, .archive-confirm { grid-template-columns: 1fr; }
}
