/* Apple 風格極簡 + 莫蘭迪色系 */
:root {
  --color-bg: #F5F1ED;
  --color-surface: #FFFFFF;
  --color-text: #3A3A3A;
  --color-text-muted: #8A8580;
  --color-border: #E5DED6;
  --color-accent: #B7A99A;       /* 莫蘭迪棕 */
  --color-accent-strong: #9C8B7A;
  --color-pink: #D9B8B0;          /* 莫蘭迪粉 */
  --color-green: #A8B5A0;         /* 莫蘭迪綠 */
  --color-blue: #A6B3BB;          /* 莫蘭迪藍 */
  --color-danger: #C08B82;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 84px;
}

a { text-decoration: none; color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(245, 241, 237, 0.92);
  backdrop-filter: blur(10px);
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--color-border);
}

.topbar h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.search-box input {
  border: none;
  outline: none;
  background: none;
  flex: 1;
  font-size: 16px;
  color: var(--color-text);
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 12px;
  padding-bottom: 2px;
}

.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 13px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  white-space: nowrap;
}

.chip.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

main {
  padding: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card .thumb {
  width: 100%;
  aspect-ratio: 1;
  background: var(--color-border);
  object-fit: cover;
  display: block;
}

.card .info {
  padding: 10px 12px 12px;
}

.card .brand {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card .name {
  font-size: 14px;
  font-weight: 600;
  margin: 2px 0 6px;
  line-height: 1.3;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
}

.badge.honnie { background: var(--color-pink); }
.badge.emily { background: var(--color-blue); }
.badge.shared { background: var(--color-green); }

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 60px 20px;
  font-size: 14px;
}

.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  border: none;
  cursor: pointer;
}

/* Add / Detail page */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 16px;
}

.header-nav .back {
  font-size: 22px;
  color: var(--color-accent-strong);
}

.header-nav h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.photo-box {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
  cursor: pointer;
}

.photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-box .hint {
  font-size: 14px;
}

.recognizing {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-accent-strong);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 15px;
  color: var(--color-text);
  outline: none;
  font-family: inherit;
}

.owner-select {
  display: flex;
  gap: 8px;
}

.owner-option {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.owner-option.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-top: 8px;
}

.btn-danger {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-danger);
  font-size: 15px;
  border: 1px solid var(--color-danger);
  cursor: pointer;
  margin-top: 10px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.toast.show { opacity: 0.92; }

.offline-banner {
  background: var(--color-pink);
  color: #fff;
  text-align: center;
  font-size: 12px;
  padding: 6px;
  display: none;
}

.offline-banner.show { display: block; }
