/* StashItFindIt design tokens and components. */
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/app/fonts/space-grotesk.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/app/fonts/inter.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 100 800; font-display: swap; src: url(/app/fonts/jetbrains-mono.woff2) format('woff2'); }

:root {
  --bg: #111213; --sf: #1B1D1F; --s2: #26292C; --ln: #35393D; --tx: #F2F1EC; --mu: #A3A8AD;
  --ac: #FFB01F; --ak: #FFB01F; --on: #141414; --bl: #8DBEFF; --blb: #1D2A3A; --ok: #6FD39A; --ph: #2B2E32;
  --font-display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-h: 64px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #F3F2EE; --sf: #FFFFFF; --s2: #E8E6E0; --ln: #D3D0C7; --tx: #17181A; --mu: #5A5F66;
    --ac: #FFB01F; --ak: #8A5600; --on: #141414; --bl: #1F5FAF; --blb: #E2ECF8; --ok: #1D7A45; --ph: #DEDBD3;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--tx); font: 400 17px/1.4 var(--font-body); -webkit-text-size-adjust: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
.muted { color: var(--mu); }
.mono { font-family: var(--font-mono); }

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
#view { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; }
.screen { padding: 8px 20px 24px; }
.screen-title { font: 700 26px var(--font-display); letter-spacing: -0.5px; margin-bottom: 8px; }
.section-label { margin: 16px 0 8px; font: 600 13px var(--font-mono); letter-spacing: 0.5px; text-transform: uppercase; color: var(--mu); }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 26px var(--font-display); letter-spacing: -0.5px; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--ac); color: var(--on); display: inline-flex; align-items: center; justify-content: center; }
.sidebar { display: none; }
body[data-route='login'] .bottom-nav, body[data-route='login'] .sidebar, body[data-route='login'] .sync-pill { display: none; }
body[data-route='login'] .main { padding-bottom: 0; }

.offline-banner { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--s2); border-bottom: 1px solid var(--ln); font-size: 15px; }
.offline-banner b { font-weight: 600; }

.sync-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ln); background: transparent; color: var(--mu); font: 500 14px var(--font-body); cursor: pointer; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sync-pill[data-kind='pending'] .sync-dot, .sync-pill[data-kind='busy'] .sync-dot { background: transparent; border: 2px dashed var(--mu); }
.sync-pill[data-kind='busy'] .sync-dot { animation: spin 1.2s linear infinite; }
.sync-pill[data-kind='offline'] { background: var(--s2); color: var(--tx); border-color: var(--s2); }
.sync-pill[data-kind='offline'] .sync-dot { background: var(--mu); }
.sync-pill[data-kind='error'] { color: var(--ak); border-color: var(--ak); }
.sync-pill[data-kind='error'] .sync-dot { background: var(--ak); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1.5px solid transparent; cursor: pointer; font: 600 16px var(--font-body); text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { min-height: 60px; border-radius: 16px; background: var(--ac); color: var(--on); font: 700 19px var(--font-display); }
.btn-secondary { background: var(--bg); border-color: var(--ln); color: var(--tx); }
.btn-dashed { background: transparent; border: 1.5px dashed var(--ln); color: var(--tx); border-radius: 12px; }
.btn-sm { padding: 0 14px; font-size: 15px; border-radius: 12px; }
.icon-btn { width: 62px; height: 62px; flex: none; border-radius: 16px; background: var(--s2); color: var(--tx); display: flex; align-items: center; justify-content: center; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 8px; }
.tile { min-height: 116px; padding: 16px; border-radius: 20px; background: var(--sf); border: 1.5px solid var(--ln); color: var(--tx); text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; }
.tile-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--ac); color: var(--on); display: flex; align-items: center; justify-content: center; }
.tile-title { display: block; font: 700 22px var(--font-display); }
.tile-sub { display: block; font-size: 14px; color: var(--mu); }
.search-row { display: flex; gap: 10px; padding-bottom: 8px; }
.search-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 18px; background: var(--sf); border: 1.5px solid var(--ln); border-radius: 16px; color: var(--mu); }
.search-input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: 0; color: var(--tx); font: 500 20px var(--font-body); }
.search-box:focus-within { border-color: var(--ac); }
.search-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 18px; background: var(--sf); border: 1.5px solid var(--ln); border-radius: 16px; color: var(--mu); text-decoration: none; font: 500 20px var(--font-body); }

.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--ln); background: var(--bg); color: var(--tx); font: 600 16px var(--font-body); cursor: pointer; }
.chip[aria-pressed='true'] { background: var(--ac); border-color: var(--ac); color: var(--on); }
.tag-chip { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 8px; background: var(--s2); font: 600 14px var(--font-mono); }
.tag-chip--suggested { background: transparent; border: 1.5px dashed var(--ak); color: var(--ak); }
.tag-chip--code { background: transparent; border: 1.5px solid var(--ln); color: var(--mu); }

.status-pill { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--s2); font-size: 14px; font-weight: 600; }
.status-pill--out { background: var(--blb); color: var(--bl); }
.last-seen { font-size: 14px; font-weight: 600; color: var(--ak); }
.not-synced { display: inline-flex; align-items: center; gap: 5px; font: 500 13px var(--font-mono); color: var(--mu); }
.not-synced::before { content: ''; width: 9px; height: 9px; border-radius: 50%; border: 2px dashed var(--mu); }

.item-card { display: flex; gap: 14px; padding: 12px; border-radius: 16px; background: var(--bg); border: 1.5px solid var(--ln); }
.thumb { width: 80px; height: 80px; flex: none; border-radius: 12px; background: var(--ph) center / cover no-repeat; color: var(--mu); display: flex; align-items: center; justify-content: center; }
.item-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--ln); }
.item-row .thumb { width: 56px; height: 56px; border-radius: 10px; }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.item-name { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.crumb { font: 500 14px var(--font-mono); color: var(--mu); }
.crumb b { color: var(--tx); font-weight: 600; }
.crumb--large { font-size: 16px; }

.scan-prompt { display: flex; align-items: center; gap: 20px; }
.scan-rings { position: relative; width: 120px; height: 120px; flex: none; display: flex; align-items: center; justify-content: center; }
.scan-rings::before, .scan-rings::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--ac); opacity: 0.4; animation: pulse 2.4s ease-out infinite; }
.scan-rings::after { animation-delay: 1.2s; }
.scan-core { width: 84px; height: 84px; border-radius: 50%; background: var(--ac); color: var(--on); display: flex; align-items: center; justify-content: center; }
.scan-title { font: 700 22px var(--font-display); }
@keyframes pulse { from { transform: scale(0.7); opacity: 0.6; } to { transform: scale(1.1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .scan-rings::before, .scan-rings::after, .sync-dot { animation: none !important; } }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font: 600 14px var(--font-body); color: var(--mu); }
.input { height: 52px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--ln); background: var(--sf); color: var(--tx); font: 400 17px var(--font-body); }
.form-error { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--s2); border: 1.5px solid var(--ak); color: var(--ak); font-weight: 600; font-size: 15px; }
.login { display: flex; justify-content: center; padding-top: 6vh; }
.login-card { width: 100%; max-width: 400px; padding: 24px; border-radius: 18px; background: var(--sf); border: 1.5px solid var(--ln); display: flex; flex-direction: column; }
.login-card .btn-primary { margin-top: 20px; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--sf); border-top: 1px solid var(--ln); }
.bottom-nav a, .side-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; color: var(--mu); text-decoration: none; font-size: 13px; font-weight: 600; }
.bottom-nav a.active, .side-nav a.active { color: var(--ac); }

.sheet { width: min(92vw, 440px); max-height: 85vh; overflow: auto; padding: 22px; border-radius: 18px; border: 1.5px solid var(--ln); background: var(--sf); color: var(--tx); }
.sheet::backdrop { background: rgb(0 0 0 / 0.55); }
.sheet-title { font: 700 22px var(--font-display); }
.sheet-status { margin: 6px 0 14px; color: var(--mu); }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.sheet .btn-primary { width: 100%; }
.problems { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.problem { padding: 12px; border-radius: 12px; background: var(--bg); border: 1.5px solid var(--ln); }
.problem-main { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.problem-reason { flex-basis: 100%; color: var(--ak); font-weight: 600; font-size: 15px; }
.problem-actions { display: flex; gap: 8px; margin-top: 10px; }

.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn-compact { min-height: 48px; font-size: 16px; }
.link-btn { background: none; border: 0; padding: 8px 4px; min-height: 44px; color: var(--ak); font: 600 15px var(--font-body); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.form { display: flex; flex-direction: column; margin-bottom: 12px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; margin-top: 16px; }
.inline-form .field { flex: 1; margin-top: 0; }
.textarea { height: auto; padding: 12px 14px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.plain-list { list-style: none; margin: 0 0 12px; padding: 0; }
.plain-list li { padding: 8px 0; border-top: 1px solid var(--ln); }
.card-list { display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.card-list .item-card, .results .item-row { text-decoration: none; color: inherit; }
.notes { color: var(--mu); white-space: pre-wrap; }
.kind-tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--s2); color: var(--mu); font: 600 12px var(--font-mono); text-transform: uppercase; letter-spacing: 0.4px; }
.tree, .out-list { list-style: none; margin: 0; padding: 0; }
.tree-head { display: flex; align-items: center; gap: 8px; min-height: 52px; border-top: 1px solid var(--ln); }
.tree-toggle { width: 36px; height: 44px; flex: none; background: none; border: 0; color: var(--mu); font-size: 18px; cursor: pointer; }
.tree-link { flex: 1; min-width: 0; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { min-width: 28px; text-align: right; font: 500 14px var(--font-mono); color: var(--mu); }
.out-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--ln); }
.out-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.out-link .thumb { width: 56px; height: 56px; border-radius: 10px; }
.item-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-field { margin-top: 8px; }
.detail-field p { margin: 0 0 4px; white-space: pre-wrap; }
.photo-full img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 16px; margin-bottom: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip { gap: 6px; }
.tag-remove { background: none; border: 0; color: var(--mu); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; min-width: 24px; min-height: 24px; }
.history-row { display: flex; justify-content: space-between; gap: 12px; }
.item-meta .status-pill { flex: none; }

@media (min-width: 1024px) {
  .app { flex-direction: row; flex-wrap: wrap; }
  .offline-banner { flex: 0 0 100%; }
  .sidebar { display: flex; flex-direction: column; gap: 24px; flex: none; width: 240px; padding: 24px 16px; border-right: 1px solid var(--ln); background: var(--sf); position: sticky; top: 0; height: 100vh; align-self: flex-start; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-nav a { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 12px; font-size: 16px; }
  .side-nav a.active { background: var(--s2); }
  .bottom-nav { display: none; }
  .main { flex: 1; padding-bottom: 0; }
  .topbar .brand { visibility: hidden; }
  .topbar { justify-content: flex-end; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.cam { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; align-items: flex-end; justify-content: center; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 16px; }
.cam-shutter { position: relative; width: 76px; height: 76px; margin-bottom: calc(28px + env(safe-area-inset-bottom)); border-radius: 50%; border: 5px solid #fff; background: var(--ac); cursor: pointer; }
.cam-shutter:disabled { opacity: 0.5; }
.cam-fallback { display: flex; flex-direction: column; gap: 12px; }
.add-preview { display: block; width: 100%; max-height: 40vh; object-fit: contain; border-radius: 16px; background: var(--sf); }
.add-bar { display: flex; align-items: center; justify-content: space-between; }
.quick-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.quick-new { max-width: 160px; }
.photo-input { margin: 8px 0; max-width: 100%; }
.scan-video { width: 100%; max-height: 40vh; margin: 12px 0; border-radius: 16px; background: #000; object-fit: cover; }
.pick-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.pick-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; height: auto; padding: 10px 14px; text-align: left; }
.tag-stickers { margin-top: 8px; }

.step-title { margin: 8px 0; font-family: var(--fd, inherit); font-size: 22px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.moving-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; margin: 8px 0; border-radius: 14px; background: var(--sf); border: 1px solid var(--ln); }
.put-total { display: flex; align-items: baseline; gap: 10px; margin: 8px 0; }
.put-count { font-size: 48px; font-weight: 700; color: var(--ac); }
.put-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.nav-badge { margin-left: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--ac); color: var(--on); font: 700 13px/22px var(--font-mono); text-align: center; }
.bottom-nav .nav-badge { display: none; }
body[data-route='inbox'] #view { max-width: none; }
.inbox-list { display: flex; flex-direction: column; gap: 12px; }
.inbox-head { display: none; }
.inbox-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: var(--sf); border: 1.5px solid var(--ln); }
.inbox-row:focus-within { border-color: var(--ac); }
.inbox-row .input { width: 100%; min-width: 0; height: 44px; }
.inbox-cell { min-width: 0; position: relative; }
.inbox-actions { display: flex; gap: 8px; }
.inbox-done { min-height: 48px; font-size: 16px; }
.inbox-row .form-error { margin: 0; grid-column: 1 / -1; }
.inbox-tags .tag-list { margin-bottom: 6px; }
.tag-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 4; margin: 2px 0 0; padding: 4px; list-style: none; border-radius: 12px; background: var(--sf); border: 1.5px solid var(--ln); box-shadow: 0 8px 24px rgb(0 0 0 / 0.35); }
.tag-option { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.tag-option[aria-selected='true'], .tag-option:hover { background: var(--s2); }
.kbd-hints { display: none; flex-wrap: wrap; gap: 6px 20px; margin: 4px 0 12px; font-size: 14px; color: var(--mu); }
kbd { padding: 1px 6px; border-radius: 6px; border: 1px solid var(--ln); background: var(--s2); font: 600 12px var(--font-mono); color: var(--tx); }
@media (min-width: 1024px) {
  .inbox .kbd-hints { display: flex; }
  .inbox-head, .inbox-row { display: grid; grid-template-columns: 64px minmax(0, 1.4fr) minmax(0, 1.5fr) minmax(0, 1.3fr) minmax(0, 1.5fr) minmax(0, 1fr) 150px; align-items: start; gap: 12px; }
  .inbox-head { padding: 0 12px; font: 600 12px var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px; color: var(--mu); }
  .inbox-list { gap: 8px; }
  .inbox-row { padding: 10px 12px; }
  .inbox-row .thumb { width: 64px; height: 64px; }
  .inbox-actions { flex-direction: column; }
  .inbox-actions .btn { min-height: 36px; }
  .inbox-done { min-height: 40px; }
  .inbox-tags .tag-list { margin-bottom: 4px; }
}
