@font-face {
  font-family: 'Barlow Condensed';
  src: url('/assets/fonts/barlow-condensed-800.ttf') format('truetype');
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('/assets/fonts/dm-sans-400.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('/assets/fonts/dm-sans-600.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  --ink: #221e1f;
  --muted: #645b56;
  --accent: #981f36;
  --burgundy: #591326;
  --cream: #f7f4ee;
  --paper: #fffefa;
  --line: #e1dbd3;
  --blush: #f8e8ec;
  --success: #216346;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 400 16px/1.5 'DM Sans', Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

p, h1, h2 { margin: 0; }
button, input, select, textarea { font: inherit; }
a { color: var(--burgundy); }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: fixed;
  z-index: 5;
  inset: 12px auto auto 12px;
  padding: 8px 12px;
  background: var(--paper);
  transform: translateY(-160%);
}

.skip-link:focus { transform: none; }
.shell { width: min(1180px, calc(100% - 56px)); margin-inline: auto; }
.staff-header { border-top: 4px solid var(--burgundy); border-bottom: 1px solid var(--line); background: var(--paper); }
.header-content { min-height: 86px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.header-content img { display: block; width: clamp(155px, 19vw, 216px); height: auto; }
.header-content nav { display: flex; align-items: center; flex-wrap: wrap; justify-content: end; gap: 14px 25px; }
.header-content nav a, .nav-button { font-size: 14px; font-weight: 600; text-underline-offset: 4px; }
.nav-button { padding: 0; border: 0; background: none; color: var(--burgundy); text-decoration: underline; }
main.shell { padding-block: 42px 66px; }
.page-intro { max-width: 680px; }
.eyebrow { color: var(--accent); font-size: 12px; letter-spacing: .12em; font-weight: 600; }
h1, h2 { font-family: 'Barlow Condensed', Impact, sans-serif; font-weight: 800; line-height: 1; }
h1 { margin-block: 7px 11px; font-size: clamp(46px, 6vw, 68px); }
h2 { font-size: 30px; }
.page-intro > p:last-child, .editor-heading > p { color: var(--muted); }
.notice { margin-block: 22px 28px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 13px 16px; border-radius: 5px; font-size: 14px; }
.loading, .load-error { padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.load-error p { margin-bottom: 13px; color: var(--burgundy); }

.workspace-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #c8bfb7;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

.tab:hover, .button:hover { background: #f3ece4; }
.tab[aria-pressed='true'], .primary { color: #fff; border-color: var(--burgundy); background: var(--burgundy); }
.tab[aria-pressed='true']:hover, .primary:hover { background: #731b33; }
.workspace-grid { display: grid; grid-template-columns: minmax(300px, 2fr) minmax(0, 3fr); align-items: start; gap: 18px; }
.catalog, .editor { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.catalog-tools { display: grid; gap: 10px; padding: 18px; border-bottom: 1px solid var(--line); }
.catalog-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 3px; }
.filter, .field { display: grid; gap: 6px; min-width: 0; }
.filter > span, .field-label { font-size: 14px; font-weight: 600; }

input:not([type='checkbox']):not([type='file']), select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #c8bfb7;
  border-radius: 5px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #796f67; opacity: 1; }

.entries {
  max-height: min(62vh, 620px);
  overflow: auto;
  list-style: none;
  padding: 6px 10px;
  margin: 0;
  scrollbar-gutter: stable;
}

.entries:empty { display: none; }
.entries li + li { border-top: 1px solid #f2eeea; }
.entry {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 65px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.entry:hover { background: var(--cream); }
.entry[aria-current='true'] { background: var(--blush); border-color: #eccbd4; }
.thumb, .photo-thumb {
  display: grid;
  place-items: center;
  background: #f2ebe4;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  overflow: hidden;
}

.thumb { width: 46px; height: 46px; font-size: 13px; }
.thumb img, .photo-thumb img { width: 100%; height: 100%; object-fit: contain; }
.entry-copy, .entry-name, .entry-detail { display: block; min-width: 0; overflow-wrap: anywhere; }
.entry-name { font-weight: 600; line-height: 1.3; }
.entry-detail { font-size: 13px; color: var(--muted); margin-top: 3px; }
.badge { align-self: center; padding: 3px 6px; background: #ede5dc; border-radius: 4px; color: #5a4941; font-size: 11px; font-weight: 600; }
.empty-list { padding: 18px; color: var(--muted); }

.editor { padding: clamp(18px, 4vw, 30px); }
.empty-editor { display: grid; place-items: start; align-content: center; gap: 9px; min-height: 220px; }
.empty-editor > p:last-child { color: var(--muted); }
.editor-heading { margin-bottom: 21px; }
.editor-heading h2 { overflow-wrap: anywhere; }
.editor-heading p { margin-top: 5px; }
.editor-heading .back-button { display: none; }
#edit-fields { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 15px; }
.field-hint { color: var(--muted); font-size: 13px; }
.field-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(146px, 100%), 1fr)); align-items: start; gap: 11px; }
.read-only-section { color: var(--muted); font-size: 14px; }
.read-only-section strong { color: var(--ink); font-weight: 600; }

.photo-fields { display: grid; gap: 9px; }
.photo-list { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-card { display: grid; gap: 5px; width: 100px; }
.photo-thumb { width: 100px; height: 86px; }
.small-button { min-height: 36px; font-size: 13px; padding: 6px 10px; }
.photo-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.photo-tools select { width: min(255px, 100%); }
.photo-upload { position: relative; cursor: pointer; }
.photo-upload:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.photo-upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-error, .save-status.error { color: var(--burgundy); }
.photo-error { font-size: 14px; }

.visibility { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; border-radius: 6px; background: var(--cream); }
.visibility input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--burgundy); }
.visibility strong, .visibility .field-hint { display: block; }
.editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 21px; border-top: 1px solid var(--line); padding-top: 16px; }
.save-status { width: 100%; color: var(--muted); font-size: 14px; }
.save-status:empty { display: none; }
.save-status.success { color: var(--success); }

.auth-shell { max-width: 520px; }
.auth-form { display: grid; justify-items: start; gap: 16px; margin-top: 22px; }
.auth-form .field { width: 100%; }
.auth-form input[readonly] { background: var(--cream); }
.auth-help { margin-top: 16px; color: var(--muted); font-size: 14px; }
.auth-message { color: var(--muted); font-size: 14px; }
.auth-message:empty { display: none; }
.auth-message.error { color: var(--burgundy); }
.auth-message.success { color: var(--success); }
.auth-message[data-signout-error]:not(:empty) { padding-top: 14px; }
.page-intro + .auth-message:not(:empty) { margin-top: 16px; }
.accounts-grid { display: grid; grid-template-columns: minmax(260px, 2fr) minmax(0, 3fr); align-items: start; gap: 18px; margin-top: 24px; }
.accounts-grid > section > .auth-message:not(:empty) { margin-top: 14px; }
.account-list { padding: 0; margin: 14px 0 0; list-style: none; }
.account-list:empty { display: none; }
.account-list li { display: grid; align-items: center; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.account-list li strong { overflow-wrap: anywhere; }
.account-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.temporary-password { display: grid; gap: 12px; padding: 16px; margin-top: 22px; background: var(--cream); border: 1px solid var(--line); border-radius: 6px; }
.temporary-password > p { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.temporary-password input { font-family: monospace; }

@media (max-width: 720px) {
  .shell { width: calc(100% - 32px); }
  .header-content { min-height: 72px; gap: 12px; }
  .header-content nav { gap: 6px 12px; }
  .header-content nav a, .nav-button { font-size: 13px; }
  main.shell { padding-block: 29px 46px; }
  .notice { margin-block: 17px 23px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .workspace-grid:not(.editing) .editor, .workspace-grid.editing .catalog { display: none; }
  .entries { max-height: none; }
  .editor-heading .back-button { display: inline-flex; margin-bottom: 14px; }
  .accounts-grid, .account-list li { grid-template-columns: 1fr; }
}
