/* Thing Collector app styles. Colors, type, space and motion come from design/tokens.css
   (loaded first); see design/DESIGN.md for the rules. No raw hex values here. */

[x-cloak] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3 { margin: 0; color: var(--tc-ink); }
.app { width: var(--tc-width); margin: 0 auto; padding: 0 0 120px; }

/* ------------------------------------------------------------------ top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--tc-s4); padding: var(--tc-s5) 0; }
.wordmark { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.1rem; color: var(--tc-ink); text-decoration: none; }
.mark { display: block; width: 22px; height: 16px; background: var(--tc-white); border-top: var(--tc-rule) solid var(--tc-red); }
.mark.big { width: 44px; height: 32px; border-top-width: 5px; margin: 0 auto; }
.account { display: flex; align-items: center; gap: var(--tc-s3); }
.account .link { font-weight: 500; min-height: 44px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 32px; }
.avatar.blank { display: inline-block; background: var(--tc-steel-1); }

/* ------------------------------------------------------------------ type */
.page-title { font-size: var(--tc-h1); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: var(--tc-h2); font-weight: 800; letter-spacing: -0.015em; line-height: 1.2; }
.lede { max-width: 38rem; margin: var(--tc-s3) 0 var(--tc-s6); }
.hint { color: var(--tc-steel-text); font-size: var(--tc-small); line-height: 1.5; margin: var(--tc-s2) 0; }
.err { color: var(--tc-red-text); }
.empty { color: var(--tc-steel-text); padding: var(--tc-s5); background: var(--tc-white); margin: 0; }
.empty p { margin: 0; }
.empty .btn { margin-left: var(--tc-s2); }
.inventory .empty { margin-top: var(--tc-s3); }

/* ------------------------------------------------------------------ drawers screen */
.drawers { padding: var(--tc-s4) 0 var(--tc-s6); }
.cabinet { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--tc-gap-grid); }
@media (min-width: 700px) { .cabinet { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .cabinet { grid-template-columns: repeat(4, 1fr); } }

.drawer {
  position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; padding: var(--tc-s3);
  border: 0; border-radius: var(--tc-radius-block); font: inherit; color: var(--tc-ink); cursor: pointer;
  background: var(--tc-steel-2);
}
.fill-0 { background: var(--tc-steel-3); }
.fill-1 { background: var(--tc-steel-2); }
.fill-2 { background: var(--tc-steel-1); }
.drawer.current { background: var(--tc-navy); }
.drawer.new { background: var(--tc-steel-1); }
.drawer::after { /* the pull */
  content: ""; position: absolute; bottom: 14%; left: 37%; width: 26%; height: 5px;
  background: var(--tc-pull); border-radius: 3px;
}
.drawer .label { min-width: 64%; max-width: 100%; margin-bottom: 12%; }
.label {
  display: block; background: var(--tc-white); border-left: var(--tc-rule) solid var(--tc-red);
  border-radius: var(--tc-radius-block); padding: var(--tc-s1) .7rem; text-align: center; line-height: 1.3;
}
.label b { display: block; font-weight: 700; font-size: var(--tc-label); overflow-wrap: anywhere; }
.label small { display: block; font-weight: 400; font-size: .78rem; color: var(--tc-steel-text); }
.drawer.new .label { border-left-color: var(--tc-steel-3); }
.drawer:focus-visible { outline-offset: 3px; }

.panel-white { background: var(--tc-white); padding: var(--tc-s5); }
.new-drawer { margin-top: var(--tc-s6); max-width: 52rem; }
.new-drawer h2 { margin-bottom: var(--tc-s4); }
.kind-pick { border: 0; padding: 0; margin: 0 0 var(--tc-s5); }
.kind-pick legend { font-weight: 500; padding: 0; margin-bottom: var(--tc-s2); }
.kind-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--tc-gap-grid); }
.kind-tile {
  position: relative; display: block; cursor: pointer; padding: var(--tc-s4) var(--tc-s4) 1.1rem;
  background: var(--tc-steel-0); border-top: var(--tc-rule-strong) solid var(--tc-steel-2);
}
.kind-tile b { display: block; font-weight: 700; }
.kind-tile span { display: block; font-size: var(--tc-small); line-height: 1.5; color: var(--tc-steel-text); margin-top: var(--tc-s1); }
.kind-tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.kind-tile.chosen { background: var(--tc-navy); border-top-color: var(--tc-red); }
.kind-tile.chosen b { color: var(--tc-white); }
.kind-tile.chosen span { color: var(--tc-steel-1); }
.kind-tile:has(input:focus-visible) { outline: 3px solid var(--tc-red); outline-offset: 3px; }

/* ------------------------------------------------------------------ inside a drawer */
.drawer-head { padding: var(--tc-s2) 0 0; }
.drawer-head .back { font-size: var(--tc-small); font-weight: 500; min-height: 44px; }
.drawer-head .back::before { content: "\2190\00a0"; }
.drawer-band { height: 6px; width: 7rem; margin: var(--tc-s3) 0 var(--tc-s4); }
.totals { display: flex; flex-wrap: wrap; gap: var(--tc-s4); color: var(--tc-steel-text); font-size: var(--tc-small); margin: 0 0 var(--tc-s3); }
.totals b { color: var(--tc-ink); font-weight: 700; }

/* tabs: quiet text, a red rule under the current one */
.tabs { display: flex; gap: var(--tc-s1); border-bottom: var(--tc-hairline); margin-bottom: var(--tc-s5); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  flex: 0 0 auto; background: none; border: 0; border-bottom: var(--tc-rule) solid transparent; margin-bottom: -1px;
  padding: .7rem var(--tc-s4); min-height: 44px; font: inherit; font-weight: 500; color: var(--tc-steel-text); cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--tc-ink); font-weight: 700; border-bottom-color: var(--tc-red); }
.pill { display: inline-block; min-width: 1.4rem; padding: 0 .4rem; border-radius: var(--tc-radius-control); background: var(--tc-navy); color: var(--tc-white); font-size: .78rem; font-weight: 700; margin-left: var(--tc-s1); text-align: center; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--tc-s2); min-height: 44px;
  padding: .65rem 1.2rem; border-radius: var(--tc-radius-control); border: 1px solid var(--tc-steel-3);
  background: var(--tc-white); color: var(--tc-navy); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--tc-navy); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--tc-navy); border-color: var(--tc-navy); color: var(--tc-white); padding: .65rem 1.5rem; }
.btn.primary:hover:not(:disabled) { background: var(--tc-ink); border-color: var(--tc-ink); }
.btn.danger { color: var(--tc-red-text); border-color: var(--tc-red); }
.btn.small { min-height: 36px; padding: .35rem .8rem; font-size: var(--tc-small); }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.link { background: none; border: 0; padding: 0; color: var(--tc-ink); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
a { color: var(--tc-ink); }
input[type=text], input[type=search], input[type=number], input[type=email], select, textarea {
  font: inherit; font-size: 1rem; padding: .6rem .7rem; min-height: 44px; min-width: 0;
  border: 1px solid var(--tc-steel-3); border-radius: var(--tc-radius-control); background: var(--tc-white); color: var(--tc-ink);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--tc-red); outline-offset: 3px; }
textarea { width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: var(--tc-s1); font-weight: 500; margin-bottom: var(--tc-s4); max-width: 28rem; }
.field input { font-weight: 400; }
.row { display: flex; gap: var(--tc-s2); align-items: center; flex-wrap: wrap; }
.row > input[type=text], .row > input[type=email] { flex: 1 1 200px; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }

/* ------------------------------------------------------------------ scan */
.scan { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: var(--tc-s5); align-items: start; }
.scan .camera-card, .scan .manual { grid-column: 1; }
.scan .batch { grid-column: 2; grid-row: 1 / span 3; }
@media (max-width: 820px) {
  .scan { grid-template-columns: 1fr; }
  .scan .batch { grid-column: 1; grid-row: auto; }
}
.viewfinder { position: relative; background: var(--tc-ink); overflow: hidden; min-height: 220px; display: flex; align-items: center; justify-content: center; }
.viewfinder video { display: none; width: 100%; height: auto; }
.viewfinder.on video { display: block; }
.viewfinder.mirrored video { transform: scaleX(-1); }
.cam-off { padding: var(--tc-s5); text-align: center; color: var(--tc-steel-1); }
.cam-off .err { color: var(--tc-white); }
.reticle { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.reticle span { width: 72%; height: 34%; border: 2px solid var(--tc-white); }
.flash { position: absolute; inset: 0; border: 4px solid var(--tc-red); pointer-events: none; }
.cam-controls { display: flex; gap: var(--tc-s2); align-items: center; margin-top: var(--tc-s2); }
.cam-controls .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.manual { background: var(--tc-white); padding: var(--tc-s4); }
.manual .row + .hint { margin-top: var(--tc-s2); }
.album-results { margin-top: var(--tc-s3); }
.album-results ul { list-style: none; margin: var(--tc-s2) 0; padding: 0; border-top: var(--tc-hairline); }
.album-results li { border-bottom: var(--tc-hairline); }
.album-results li button {
  display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 44px; padding: var(--tc-s2) var(--tc-s3);
  text-align: left; background: none; border: 0; border-left: var(--tc-rule) solid transparent; font: inherit; color: var(--tc-ink); cursor: pointer;
}
.album-results li button:hover, .album-results li button:focus-visible { background: var(--tc-steel-0); border-left-color: var(--tc-red); }
.album-results li span { font-size: var(--tc-small); color: var(--tc-steel-text); }
.manual-add { margin-top: var(--tc-s4); padding-top: var(--tc-s3); border-top: var(--tc-hairline); }
.manual-add .hint { margin-top: 0; }
.camera-card .cam-off .btn.primary { background: var(--tc-white); border-color: var(--tc-white); color: var(--tc-navy); }
.import { margin-top: var(--tc-s3); border-top: var(--tc-hairline); padding-top: var(--tc-s3); }
.import summary { cursor: pointer; font-weight: 700; }
.import textarea { margin: var(--tc-s2) 0; font-size: var(--tc-small); }

.batch-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--tc-s3); margin-bottom: var(--tc-s3); }
.batch-head h2 { font-size: var(--tc-title); }
.item { display: flex; gap: var(--tc-s3); background: var(--tc-white); border-left: var(--tc-rule) solid var(--tc-steel-1); padding: var(--tc-s3); margin-bottom: var(--tc-gap-grid); }
.item.st-found { border-left-color: var(--tc-red); animation: tc-slide-in var(--tc-quick) var(--tc-ease); }
@keyframes tc-slide-in { from { transform: translateY(-.5rem); opacity: .4; } to { transform: none; opacity: 1; } }
.item.st-pending { border-left-color: var(--tc-steel-2); }
.item.st-error { border-left-color: var(--tc-steel-3); }
.thumb { flex: 0 0 72px; height: 72px; display: flex; align-items: center; justify-content: center; background: var(--tc-steel-0); overflow: hidden; }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.nothumb { width: 30px; height: 22px; background: var(--tc-white); border-top: var(--tc-rule) solid var(--tc-steel-2); }
.item .body { flex: 1; min-width: 0; }
.line1 { display: flex; align-items: center; gap: var(--tc-s2); }
.num { font-weight: 700; font-variant-numeric: tabular-nums; }
.status { font-size: .82rem; color: var(--tc-steel-text); }
.st-error .status { color: var(--tc-red-text); }
.x { margin-left: auto; background: none; border: 0; font-size: 1.4rem; line-height: 1; color: var(--tc-steel-text); cursor: pointer; min-width: 44px; min-height: 44px; margin-top: -10px; margin-right: -10px; }
.item .name { font-weight: 700; margin: 2px 0; }
.meta { display: flex; gap: var(--tc-s3); flex-wrap: wrap; color: var(--tc-steel-text); font-size: var(--tc-small); }
.via, .msg, .owned { font-size: var(--tc-small); margin-top: var(--tc-s1); }
.via, .msg, .owned { color: var(--tc-steel-text); }
.st-error .msg { color: var(--tc-red-text); }
.qty { display: flex; align-items: center; gap: var(--tc-s2); margin-top: var(--tc-s2); font-size: var(--tc-small); color: var(--tc-steel-text); }
.qty b { min-width: 18px; text-align: center; color: var(--tc-ink); font-size: 1rem; }
.step { width: 36px; height: 36px; border-radius: var(--tc-radius-control); border: 1px solid var(--tc-steel-3); background: var(--tc-white); color: var(--tc-navy); font: inherit; font-weight: 700; cursor: pointer; }
.step:disabled { opacity: .4; }
.fix { display: flex; flex-wrap: wrap; gap: var(--tc-s2); margin-top: var(--tc-s2); }
.fix input { width: 140px; }
.manual-entry { display: flex; gap: var(--tc-s2); flex-wrap: wrap; width: 100%; }
.manual-entry input[type=text] { flex: 1 1 160px; width: auto; }
.manual-entry input[type=number] { width: 90px; }
.fix .row { display: flex; gap: var(--tc-s2); }
.manual-add .row { display: flex; gap: var(--tc-s2); flex-wrap: wrap; }
.manual-add input[type=text] { flex: 1 1 140px; width: auto; }
.manual-add input.year { width: 90px; }
.actions { margin-top: var(--tc-s2); }
.releases { list-style: none; margin: var(--tc-s2) 0 0; padding: 0; font-size: var(--tc-small); }
.releases li { margin: 2px 0; }
.releases button { text-align: left; }
.releases button:disabled { color: var(--tc-steel-text); text-decoration: none; cursor: default; }

.commit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: var(--tc-s3); align-items: center; justify-content: flex-end; flex-wrap: wrap;
  padding: var(--tc-s3) var(--tc-s4) calc(var(--tc-s3) + env(safe-area-inset-bottom)); background: var(--tc-white); border-top: var(--tc-hairline);
}
.commit-bar label { display: flex; gap: var(--tc-s2); align-items: center; font-size: var(--tc-small); color: var(--tc-steel-text); }
.commit-bar select { max-width: 220px; }

/* ------------------------------------------------------------------ cards (inventory) */
.filters { display: flex; gap: var(--tc-s2); flex-wrap: wrap; align-items: center; }
.filters input[type=search] { flex: 1 1 240px; }
.filters select { max-width: 14rem; }
.filters .btn { margin-left: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--tc-gap-grid); margin-top: var(--tc-s3); }
.card {
  text-align: left; background: var(--tc-white); border: 0; border-top: var(--tc-rule) solid var(--tc-red); border-radius: var(--tc-radius-block);
  padding: var(--tc-s3); font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
.card .img { height: 120px; display: flex; align-items: center; justify-content: center; background: var(--tc-steel-0); margin-bottom: var(--tc-s2); overflow: hidden; }
.card .img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.card .num { display: flex; justify-content: space-between; font-size: var(--tc-small); }
.card .q { color: var(--tc-steel-text); font-weight: 700; }
.card .name { font-weight: 700; font-size: .95rem; line-height: 1.3; }
.card .loc { align-self: flex-start; margin-top: var(--tc-s1); font-size: .78rem; font-weight: 500; line-height: 1.4; padding: 0 var(--tc-s2); background: var(--tc-steel-0); border-left: var(--tc-rule) solid var(--tc-steel-3); }
.card .meta { font-size: .82rem; }
.more { text-align: center; margin: var(--tc-s4) 0; }

/* ------------------------------------------------------------------ locations */
.locations { max-width: 52rem; }
.new-loc { padding: var(--tc-s4); margin: var(--tc-s4) 0; }
.loclist { list-style: none; padding: 0; margin: var(--tc-s3) 0; }
.loclist li b { font-weight: 700; }
.loclist li { background: var(--tc-white); padding: var(--tc-s3); margin-bottom: var(--tc-gap-grid); }

/* ------------------------------------------------------------------ item detail: one large catalog card */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center;
  padding: max(4vh, var(--tc-s4)) var(--tc-s3) var(--tc-s6); background: rgba(20, 32, 43, .45);
}
.catalog-card {
  position: relative; width: min(46rem, 100%); background: var(--tc-white); border-top: var(--tc-rule-strong) solid var(--tc-red);
  padding: var(--tc-s4) 1.2rem calc(var(--tc-s5) + env(safe-area-inset-bottom));
}
/* The card slide: out of the drawer above, into place. */
.card-in { transition: transform var(--tc-card-open) var(--tc-ease), opacity var(--tc-card-open) var(--tc-ease); }
.card-away { transition: transform var(--tc-card-close) var(--tc-ease), opacity var(--tc-card-close) var(--tc-ease); }
.card-out { transform: translateY(-2.5rem); opacity: 0; }
.card-rest { transform: none; opacity: 1; }
.catalog-card .close { position: absolute; top: var(--tc-s1); right: var(--tc-s1); margin: 0; }
.cc-top { display: grid; gap: var(--tc-s5); }
@media (min-width: 640px) { .cc-top.has-cover { grid-template-columns: 11rem 1fr; } }
.cc-cover img { display: block; max-width: 100%; max-height: 16rem; object-fit: contain; }
.cc-facts h2 { font-size: 1.45rem; padding-right: 2.5rem; margin-bottom: var(--tc-s3); }
.cc-fields { display: grid; grid-template-columns: auto 1fr; gap: .15rem var(--tc-s4); margin: 0; font-size: var(--tc-small); }
.cc-fields > div { display: contents; }
.cc-fields dt { color: var(--tc-steel-text); }
.cc-fields dd { margin: 0; overflow-wrap: anywhere; }
.links { display: flex; flex-wrap: wrap; gap: var(--tc-s4); font-size: var(--tc-small); margin: var(--tc-s3) 0 0; }
.cc-edit { display: grid; grid-template-columns: 1fr 1fr; gap: var(--tc-s3) var(--tc-s4); margin-top: var(--tc-s5); padding-top: var(--tc-s5); border-top: var(--tc-hairline); }
.cc-edit label { display: flex; flex-direction: column; gap: var(--tc-s1); font-size: var(--tc-small); font-weight: 500; }
.cc-edit .wide, .cc-edit .form-wide { grid-column: 1 / -1; }
.cc-edit .form-wide { display: grid; grid-template-columns: 1fr 1fr; gap: var(--tc-s3) var(--tc-s4); }
.cc-actions { justify-content: space-between; margin-top: var(--tc-s2); }
@media (max-width: 480px) { .cc-edit, .cc-edit .form-wide { grid-template-columns: 1fr; } }
/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; top: var(--tc-s3); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--tc-s2); z-index: 20; width: min(92vw, 420px); }
.toast { background: var(--tc-navy); color: var(--tc-white); padding: var(--tc-s3) var(--tc-s4); border-left: var(--tc-rule) solid var(--tc-steel-2); font-size: var(--tc-small); cursor: pointer; }
.toast.error { background: var(--tc-white); color: var(--tc-red-text); border-left-color: var(--tc-red); }
.toast.ok { border-left-color: var(--tc-red); }

/* A kind's own page (/vinyl): its name after the wordmark, and on the sign-in card. */
.wordmark .view-name { margin-left: var(--tc-s2); padding-left: var(--tc-s2); border-left: var(--tc-hairline); font-weight: 500; color: var(--tc-steel-text); }
.signin-card .view-name { margin: calc(-1 * var(--tc-s1)) 0 var(--tc-s3); font-weight: 700; color: var(--tc-navy); }
.lede a { color: var(--tc-navy); }

/* ------------------------------------------------------------------ privacy page */
.prose { max-width: 42rem; }
.prose h2 { font-size: var(--tc-title); margin: var(--tc-s6) 0 var(--tc-s2); }
.prose ul { padding-left: 1.2rem; margin: 0 0 var(--tc-s3); }
.prose li { margin-bottom: var(--tc-s2); }
.prose a, .your-account a:not(.btn), .signin-card a { color: var(--tc-navy); }

/* ------------------------------------------------------------------ your account */
.your-account { margin-top: var(--tc-s7); max-width: 640px; }
.your-account h2 { font-size: var(--tc-title); margin: 0 0 var(--tc-s3); }
.your-account h3 { font-size: 1rem; font-weight: 700; margin: 0 0 var(--tc-s2); }

/* ------------------------------------------------------------------ sharing */
.sharing { max-width: 640px; }
.share-card { background: var(--tc-white); padding: var(--tc-s5); margin-bottom: var(--tc-gap-grid); }
.share-card h2 { font-size: var(--tc-title); margin: 0 0 var(--tc-s2); }
.share-card .row { margin-top: var(--tc-s3); }
.danger-zone { border-top: var(--tc-rule) solid var(--tc-red); }
.members { list-style: none; padding: 0; margin: var(--tc-s3) 0; }
.members li { padding: var(--tc-s2) 0; border-bottom: var(--tc-hairline); flex-wrap: nowrap; }
.members li:last-child { border-bottom: 0; }
.members .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: .82rem; padding: 2px var(--tc-s2); border-radius: var(--tc-radius-control); background: var(--tc-steel-0); color: var(--tc-steel-text); }

/* ------------------------------------------------------------------ sign-in page */
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--tc-s5); }
.signin-card { background: var(--tc-white); border-top: var(--tc-rule-strong) solid var(--tc-red); padding: var(--tc-s6) 1.75rem; max-width: 400px; width: 100%; text-align: center; }
.signin-card h1 { margin: var(--tc-s4) 0 var(--tc-s2); font-size: var(--tc-h2); font-weight: 800; letter-spacing: -0.015em; }
.signin-card p { color: var(--tc-steel-text); }
.signin-card .err { color: var(--tc-red-text); }
.signin-card .g_id_signin { display: flex; justify-content: center; margin: var(--tc-s5) 0 var(--tc-s2); min-height: 44px; }
