:root {
  --ink: #253141;
  --muted: #657282;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #d9ded9;
  --accent: #b5533a;
  --accent-dark: #853927;
  --green: #617f6d;
  --gold: #d39f43;
  --blue: #d8e7ed;
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

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

.app-header,
.public-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 18px 28px;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 20px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

nav a,
button {
  align-items: center;
  background: var(--ink);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  min-height: 40px;
  padding: 9px 14px;
  text-decoration: none;
}

nav a[aria-current="page"],
button:hover {
  background: var(--accent);
}

button.danger {
  background: #6f2d21;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #bdc6bd;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.staff-layout {
  padding: 22px;
}

.toolbar {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  margin-bottom: 18px;
}

.content-grid {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 360px) 1fr;
  height: calc(100vh - 214px);
  min-height: 420px;
}

.record-list,
.editor {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 0;
  overflow: auto;
}

.record-list {
  max-height: none;
}

.list-heading,
.editor-heading {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 16px;
  position: sticky;
  top: 0;
  z-index: 2;
}

#record-count,
.public-count {
  color: var(--muted);
  font-size: 14px;
}

.record-button {
  background: #fff;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  display: block;
  min-height: auto;
  padding: 14px 16px;
  text-align: left;
  width: 100%;
}

.record-button:hover,
.record-button.active {
  background: var(--blue);
}

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

.badge {
  background: var(--green);
  border-radius: 999px;
  color: #fff;
  display: inline-block;
  font-size: 12px;
  margin-left: 8px;
  padding: 2px 8px;
}

.editor form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.publish-toggle {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.publish-toggle input {
  min-height: auto;
  width: auto;
}

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

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

#status {
  color: var(--green);
  font-weight: 700;
}

.public-header {
  align-items: end;
  background: #253141;
  color: #fff;
}

.public-header .eyebrow {
  color: #f0c76a;
}

#public-search {
  display: flex;
  gap: 8px;
  min-width: min(460px, 100%);
}

.public-page main,
.embed-page main {
  padding: 22px;
}

.public-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  margin-top: 14px;
}

.collection-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.collection-card img {
  aspect-ratio: 4 / 3;
  background: var(--blue);
  display: block;
  object-fit: cover;
  width: 100%;
}

.collection-card div {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.collection-card h2 {
  font-size: 18px;
}

.collection-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.compact {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.embed-page {
  background: transparent;
}

@media (max-width: 760px) {
  .app-header,
  .public-header,
  .toolbar,
  .content-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .app-header,
  .public-header {
    align-items: stretch;
    display: grid;
  }

  .content-grid {
    height: auto;
    min-height: 0;
  }

  .record-list,
  .editor {
    max-height: none;
    overflow: visible;
  }

  #public-search {
    min-width: 0;
  }
}

.account-bar,
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.account-bar {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.account-bar p,
.login-panel p {
  color: var(--muted);
}

.success-bar {
  background: #edf7ef;
  border-color: #8fc99b;
}

.success-bar p {
  color: #1f5f2c;
}

.password-form {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
}

.password-form[hidden] {
  display: none;
}

.login-page {
  background: var(--ink);
  min-height: 100vh;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 22px;
  place-items: center;
}

.login-panel {
  display: grid;
  gap: 18px;
  max-width: 440px;
  padding: 28px;
  width: 100%;
}

.login-panel form {
  display: grid;
  gap: 14px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

@media (max-width: 760px) {
  .password-form {
    grid-template-columns: 1fr;
  }
}

.upload-panel {
  background: #f7f9f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.upload-panel h3 {
  font-size: 17px;
  margin: 2px 0 0;
}

.upload-controls {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) auto;
}

.uploaded-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.uploaded-list a,
.collection-card a {
  background: #eef3ee;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 13px;
  padding: 6px 8px;
  text-decoration: none;
}

@media (max-width: 760px) {
  .upload-controls {
    grid-template-columns: 1fr;
  }
}

.import-layout {
  display: grid;
  gap: 18px;
}

.import-panel,
.import-results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-panel form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.table-wrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 840px;
  width: 100%;
}

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

th {
  background: #f4f6f2;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.admin-layout {
  display: grid;
  gap: 18px;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-tabs .tab {
  background: #eef3ee;
  border: 1px solid var(--line);
  color: var(--ink);
}

.admin-tabs .tab.active,
.admin-tabs .tab:hover {
  background: var(--accent);
  color: #fff;
}

.admin-grid {
  display: none;
  gap: 18px;
  grid-template-columns: minmax(260px, 360px) 1fr;
}

.admin-grid.active {
  display: grid;
}

.admin-form {
  padding: 0;
}

.admin-form > label,
.admin-form > .form-grid,
.admin-form > .actions,
.admin-form > p {
  margin-left: 16px;
  margin-right: 16px;
}

.admin-form > .actions,
.admin-form > p:last-child {
  margin-bottom: 16px;
}

@media (max-width: 760px) {
  .admin-grid,
  .admin-grid.active {
    grid-template-columns: 1fr;
  }
}

.linked-context {
  background: #f4f6f2;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  padding: 10px 12px;
}

.acquisition-layout {
  display: grid;
  gap: 18px;
}

.wizard-form {
  display: grid;
  gap: 18px;
}

.wizard-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.object-rows {
  display: grid;
  gap: 14px;
}

.object-row {
  background: #f7f9f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.object-row h3 {
  margin: 0;
}

.summary-section {
  border-color: #c8d7c8;
}

.deed-page {
  background: #e8ece6;
}

.deed-document {
  background: #fff;
  color: #111;
  margin: 24px auto;
  max-width: 8.5in;
  min-height: 11in;
  padding: 0.65in;
}

.deed-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.deed-header {
  border-bottom: 2px solid #111;
  margin-bottom: 24px;
  padding-bottom: 14px;
  text-align: center;
}

.deed-header h1 {
  font-size: 34px;
}

.deed-block,
.deed-text {
  margin: 22px 0;
}

.deed-block dl {
  display: grid;
  gap: 8px;
}

.deed-block dl div {
  display: grid;
  grid-template-columns: 180px 1fr;
}

.deed-block dt {
  font-weight: 700;
}

.deed-block dd {
  margin: 0;
}

.signature-grid {
  display: grid;
  gap: 34px;
  grid-template-columns: 1fr 1fr;
  margin-top: 70px;
}

.signature-grid span {
  border-bottom: 1px solid #111;
  display: block;
  height: 42px;
}

.signature-grid p {
  margin-top: 8px;
}

@media print {
  body {
    background: #fff;
  }

  .deed-document {
    margin: 0;
    max-width: none;
    min-height: 0;
    padding: 0;
  }

  .deed-actions {
    display: none;
  }
}

.inline-upload {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(26, 32, 38, 0.52);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 1000;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(20, 28, 34, 0.22);
  display: grid;
  gap: 18px;
  max-width: 560px;
  padding: 22px;
  width: min(560px, 100%);
}

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

.modal-copy h2 {
  font-size: 22px;
}

.modal-copy p {
  color: var(--muted);
}

.modal-details {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.modal-details label {
  display: grid;
  gap: 8px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

button.secondary {
  background: #eef2f1;
  color: var(--ink);
}
.record-button-media {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 54px 1fr;
}

.record-thumb {
  aspect-ratio: 1;
  background: var(--blue);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: block;
  object-fit: cover;
  width: 54px;
}

.record-thumb-empty::after {
  content: "";
  display: block;
  height: 100%;
}

.record-copy {
  min-width: 0;
}

.collection-card-button {
  align-items: stretch;
  background: var(--panel);
  color: var(--ink);
  display: grid;
  min-height: 0;
  padding: 0;
  text-align: left;
  width: 100%;
}

.collection-card-button:hover,
.collection-card-button:focus-visible {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(181, 83, 58, 0.18);
  outline: none;
}

.collection-card-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.collection-card-body strong {
  font-size: 18px;
}

.media-pill {
  color: var(--accent-dark);
  font-weight: 700;
}

.public-detail-panel {
  max-height: calc(100vh - 48px);
  max-width: 980px;
  overflow: auto;
  position: relative;
  width: min(980px, 100%);
}

.detail-close {
  justify-self: end;
}

.detail-media {
  background: #111820;
  border-radius: 8px;
  display: grid;
  min-height: 260px;
  overflow: hidden;
  place-items: center;
}

.detail-media img,
.detail-media video {
  max-height: 68vh;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

.detail-media audio {
  margin: 40px;
  width: min(620px, calc(100% - 40px));
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.media-choice,
.document-link {
  background: #eef2f1;
  border-radius: 6px;
  color: var(--ink);
  min-height: 36px;
  padding: 8px 10px;
}
.autofill-username {
  height: 0;
  left: -9999px;
  opacity: 0;
  padding: 0;
  position: absolute;
  width: 0;
}
@media (max-width: 760px) {
  .public-grid,
  .public-grid.compact {
    grid-template-columns: 1fr;
  }

  .collection-card-button {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    touch-action: manipulation;
  }

  .collection-card-button > img {
    aspect-ratio: 4 / 3;
    min-height: 160px;
    object-fit: cover;
  }

  .media-pill::after {
    content: " Tap to open";
  }

  .public-detail-backdrop {
    align-items: stretch;
    padding: 10px;
  }

  .public-detail-panel {
    max-height: calc(100vh - 20px);
    width: 100%;
  }
}