* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f6f8; color: #222; overflow: hidden; }
.hidden { display: none !important; }

#login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
#login form { display: flex; flex-direction: column; gap: 12px; width: min(320px, 86vw); }
#login h1 { text-align: center; font-size: 22px; }

input, select, button, .btn {
  font-size: 16px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid #ccc; background: #fff; color: #222;
}
button, .btn { cursor: pointer; text-align: center; text-decoration: none; }
button.primary { background: #1a73e8; border-color: #1a73e8; color: #fff; }
button.danger { color: #c0392b; }
.error { color: #c0392b; text-align: center; min-height: 1em; }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#app main {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px; max-width: 560px; margin: 0 auto; width: 100%;
}
nav {
  flex: none; display: flex;
  background: #fff; border-top: 1px solid #ddd; padding-bottom: env(safe-area-inset-bottom);
}
nav button { flex: 1; border: 0; border-radius: 0; background: none; padding: 14px 0; color: #888; }
nav button.active { color: #1a73e8; font-weight: 600; }

#search { width: 100%; margin-bottom: 12px; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; gap: 10px; background: #fff; border-radius: 12px; padding: 10px; align-items: center; }
.card img, .card .noimg { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; cursor: pointer; }
.card .noimg { background: #eee; color: #aaa; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.card .info { flex: 1; min-width: 0; }
.card .name { font-weight: 600; word-break: break-all; }
.card .meta { font-size: 13px; color: #777; margin-top: 2px; }
.card .actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.card .actions button, .card .actions .btn { font-size: 14px; padding: 7px 10px; }
.card > button { flex: none; }

.variants { background: #fff; border-radius: 12px; padding: 4px 12px 8px; }
.vrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f2f2f2; }
.vrow:last-of-type { border-bottom: 0; }
.vlabel { flex: 1; font-size: 15px; word-break: break-all; }
.vmeta { font-size: 13px; color: #777; flex: none; }
button.small { font-size: 14px; padding: 6px 10px; }
.variants > button.small { margin-top: 6px; }
#new-only { display: flex; flex-direction: column; gap: 10px; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.lightbox-body { background: #fff; border-radius: 14px; padding: 14px; width: 100%; max-width: 420px; max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.lightbox-img img { width: 100%; max-height: 60vh; object-fit: contain; background: #f2f2f2; border-radius: 10px; display: block; }
.lightbox-img .noimg.big { width: 100%; height: 180px; border-radius: 10px; background: #eee; color: #aaa; display: flex; align-items: center; justify-content: center; }
.lightbox-body .name { font-weight: 600; font-size: 18px; word-break: break-all; }
.lightbox-body .meta { font-size: 14px; color: #777; }
.lightbox-body .actions { display: flex; gap: 8px; }

.tag { font-size: 12px; padding: 1px 6px; border-radius: 6px; color: #fff; }
.tag.red { background: #c0392b; }
.tag.orange { background: #e67e22; }
.tag.blue { background: #1a73e8; }
.empty { text-align: center; color: #999; padding: 40px 0; }

#pform { display: flex; flex-direction: column; gap: 10px; background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
#pform h2 { font-size: 16px; }
#pform .row { display: flex; gap: 10px; }
#pform .row > * { flex: 1; }
#pform label { font-size: 14px; color: #555; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#pform label input { width: 100%; }
#photo-preview { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #777; }
#photo-preview img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
