:root {
  --bg-deep: #0a1018;
  --bg-deep2: #0d1c24;
  --ink: #eef3f6;
  --muted: #9fb0bc;
  --card: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.10);
  --accent: #2dd4bf;
  --accent2: #c084fc;
  --danger: #fb7185;
  --ok: #34d399;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg-deep); }
body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
}
h1, h2, h3, .brand-text { font-family: "Sora", sans-serif; }

.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 15% 15%, rgba(45,212,191,0.16), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(192,132,252,0.14), transparent 42%),
    linear-gradient(160deg, var(--bg-deep), var(--bg-deep2) 60%, #0a1420);
}

/* topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(10,16,24,0.6);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem; color: #0a1018;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 16px rgba(192,132,252,0.4);
}
.brand-text { font-weight: 700; font-size: 1.15rem; }
.user-area { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: .9rem; }

main { max-width: 980px; margin: 0 auto; padding: 40px 24px 80px; }

/* buttons */
.btn {
  font-family: "Sora", sans-serif; font-weight: 600;
  border-radius: 999px; cursor: pointer; border: 1px solid var(--border);
  padding: 10px 18px; font-size: .9rem;
  background: rgba(255,255,255,0.06); color: var(--ink);
  transition: transform .12s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.sm { padding: 7px 14px; font-size: .82rem; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #0a1018; border: none; }
.btn.ghost { background: rgba(255,255,255,0.05); }
.btn.danger { color: #fca5a5; border-color: rgba(248,113,113,0.35); }
.btn.danger:hover { background: rgba(248,113,113,0.14); color: #fecaca; }

.site-footer { text-align: center; padding: 28px 16px 40px; color: var(--muted); font-size: .82rem; }
.site-footer a { color: var(--muted); text-decoration: underline; }
.site-footer a:hover { color: var(--ink); }
.site-footer #delete-account { margin-left: 12px; background: none; border: none; color: var(--muted);
  text-decoration: underline; cursor: pointer; font: inherit; }
.site-footer #delete-account:hover { color: #fca5a5; }

/* Trash view */
.trash-group { margin: 18px 0 8px; color: var(--muted); font-size: .95rem; }
.trash-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 8px; }
.trash-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trash-main .muted { font-size: .82rem; }
.trash-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* auth */
.auth { max-width: 420px; margin: 6vh auto 0; text-align: center; }
.auth h1 { font-size: 2.4rem; margin: 0 0 6px;
  background: linear-gradient(120deg, #fff, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth .sub { color: var(--muted); margin: 0 0 28px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
}
.auth-card { text-align: left; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1; background: none; border: none; color: var(--muted);
  font-family: "Sora", sans-serif; font-weight: 600; padding: 10px;
  border-radius: 10px; cursor: pointer;
}
.tab.active { background: rgba(255,255,255,0.08); color: var(--ink); }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25);
  color: var(--ink); font-size: .95rem;
}
.field input:focus { outline: none; border-color: var(--accent); }
.auth-card .btn.primary { width: 100%; margin-top: 4px; }

/* pages */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h2 { margin: 0; font-size: 1.6rem; }
.back { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; font-weight: 600; margin-bottom: 16px; padding: 0; }
.back:hover { color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.loc-card, .bin-card {
  text-align: left; cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
}
.loc-card:hover, .bin-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,0.25); }
.loc-card h3, .bin-card h3 { margin: 0 0 6px; font-size: 1.1rem; color: #fff; }
.loc-card p, .bin-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); }

/* bin detail */
.bin-detail { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }
@media (max-width: 700px) { .bin-detail { grid-template-columns: 1fr; } }
.qr { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; text-align: center; }
.qr img { width: 100%; max-width: 200px; background: #fff; border-radius: 10px; padding: 8px; }
.qr p { color: var(--muted); margin: 12px 0 0; font-size: .85rem; }
.side-col { display: flex; flex-direction: column; gap: 16px; }
.box-photo { padding: 14px; text-align: center; }
.box-photo img { width: 100%; border-radius: 10px; margin-bottom: 10px; display: block; }
.box-photo-empty {
  color: var(--muted); font-size: .82rem; padding: 24px 0; margin-bottom: 10px;
  border: 1px dashed var(--border); border-radius: 10px;
}
.box-photo .btn { width: 100%; }
.contents-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.contents-photos img {
  width: 84px; height: 84px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); display: block;
}
.items-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.items-head h3 { margin: 0; }
#item-list { list-style: none; padding: 0; margin: 0; }
#item-list li.empty { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--muted); }
.qty { color: var(--accent); font-weight: 700; margin-right: 8px; }
.muted { color: var(--muted); }

/* editable item rows */
.item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: var(--card);
}
.item-row .item-qty {
  width: 56px; text-align: center; padding: 7px 6px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--ink);
}
.item-row .item-name {
  flex: 1; padding: 7px 10px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--ink); font-size: .95rem;
}
.item-row .item-name:focus, .item-row .item-qty:focus { outline: none; border-color: var(--accent); }
.item-conf { color: var(--muted); font-size: .75rem; min-width: 30px; text-align: right; }
.item-save {
  display: none; background: var(--accent); color: #062b24; border: none;
  border-radius: 999px; padding: 6px 12px; font-size: .78rem; font-weight: 600; cursor: pointer;
}
.item-row.dirty .item-save { display: inline-block; }
.item-del {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 1rem; padding: 4px 6px; border-radius: 6px;
}
.item-del:hover { color: var(--danger); background: rgba(251,113,133,0.12); }

/* code chips + metadata */
.code-chip {
  display: inline-block; font-family: "Sora", sans-serif; font-weight: 700;
  font-size: .72rem; letter-spacing: .04em; color: #0a1018;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 6px; padding: 2px 8px; margin-right: 8px; vertical-align: middle;
}
.loc-card .code-chip, .bin-card .code-chip { margin-bottom: 10px; }
.bin-desc { color: var(--ink); margin: 0 0 6px; }
.bin-meta { color: var(--muted); font-size: .85rem; margin: 0 0 20px; }

/* inline + review forms */
.inline-form { margin-bottom: 22px; max-width: 520px; }
.inline-form select {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--ink);
}
.analyzing { color: var(--accent); padding: 14px 0; }

/* bin edit form */
.bin-edit { max-width: 640px; margin-bottom: 22px; }
.bin-edit .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.bin-edit .field { margin-bottom: 0; }
.bin-edit .field.span2 { grid-column: 1 / -1; }
.bin-edit textarea, .bin-edit select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--ink);
  font: inherit; resize: vertical;
}
.bin-edit textarea:focus, .bin-edit select:focus { outline: none; border-color: var(--accent); }
.bin-edit .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.bin-class { color: var(--muted); font-size: .85rem; margin: 0 0 20px; }
@media (max-width: 560px) { .bin-edit .form-grid { grid-template-columns: 1fr; } }
.review { margin: 12px 0 18px; }
.review-head { display: flex; justify-content: space-between; margin-bottom: 12px; }
.review-head span { color: var(--muted); font-size: .82rem; }
.review-row { display: grid; grid-template-columns: 24px 64px 1fr 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.review-row input[type="number"], .review-row input[type="text"] {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.25); color: var(--ink); font-size: .9rem;
}
.rv-conf { color: var(--muted); font-size: .8rem; text-align: right; }
.review-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* share panel */
.share-panel { margin-bottom: 22px; max-width: 560px; }
.share-head { margin-bottom: 12px; }
.member-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.member {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(0,0,0,0.18);
}
.role-chip {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--muted);
}
.role-chip.owner { background: rgba(45,212,191,0.15); color: var(--accent); }
.member-ctrl { display: flex; align-items: center; gap: 8px; }
.member-ctrl .role-select {
  padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.25); color: var(--ink); font-size: .8rem;
}
.member-remove {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: .95rem; padding: 4px 6px; border-radius: 6px;
}
.member-remove:hover { color: var(--danger); background: rgba(251,113,133,0.12); }
.share-form { display: flex; gap: 8px; }
.share-form input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--ink); }
.share-form select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--ink); }
.share-form input:focus, .share-form select:focus { outline: none; border-color: var(--accent); }
.share-note { color: var(--muted); font-size: .8rem; margin: 12px 0 0; }

/* search */
.search-bar { display: flex; gap: 10px; margin-bottom: 24px; }
.search-bar input {
  flex: 1; padding: 11px 15px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25);
  color: var(--ink); font-size: .95rem;
}
.search-bar input:focus { outline: none; border-color: var(--accent); }
.search-title { font-size: 1.3rem; margin: 0 0 18px; }
.result-group { margin-bottom: 28px; }
.result-group h3 { margin: 0 0 12px; color: var(--muted); font-size: .95rem; font-weight: 600; }
.result-list { display: flex; flex-direction: column; gap: 8px; }
.result-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; color: var(--ink);
  font: inherit; transition: transform .12s ease, border-color .12s ease;
}
.result-row:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.25); }
.result-main { font-weight: 600; }
.result-sub { color: var(--muted); font-size: .85rem; }
.code-chip.sm { margin: 0 2px; padding: 1px 6px; font-size: .68rem; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 20px; border-radius: 10px; font-size: .9rem; z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.err { background: var(--danger); color: #2a0a12; }
.toast.ok { background: var(--ok); color: #052e1a; }
