:root {
  color-scheme: light;
  --ink: #191c18;
  --ink-soft: #586056;
  --paper: #f3f3ec;
  --surface: #fbfbf6;
  --surface-raised: #ffffff;
  --line: #d9dacf;
  --line-strong: #b8bcb0;
  --accent: #415d0c;
  --accent-bright: #d9ff73;
  --accent-soft: #ecf7cc;
  --danger: #a13527;
  --danger-soft: #fae7e1;
  --warning: #856411;
  --warning-soft: #fff1c8;
  --success: #286742;
  --success-soft: #dff3e5;
  --sidebar: #171a15;
  --sidebar-soft: #aeb6a7;
  --shadow: 0 18px 50px rgb(22 26 19 / 8%);
  --radius: 18px;
  --radius-small: 10px;
  --content: 1480px;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 4%, rgb(217 255 115 / 18%), transparent 24rem), var(--paper);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select,
textarea,
summary {
  outline-offset: 3px;
}

:focus-visible {
  outline: 3px solid #769c28;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

img {
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h1 {
  max-width: 24ch;
  margin-bottom: 0.65rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  font-weight: 500;
}

h2 {
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

h3 {
  font-size: 1.05rem;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--sidebar);
  background: var(--accent-bright);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: none;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: 240px;
  flex-direction: column;
  padding: 1.35rem 1rem;
  color: white;
  background: var(--sidebar);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0.4rem 2.2rem;
  color: white;
  text-decoration: none;
}

.brand-lockup > span:last-child {
  display: grid;
}

.brand-lockup strong {
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.brand-lockup small {
  color: var(--sidebar-soft);
  font-size: 0.72rem;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 9px;
  color: var(--sidebar);
  background: var(--accent-bright);
  font-family: Georgia, serif;
  font-weight: 700;
}

.side-navigation {
  display: grid;
  gap: 0.3rem;
}

.nav-group {
  margin-top: 0.8rem;
}

.nav-group summary {
  min-height: 32px;
  padding: 0.35rem 0.8rem;
  color: var(--sidebar-soft);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  list-style: none;
  text-transform: uppercase;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group.active > summary {
  color: var(--accent-bright);
}

.nav-group summary::after {
  float: right;
  content: '+';
  font-size: 0.9rem;
  line-height: 1;
}

.nav-group[open] summary::after {
  content: '−';
}

.nav-group-items {
  display: grid;
  gap: 0.3rem;
}

.nav-link {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border-radius: 9px;
  color: var(--sidebar-soft);
  font-size: 0.91rem;
  font-weight: 600;
  text-decoration: none;
}

.nav-link:hover {
  color: white;
  background: rgb(255 255 255 / 7%);
}

.nav-link.active {
  color: var(--sidebar);
  background: var(--accent-bright);
}

.nav-symbol {
  display: grid;
  width: 1.4rem;
  place-items: center;
  font-size: 1.05rem;
}

.mobile-header {
  display: none;
}

.menu-backdrop {
  display: none;
}

.main-content {
  width: calc(100% - 240px);
  max-width: calc(var(--content) + 240px);
  min-height: 100vh;
  margin-left: 240px;
  padding: clamp(2rem, 5vw, 5rem);
}

.main-content:focus {
  outline: none;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.page-header p:not(.eyebrow) {
  max-width: 68ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
}

.page-actions,
.toolbar,
.button-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.view-toggle {
  display: inline-flex;
  min-height: 44px;
  align-items: stretch;
  padding: 0.2rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-raised);
}

.view-toggle-button {
  min-width: 74px;
  min-height: 40px;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  cursor: pointer;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 750;
}

.view-toggle-button:hover,
.view-toggle-button:focus-visible {
  color: var(--ink);
  background: var(--accent-soft);
}

.view-toggle-button.active {
  color: white;
  background: var(--accent);
}

.eyebrow {
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.1;
  text-decoration: none;
}

.button:hover {
  filter: brightness(0.96);
}

.button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.button.primary {
  color: white;
  background: var(--accent);
}

.button.secondary {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface-raised);
}

.button.ghost {
  color: var(--ink-soft);
  background: transparent;
}

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

.icon-button,
.menu-button {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  background: var(--surface);
}

.filter-chip {
  display: inline-flex;
  min-height: 40px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 50%);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.filter-chip.active {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.section-navigation {
  display: flex;
  overflow-x: auto;
  gap: 0.35rem;
  margin: -1.8rem 0 2rem;
  padding-bottom: 0.4rem;
}

.section-link,
.back-link {
  display: inline-flex;
  min-height: 40px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.section-link {
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 50%);
}

.section-link.active {
  border-color: var(--accent);
  color: white;
  background: var(--accent);
}

.back-link {
  margin-bottom: 1rem;
  padding-left: 0;
  color: var(--accent);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-card {
  display: grid;
  min-height: 170px;
  align-content: end;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.metric-card:hover,
.quick-link:hover,
.entity-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.metric-value {
  margin-bottom: auto;
  font-family: Georgia, serif;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1;
}

.metric-card small,
.quick-link small {
  margin-top: 0.35rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.dashboard-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.quick-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  min-height: 100px;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.quick-link > span:nth-child(2) {
  display: grid;
}

.quick-symbol,
.empty-mark {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 1.35rem;
}

.panel,
.entity-card,
.card,
.document-card,
.inventory-card,
.list-card,
.error-panel,
.empty-state,
.detail-hero,
.table-wrap,
.timeline-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.card,
.document-card,
.inventory-card,
.list-card,
.error-panel,
.empty-state,
.detail-hero {
  padding: clamp(1.1rem, 3vw, 1.6rem);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.list-stack {
  display: grid;
  gap: 0.75rem;
}

.list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.list-card-main,
.card-heading,
.section-heading {
  display: grid;
  gap: 0.35rem;
}

.card-heading {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.card-note,
.note,
.result-count {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.badge-row,
.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 1rem;
}

.markdown-source {
  white-space: pre-wrap;
}

.timeline-entry {
  padding: 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--surface);
}

.section-header,
.entity-card-header,
.detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-header h2,
.entity-card-header h2,
.entity-card-header h3 {
  margin: 0;
}

.document-list,
.clean-list,
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.document-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.8rem;
  min-height: 54px;
  border-top: 1px solid var(--line);
}

.document-list li:first-child {
  border-top: 0;
}

.document-list li > span:not(.badge) {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: var(--ink-soft);
  background: #e8e9e2;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-active,
.badge-completed,
.badge-complete,
.badge-stored {
  color: var(--success);
  background: var(--success-soft);
}

.badge-draft,
.badge-incomplete,
.badge-hosted {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge-disposed,
.badge-archived,
.badge-superseded {
  color: var(--ink-soft);
  background: #e6e7e1;
}

.entity-grid,
.gallery-grid,
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.resource-card,
.child-card {
  position: relative;
  display: grid;
  min-height: 180px;
  align-content: space-between;
  gap: 1rem;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.resource-card h2,
.resource-card h3,
.child-card h3 {
  margin-bottom: 0.4rem;
}

.resource-list,
.child-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.resource-row,
.child-row {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
}

.row-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.row-actions .button {
  min-height: 40px;
  padding: 0.55rem 0.7rem;
}

.entity-card {
  position: relative;
  display: grid;
  min-height: 220px;
  align-content: space-between;
  gap: 1.2rem;
  padding: 1.25rem;
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.entity-card > a.stretched-link::after {
  position: absolute;
  inset: 0;
  content: '';
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

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

.empty-state {
  display: grid;
  min-height: 300px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-state .empty-mark {
  margin-bottom: 1rem;
}

.empty-state p {
  max-width: 48ch;
  color: var(--ink-soft);
}

.loading {
  display: flex;
  min-height: 60vh;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--ink-soft);
}

.spinner {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.error-panel {
  border-left: 5px solid var(--danger);
  background: var(--danger-soft);
}

.error-panel h2 {
  margin-bottom: 0.5rem;
}

.error-panel pre,
.technical-details pre {
  overflow: auto;
  max-height: 24rem;
  padding: 0.8rem;
  border-radius: 8px;
  background: rgb(0 0 0 / 6%);
  font-size: 0.75rem;
  white-space: pre-wrap;
}

.toolbar {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 52%);
}

.toolbar .field {
  min-width: 150px;
  flex: 1 1 180px;
  margin: 0;
}

.filter-bar,
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 52%);
}

.filter-bar .field,
.form-grid .field {
  margin: 0;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack.compact {
  gap: 0.45rem;
}

.notice {
  padding: 0.8rem 1rem;
  border: 1px solid #d8bc68;
  border-radius: 9px;
  color: var(--warning);
  background: var(--warning-soft);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.associated-details {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.associated-details > summary {
  min-height: 52px;
  padding: 1rem 1.2rem;
  cursor: pointer;
  font-weight: 750;
}

.associated-content {
  display: grid;
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
}

.media-card > img {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
}

.media-card > div {
  padding: 0.8rem;
}

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

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

.field {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field label,
.field > span:first-child {
  font-size: 0.78rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.68rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input[type='checkbox'],
input[type='radio'] {
  width: 1.15rem;
  min-height: auto;
  accent-color: var(--accent);
}

.field-help {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.4;
}

.check-field {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.dialog {
  width: min(720px, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 30px 90px rgb(0 0 0 / 30%);
}

.dialog::backdrop {
  background: rgb(12 15 10 / 68%);
  backdrop-filter: blur(4px);
}

.dialog form {
  display: flex;
  max-height: calc(100dvh - 2rem);
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.3rem 0;
}

.dialog-header h2 {
  margin-bottom: 0.25rem;
}

.dialog-description {
  margin: 0;
  padding: 0.3rem 1.3rem 0;
  color: var(--ink-soft);
}

.dialog-body,
.dialog-errors {
  overflow-y: auto;
  padding: 1.2rem 1.3rem;
}

.dialog-errors:empty {
  display: none;
}

.dialog-errors .error-panel {
  box-shadow: none;
}

.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 0.65rem;
  padding: 1rem 1.3rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.definition-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.55fr) minmax(0, 1.45fr);
  margin: 0;
}

.definition-list dt,
.definition-list dd {
  margin: 0;
  padding: 0.72rem 0;
  border-bottom: 1px solid var(--line);
}

.definition-list dt {
  padding-right: 1rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.definition-list dd {
  overflow-wrap: anywhere;
}

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

.catalog-table-wrap {
  min-width: 0;
}

.catalog-table-wrap table {
  min-width: 700px;
}

.catalog-table-wrap td:last-child {
  white-space: nowrap;
}

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

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

th {
  color: var(--ink-soft);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.detail-hero {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.detail-hero h1 {
  font-size: clamp(2rem, 4vw, 3.7rem);
}

.gallery-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.gallery-image,
.media-placeholder {
  display: grid;
  aspect-ratio: 4 / 3;
  width: 100%;
  place-items: center;
  overflow: hidden;
  color: var(--ink-soft);
  background: linear-gradient(135deg, rgb(65 93 12 / 10%), transparent), #e5e6dc;
}

.gallery-image img,
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-body {
  padding: 1rem;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.media-thumb {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
}

.media-thumb > div:last-child {
  padding: 0.6rem;
}

.timeline {
  display: grid;
  gap: 0.75rem;
}

.timeline-item {
  position: relative;
  padding: 1rem 1rem 1rem 1.3rem;
  border-left: 4px solid var(--accent);
}

.timeline-item time {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.quantity-preview {
  padding: 0.9rem;
  border-radius: 9px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

@media (max-width: 1120px) {
  .metric-grid,
  .entity-grid,
  .gallery-grid,
  .resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .list-card {
    display: grid;
    align-items: start;
  }
}

@media (max-width: 760px) {
  .mobile-header {
    position: sticky;
    z-index: 30;
    top: 0;
    display: flex;
    min-height: 60px;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--line);
    background: rgb(243 243 236 / 92%);
    backdrop-filter: blur(12px);
  }

  .mobile-brand {
    color: var(--ink);
    font-family: Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
  }

  .sidebar {
    width: min(290px, calc(100% - 3rem));
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 12px 0 40px rgb(0 0 0 / 24%);
  }

  .menu-open .sidebar {
    transform: translateX(0);
  }

  .menu-open .menu-backdrop {
    display: block;
  }

  .menu-backdrop {
    display: none;
    position: fixed;
    z-index: 15;
    inset: 0;
    border: none;
    padding: 0;
    background: rgb(0 0 0 / 48%);
    cursor: pointer;
  }

  .main-content {
    width: 100%;
    margin: 0;
    padding: 1.35rem 1rem 3rem;
  }

  .page-header {
    display: grid;
    align-items: start;
    gap: 1.2rem;
    margin-bottom: 2.2rem;
  }

  .page-actions .button {
    flex: 1 1 auto;
  }

  .metric-grid,
  .dashboard-grid,
  .quick-grid,
  .detail-grid,
  .entity-grid,
  .gallery-grid,
  .field-grid,
  .media-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .resource-row,
  .child-row {
    display: grid;
    align-items: start;
  }

  .metric-card {
    min-height: 140px;
  }

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

  .document-list li > span:not(.badge) {
    grid-column: 1 / -1;
  }

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

  .definition-list dt {
    padding-bottom: 0.15rem;
    border-bottom: 0;
  }

  .definition-list dd {
    padding-top: 0.15rem;
  }

  .dialog {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
  }

  .dialog form {
    max-height: 92dvh;
  }
}

@media (forced-colors: active) {
  .badge,
  .button,
  .nav-link,
  .metric-card,
  .panel {
    border: 1px solid CanvasText;
  }
}

/* Modern workspace presentation. The application keeps its existing semantic
   classes; this layer changes the visual language without changing workflows. */
:root {
  --ink: #182033;
  --ink-soft: #56647a;
  --paper: #f7f8fb;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --line: #e5e8f0;
  --line-strong: #d4d9e5;
  --accent: #3c4bf5;
  --accent-bright: #eef0ff;
  --accent-soft: #f0f2ff;
  --danger: #b43b4b;
  --danger-soft: #fff0f2;
  --warning: #946a16;
  --warning-soft: #fff8df;
  --success: #24704d;
  --success-soft: #e7f7ee;
  --sidebar: #ffffff;
  --sidebar-soft: #56647a;
  --shadow: 0 10px 30px rgb(31 43 72 / 5%);
  --radius: 13px;
  --radius-small: 9px;
  --content: 1440px;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

body {
  background: var(--paper);
}

h1,
h2,
h3 {
  font-family: inherit;
  letter-spacing: -0.035em;
}

h1 {
  max-width: 30ch;
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 3.4vw, 3.25rem);
  font-weight: 720;
}

h2 {
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  font-weight: 700;
}

.sidebar {
  width: 250px;
  padding: 1.65rem 0.85rem 1.1rem;
  color: var(--ink);
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  box-shadow: none;
}

.brand-lockup {
  margin: 0 0.55rem 2rem;
  color: var(--ink);
}

.brand-lockup small {
  color: var(--ink-soft);
}

.brand-mark {
  width: 2.35rem;
  height: 2.35rem;
  color: white;
  background: var(--accent);
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: -0.04em;
}

.nav-group {
  margin-top: 0.65rem;
}

.nav-group summary {
  color: #56647a;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
}

.nav-group.active > summary {
  color: var(--accent);
}

.nav-group summary::after {
  display: none;
}

.nav-group-items {
  gap: 0.12rem;
}

.nav-link {
  min-height: 42px;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  color: #526078;
  font-size: 0.88rem;
  font-weight: 600;
}

.nav-link:hover {
  color: var(--ink);
  background: #f4f6fa;
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-symbol {
  width: 1.35rem;
  color: currentColor;
  font-size: 1rem;
}

.main-content {
  width: calc(100% - 250px);
  max-width: calc(var(--content) + 250px);
  margin-left: 250px;
  padding: clamp(2rem, 4vw, 4.2rem) clamp(1.4rem, 4vw, 4.5rem) 4rem;
}

.page-header {
  align-items: start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.page-header p:not(.eyebrow) {
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.5;
}

.eyebrow {
  margin-bottom: 0.65rem;
  color: var(--accent);
  font-size: 0.67rem;
  letter-spacing: 0.13em;
}

.page-actions {
  gap: 0.55rem;
}

.button {
  min-height: 42px;
  padding: 0.66rem 0.9rem;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 680;
}

.button.primary {
  background: var(--accent);
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
}

.button.secondary:hover,
.button.ghost:hover {
  filter: none;
  background: #f4f6fa;
}

.button.ghost {
  color: var(--ink-soft);
}

.view-toggle {
  min-height: 42px;
  padding: 0.15rem;
  border-color: var(--line);
  border-radius: 9px;
  background: #fbfcfe;
}

.view-toggle-button {
  min-width: 64px;
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  border-radius: 7px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 680;
}

.view-toggle-button:hover,
.view-toggle-button:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
}

.view-toggle-button.active {
  color: var(--accent);
  background: #eef0f8;
  box-shadow: none;
}

.catalog-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 560;
}

.catalog-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.catalog-breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: #a7b0c0;
}

.breadcrumb-current {
  color: var(--ink-soft);
}

.section-navigation {
  gap: 0.35rem;
  margin: -0.75rem 0 1.7rem;
  padding-bottom: 0.25rem;
}

.section-link {
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border-color: var(--line);
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.8rem;
}

.section-link.active {
  border-color: transparent;
  color: var(--accent);
  background: var(--accent-soft);
}

.filter-bar {
  display: block;
  margin-bottom: 1.15rem;
  padding: 0;
  border-color: var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 3px 14px rgb(31 43 72 / 3%);
}

.filter-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  list-style: none;
}

.filter-summary::-webkit-details-marker {
  display: none;
}

.filter-summary::before {
  display: grid;
  flex: 0 0 1.55rem;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  content: '+';
  font-size: 1.1rem;
  line-height: 1;
}

.filter-disclosure[open] > .filter-summary::before {
  content: '−';
}

.filter-summary-copy {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 0.55rem;
}

.filter-summary-title {
  font-weight: 700;
}

.filter-summary-status {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-summary-action {
  margin-left: auto;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.filter-summary-hide {
  display: none;
}

.filter-disclosure[open] .filter-summary-show {
  display: none;
}

.filter-disclosure[open] .filter-summary-hide {
  display: inline;
}

.filter-fields {
  display: grid;
  grid-template-columns: minmax(230px, 1.6fr) repeat(auto-fit, minmax(145px, 1fr));
  align-items: end;
  gap: 0.6rem;
  padding: 0.7rem;
  border-top: 1px solid var(--line);
}

.filter-fields .field {
  min-width: 0;
}

.filter-fields .field label {
  margin-bottom: 0.3rem;
  color: #56647a;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-fields input,
.filter-fields select {
  min-height: 42px;
  padding: 0.58rem 0.7rem;
  border-color: var(--line);
  border-radius: 8px;
  background: #fcfdff;
  font-size: 0.84rem;
}

.filter-fields input:focus,
.filter-fields select:focus {
  border-color: #aab2ff;
  box-shadow: 0 0 0 3px rgb(60 75 245 / 10%);
  outline: none;
}

.filter-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.filter-fields .button {
  min-height: 42px;
}

.notice {
  border-color: #eadba7;
  border-radius: 10px;
  color: var(--warning);
  background: var(--warning-soft);
}

.resource-grid,
.entity-grid,
.gallery-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.resource-card,
.entity-card,
.gallery-card {
  min-height: 196px;
  padding: 1.1rem;
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.resource-card:hover,
.entity-card:hover,
.gallery-card:hover {
  border-color: #cfd4ff;
  box-shadow: 0 14px 32px rgb(31 43 72 / 8%);
  transform: translateY(-1px);
}

.resource-card h2,
.resource-card h3 {
  margin-bottom: 0.35rem;
  font-size: 1.08rem;
}

.resource-card .eyebrow {
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.64rem;
}

.resource-card .muted {
  font-size: 0.8rem;
}

.badge {
  padding: 0.25rem 0.5rem;
  color: var(--ink-soft);
  background: #f0f2f6;
  font-size: 0.66rem;
}

.table-wrap {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.catalog-table-wrap table {
  min-width: 680px;
}

th,
td {
  padding: 0.78rem 0.9rem;
  border-bottom-color: var(--line);
}

th {
  color: #56647a;
  font-size: 0.66rem;
  letter-spacing: 0.07em;
}

tbody tr:hover {
  background: #fafbff;
}

.pagination {
  margin-top: 0.95rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.pagination .button {
  min-width: 42px;
}

.catalog-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.35rem 0 0.85rem;
}

.catalog-results-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.collection-count {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 650;
}

.catalog-results-count {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 720;
}

.catalog-results-note {
  margin: 0.22rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.switch-card {
  min-height: 214px;
}

.switch-card-body {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.switch-card-media {
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: #f8f9fc;
}

.switch-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.switch-card-descriptor {
  margin: 0.1rem 0 0;
  font-size: 0.79rem;
}

.switch-fallback {
  --switch-stem: #64748b;
  position: relative;
  width: 76px;
  height: 92px;
  border: 7px solid #d7dbe4;
  border-radius: 18px 18px 12px 12px;
  background: linear-gradient(180deg, #f7f8fb 0 56%, #d8dce5 56% 100%);
  box-shadow: 0 8px 16px rgb(31 43 72 / 12%);
}

.switch-fallback::before {
  position: absolute;
  top: -19px;
  left: 50%;
  width: 27px;
  height: 39px;
  border-radius: 5px 5px 3px 3px;
  background: var(--switch-stem);
  box-shadow: inset 0 -6px rgb(0 0 0 / 12%);
  content: '';
  transform: translateX(-50%);
}

.switch-fallback::after {
  position: absolute;
  right: 11px;
  bottom: 9px;
  left: 11px;
  height: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 70%);
  content: '';
}

.switch-card-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 0.9rem;
  margin: 0.85rem 0 0;
}

.switch-card-facts dt {
  color: #56647a;
  font-size: 0.62rem;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.switch-card-facts dd {
  margin: 0.18rem 0 0;
  color: var(--ink);
  font-size: 0.78rem;
}

.switch-card .row-actions {
  justify-content: end;
  margin-top: 0.25rem;
}

.switch-card .row-actions .button {
  min-height: 36px;
  padding: 0.45rem 0.65rem;
  color: var(--accent);
  border-color: transparent;
  background: transparent;
}

.switch-card .row-actions .button:hover {
  background: var(--accent-soft);
}

@media (max-width: 1120px) {
  .resource-grid,
  .entity-grid,
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .mobile-header {
    min-height: 58px;
    padding: 0.5rem 1rem;
    border-bottom-color: var(--line);
    background: rgb(247 248 251 / 94%);
  }

  .mobile-brand {
    color: var(--ink);
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 760;
  }

  .menu-button {
    border-color: var(--line);
    color: var(--ink);
    background: var(--surface);
    font-size: 0.78rem;
    font-weight: 680;
  }

  .sidebar {
    width: min(292px, calc(100% - 2.25rem));
    box-shadow: 14px 0 36px rgb(31 43 72 / 16%);
  }

  .main-content {
    width: 100%;
    margin: 0;
    padding: 1.25rem 1rem 3rem;
  }

  .page-header {
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .page-header p:not(.eyebrow) {
    font-size: 0.9rem;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .button {
    flex: 1 1 auto;
  }

  .page-actions .view-toggle {
    flex: 0 0 auto;
  }

  .filter-bar {
    padding: 0;
  }

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

  .filter-actions {
    grid-column: auto;
  }

  .catalog-results-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
  }

  .resource-grid,
  .entity-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .switch-card-body {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 0.85rem;
  }

  .switch-card-media {
    width: 96px;
    height: 96px;
  }

  .switch-fallback {
    width: 58px;
    height: 72px;
    border-width: 6px;
  }

  .switch-fallback::before {
    width: 21px;
    height: 31px;
    top: -15px;
  }
}

.sidebar-account {
  margin-top: auto;
  padding: 1rem 1.1rem 1.25rem;
}

.mobile-user {
  margin-left: auto;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-panel {
  width: min(100%, 28rem);
}
