/* ---------- layout helpers ---------- */
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.gap { gap: var(--sp-2); } .gap3 { gap: var(--sp-3); }
.end { justify-content: flex-end; } .between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: var(--sp-4); } .mt2 { margin-top: var(--sp-2); } .mb { margin-bottom: var(--sp-4); }
.stack > * + * { margin-top: var(--sp-3); }
.stack-lg > * + * { margin-top: var(--sp-5); }
.flow > * + * { margin-top: var(--sp-4); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: var(--sp-4);
}
.card.tight { padding: var(--sp-3); }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: var(--sp-3); }
.card-title h2, .card-title h3 { flex: 1; }
.card-title .ico { color: var(--accent); }
.section-label { font-family: var(--f-ui); font-weight: 500; font-size: var(--fs-sm); color: var(--muted); letter-spacing: .02em; margin: var(--sp-6) 4px var(--sp-2); display: flex; align-items: center; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: var(--sp-3) 0; border: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--r-md); border: 1px solid transparent;
  font-family: var(--f-ui); font-weight: 500; font-size: var(--fs-base); cursor: pointer; text-decoration: none;
  transition: transform .15s var(--ease), background-color .15s, box-shadow .15s;
  background: var(--surface-2); color: var(--text);
}
.btn:active, .icon-btn:active, .press:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-on); box-shadow: 0 6px 16px -8px var(--accent); }
.btn.pine { background: var(--pine); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.big { min-height: 60px; font-size: var(--fs-md); border-radius: 20px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 48px; height: 48px; flex: none; display: inline-grid; place-items: center;
  border-radius: 14px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn.solid { background: var(--surface-2); color: var(--text); }
.link-btn { background: none; border: 0; color: var(--accent); font-family: var(--f-ui); font-weight: 500; cursor: pointer; min-height: 48px; padding: 0 6px; }

/* ---------- forms ---------- */
.field { display: block; }
.field > span { display: block; font-family: var(--f-ui); font-weight: 500; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; }
.input, .field input, .field select, .field textarea, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-solid); color: var(--text); font-size: var(--fs-base);
}
textarea.input, .field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.inline-input { border: 1px solid transparent; background: transparent; padding: 6px 8px; margin: -6px -8px; border-radius: 10px; width: calc(100% + 16px); min-height: 48px; }
.inline-input:hover { border-color: var(--line); }
.inline-input:focus { background: var(--surface-solid); border-color: var(--accent); outline: none; }

.seg { display: flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: var(--r-md); overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1; min-height: 48px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-family: var(--f-ui); font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed='true'], .seg button[aria-selected='true'] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; cursor: pointer; }
.switch input { appearance: none; width: 52px; height: 32px; border-radius: 16px; background: var(--glacier-soft); position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--pine); }
.switch input:checked::after { transform: translateX(20px); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 12px; border-radius: var(--r-pill); background: var(--surface-2); font-family: var(--f-ui); font-size: var(--fs-sm); font-weight: 500; color: var(--text); white-space: nowrap; }
.chip .ico { width: 16px; height: 16px; color: var(--muted); }
.chip.est::before { content: '~'; color: var(--muted); margin-right: -4px; }
.cchip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 5px; border-radius: 8px; background: var(--surface-2); font-family: var(--f-ui); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .03em; line-height: 1.7; vertical-align: middle; white-space: nowrap; }
.cchip .flag { border-radius: 2px; flex: none; }
.cchip span:not(.sr-only) { font-weight: 500; letter-spacing: 0; }
.cchips { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cchips .arrow { color: var(--muted); font-size: var(--fs-xs); }
.place-c { color: var(--muted); }
.daychips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-snap-type: x proximity; scrollbar-width: none; }
.daychips::-webkit-scrollbar { display: none; }
.daychip { scroll-snap-align: start; flex: none; min-width: 60px; min-height: 60px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; font-family: var(--f-ui); padding: 4px 10px; }
.daychip b { font-size: var(--fs-md); line-height: 1.1; }
.daychip small { font-size: var(--fs-xs); color: var(--muted); }
.daychip[aria-pressed='true'] { background: var(--accent); color: var(--accent-on); border-color: transparent; }
.daychip[aria-pressed='true'] small { color: inherit; opacity: .85; }

/* ---------- rating & mood ---------- */
.stars { display: inline-flex; gap: 2px; }
.stars button { width: 48px; height: 48px; border: 0; background: none; cursor: pointer; color: var(--glacier-soft); padding: 0; display: grid; place-items: center; }
.stars button[aria-checked='true'] { color: var(--gold); }
.stars button[aria-checked='true'] .ico { fill: var(--gold); }
.stars.readonly .ico { width: 16px; height: 16px; }
.moods { display: flex; gap: 4px; flex-wrap: wrap; }
.moods button { width: 48px; height: 48px; border-radius: 14px; border: 1px solid transparent; background: var(--surface-2); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.moods button[aria-checked='true'] { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.banner .ico { flex: none; margin-top: 2px; }
.banner ul { margin: 0; padding-left: 18px; }
.banner.info { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.banner.info .ico { color: var(--accent); }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 22, 36, .45); opacity: 0; transition: opacity .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 640px; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--surface-solid); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lg);
  padding-bottom: var(--safe-b);
  transform: translateY(100%); transition: transform .24s var(--ease);
}
.sheet-wrap.in .sheet { transform: none; }
.sheet-wrap.in .sheet-backdrop { opacity: 1; }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; }
.sheet-head { display: flex; align-items: center; padding: 6px 8px 4px 20px; }
.sheet-head h2 { flex: 1; font-size: var(--fs-md); }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; }
.lead { font-size: var(--fs-md); line-height: 1.6; }

/* ---------- toast ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; padding: 12px 12px 12px 18px; border-radius: var(--r-md); background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); font-family: var(--f-ui); opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s var(--ease); }
:root[data-theme='dark'] .toast { background: #E4EDF5; color: var(--navy); }
.toast.in { opacity: 1; transform: none; }
.toast-btn { min-height: 40px; padding: 0 14px; border-radius: 12px; border: 0; background: rgba(255,255,255,.16); color: inherit; font-weight: 600; cursor: pointer; }

/* ---------- empty & skeleton ---------- */
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); }
.empty-art { width: 160px; height: 100px; margin: 0 auto var(--sp-3); }
.empty p { color: var(--muted); margin-bottom: var(--sp-4); font-size: var(--fs-md); }
.skeleton { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 300% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- list rows ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-ui); font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.badge.hl { background: rgba(217, 169, 58, .18); color: #7A5A0F; }
:root[data-theme='dark'] .badge.hl { color: #F1D48C; }
.badge.food { background: rgba(233, 150, 122, .18); color: var(--alpen-ink); }
.badge.lesson { background: rgba(42, 111, 107, .16); color: var(--pine-ink); }
.badge .ico { width: 14px; height: 14px; }

.bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--glacier), var(--pine)); }
