:root {
  --ground: #F3F5F2; --ink: #18221E; --muted: #55615B; --line: #D5DBD7; --line2: #A9B3AD;
  --green: #1F5A44; --green-d: #143D2E; --white: #FFFFFF; --amber: #E0A100;
  --ask-bg: #FBF3D9; --ask-line: #8A6400; --ask-ink: #5A4300; --red: #9B2C1F;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 16px; line-height: 1.45; }
h1, h2, h3 { font-family: 'Archivo', system-ui, sans-serif; margin: 0; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--green); }
a:hover { color: var(--green-d); }
p { margin: 0; }
.mono { font-family: 'IBM Plex Mono', monospace; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
.btn { min-height: 46px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--line2); background: var(--white); color: var(--ink); font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--white); font-weight: 600; }
.btn.primary:hover { background: var(--green-d); color: var(--white); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--white); }
.btn.danger { color: var(--red); border-color: var(--line2); }
.btn.big { min-height: 54px; font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 17px; width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.linkbtn { background: none; border: none; padding: 0; min-height: 44px; color: var(--green); text-decoration: underline; cursor: pointer; font-size: 15px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
input.in, select.in, textarea.in { min-height: 46px; width: 100%; border: 1px solid var(--line2); border-radius: 6px; padding: 10px; font-size: 16px; color: var(--ink); background: var(--white); }
textarea.in { line-height: 1.45; resize: vertical; }
textarea.tall { min-height: 130px; }

/* Top bar */
.top { background: var(--ink); color: var(--ground); padding: 0 16px; }
.top-in { max-width: 1216px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; column-gap: 28px; }
.brand { font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 18px; padding: 14px 0; color: var(--white); text-decoration: none; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1 1 auto; min-width: 0; }
.tabs a { color: #C9D2CC; text-decoration: none; font-size: 15px; padding: 14px 12px; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--white); font-weight: 600; border-bottom-color: var(--amber); }
.page { max-width: 1216px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.page.narrow { max-width: 620px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.ask { background: var(--ask-bg); border-color: var(--ask-line); color: #3D2E00; }
.card.err { border-color: var(--red); }

/* Pills and chips */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.pill.reviewed { background: #DCEBE3; color: #1F5A44; }
.pill.ask { background: #F6E3A8; color: #5A4300; }
.pill.identified { background: #DCE6F2; color: #1F3F6B; }
.pill.working, .pill.draft { background: #E3E7E4; color: #47524C; }
.pill.error { background: #F3D9D5; color: #7A1F15; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line2); background: var(--white); font-size: 14px; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--white); font-weight: 500; }
.chip.pick.on { background: var(--green); border-color: var(--green); }

/* Item list */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.item:hover { border-color: var(--ink); color: var(--ink); }
.thumb { width: 60px; height: 60px; flex-shrink: 0; border-radius: 6px; background: #E3E7E4; object-fit: cover; display: block; }
.item .mid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .name { font-weight: 600; font-size: 15px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; font-size: 13px; font-weight: 500; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); background: var(--white); border: 1px dashed var(--line2); border-radius: 8px; }

/* Capture screen */
.cap-top { background: var(--ink); color: var(--ground); display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; gap: 12px; }
.cap-top a { color: var(--ground); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.cap-top .t { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 17px; }
.num { font-family: 'IBM Plex Mono', monospace; font-size: 14px; background: var(--amber); color: var(--ink); padding: 4px 8px; border-radius: 4px; }
.photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #E3E7E4; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.up::after { content: 'Saving…'; position: absolute; inset: 0; background: rgba(24, 34, 30, .6); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.ph .x { position: absolute; top: 2px; right: 2px; width: 32px; height: 32px; border-radius: 16px; border: none; background: rgba(24, 34, 30, .8); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.add { aspect-ratio: 1; border-radius: 8px; border: 2px solid var(--green); background: var(--white); color: var(--green); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.add input, .tagbtn input, .pickmore input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.add:focus-within, .tagbtn:focus-within { outline: 3px solid var(--amber); outline-offset: 2px; }
.tagbtn { position: relative; min-height: 72px; border-radius: 8px; border: 2px dashed var(--ask-line); background: var(--ask-bg); color: var(--ask-ink); font-size: 15px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; padding: 8px; }
.pickmore { position: relative; color: var(--green); text-decoration: underline; cursor: pointer; font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; }
.notes-wrap { position: relative; }
.notes-wrap textarea { padding-bottom: 58px; }
.speak { position: absolute; right: 8px; bottom: 12px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: none; background: var(--ink); color: var(--ground); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.speak.on { background: var(--red); }
.cap-foot { position: sticky; bottom: 0; background: var(--white); border-top: 1px solid var(--line); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.cap-foot > * { max-width: 588px; }

/* Item detail */
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-a { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.col-b { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.gal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gal a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #E3E7E4; position: relative; }
.gal a.first { grid-column: span 3; aspect-ratio: 16 / 10; }
.gal img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal .tag { position: absolute; left: 6px; bottom: 6px; background: var(--ask-bg); color: var(--ask-ink); font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.value { font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 30px; line-height: 1.1; }
.tablebox { overflow-x: auto; }
table.t { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 8px; border-bottom: 1px solid #E7ECE8; vertical-align: top; }
table.t th:first-child, table.t td:first-child { padding-left: 0; }
table.t .r { text-align: right; font-weight: 600; white-space: nowrap; padding-right: 0; }
.place { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid #E7ECE8; }
.place:first-child { border-top: none; padding-top: 0; }
.place .n { width: 28px; height: 28px; flex-shrink: 0; border-radius: 14px; background: var(--ink); color: #fff; font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.place .b { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.place .b strong { font-size: 15px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; flex: 1 1 150px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: 'Archivo', sans-serif; font-size: 24px; }
.spin { width: 18px; height: 18px; border: 3px solid var(--line2); border-top-color: var(--green); border-radius: 50%; animation: sp 1s linear infinite; flex-shrink: 0; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 15px; max-width: calc(100vw - 32px); z-index: 20; }
.login { max-width: 400px; margin: 0 auto; padding: 64px 16px; display: flex; flex-direction: column; gap: 18px; }

@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span3 { grid-column: span 2; }
  .value { font-size: 26px; }
  .items { grid-template-columns: minmax(0, 1fr); }
}

.gbtn { font-family: 'IBM Plex Sans', sans-serif; font-weight: 500; font-size: 16px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line2); }
