/* ===== Coffee Vault — Dark Roast Theme ===== */
:root {
  --bg: #1a1412;
  --surface: #231e1a;
  --surface2: #2c2520;
  --surface3: #362e28;
  --border: #3d3430;
  --border-light: #4a3f39;
  --text: #f0e8e0;
  --text-muted: #a89888;
  --text-dim: #7a6b5e;
  --accent: #d4a574;
  --accent-glow: #e8b888;
  --green: #6db87a;
  --blue: #7aa3c8;
  --purple: #9b82c4;
  --red: #c47a6d;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Noto Sans SC', -apple-system, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-body);
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Top Bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  background: linear-gradient(180deg, var(--bg) 60%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 24px; }
.topbar h1 {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.count { font-size: 13px; color: var(--text-dim); }
.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 50%; color: var(--accent); cursor: pointer;
  transition: all .2s;
}
.icon-btn:hover { background: var(--surface3); border-color: var(--accent); }

/* ===== Filters ===== */
.filters {
  position: sticky; top: 54px; z-index: 9;
  padding: 8px 20px 12px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
}
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none;
}
.filters input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); font-size: 14px;
  font-family: var(--font-body);
  transition: border-color .2s;
}
.filters input:focus { outline: none; border-color: var(--accent); }
.filters input::placeholder { color: var(--text-dim); }

.chips {
  display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 5px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 13px; font-family: var(--font-body); font-weight: 400;
  cursor: pointer; transition: all .2s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-light); color: var(--text); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 500;
}

/* ===== Cards ===== */
.cards {
  padding: 6px 16px 100px;
  display: flex; flex-direction: column; gap: 10px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 3px 0 0 3px;
}
.card.s-正在喝::before { background: var(--green); }
.card.s-架子上::before { background: var(--blue); }
.card.s-冰箱::before { background: var(--purple); }
.card.s-已喝完::before { background: var(--text-dim); }

.card:active { transform: scale(.985); }
@media (hover: hover) {
  .card:hover { border-color: var(--border-light); background: var(--surface2); }
}

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-name {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600;
  color: var(--accent-glow);
  line-height: 1.3;
}
.card-status {
  flex-shrink: 0;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}
.card-status.正在喝 { background: rgba(109,184,122,.15); color: var(--green); }
.card-status.架子上 { background: rgba(122,163,200,.12); color: var(--blue); }
.card-status.冰箱 { background: rgba(155,130,196,.12); color: var(--purple); }
.card-status.已喝完 { background: rgba(168,152,136,.1); color: var(--text-dim); }

.card-origin {
  margin-top: 6px; font-size: 13px; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 4px 0;
}
.card-origin .sep { margin: 0 6px; opacity: .4; }

.card-tags {
  margin-top: 8px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.tag {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--surface3);
  border-radius: 6px;
  color: var(--text-muted);
}

.card-flavor {
  margin-top: 8px; font-size: 13px; line-height: 1.5;
  color: var(--text);
  font-style: italic;
  font-family: var(--font-display);
  letter-spacing: .01em;
}

.card-footer {
  margin-top: 8px;
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-dim);
}

/* ===== Empty State ===== */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== Editor Dialog ===== */
dialog {
  border: none; border-radius: 16px;
  max-width: 520px; width: 94vw;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  padding: 0;
}
dialog::backdrop { background: rgba(0,0,0,.65); }

.editor-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px 0;
}
.editor-header h3 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600; color: var(--accent);
}
.close-btn {
  background: none; border: none;
  color: var(--text-dim); font-size: 18px; cursor: pointer;
  padding: 4px 8px;
}

.editor-body {
  padding: 16px 20px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  max-height: 60vh; overflow-y: auto;
}
.editor-body label {
  display: flex; flex-direction: column; gap: 4px;
}
.editor-body label.full { grid-column: 1 / -1; }
.editor-body span {
  font-size: 12px; color: var(--text-dim); font-weight: 400;
}
.editor-body input, .editor-body select, .editor-body textarea {
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px;
  font-family: var(--font-body);
  transition: border-color .2s;
}
.editor-body input:focus, .editor-body select:focus, .editor-body textarea:focus {
  outline: none; border-color: var(--accent);
}
.editor-body textarea { resize: vertical; }

.editor-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--border);
}
.spacer { flex: 1; }

.ghost-btn {
  padding: 8px 18px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 14px;
  cursor: pointer; transition: all .2s;
}
.ghost-btn:hover { border-color: var(--text-muted); color: var(--text); }

.primary-btn {
  padding: 8px 22px;
  background: var(--accent);
  border: none; border-radius: var(--radius-sm);
  color: var(--bg); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .2s;
}
.primary-btn:hover { background: var(--accent-glow); }

.danger-btn {
  padding: 8px 16px;
  background: none; border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red); font-size: 13px;
  cursor: pointer; transition: all .2s;
}
.danger-btn:hover { background: rgba(196,122,109,.12); }

/* ===== Animations ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeUp .35s ease both; }
.cards .card:nth-child(1) { animation-delay: 0s; }
.cards .card:nth-child(2) { animation-delay: .03s; }
.cards .card:nth-child(3) { animation-delay: .06s; }
.cards .card:nth-child(4) { animation-delay: .09s; }
.cards .card:nth-child(5) { animation-delay: .12s; }

/* ===== Mobile ===== */
@media (max-width: 520px) {
  .editor-body { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .filters { padding: 6px 16px 10px; }
  .topbar h1 { font-size: 22px; }
}