:root {
  --ink: #251f21;
  --ink-2: #585254;
  --ink-4: #c0bebf;
  --hairline: #eae9ea;
  --sand: #f4efec;
  --teal: #73a89a;
  --red: #d43a35;
  --surface: #ffffff;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--sand); color: var(--ink);
  font-size: 16px; line-height: 1.45;
  min-height: 100%;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

#topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(244,239,236,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
}
#topbar-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }

#view { padding: 16px 16px calc(120px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }

/* tab bar */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: flex-end;
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--hairline);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabbtn { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 62px; min-height: 44px; justify-content: center; color: var(--ink-2); border-radius: 10px; }
.tabbtn svg { width: 24px; height: 24px; }
.tabbtn .tablabel { font-size: 11px; }
.tabbtn.active { color: var(--ink); font-weight: 600; }
.tabbtn.active svg { stroke: var(--teal); }
.fabwrap { position: relative; width: 62px; }
.fab {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(37,31,33,.28);
}
.fab svg { width: 26px; height: 26px; stroke: #fff; }

/* cards and sections */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.sect { margin: 22px 2px 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* capture */
.capture textarea {
  width: 100%; border: 1px solid var(--hairline); border-radius: 12px;
  padding: 12px; font-size: 16px; min-height: 52px; resize: vertical; background: #fff;
}
.capture textarea:focus { outline: 2px solid var(--teal); outline-offset: -1px; border-color: transparent; }
.capture-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.thumb-prev { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.spacer { flex: 1; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 15px;
}
.btn:disabled { opacity: .4; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--hairline); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn.block { width: 100%; margin-top: 12px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--hairline); background: #fff; }
.iconbtn svg { width: 20px; height: 20px; stroke: var(--ink-2); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--hairline);
  background: #fff; font-size: 14px; color: var(--ink-2); min-height: 36px;
}
.chip.sel { border-color: var(--teal); color: var(--ink); background: #eef4f2; font-weight: 600; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }

/* collection list */
.coll { display: flex; align-items: center; gap: 12px; padding: 16px; background: #fff; border-radius: var(--radius); margin-bottom: 10px; width: 100%; text-align: left; }
.coll .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.coll .name { font-weight: 600; flex: 1; }
.coll .count { color: var(--ink-2); font-size: 14px; }
.coll .chev { color: var(--ink-4); font-size: 20px; }

/* items */
.item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: #fff; border-radius: var(--radius); margin-bottom: 10px; width: 100%; text-align: left; }
.item.done .itext { text-decoration: line-through; color: var(--ink-4); }
.item.past .itext { color: var(--ink-2); }
.check {
  flex: none; width: 26px; height: 26px; border-radius: 50%; margin-top: 1px;
  border: 2px solid var(--ink-4); display: flex; align-items: center; justify-content: center;
}
.item.done .check { background: var(--teal); border-color: var(--teal); }
.item.done .check svg { stroke: #fff; }
.check svg { width: 14px; height: 14px; stroke: transparent; }
.imain { flex: 1; min-width: 0; }
.itext { font-size: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.imeta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--sand); color: var(--ink-2); }
.tag .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.ithumb { flex: none; width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }

/* inspiration grid */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gcell { background: #fff; border-radius: var(--radius); overflow: hidden; text-align: left; width: 100%; }
.gcell img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.gcell .gtext { padding: 10px 12px; font-size: 14px; }

/* search */
.searchbox { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--hairline); padding: 0 14px; }
.searchbox input { flex: 1; border: none; outline: none; min-height: 48px; font-size: 16px; background: transparent; }
.searchbox svg { width: 20px; height: 20px; stroke: var(--ink-2); flex: none; }

/* sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(37,31,33,.4); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto; max-height: 88vh; overflow-y: auto;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--hairline); margin: 6px auto 14px; }
.sheet h2 { font-size: 19px; margin-bottom: 12px; }
.sheet textarea, .sheet input[type="datetime-local"] {
  width: 100%; border: 1px solid var(--hairline); border-radius: 12px;
  padding: 12px; font-size: 16px; min-height: 52px; resize: vertical; background: #fff;
}
.sheet .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }

/* viewer */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(20,17,18,.96); display: flex; flex-direction: column; }
.viewer .vimg { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 12px; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer .vfoot { padding: 14px 20px calc(20px + env(safe-area-inset-bottom)); color: #fff; }
.viewer .vclose { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 14px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 20px; }

/* toast */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60; display: flex; justify-content: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }

.empty { text-align: center; color: var(--ink-2); padding: 36px 20px; }
.empty .big { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.hidden { display: none !important; }
