:root {
  color-scheme: light;
  --green: #03433d;
  --green-dark: #022f2b;
  --green-soft: #e7efeb;
  --paper: #f8f7f2;
  --surface: #fffefa;
  --sand: #eee9dd;
  --brass: #9a8050;
  --ink: #202925;
  --muted-ink: #69736d;
  --line: #dedfd7;
  --danger: #9b4138;
  --shadow: 0 16px 48px rgb(25 38 31 / 13%);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

html { min-width: 320px; min-height: 100%; background: var(--paper); }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
img { max-width: 100%; }

:focus-visible {
  outline: 3px solid #b28b45;
  outline-offset: 3px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 54px);
  color: var(--green);
  background: var(--surface);
  border-bottom: 2px solid var(--green);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  color: var(--green);
  text-decoration: none;
}
.brand img { display: block; width: 112px; height: 35px; object-fit: contain; }
.brand span { padding-left: 13px; border-left: 1px solid var(--line); font-family: "Playfair Display", Georgia, serif; font-size: 19px; }

.role-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ink);
}
.role-picker span { line-height: 1.4; }
.role-picker small { display: block; color: var(--muted-ink); font-size: 11px; }
.role-picker select {
  min-height: 38px;
  max-width: 100%;
  padding: 7px 34px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--green);
  background: var(--paper);
}
.role-picker option { color: var(--ink); background: #fff; }

.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 132px);
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.sidebar {
  min-width: 0;
  padding: 26px 15px;
  background: #f0eee6;
  border-right: 1px solid var(--line);
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--brass);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
}
.eyebrow span[lang="en"] { display: block; color: var(--muted-ink); font-weight: 500; letter-spacing: .04em; }
.list-nav { display: grid; gap: 5px; }
.list-picker { display: none; }
.list-picker select { min-width: 0; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--green); background: var(--surface); }
.list-nav button {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  overflow-wrap: anywhere;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #46514b;
  background: transparent;
}
.list-nav button:hover { background: rgb(255 255 255 / 65%); }
.list-nav button[aria-current="page"] {
  color: var(--green);
  background: var(--surface);
  border-color: #d9dfd8;
  box-shadow: inset 3px 0 var(--brass);
  font-weight: 650;
}
.sidebar > .button { width: 100%; margin-top: 16px; }

.main { min-width: 0; padding: clamp(22px, 4vw, 48px); }
.gate { max-width: 700px; margin-inline: auto; min-height: min(70vh, 580px); }
.gate h1 { color: var(--green); font: 500 34px/1.2 "Playfair Display", Georgia, serif; }
.gate .notice { margin-top: 16px; }
.role-picker { flex-wrap: wrap; }
.account-menu { position: relative; max-width: 260px; }
.account-menu summary { cursor: pointer; min-height: 40px; padding: 5px 0; overflow-wrap: anywhere; }
.account-menu summary small { padding-left: 14px; }
.account-actions { position: absolute; inset: calc(100% + 4px) 0 auto auto; z-index: 2; min-width: 210px;
  display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.list-header { display: grid; gap: 12px; margin-bottom: 23px; }
.list-header > * { margin: 0; }
.list-cover-art { height: 220px; overflow: hidden; background: var(--green-soft); border-radius: 4px; }
.list-cover-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand-icons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0; list-style: none; }
.brand-icons li { display: grid; place-items: center; width: 44px; height: 44px; padding: 5px; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; }
.brand-icons img { width: 100%; height: 100%; object-fit: contain; }
.catalog-section { margin-block: 20px; }
.catalog-section > .panel-bar { padding-inline: 0; border-bottom: 1px solid var(--line); }
.marquetry-entry { min-width: 0; margin-block: 16px 28px; border-bottom: 1px solid var(--line); }
.catalog-reference { margin-block: 18px 22px; }
.catalog-source { color: var(--green); font-size: 12px; text-underline-offset: 2px; }
.marquetry-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 12px; background: #f4eddb; }
.marquetry-heading h3 { flex: 1 1 150px; margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--green); font: 500 23px/1.15 "Playfair Display", Georgia, serif; }
.marquetry-dimension { color: var(--green); font-size: 13px; font-weight: 650; }
.marquetry-visuals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-block: 12px; }
.marquetry-visuals:has(figure:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.marquetry-visuals:has(figure:only-child) { grid-template-columns: minmax(0, 1fr); }
.marquetry-visuals figure { display: flex; min-width: 0; flex-direction: column; gap: 5px; margin: 0; }
.marquetry-visuals figcaption { margin-bottom: auto; color: var(--green); font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.marquetry-visual { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; max-height: 245px; min-width: 0; overflow: hidden; background: #eeeee8; color: var(--muted-ink); text-align: center; font-size: 11px; }
.marquetry-visual button { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; min-height: 0; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.marquetry-visual button:focus-visible { outline-offset: -3px; }
.marquetry-visual img { display: block; width: 100%; height: 100%; object-fit: contain; }
.marquetry-table { min-width: 0; overflow-x: auto; }
.marquetry-table table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.marquetry-table table:has(th:nth-child(6)) { min-width: 640px; }
.marquetry-table th, .marquetry-table td { padding: 8px 10px; text-align: left; overflow-wrap: anywhere; }
.marquetry-table thead th { color: #fff; background: #26342d; font-size: 12px; }
.marquetry-table tbody > tr > * { background: #f5f4ee; font-size: 13px; }
.marquetry-table tbody > tr:nth-child(even) > * { background: #eeeee8; }
.marquetry-table .price { white-space: normal; }
.catalog-preview-image { display: block; width: 100%; max-height: 72vh; object-fit: contain; background: var(--surface); }
.list-header h1, .list-header h2 {
  margin: 3px 0 7px;
  color: var(--green);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 34px;
  font-weight: 500;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.lead { max-width: 740px; margin: 0; color: var(--muted-ink); font-size: 14px; line-height: 1.65; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 39px;
  max-width: 100%;
  padding: 8px 13px;
  border: 1px solid #c9cec6;
  border-radius: 4px;
  color: var(--green);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.button:hover { border-color: var(--green); background: var(--green-soft); }
.button.primary { border-color: var(--green); color: #fff; background: var(--green); }
.button.primary:hover { border-color: var(--green-dark); background: var(--green-dark); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 18px; height: 18px; }

.panel { min-width: 0; margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; }
.panel > .panel-bar { background: #f4eddb; }
.panel > .notice { margin: 10px; }
.editor-actions { margin: 12px 0 0; }
.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-bar h2, .panel-bar h3 { margin: 0; color: var(--green); font-family: "Playfair Display", Georgia, serif; font-size: 19px; font-weight: 500; }
.filter { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 12px; padding-inline: 0; }
.filter > .muted { margin-left: auto; }
.filter input, .filter select, .field input, .field select, .field textarea {
  min-width: 0;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #cfd3cc;
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
}
.filter input { width: min(100%, 260px); }
.filter input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #8b938d; }

.table-wrap { width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
.table-wrap table { width: 100%; min-width: 650px; border-collapse: collapse; text-align: left; }
.table-wrap th, .table-wrap td { padding: 13px 15px; border-bottom: 1px solid #e9e9e3; vertical-align: middle; }
.table-wrap thead th { color: #fff; background: #26342d; font-size: 11px; font-weight: 650; text-transform: uppercase; }
.table-wrap tbody th { color: var(--green); font-size: 13px; text-align: left; }
.table-wrap tbody tr:nth-child(even) { background: #f5f4ee; }
.table-wrap th small, .row-source { display: block; margin-top: 5px; }
.row-source { max-width: 20ch; overflow-wrap: anywhere; }
.table-wrap td { color: #424c46; font-size: 13px; line-height: 1.5; }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover { background: #fbfaf6; }
.row-title { color: var(--green); font-weight: 650; }
.muted { color: var(--muted-ink); }
.pending, .status { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border-radius: 3px; font-size: 11px; font-weight: 650; line-height: 1.4; }
.pending { color: #755d29; background: #f2ecd9; }
.status { color: #285d48; background: #e6f0e9; }
.status[data-state="inactive"], .status[data-state="archived"] { color: #5f6661; background: #ecece8; }
.price { color: var(--green); font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.row-image { display: block; width: 52px; height: 42px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; background: var(--sand); }
.notice { margin: 0 0 18px; padding: 12px 15px; border: 1px solid #ddd2b8; border-left: 3px solid var(--brass); border-radius: 3px; color: #554b37; background: #f7f2e7; font-size: 13px; line-height: 1.55; }
.empty { padding: 34px 20px; color: var(--muted-ink); text-align: center; line-height: 1.6; }
.empty h2, .empty h3 { margin: 0 0 7px; color: var(--green); font-family: "Playfair Display", Georgia, serif; font-size: 21px; font-weight: 500; }
.footer { display: flex; justify-content: space-between; gap: 16px; padding: 15px clamp(18px, 4vw, 54px); border-top: 1px solid var(--line); color: var(--muted-ink); background: #f0eee6; font-size: 11px; line-height: 1.5; }
.footer span { text-align: right; }

dialog {
  width: min(640px, calc(100% - 28px));
  max-width: 100%;
  max-height: min(88vh, 860px);
  padding: 0;
  overflow: auto;
  border: 1px solid #d4d7cf;
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(13 30 25 / 52%); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 21px 24px 16px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; color: var(--green); font-family: "Playfair Display", Georgia, serif; font-size: 24px; font-weight: 500; line-height: 1.25; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 20px 24px; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; }
.field:has(textarea), .field.full, .field.wide { grid-column: 1 / -1; }
.check-field { display: flex; align-items: center; }
.column-options { padding: 12px 24px; }
.column-options > div { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.field label, .field > span { color: #4c5750; font-size: 12px; font-weight: 650; }
.field input, .field select, .field textarea { width: 100%; font-size: 13px; }
.field textarea { min-height: 90px; resize: vertical; }
.field input[type="checkbox"], .field input[type="radio"] { width: 17px; min-height: 17px; accent-color: var(--green); }
.field input[type="file"] { padding: 7px; }
.field small { color: var(--muted-ink); font-size: 11px; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding: 15px 24px 21px; border-top: 1px solid var(--line); }
.import-preview, .import-message { padding-inline: 24px; }
.import-preview { padding-block: 16px; }
.import-file { margin-top: 0; overflow-wrap: anywhere; }
.import-warnings { border-left: 3px solid var(--brass); background: #f5f4ee; padding: 8px 12px 8px 25px; }
.import-warnings li + li { margin-top: 6px; }
.import-preview summary { cursor: pointer; color: var(--green); font-weight: 650; padding-block: 9px; }
.import-preview details[open] { max-height: min(42vh, 380px); overflow: auto; overscroll-behavior: contain; }
.import-preview details[open] summary { position: sticky; z-index: 1; top: 0; background: var(--surface); }
.import-preview .panel { box-shadow: none; }
.import-preview .check-field { margin-top: 14px; }
.toast { position: fixed; z-index: 5; right: 20px; bottom: 20px; width: min(400px, calc(100vw - 40px)); margin: 0; padding: 13px 16px; border: 1px solid #356a54; border-radius: 4px; color: white; background: #24533f; box-shadow: var(--shadow); font-size: 13px; line-height: 1.5; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.preview-link { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 12px; font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.preview-link:hover { color: var(--brass); }

@media (max-width: 900px) {
  .topbar { min-height: 68px; padding: 12px 18px; }
  .workspace { grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - 124px); }
  .sidebar { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar > .eyebrow, .list-nav { display: none; }
  .list-picker { display: grid; min-width: 0; gap: 5px; color: var(--green); font-size: 13px; font-weight: 650; }
  .list-picker:has(select:disabled) { display: none; }
  .list-picker select { font-size: 16px; }
  .sidebar > .button { width: fit-content; margin: 0; }
  .main { padding: 23px 18px 30px; }
  .list-header h1 { font-size: 27px; }
  .list-cover-art { height: 150px; }
  .actions { width: 100%; }
}

@media (max-width: 680px) {
  .marquetry-table { position: relative; overflow: visible; }
  .marquetry-table table, .marquetry-table table:has(th:nth-child(6)),
  .marquetry-table tbody, .marquetry-table tbody > tr { display: block; width: 100%; min-width: 0; }
  .marquetry-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .marquetry-table tbody > tr + tr { border-top: 5px solid var(--surface); }
  .marquetry-table tbody > tr > td[data-label] { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr); gap: 10px; border-top: 1px solid var(--line); }
  .marquetry-table td[data-label]::before { content: attr(data-label); color: var(--green); font-weight: 650; }
  .marquetry-table tbody > tr > th, .marquetry-table .catalog-row-action { display: block; width: 100%; }
  .marquetry-table tbody > tr > th { color: var(--green); font-size: 15px; }
  .marquetry-table .catalog-row-action .button { min-height: 44px; }
  .marquetry-table .row-source { max-width: none; }
}

@media (max-width: 480px) {
  .marquetry-visuals, .marquetry-visuals:has(figure:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .marquetry-visuals:has(figure:nth-child(3)) figure[data-visual="drawing"] { grid-column: 1 / -1; }
  .marquetry-visuals:has(figure:nth-child(3)) figure[data-visual="drawing"] .marquetry-visual { aspect-ratio: 3 / 1; }
  .marquetry-visuals figcaption { font-size: 11px; }
  .marquetry-heading h3 { flex-basis: 125px; font-size: 20px; }
  .marquetry-table th, .marquetry-table td { padding-inline: 6px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .brand img { width: 96px; height: 30px; }
  .brand span { font-size: 17px; }
  .role-picker { flex: 0 1 auto; max-width: 44%; gap: 8px; }
  .role-picker select { min-height: 36px; }
  .sidebar { padding-inline: 14px; }
  .main { padding-inline: 14px; }
  .panel-bar { align-items: flex-start; flex-direction: column; }
  .filter { width: 100%; flex-direction: row; align-items: center; }
  .filter input, .filter select { flex: 1 1 150px; max-width: 100%; }
  .actions > .button { flex: 1 1 115px; min-height: 44px; }
  .field input:not([type="checkbox"]), .field textarea, .field select, .filter select { font-size: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; padding: 17px; }
  .field:has(textarea), .field.full, .field.wide { grid-column: auto; }
  .dialog-head { padding: 17px; }
  .dialog-actions { padding: 13px 17px 17px; }
  .dialog-actions .button { flex: 1 1 auto; }
  .import-preview, .import-message { padding-inline: 17px; }
  .footer { padding-inline: 14px; }
}

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