:root {
  color-scheme: light;
  font-family: "Instrument Sans", system-ui, sans-serif;
  color: #173a35;
  background: #f0f5f0;
  --muted: #4a655e;
  --line: #d7e3da;
  --green: #0e5749;
  --surface: #fff;
  --surface-subtle: #f3f8f4;
  --radius-panel: 1.25rem;
  --radius-control: .58rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
.shell { width: min(100% - 2rem, 69rem); margin-inline: auto; }
.topbar { background: #103a34; color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 4.5rem; }
.topbar a { color: inherit; text-decoration: none; }
.brand { font-family: Georgia, serif; font-size: 1.5rem; }
nav { display: flex; gap: .25rem; }
nav a { padding: .55rem .75rem; border-radius: .5rem; white-space: nowrap; }
nav a:hover, nav a[aria-current] { background: #286055; }

.intro { padding: clamp(2.5rem, 7vw, 5rem) 0 2rem; }
h1 { margin: 0; font: 400 clamp(2.5rem, 7vw, 4.75rem)/1.02 Georgia, serif; letter-spacing: -.055em; }
.intro p { margin: 1rem 0 0; color: var(--muted); font-size: 1.125rem; }
.intro .active-model { color: var(--green); font-size: .95rem; font-weight: 650; }
.results .file-name { margin: 0 0 .75rem; }
.workspace { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.25rem; padding-bottom: 3rem; }
.panel { min-width: 0; padding: clamp(1.15rem, 3vw, 1.75rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); }
h2 { margin: 0 0 1.25rem; font-size: 1.25rem; }
.drop-area {
  display: grid;
  align-content: center;
  min-height: 15rem;
  padding: 1rem;
  background: var(--surface-subtle);
  border: 2px dashed #9ab7a8;
  border-radius: .85rem;
  text-align: center;
}
.drop-area.dragging { border-color: var(--green); background: #e2f2e7; }
.picker { display: grid; justify-items: center; gap: .65rem; }
.picker small { color: var(--muted); font-size: .875rem; }
.upload-preview { width: 100%; max-height: 18rem; object-fit: contain; margin-bottom: 1rem; }
.file-name { color: var(--muted); margin: .75rem 0 0; overflow-wrap: anywhere; }
button, .button { font: inherit; font-weight: 650; cursor: pointer; border-radius: var(--radius-control); padding: .7rem 1rem; }
.button { display: inline-block; text-decoration: none; }
:where(button, a, select, [tabindex]):focus-visible { outline: 3px solid #b86a19; outline-offset: 3px; }
.secondary { background: var(--surface); color: var(--green); border: 1px solid #9ab7a8; }
.secondary:hover { background: #eaf3ec; }
.primary { display: block; width: 100%; margin-top: 1rem; border: 1px solid transparent; background: var(--green); color: white; }
.primary:hover:enabled { background: #0a463a; }
button:disabled { opacity: .65; cursor: default; }
.status { margin: .75rem 0 0; color: var(--muted); }
.status:empty { display: none; }
.status.error { color: #a22720; }
.result-hint { color: var(--muted); padding: 1.25rem; margin: 0; border-radius: .75rem; background: var(--surface-subtle); line-height: 1.5; }
dl { margin: 0; }
dl > div { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--line); }
dd { margin: 0; padding: .25rem .55rem; background: #e4f2e8; color: #184f40; border-radius: .4rem; font-weight: 650; white-space: nowrap; }

@media (max-width: 46rem) {
  .workspace { grid-template-columns: 1fr; }
}

.topbar-inner { flex-wrap: wrap; padding-block: .5rem; }
.gallery-page { padding-bottom: 3rem; }
.gallery-filters label { display: grid; gap: .4rem; font-weight: 650; }
#class-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .9rem; }
.gallery-filters select {
  width: 100%;
  padding: .5rem;
  border: 1px solid #9ab7a8;
  border-radius: .5rem;
  background: white;
  color: inherit;
  font: inherit;
  font-weight: 400;
}
.gallery-filters button { margin-top: 1rem; }
#gallery-status { color: var(--muted); }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
  align-items: start;
  gap: 1rem;
  padding: 0;
  list-style: none;
}
.gallery-grid li { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: .85rem; }
.gallery-grid img { display: block; width: 100%; aspect-ratio: 1.65; object-fit: contain; padding: .75rem; background: white; }
.gallery-grid p, .gallery-grid summary { margin: 0; padding: .65rem .85rem; overflow-wrap: anywhere; }
.gallery-grid p { border-top: 1px solid var(--line); }
.gallery-grid summary { color: var(--green); cursor: pointer; }
.gallery-grid dl { padding-inline: .85rem; }
.gallery-modes { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.gallery-modes label { min-width: min(12rem, 100%); }
.gallery-filters .difference-filter { display: flex; align-items: center; margin-top: 1rem; }
.gallery-grid .comparison-value { white-space: normal; text-align: right; }
.gallery-grid .difference { background: #fae7c8; color: #693b12; }

.actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
.page-end { margin-bottom: 3rem; }
.table-scroll {
  overflow: auto;
  max-height: 34rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
}
.data-table {
  width: 100%;
  border-spacing: 0;
  text-align: left;
}
.data-table th, .data-table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-subtle);
}
.data-table tbody th { font-weight: 550; }
.data-table tbody tr:nth-child(even) { background: var(--surface-subtle); }
.data-table tbody tr:last-child > * { border-bottom: 0; }
