/* 後台給店家用（可能是長輩）：按鈕高 ≥56px、按鈕字 ≥22px、輸入框字 ≥18px、輸入框高 ≥48px。 */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  font-size: 18px;
  background: #fafaf7;
  color: #222;
}

header {
  padding: 12px 16px;
  background: #3b2f2a;
  color: #fff;
}

header h1 {
  margin: 0;
  font-size: 22px;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px;
}

.panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.item h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.field {
  display: block;
  margin: 8px 0;
}

.field > span {
  display: block;
  margin-bottom: 4px;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: 18px;
  min-height: 48px;
  padding: 8px;
  border: 2px solid #999;
  border-radius: 6px;
}

.field textarea {
  min-height: 96px;
}

.field .msg {
  display: block;
  min-height: 1em;
  color: #b00020;
  font-size: 16px;
}

.field.bad input,
.field.bad textarea {
  border-color: #b00020;
  background: #fff0f2;
}

.variant {
  border-top: 1px solid #ddd;
  padding-top: 8px;
  margin-top: 8px;
}

.btn {
  display: inline-block;
  min-height: 56px;
  min-width: 56px;
  padding: 8px 16px;
  margin: 8px 8px 8px 0;
  font-size: 22px;
  border: 2px solid #3b2f2a;
  border-radius: 8px;
  background: #fff;
  color: #222;
  cursor: pointer;
}

.btn-primary {
  background: #3b2f2a;
  color: #fff;
}

#user,
#password {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  font-size: 18px;
  padding: 8px;
  margin: 8px 0 16px;
  border: 2px solid #999;
  border-radius: 6px;
}

#status {
  font-size: 20px;
  min-height: 1.5em;
}

#status.bad {
  color: #b00020;
}

#export {
  width: 100%;
  box-sizing: border-box;
  font-family: monospace;
  font-size: 16px;
}

/* ---- 帳號登入、兩個分頁、種類、商品照片、庫存、底部儲存列 ---- */
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.who .btn {
  margin: 0;
  background: #fff;
  color: #222;
}

.offscreen {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.note {
  font-size: 18px;
  color: #3b2f2a;
  font-weight: bold;
}

.bad {
  color: #b00020;
}

.hint {
  font-size: 18px;
  margin: 4px 0 12px;
}

.btn-wide {
  box-sizing: border-box;
  margin-right: 0;
  display: block;
  width: 100%;
}

.btn:disabled {
  color: #555;
  background: #eee;
  border-color: #bbb;
  cursor: default;
}

.btn-danger {
  color: #b00020;
  border-color: #b00020;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  margin: 0 -12px 12px;
  padding: 8px 12px;
  background: #fafaf7;
  border-bottom: 2px solid #ddd;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 4px;
  min-height: 56px;
  font-size: 22px;
  font-weight: bold;
  border: 2px solid #3b2f2a;
  border-radius: 8px;
  background: #fff;
  color: #3b2f2a;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: #3b2f2a;
  color: #fff;
}

.cat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.cat-head h2 {
  margin: 0;
  font-size: 22px;
  flex: 1 1 auto;
}

.cat-no,
.cat-count {
  font-size: 18px;
  color: #555;
}

.cat-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 56px;
  font-size: 28px;
  color: #555;
  background: #eee;
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.cat.dragging {
  opacity: 0.7;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.cat-moves {
  display: flex;
  gap: 12px;
}

.cat-moves .btn {
  flex: 1 1 50%;
  margin-right: 0;
}

.photo {
  margin: 8px 0;
}

.photo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  max-width: 320px;
  background: #e6e6e6;
  border-radius: 8px;
  overflow: hidden;
  color: #444;
}

.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-btn {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 320px;
}

.photo-msg {
  min-height: 1em;
  margin: 0;
  font-size: 18px;
}

.pick {
  display: block;
  margin: 8px 0;
}

.pick > span {
  display: block;
  margin-bottom: 4px;
}

.pick select {
  display: block;
  width: 100%;
  min-height: 48px;
  font-size: 18px;
  padding: 8px;
  border: 2px solid #999;
  border-radius: 6px;
  background: #fff;
}

.stock {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.stock > span {
  flex: 0 0 auto;
}

.stock .btn {
  flex: 1 1 40%;
  margin: 0;
}

.stock .btn.on {
  background: #3b2f2a;
  color: #fff;
}

.item.soldout h2::after {
  content: "（缺貨）";
  color: #b00020;
}

#page-pw .field,
#page-pw .field > span,
#setup-box .field,
#setup-box .field > span {
  font-size: 18px;
}

#page-pw .panel h2,
#setup-box h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.acct-list {
  font-size: 18px;
}

.acct-name {
  margin-top: 6px;
  font-size: 20px;
  font-weight: bold;
  overflow-wrap: anywhere;
}

#pw-msg,
#rename-msg,
#add-msg,
#setup-msg {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-size: 18px;
  font-weight: bold;
}

.good {
  color: #1b6e2d;
}

.savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 -12px;
  padding: 8px 12px 12px;
  background: #fff;
  border-top: 2px solid #ddd;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
}

.savebar .btn {
  margin: 0;
}

.savebar #status {
  margin: 6px 0 0;
  font-size: 18px;
}

.dirty {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: bold;
  color: #8a4b00;
}

#selftest {
  white-space: pre-wrap;
  word-break: break-all;
}
