:root {
  --ink: #213b35;
  --muted: #6c7c75;
  --green: #236b53;
  --line: #e2e7df;
  --paper: #f7f8f3;
  --amber: #91621b;
  --shadow: 0 6px 26px #22352c08;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
}
.intake-photo {
  background: #f3f6ef;
  padding: 14px;
  border-radius: 10px;
}
.intake-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.intake-actions label {
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.intake-actions input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
#intake-preview,
#photo-preview {
  display: block;
  max-width: 100%;
  height: 230px;
  object-fit: contain;
  margin: 10px auto;
}
.photo-options {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 12px 0;
  padding: 10px;
  min-width: 0;
}
.photo-options .check-label {
  margin: 8px 0;
}
.help {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.intake-candidates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.intake-candidate {
  text-align: left;
  font-size: 0.85rem;
  font-weight: 400;
}
.intake-candidate img {
  display: block;
  height: 150px;
  max-width: 100%;
  object-fit: contain;
  margin: auto auto 8px;
}
.intake-candidate strong,
.intake-candidate span {
  display: block;
  margin-top: 4px;
}
.intake-candidate.selected {
  outline: 3px solid var(--green);
}
.intake-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.intake-comparison figure {
  margin: 0;
  min-width: 0;
  text-align: center;
}
.intake-comparison img {
  width: 100%;
  height: 200px;
  object-fit: contain;
}
.intake-comparison figcaption {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 5px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
summary,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
summary {
  cursor: pointer;
}
button,
.button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 15px;
  border-radius: 9px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}
button:hover,
.button:hover {
  border-color: #9aac9e;
  background: #f4f7f1;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
.primary {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.primary:hover {
  background: #1c5944;
  color: white;
  border-color: #1c5944;
}
.quiet {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px;
  font-size: 0.85rem;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8e0d6;
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #83ab93;
  outline-offset: 1px;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  flex: none;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5a6f64;
}
h1 {
  font-size: 2.35rem;
  letter-spacing: -1.1px;
  margin: 6px 0 9px;
  line-height: 1.12;
}
h2 {
  font-size: 1.15rem;
  letter-spacing: -0.2px;
  margin: 0 0 16px;
}
h3 {
  font-size: 1.1rem;
  margin: 0;
}
p {
  line-height: 1.55;
}
a {
  color: var(--green);
}
[hidden] {
  display: none !important;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  font-size: 1.3rem;
  letter-spacing: -0.45px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #e7f0e4;
  color: var(--green);
  border-radius: 50%;
  font-size: 19px;
}
.topbar nav {
  display: flex;
  gap: 8px;
}
.nav-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 16px;
}
.nav-button.active {
  background: #edf3e9;
  color: var(--green);
}
.account {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.85rem;
}
main {
  max-width: 1450px;
  margin: auto;
  padding: 42px 5% 105px;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 0.69rem;
  letter-spacing: 1.8px;
  font-weight: 750;
  color: var(--green);
  margin: 0;
}
.subtitle {
  color: var(--muted);
  margin: 0;
}
.heading-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat {
  padding: 19px 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.stat strong {
  display: block;
  font-size: 1.9rem;
  font-weight: 650;
  letter-spacing: -1px;
  line-height: 1.25;
}
.stat span {
  font-size: 0.83rem;
  color: var(--muted);
}
.search-bar {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr 1.2fr;
  gap: 15px;
}
.valuation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.valuation-total {
  padding: 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.valuation-total strong, .valuation-total small {
  display: block;
  margin-top: 6px;
}
.valuation-total strong { font-size: 1.3rem; }
.valuation-total small, .review-reasons { color: var(--muted); font-size: 0.78rem; }
.risk-value { font-size: 0.85rem; font-weight: 600; }
@media (max-width: 600px) {
  .valuation-grid { grid-template-columns: 1fr; gap: 8px; }
}
.search-label input {
  background: #f9faf6;
}
.result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--muted);
  margin: 14px 0;
}
.result-line p {
  margin: 0;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: #b8c8b9;
}
.card-open {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0;
  border: 0;
  background: white;
  border-radius: 0;
  font-weight: 400;
}
.card-open:hover {
  background: white;
  border: 0;
}
.card-image {
  height: 225px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #edf0e9;
  padding: 16px;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px #172d2614);
}
.no-photo {
  color: #7d8c81;
  font-size: 0.83rem;
}
.card-info {
  padding: 17px 18px 18px;
}
.card-info h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 8px 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-set {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 10px;
}
.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.73rem;
  color: var(--muted);
  gap: 8px;
}
.card-price {
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 650;
  margin: 11px 0 0;
}
.unknown-price {
  font-size: 0.79rem;
  color: var(--muted);
  font-weight: 400;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 0.64rem;
  font-weight: 650;
  background: #edf3e9;
  color: var(--green);
}
.badge.review {
  background: #fbf0dc;
  color: var(--amber);
}
.badge.reserved {
  background: #ebeff8;
  color: #586aa0;
}
.badge.sold {
  background: #edeceb;
  color: #797c77;
}
.card-select {
  position: absolute;
  top: 11px;
  left: 12px;
  background: #fffc;
  border: 1px solid #e0e6dc;
  padding: 5px;
  border-radius: 6px;
  z-index: 1;
  display: flex;
}
.card-select span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.card-language {
  position: absolute;
  right: 12px;
  top: 12px;
  background: #fffd;
  border-radius: 5px;
  font-size: 0.64rem;
  padding: 4px 6px;
  font-weight: 700;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 0.85rem;
}
.selection-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #b7c9b5;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 40px #1a302b26;
  z-index: 5;
  max-width: 95vw;
}
.selection-bar span {
  white-space: nowrap;
  font-size: 0.84rem;
}
.card.selected {
  outline: 3px solid var(--green);
  outline-offset: -2px;
}
.lot-builder {
  border: 1px solid #b7c9b5;
  background: #edf4ea;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 22px;
}
.lot-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}
.lot-heading h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}
.lot-heading p,
#lot-summary {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 12px;
}
.lot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.lot-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 180px;
  overflow-y: auto;
}
.lot-chip {
  font-size: 0.78rem;
  font-weight: 400;
  text-align: left;
  overflow-wrap: anywhere;
}
.lot-preview {
  background: var(--paper);
  padding: 13px;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.lot-preview p {
  font-size: 0.8rem;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .lot-heading {
    flex-direction: column;
  }
  .lot-builder {
    padding: 15px;
  }
}
.export-menu {
  position: relative;
}
.export-menu summary {
  list-style: none;
  white-space: nowrap;
}
.export-menu summary::-webkit-details-marker {
  display: none;
}
.export-menu > div {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  padding: 7px;
  background: #fff;
  box-shadow: 0 6px 30px #213b351c;
  min-width: 250px;
  border: 1px solid var(--line);
  border-radius: 10px;
  z-index: 10;
}
.export-menu a {
  display: block;
  padding: 11px;
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 6px;
}
.export-menu a:hover {
  background: #edf3e9;
}
.access {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #e7efe3, transparent 70%);
}
.access-card {
  max-width: 450px;
  width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 38px;
  box-shadow: 0 10px 60px #2447340b;
}
.access-card .brand {
  margin-bottom: 30px;
}
.access h1 {
  font-size: 1.75rem;
}
.access p {
  color: var(--muted);
  font-size: 0.9rem;
}
.access form,
.panel form {
  display: grid;
  gap: 17px;
  margin-top: 25px;
}
.access button {
  margin-top: 5px;
}
.error {
  color: #a34032 !important;
  font-size: 0.83rem;
}
.empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
dialog {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  max-width: 900px;
  width: calc(100% - 40px);
  max-height: 92vh;
  box-shadow: 0 20px 90px #0b271d30;
}
dialog::backdrop {
  background: #162b2466;
  backdrop-filter: blur(2px);
}
.dialog-header {
  padding: 18px 25px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dialog-header h2 {
  margin: 0;
}
.close {
  font-size: 25px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.detail-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 28px;
  padding: 25px;
}
.detail-photo {
  position: sticky;
  top: 0;
  align-self: start;
}
.detail-photo img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #edf0e9;
  border-radius: 9px;
  padding: 15px;
}
.detail-photo p {
  font-size: 0.8rem;
  color: var(--muted);
}
.detail-photo label {
  margin-top: 15px;
}
.detail-fields {
  display: grid;
  gap: 14px;
}
.detail-fields h2 {
  font-size: 1.4rem;
  margin: 0;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}
.check-label {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  font-size: 0.82rem;
}
.detail-fields details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}
.detail-fields details summary {
  font-weight: 600;
  color: var(--ink);
}
.source-data {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
  font:
    12px/1.6 ui-monospace,
    monospace;
  background: #f6f8f3;
  padding: 12px;
  border-radius: 6px;
}
.history-entry {
  padding: 12px 0;
  border-bottom: 1px solid #edf0e9;
}
.history-entry strong {
  color: var(--ink);
  font-size: 0.82rem;
}
.history-entry p {
  margin: 4px 0;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.dialog-form {
  padding: 25px;
  display: grid;
  gap: 16px;
}
.dialog-form > p {
  font-size: 0.83rem;
  color: var(--muted);
  margin: 0;
}
#add-dialog,
#sale-dialog {
  max-width: 510px;
}
.sales-list {
  display: grid;
  gap: 20px;
}
.sale {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 23px;
}
.sale-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 15px;
}
.sale-heading h2 {
  margin-bottom: 5px;
}
.sale-meta {
  font-size: 0.83rem;
  color: var(--muted);
  margin: 0 0 18px;
}
.sale-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.sale-items button {
  font-size: 0.77rem;
  font-weight: 400;
  padding: 6px 10px;
}
.sale-money {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.sale form {
  display: grid;
  gap: 15px;
}
.sale-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sale-total {
  font-size: 0.9rem;
  font-weight: 650;
  margin: 8px 0;
  color: var(--green);
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 27px;
}
.panel p {
  color: var(--muted);
  font-size: 0.85rem;
}
.panel h2:not(:first-child) {
  margin-top: 32px;
}
.user-row {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 12px 0;
  font-size: 0.85rem;
}
#toast {
  position: fixed;
  right: 20px;
  bottom: 22px;
  background: var(--ink);
  color: white;
  padding: 13px 20px;
  border-radius: 9px;
  z-index: 30;
  max-width: 90vw;
  box-shadow: var(--shadow);
}
@media (min-width: 1350px) {
  .card-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media (max-width: 1000px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .topbar {
    padding: 0 3%;
    gap: 12px;
  }
  .account #account-label {
    display: none;
  }
  .search-bar {
    grid-template-columns: 1.5fr 1fr;
  }
  .heading-actions {
    flex-direction: column;
    align-items: end;
  }
  .card-image {
    height: 210px;
  }
}
@media (max-width: 650px) {
  .topbar {
    height: auto;
    min-height: 100px;
    flex-wrap: wrap;
    padding: 16px 5% 10px;
    gap: 8px;
  }
  .brand {
    font-size: 1.15rem;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    gap: 4px;
  }
  .nav-button {
    padding: 9px 13px;
    font-size: 0.85rem;
  }
  .account {
    margin-left: auto;
  }
  .quiet {
    font-size: 0.75rem;
  }
  main {
    padding: 26px 5% 110px;
  }
  .heading {
    align-items: start;
    margin-bottom: 22px;
    flex-direction: column;
    gap: 17px;
  }
  h1 {
    font-size: 1.95rem;
  }
  .subtitle {
    font-size: 0.85rem;
  }
  .heading-actions {
    flex-direction: row;
    align-items: center;
    width: 100%;
  }
  .heading-actions button,
  .heading-actions summary {
    font-size: 0.79rem;
    padding: 9px 12px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    margin-bottom: 20px;
  }
  .stat {
    padding: 13px 15px;
  }
  .stat strong {
    font-size: 1.5rem;
  }
  .stat span {
    font-size: 0.72rem;
  }
  .search-bar {
    padding: 13px;
    gap: 11px;
    grid-template-columns: 1fr 1fr;
  }
  .search-label {
    grid-column: 1/-1;
  }
  .search-bar label:last-child {
    grid-column: 1/-1;
  }
  .search-bar label {
    font-size: 0.73rem;
  }
  .search-bar input,
  .search-bar select {
    font-size: 0.85rem;
  }
  .result-line {
    align-items: start;
    flex-direction: column;
    gap: 3px;
    font-size: 0.77rem;
    margin: 15px 0;
  }
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }
  .card-image {
    height: 177px;
    padding: 12px;
  }
  .card-info {
    padding: 12px;
  }
  .card-info h3 {
    font-size: 0.86rem;
  }
  .card-set {
    font-size: 0.68rem;
    margin-bottom: 7px;
  }
  .card-bottom {
    font-size: 0.63rem;
    align-items: start;
    flex-direction: column;
    gap: 3px;
  }
  .card-price {
    font-size: 0.82rem;
    margin-top: 8px;
  }
  .unknown-price {
    font-size: 0.68rem;
  }
  .badge {
    font-size: 0.58rem;
  }
  .card-select {
    top: 7px;
    left: 7px;
    padding: 3px;
  }
  .card-language {
    top: 9px;
    right: 8px;
    font-size: 0.59rem;
  }
  .pagination {
    gap: 12px;
  }
  .pagination button {
    font-size: 0.75rem;
    padding: 9px 11px;
  }
  .selection-bar {
    bottom: 9px;
    padding: 10px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    width: 95vw;
  }
  .selection-bar span {
    font-size: 0.76rem;
  }
  .selection-bar button {
    font-size: 0.76rem;
    padding: 8px 10px;
  }
  dialog {
    width: calc(100% - 18px);
    max-height: 95vh;
    border-radius: 12px;
  }
  .detail-layout {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 18px;
  }
  .detail-photo {
    position: static;
  }
  .detail-photo img {
    height: 260px;
  }
  .dialog-header {
    padding: 14px 18px;
  }
  .detail-fields input,
  .detail-fields select {
    font-size: 16px;
  }
  .dialog-form {
    padding: 20px;
  }
  .sale {
    padding: 17px;
  }
  .sale-money {
    grid-template-columns: 1fr 1fr;
  }
  .sale-money label:last-child {
    grid-column: 1/-1;
  }
  .sale-heading h2 {
    font-size: 1rem;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 20px;
  }
  .access-card {
    padding: 27px;
  }
}

.user-access {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.media-zoom {
  display: block;
  position: relative;
  background: transparent;
  border: 0;
  padding: 0;
  width: 100%;
  cursor: zoom-in;
  color: var(--ink);
}
.media-zoom:has(img[hidden]),
.media-zoom:has(img:not([src])) {
  display: none;
}
.media-zoom img {
  max-width: 100%;
}
.media-zoom-mark {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border-radius: 5px;
  padding: 2px 6px;
  background: #ffffffdf;
  font-size: 20px;
}
.media-zoom:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
.media-lightbox {
  width: min(1200px, 95vw);
  max-width: 95vw;
  max-height: 94dvh;
  padding: 0;
}
.media-gallery {
  display: flex;
  gap: 16px;
  padding: 18px;
}
.media-gallery figure {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.media-gallery figcaption {
  font-weight: 600;
  margin-bottom: 10px;
}
.media-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.media-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.media-controls input {
  width: 120px;
}
.media-frame {
  width: 100%;
  max-height: 65dvh;
  overflow: auto;
  overscroll-behavior: contain;
  background: #edf0e9;
}
.media-frame img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
}
.media-camera {
  width: min(750px, 94vw);
  padding: 0;
}
.media-camera video {
  display: block;
  width: 100%;
  max-height: 55dvh;
  background: #182821;
  object-fit: contain;
}
.media-camera-stage {
  position: relative;
  overflow: hidden;
}
.media-camera-guide {
  position: absolute;
  border: 2px dashed #fff;
  border-radius: 4.5% / 3.2%;
  /* Dim the frame outside the card, clipped by the stage. */
  box-shadow: 0 0 0 100vmax #18282170;
  pointer-events: none;
}
.intake-candidate-entry {
  min-width: 0;
}
.intake-candidate-entry .media-zoom img {
  height: 130px;
  object-fit: contain;
}
.intake-candidate-entry .intake-candidate {
  width: 100%;
}
@media (max-width: 650px) {
  .media-gallery {
    flex-direction: column;
  }
  .media-frame {
    max-height: 55dvh;
  }
}
.media-frame img {
  margin: 0 auto;
}
.media-frame.is-zoomed {
  cursor: grab;
}
.media-frame.is-panning {
  cursor: grabbing;
  user-select: none;
}
.media-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}
.card-faces {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.detail-photo .card-faces img {
  height: 210px;
  padding: 4px;
}
.card-faces figure {
  margin: 0 0 20px;
}
.card-faces figcaption {
  font-weight: 700;
  margin-bottom: 8px;
}
.card-faces .intake-actions {
  margin-top: 10px;
}
.condition-panel {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 16px;
}
.condition-panel h3,
.condition-panel h4 {
  margin: 10px 0;
}
.condition-panel p,
.assessment-limits {
  font-size: 14px;
}
.assessment-limits {
  padding-left: 20px;
  color: var(--muted);
}
.condition-validation {
  display: grid;
  gap: 12px;
}

.workflow-panel {
  border: 1px solid #c5d2bb;
  background: #f4f7ef;
  border-radius: 12px;
  padding: 16px;
  margin: 14px 0;
}
.workflow-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}
.edition-list {
  display: block;
}
.edition-group {
  border: 1px solid #d9dfd5;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  background: white;
}
.edition-group summary {
  cursor: pointer;
  line-height: 1.6;
  font-weight: 600;
}
.edition-group .card-grid {
  margin-top: 14px;
}
.batch-card {
  padding: 14px 0;
  border-bottom: 1px solid #d9dfd5;
}
#series-back-preview img {
  max-height: 180px;
  object-fit: contain;
}
#batch-results img {
  max-height: 260px;
  object-fit: contain;
}
#batch-history {
  gap: 8px;
}
#backup-status-panel .help {
  max-width: 75ch;
}
#display-mode {
  min-width: 190px;
}
#batch-photos {
  margin: 0 0 16px;
}
@media (max-width: 600px) {
  .workflow-actions {
    align-items: stretch;
  }
  .workflow-actions span {
    flex-basis: 100%;
  }
  .edition-group {
    padding: 10px;
  }
  #series-progress {
    font-size: 16px;
  }
  #batch-results .intake-comparison {
    grid-template-columns: 1fr 1fr;
  }
}
.price-panel {
  background: #f3f6ef;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0 14px;
}
.price-panel p {
  margin: 6px 0;
}
.price-warnings {
  color: var(--amber);
  margin: 6px 0;
  padding-left: 18px;
}
.card-alert {
  color: var(--amber);
  font-weight: 600;
}
.sale-estimate {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 8px;
}
.sale-estimate textarea {
  width: 100%;
  font: inherit;
}
.sale-estimate-value {
  font-weight: 600;
}

/* Keyboard browsing: the focused card of the grid, then the viewer. */
.card {
  scroll-margin: 96px 0 24px;
}
.card:has(.card-open:focus-visible) {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
  transform: translateY(-2px);
}
.card.selected:has(.card-open:focus-visible) {
  box-shadow: inset 0 0 0 3px var(--green);
}
.card-open:focus-visible {
  outline: none;
}
.keyboard-help {
  margin: 0 0 12px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* The viewer gives the whole screen to the photo; everything else floats. */
html:has(dialog.card-viewer[open]) {
  overflow: hidden;
}
dialog.card-viewer {
  --bar: 52px;
  --caption: 44px;
  --panel: 360px;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #111814;
  color: #fff;
  overflow: hidden;
}
dialog.card-viewer::backdrop {
  background: #111814;
}
.viewer-photo {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: var(--bar) 64px var(--caption);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  outline: none;
  transition:
    right 0.2s,
    padding 0.2s;
}
.viewer-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.viewer-photo .no-photo {
  color: #c9d3cd;
}
.viewer-top {
  position: absolute;
  inset: 0 0 auto;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: linear-gradient(#000b, #0000);
}
.viewer-top p {
  margin: 0 auto 0 4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px #000;
}
.card-viewer .viewer-top button,
.viewer-step {
  color: #fff;
  background: #ffffff1c;
  border: 1px solid #ffffff38;
  border-radius: 8px;
  min-width: 38px;
  height: 36px;
  padding: 0 10px;
  font-weight: 600;
}
.card-viewer .viewer-top button:hover,
.viewer-step:hover {
  background: #ffffff33;
}
.card-viewer .viewer-top button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
}
.card-viewer .viewer-top .close {
  font-size: 24px;
}
.viewer-step {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 72px;
  min-width: 44px;
  font-size: 32px;
  line-height: 1;
  background: #0005;
  z-index: 1;
}
.viewer-step.previous {
  left: 10px;
}
.viewer-step.next {
  right: 10px;
  transition: right 0.2s;
}
.viewer-step:disabled {
  opacity: 0.25;
}
.viewer-caption {
  position: absolute;
  inset: auto 0 0;
  min-height: var(--caption);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: linear-gradient(#0000, #000c);
  text-shadow: 0 1px 3px #000;
  transition: right 0.2s;
}
.viewer-caption-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dfe6e2;
}
.viewer-caption-name strong {
  color: #fff;
}
.viewer-caption-price {
  font-weight: 700;
  white-space: nowrap;
}
.viewer-caption-price.unknown-price {
  font-weight: 400;
  color: #c9d3cd;
}
.viewer-caption-place {
  white-space: nowrap;
  color: #c9d3cd;
}
.viewer-side {
  padding: 2px 8px;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  text-shadow: none;
}
.viewer-strip {
  position: absolute;
  inset: auto 0 var(--caption);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px;
  background: #000a;
  scrollbar-width: thin;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.15s,
    transform 0.15s,
    visibility 0.15s,
    right 0.2s;
}
/* A pinned strip makes room; one shown by hovering floats over the photo. */
.strip-open .viewer-photo {
  padding-bottom: calc(var(--caption) + 92px);
}
.strip-open .viewer-strip,
.strip-peek .viewer-strip {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.viewer-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 72px;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #ffffff14;
  overflow: hidden;
}
.viewer-thumb:hover {
  background: #ffffff2b;
  border-color: transparent;
}
.viewer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.viewer-thumb .no-photo {
  color: #c9d3cd;
  font-size: 0.6rem;
}
.viewer-thumb.selected {
  border-color: #6fcf9f;
}
.viewer-thumb.current {
  border-color: #f0b44c;
}
.viewer-info {
  position: absolute;
  inset: var(--bar) 0 0 auto;
  width: var(--panel);
  overflow: auto;
  padding: 20px;
  background: var(--paper);
  color: var(--ink);
  border-top-left-radius: 13px;
  visibility: hidden;
  transform: translateX(100%);
  transition:
    transform 0.2s,
    visibility 0.2s;
}
.info-open .viewer-info {
  visibility: visible;
  transform: none;
}
.info-open .viewer-photo,
.info-open .viewer-caption,
.info-open .viewer-strip {
  right: var(--panel);
}
.info-open .viewer-step.next {
  right: calc(var(--panel) + 10px);
}
.viewer-info h3 {
  margin: 4px 0 6px;
  font-size: 1.3rem;
}
.viewer-info p {
  margin: 6px 0;
}
.viewer-info .card-language {
  position: static;
}
.viewer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.viewer-price {
  font-size: 1.15rem;
  font-weight: 600;
}
.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.viewer-help {
  margin-top: 18px !important;
  font-size: 0.8rem;
}
@media (max-width: 800px) {
  dialog.card-viewer {
    --bar: 48px;
    --caption: 40px;
  }
  .viewer-photo {
    padding-left: 0;
    padding-right: 0;
  }
  .viewer-step {
    height: 56px;
    min-width: 36px;
    font-size: 26px;
    background: #0004;
  }
  .viewer-step.previous {
    left: 4px;
  }
  .viewer-step.next {
    right: 4px;
  }
  .viewer-caption {
    gap: 10px;
    padding: 6px 12px;
    font-size: 0.9rem;
  }
  .viewer-caption-place {
    display: none;
  }
  /* On a phone the details rise from the bottom over the photo. */
  .viewer-info {
    inset: auto 0 0;
    width: auto;
    max-height: 62dvh;
    border-radius: 13px 13px 0 0;
    box-shadow: 0 -10px 40px #0008;
    transform: translateY(100%);
  }
  .info-open .viewer-photo,
  .info-open .viewer-caption,
  .info-open .viewer-strip {
    right: 0;
  }
  .info-open .viewer-step.next {
    right: 4px;
  }
  .viewer-help {
    display: none;
  }
}
.gallery-loading #cards,
.gallery-loading .viewer-photo {
  opacity: 0.6;
  cursor: progress;
  transition: opacity 0.2s 0.15s;
}
@media (max-width: 800px) {
  .keyboard-help {
    display: none;
  }
}
