:root {
  --bg: #121212;
  --surface: #1c1c1c;
  --surface-elevated: #242424;
  --border: #2a2a2a;
  --text: #f5f0e8;
  --text-muted: #a39e94;
  --accent: #3d6b52;
  --accent-hover: #4a7d62;
  --accent-soft: rgba(61, 107, 82, 0.18);
  --gold: #c4a574;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}
header.app-header {
  padding: 18px 20px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.logo {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
}
.logo span { color: var(--accent); }
.tagline {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}
.screen {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: none;
}
.screen.active { display: block; }
h1 { font-size: 26px; font-weight: 600; margin-bottom: 8px; line-height: 1.2; }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.subtitle { color: var(--text-muted); font-size: 15px; margin-bottom: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.card.selectable {
  cursor: pointer;
}
.card.selectable:hover, .card.selectable.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.card-title { font-weight: 600; font-size: 16px; margin-bottom: 2px; }
.card-desc { font-size: 13px; color: var(--text-muted); }
.btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.large { padding: 18px; font-size: 17px; }
input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 14px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}
label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.rating {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 18px;
}
.rating button {
  flex: 1;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.rating button.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.strength {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.strength button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}
.strength button.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tag {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.tag.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.entry {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.entry-info { flex: 1; }
.entry-brand { font-weight: 600; font-size: 15px; }
.entry-name { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.entry-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; display: flex; gap: 10px; align-items: center; }
.stars { color: var(--gold); letter-spacing: 1px; }
.nav {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 0 env(safe-area-inset-bottom);
}
.nav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 10px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.nav button.active { color: var(--accent); }
.nav button svg { width: 22px; height: 22px; }
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.insight-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.progress {
  height: 6px;
  background: #333;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.rec-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.rec-reason { font-size: 13px; color: var(--text-muted); margin: 8px 0; }
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-top: 8px;
}
.logo-mark {
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
}

/* ---------- Additions (v2) ---------- */
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.danger { background: transparent; border: 1px solid #7a2e2e; color: #e8a0a0; }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; margin-top: 0; border-radius: 10px; }
.btn.link { background: none; border: none; color: var(--gold); padding: 8px; font-weight: 500; font-size: 14px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.hint { font-size: 12px; color: var(--text-muted); margin: -8px 0 14px; line-height: 1.5; }
.notice { font-size: 13px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; line-height: 1.5; }
.notice.error { border-left-color: #b54a4a; color: #e8b4b4; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--text); line-height: 1.45; margin-bottom: 14px; cursor: pointer; font-weight: 400; }
.check input { width: 20px; height: 20px; flex: 0 0 20px; margin: 2px 0 0; accent-color: var(--accent); }
.check small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--surface); padding: 4px; border-radius: 12px; border: 1px solid var(--border); }
.tabs button { flex: 1; background: none; border: none; color: var(--text-muted); padding: 10px; border-radius: 9px; font-size: 14px; cursor: pointer; }
.tabs button.active { background: var(--accent); color: #fff; }
.entry-actions { display: flex; gap: 8px; margin-top: 12px; }
.entry-actions button { background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; }
.entry-actions button:hover { color: var(--text); border-color: var(--accent); }
.entry-actions button.del:hover { border-color: #b54a4a; color: #e8a0a0; }
.sync-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-left: 6px; vertical-align: middle; }
details.more { margin-bottom: 14px; }
details.more summary { cursor: pointer; color: var(--text-muted); font-size: 13px; margin-bottom: 12px; list-style: none; }
details.more summary::before { content: "+ "; color: var(--accent); }
details.more[open] summary::before { content: "– "; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--surface-elevated); color: var(--text); border: 1px solid var(--border); padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; }
.status-pill { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-top: 6px; }
.footer-links { text-align: center; font-size: 12px; margin: 24px 0 8px; color: var(--text-muted); }
.footer-links a { color: var(--text-muted); margin: 0 8px; }
.strength-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); margin-top: 10px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toggle-row input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: 0 0 22px; }
.strength button.selected:hover { background: var(--accent-hover); }
/* Add to Home Screen sheet */
.install-sheet { position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 110%); width: 100%; max-width: 480px; background: var(--surface-elevated); border: 1px solid var(--border); border-bottom: none; border-radius: 20px 20px 0 0; padding: 20px 20px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); z-index: 60; transition: transform .3s ease, visibility 0s linear .3s; visibility: hidden; }
.install-sheet.show { transform: translate(-50%, 0); visibility: visible; transition: transform .3s ease; }
.install-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; padding-right: 28px; }
.install-head img { border-radius: 10px; flex: 0 0 44px; }
.install-close { position: absolute; top: 10px; right: 14px; background: none; border: none; color: var(--text-muted); font-size: 26px; cursor: pointer; line-height: 1; }
.install-steps { padding-left: 20px; font-size: 14px; line-height: 1.9; color: var(--text); }
.install-steps b { color: var(--gold); font-weight: 600; }
.ios-share { width: 20px; height: 20px; vertical-align: -4px; color: #4a9eff; margin: 0 2px; }
.plus-box { display: inline-block; border: 1.5px solid var(--text-muted); border-radius: 4px; width: 18px; height: 18px; line-height: 15px; text-align: center; font-size: 14px; }
/* Legal pages */
.doc { max-width: 720px; margin: 0 auto; padding: 24px 20px 60px; line-height: 1.65; font-size: 15px; }
.doc h1 { margin-top: 8px; }
.doc h2 { margin-top: 28px; font-size: 18px; }
.doc p, .doc li { color: #d9d3c9; margin-bottom: 10px; }
.doc ul { padding-left: 22px; }
.doc a { color: var(--gold); }
.doc table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0 16px; }
.doc th, .doc td { border: 1px solid var(--border); padding: 8px; text-align: left; vertical-align: top; color: #d9d3c9; }
.draft-banner { background: #3a2a10; border: 1px solid var(--gold); color: #f1dcb0; padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 18px; }
.ph { background: rgba(196,165,116,.18); padding: 0 4px; border-radius: 4px; }
