:root {
  --bg: #F6F4EF;
  --card: #FFFFFF;
  --ink: #1C2120;
  --ink-2: #3E4745;
  --muted: #5B6461;
  --line: #E6E3DC;
  --border: #D5D9D6;
  --accent: #1D6B66;
  --accent-ink: #134B47;
  --accent-soft: #EEF5F4;
  --away-bg: #FCEBD9;
  --chip: #F1EFEA;
  --danger: #A3261B;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, sans-serif; font-size: 16px; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
h1, h2 { font-family: 'Space Grotesk', sans-serif; font-weight: 600; margin: 0; }

.view { min-height: 100dvh; padding: calc(var(--safe-t) + 16px) 20px calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; }
.view.form { padding-bottom: calc(24px + var(--safe-b)); }
.top { display: flex; align-items: flex-end; justify-content: space-between; padding-top: 24px; }
.top h1 { font-size: 30px; }
.sub { font-size: 15px; color: var(--muted); }
.formbar { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; min-height: 52px; }
.formbar h1 { font-size: 20px; }
.formbar .spacer { width: 56px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* Buttons */
.btn { min-height: 54px; border-radius: 16px; border: 0; background: var(--card); font-size: 18px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: transparent; color: var(--danger); font-size: 16px; min-height: 44px; }
.btn.ghost { background: transparent; border: 2px solid #fff; color: #fff; }
.btn.light { background: #fff; color: var(--accent-ink); }
.btn:disabled { opacity: 0.6; }
.pill { min-height: 44px; padding: 0 16px 0 12px; border-radius: 22px; border: 0; background: var(--card); color: var(--accent); font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.pill.primary { background: var(--accent); color: #fff; }
.link { background: none; border: 0; color: var(--accent); font-size: 17px; min-height: 44px; padding: 0; cursor: pointer; }
.link.strong { font-weight: 600; font-size: 16px; }
.link.light { color: #fff; }
.dashed { min-height: 48px; border-radius: 16px; border: 1px dashed #B9BFBC; background: transparent; color: var(--accent); font-size: 15px; font-weight: 600; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; }
.i { display: inline-flex; }

/* Groups (iOS-style cards) */
.group { background: var(--card); border-radius: 16px; display: flex; flex-direction: column; }
.group.pad { padding: 14px 16px; gap: 10px; }
.group > label { padding: 12px 16px 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.group > input { border: 0; padding: 4px 16px 12px; font-size: 17px; background: transparent; outline: none; }
.group hr { border: 0; height: 1px; background: var(--line); margin: 0 0 0 16px; }
.glabel { font-size: 13px; font-weight: 600; color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; min-height: 52px; }
.row.tight, .group.pad .row { padding: 0; min-height: 0; }
.group.row { padding: 0 16px; min-height: 52px; flex-direction: row; }
.row label { font-size: 17px; }
.pair { display: flex; gap: 6px; flex: 1; min-width: 0; justify-content: flex-end; }
.pair input { min-width: 0; flex: 1 1 auto; max-width: 62%; }
.pair input[type=time] { max-width: 38%; }
.pair input, select, input[type=date], input[type=time] { border: 0; background: #EEF0ED; border-radius: 8px; padding: 6px 8px; font-size: 16px; }
select { max-width: 60%; }
.boxed { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 17px; background: #fff; }
.note { font-size: 13px; color: var(--muted); }
.note.light { color: #DDEFEC; text-align: center; }
.err { color: var(--danger); margin: 0; min-height: 0; }
.err:empty { display: none; }

/* Switch */
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: #D5D9D6; position: relative; flex-shrink: 0; transition: background .2s; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

/* Segmented + types */
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seg button, .types button { min-height: 44px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font-size: 16px; color: var(--ink); cursor: pointer; }
.seg button[aria-checked=true], .types button[aria-checked=true] { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.types { display: flex; gap: 6px; }
.types.open { flex-wrap: wrap; }
.types button { flex: 1 1 0; min-width: 0; min-height: 64px; font-size: 11px; font-weight: 600; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 2px; white-space: nowrap; }
.types.open button { flex: 0 0 calc(25% - 5px); }

/* Lists */
.list { display: flex; flex-direction: column; gap: 6px; }
.list .head { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 2px 2px; }
.item { background: var(--card); border-radius: 14px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; border: 0; width: 100%; text-align: left; cursor: pointer; }
.item.away { background: var(--away-bg); }
.item.visited { opacity: .55; }
.item .ic { width: 40px; height: 40px; border-radius: 20px; background: var(--chip); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--ink-2); }
.item .txt { flex: 1; min-width: 0; }
.item .ti { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .me { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .who { font-size: 12px; font-weight: 600; color: var(--ink-2); background: #EEF0ED; border-radius: 10px; padding: 3px 8px; flex-shrink: 0; }
.empty { color: var(--muted); text-align: center; padding: 32px 8px; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.chips::-webkit-scrollbar { display: none; }
.chips button { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--border); background: #fff; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.chips button[aria-pressed=true] { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chips.small button { min-height: 32px; font-size: 13px; padding: 0 12px; }

/* Photos */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tile { position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: #D9DDDA; border: 0; padding: 0; cursor: pointer; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; padding: 2px 6px; font-size: 12px; font-weight: 600; }
.tile .tag { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; padding: 2px 6px; font-size: 11px; max-width: calc(100% - 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .check { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 13px; border: 2px solid #fff; background: rgba(0,0,0,.3); }
.tile.sel .check { background: var(--accent); }
.tile.sel::after { content: ''; position: absolute; inset: 0; border: 3px solid var(--accent); border-radius: 8px; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* Wishlist CTA */
.sticky-cta { position: fixed; left: 20px; right: 20px; bottom: calc(76px + var(--safe-b)); }

/* Pick */
.view.pick { background: var(--accent); color: #fff; }
.formbar.dark .link { color: #fff; }
.formbar.dark .sub { color: #fff; font-weight: 500; }
.pick h2 { font-size: 26px; text-align: center; margin-top: 12px; }
.pick-card { background: #fff; color: var(--ink); border-radius: 24px; overflow: hidden; }
.pick-art { height: 160px; background: #A68A6D; display: flex; align-items: center; justify-content: center; color: #fff; }
.pick-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; }
.pick-name { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 600; }
.pick-meta { font-size: 16px; color: var(--muted); }
.pick-link { color: var(--accent); font-weight: 600; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* Tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 0 calc(8px + var(--safe-b)); z-index: 5; }
.tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; justify-content: center; font-size: 12px; color: var(--muted); cursor: pointer; }
.tabs button[aria-current=page] { color: var(--accent); font-weight: 600; }

/* Login */
.login { justify-content: center; }
.login-card { background: #fff; border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.login-card h1 { font-size: 28px; margin-bottom: 8px; }
.login-card label { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.login-card input { border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 17px; }
.login-card .btn { margin-top: 12px; }
.tip { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin: 0 0 6px; font-size: 14px; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 15px; z-index: 10; max-width: calc(100% - 40px); }

/* Fit to the wall */
.fit-intro { font-size: 15px; margin: 0; }
.seg.two-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fit-editor { position: relative; align-self: center; background: #111; border-radius: 12px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.fit-media, .fit-media img, .fit-media video { width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.fit-editor .shade { position: absolute; left: 0; right: 0; background: rgba(0,0,0,.55); }
.fit-editor .shade.top { top: 0; }
.fit-editor .shade.bot { bottom: 0; }
.fit-editor .frame { position: absolute; left: 0; right: 0; border: 3px solid #fff; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; cursor: grab; }
.fit-editor .frame span { background: rgba(0,0,0,.6); color: #fff; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 14px; }
.fit-editor.whole .shade, .fit-editor.whole .frame { display: none; }
.fit-wall { width: 192px; height: 120px; flex-shrink: 0; align-self: center; border-radius: 10px; overflow: hidden; background: #111; border: 4px solid var(--ink); display: flex; gap: 3px; }
.fit-wall img, .fit-wall video, .fit-wall .other { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; display: block; }
.fit-wall .other { background: repeating-linear-gradient(135deg, #3E4745 0 6px, #4A5452 6px 12px); }
#fitAllWhole { align-self: center; }
.tile .fitbadge { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 600; }

/* Dog sitter + notes */
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips .new { border-style: dashed; color: var(--accent); }
.glabel.with-ic { display: flex; align-items: center; gap: 6px; }
.glabel.with-ic svg { width: 16px; height: 16px; }
.dog-new { display: flex; gap: 8px; }
.dog-new input { flex: 1; min-width: 0; }
.group > textarea { border: 0; padding: 4px 16px 8px; font: inherit; font-size: 17px; background: transparent; outline: none; resize: vertical; min-height: 72px; }
.group-note { padding: 0 16px 12px; }
