/* Kids Plans: shared components. */

/* ---------- Stickers ---------- */
.sticker { background: var(--paper); border: var(--bw) solid var(--ink); border-radius: var(--r-l); box-shadow: var(--shadow); }
.sticker-flat { background: var(--paper); border: var(--bw) solid var(--ink); border-radius: var(--r-m); }
.bg-orange { background: var(--orange); }
.bg-lilac { background: var(--lilac); }
.bg-cyan { background: var(--cyan); }
.bg-yellow { background: var(--yellow); }
.bg-mint { background: var(--mint); }
.bg-blue { background: var(--blue); color: #fff; }
.bg-ink { background: var(--ink); color: var(--ground); }
.bg-paper { background: var(--paper); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: var(--bw) solid var(--ink); border-radius: var(--r-s);
  background: var(--paper); color: var(--ink);
  font: 700 15px/1 var(--text); letter-spacing: .01em; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-s);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast);
  user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:active:not(:disabled) { transform: translate(1px, 1px); }
.btn-dashed { background: transparent; box-shadow: none; border-style: dashed; border-color: var(--ink-3); color: var(--ink-2); font-weight: 400; }
.btn-block { width: 100%; min-height: 52px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: var(--red); box-shadow: none; background: transparent; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: var(--bw) solid var(--ink); border-radius: var(--r-s); background: var(--paper);
  box-shadow: var(--shadow-s); transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.plain { border-color: transparent; box-shadow: none; background: transparent; }
.link-btn { background: none; border: 0; padding: 10px 0; min-height: 44px; font: 700 14px/1 var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }

/* ---------- Chips (people, families, filters) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 44px; padding: 0 14px;
  border: var(--bw) solid var(--ink); border-radius: var(--r-s);
  background: var(--paper); color: var(--ink);
  font: 700 15px/1 var(--text);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast);
}
.chip:active { transform: scale(.97); }
.chip svg { width: 16px; height: 16px; }
.chip.off { background: transparent; border-style: dashed; border-color: var(--ink-3); color: var(--ink-2); font-weight: 400; }
.chip.on { box-shadow: var(--shadow-s); }
.chip.small { min-height: 34px; padding: 0 10px; font-size: 13px; border-radius: 10px; }
.chip .x { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; border-radius: 50%; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); }

/* ---------- Segmented control ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: var(--bw) solid var(--ink); border-radius: var(--r-s); background: var(--paper); padding: 3px; gap: 3px; }
.seg button {
  min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2);
  font: 400 14px/1.1 var(--text); padding: 0 6px; transition: background var(--t-fast), color var(--t-fast);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 700; }

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font: 700 11px/1 var(--text); letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 8px; background: var(--paper); color: var(--ink); white-space: nowrap;
}
.tag svg { width: 12px; height: 12px; }
.tag.ink { background: var(--ink); color: var(--paper); }
.tag.line { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }
.tag.warn { background: var(--yellow); box-shadow: inset 0 0 0 1.5px var(--ink); }
.tag.yellow { background: var(--yellow); }
.tag.mint { background: var(--mint); }
.tag.lilac { background: var(--lilac); }
.tag.cyan { background: var(--cyan); }
.tag.orange { background: var(--orange); }

/* ---------- Dot scale (0 to 3) ---------- */
.dots { display: inline-flex; gap: 4px; align-items: center; }
.dots i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; }
.dots i.f { background: var(--ink); }
.dot-scale { display: inline-flex; gap: 2px; }
.dot-scale button { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; padding: 0; }
.dot-scale button i { width: 20px; height: 20px; border-radius: 50%; border: var(--bw) solid var(--ink); background: transparent; transition: background var(--t-fast), transform var(--t-fast) var(--ease); }
.dot-scale button.f i { background: var(--ink); }
.dot-scale button:active i { transform: scale(.85); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child, .field > label:first-child { font: 700 11px/1.2 var(--text); letter-spacing: .14em; text-transform: uppercase; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: var(--bw) solid var(--ink); border-radius: var(--r-s); background: var(--paper);
  font: 400 16px/1.3 var(--text); color: var(--ink); appearance: none; -webkit-appearance: none;
}
.textarea { min-height: 88px; resize: vertical; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231D1A3A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: var(--shadow-s); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; pointer-events: none; }
.search .input { padding-left: 42px; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 6px 0; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .knob { position: relative; width: 52px; height: 32px; flex: none; border: var(--bw) solid var(--ink); border-radius: 999px; background: var(--paper); transition: background var(--t-fast); }
.toggle .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: transform var(--t-med) var(--ease); }
.toggle input:checked + .knob { background: var(--mint); }
.toggle input:checked + .knob::after { transform: translateX(20px); }
.toggle input:focus-visible + .knob { outline: 3px solid var(--blue); outline-offset: 2px; }

.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-editor .tag-x { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 4px 0 10px; border: var(--bw) solid var(--ink); border-radius: 10px; background: var(--paper); font: 700 13px/1 var(--text); }
.tag-editor .tag-x button { width: 30px; height: 30px; border: 0; background: transparent; display: grid; place-items: center; padding: 0; }
.tag-editor .tag-x svg { width: 14px; height: 14px; }
.tag-editor input { flex: 1 1 110px; min-width: 110px; min-height: 34px; border: var(--bw) dashed var(--ink-3); border-radius: 10px; padding: 4px 10px; background: transparent; font: 400 14px var(--text); }
.tag-editor input:focus { outline: none; border-color: var(--ink); border-style: solid; }

/* ---------- Sheet ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(29, 26, 58, .42); animation: fade-in var(--t-med) var(--ease); }
.sheet {
  position: relative; width: 100%; max-width: var(--col); max-height: calc(100dvh - var(--safe-t) - 24px);
  display: flex; flex-direction: column;
  background: var(--ground); border: var(--bw) solid var(--ink); border-bottom: 0; border-radius: var(--r-l) var(--r-l) 0 0;
  animation: sheet-up var(--t-med) var(--ease);
}
.sheet.closing { animation: sheet-down 180ms var(--ease) forwards; }
.sheet-root.closing .sheet-scrim { animation: fade-out 180ms var(--ease) forwards; }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--ink-3); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px var(--gutter) 10px; flex: none; }
.sheet-head .titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px var(--gutter) calc(var(--safe-b) + 24px); display: flex; flex-direction: column; gap: 18px; }
.sheet-foot { flex: none; padding: 12px var(--gutter) calc(var(--safe-b) + 12px); border-top: var(--bw) solid var(--ink); background: var(--ground); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1 1 0; min-height: 52px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { from { transform: none; } to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@media (min-width: 700px) {
  .sheet-root { align-items: center; padding: 24px; }
  .sheet { border-bottom: var(--bw) solid var(--ink); border-radius: var(--r-l); box-shadow: 6px 6px 0 var(--ink); max-height: calc(100dvh - 48px); }
  .sheet-foot { border-radius: 0 0 var(--r-l) var(--r-l); }
}

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 80; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 440px; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--paper); border-radius: var(--r-s); padding: 10px 10px 10px 16px; min-height: 48px;
  font: 400 14px/1.3 var(--text); box-shadow: 4px 4px 0 var(--orange); animation: toast-in var(--t-med) var(--ease);
}
.toast button { background: var(--paper); color: var(--ink); border: 0; border-radius: 10px; min-height: 36px; padding: 0 12px; font: 700 13px var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; border: var(--bw) solid var(--ink); border-radius: var(--r-m); background: var(--paper); overflow: hidden; }
.list > * + *, .list > .list-row + .list-row { border-top: 1.5px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; background: transparent; border: 0; width: 100%; text-align: left; }
.list-row .grow { display: flex; flex-direction: column; gap: 2px; }
.list-row svg.chev { width: 18px; height: 18px; flex: none; color: var(--ink-2); }

.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-weight: 700; }

.empty { border: var(--bw) dashed var(--ink-3); border-radius: var(--r-m); padding: 22px 18px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; gap: 10px; align-items: center; }

.skeleton { border: var(--bw) solid var(--line); border-radius: var(--r-l); background: linear-gradient(90deg, #F5EDDD 0, #FBF4E6 40%, #F5EDDD 80%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Navigate (Waze / Google Maps / Apple Maps) ---------- */
.nav-row { display: flex; flex-wrap: wrap; gap: 8px; }
.nav-row .nav-btn { flex: 0 1 auto; min-width: 0; }
.nav-apps { gap: 10px; }
.nav-app { justify-content: flex-start; gap: 12px; padding: 0 14px; }
.nav-app .grow { text-align: left; }
.nav-app-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border: var(--bw) solid var(--ink); border-radius: 9px; font: 900 15px/1 var(--display); }
.nav-app-mark.m-waze { background: var(--cyan); }
.nav-app-mark.m-google { background: var(--yellow); }
.nav-app-mark.m-apple { background: var(--lilac); }
