@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/nunito-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/nunito-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/nunito-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/nunito-latin-700.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/nunito-latin-800.woff2") format("woff2");
}

:root {
  --text: #1E1B2E;
  --muted: #5B5670;
  --card: #FFFFFF;
  --shadow: 0 2px 8px rgba(46, 16, 101, 0.06);
  --icon-bg: #EDE9FE;
  --icon-fg: #6D28D9;
  --price-bg: #FDE68A;
  --price-fg: #422006;
  --chip-wait-bg: #FEF3C7;
  --chip-wait-fg: #92400E;
  --chip-done-bg: #DCFCE7;
  --chip-done-fg: #166534;
  --chip-rej-bg: #FEE2E2;
  --chip-rej-fg: #991B1B;
  --plus: #166534;
  --minus: #991B1B;
  --field-border: #7C6FA8;
  --julius: #FDE68A;
  --julius-fg: #422006;
  --charlie: #C4B5FD;
  --charlie-fg: #2E1065;
  --focus: #6D28D9;
  --danger: #991B1B;
  --radius-card: 16px;
  --radius-btn: 12px;
  --bg: #FFFBF0;
  --card-border: #EDE6F7;
  --btn-primary-bg: #6D28D9;
  --btn-primary-fg: #FFFFFF;
  --btn-primary-hover: #5B21B6;
  --btn-secondary-bg: transparent;
  --btn-secondary-fg: #6D28D9;
  --btn-secondary-border: #6D28D9;
  --balance-bg: linear-gradient(135deg, #5B21B6, #7C3AED);
  --balance-label: #FFFFFF;
  --balance-amount: #FDE68A;
  --tab-active-bg: #EDE9FE;
  --tab-active-fg: #4C1D95;
  --tab-bar-border: #EDE6F7;
  --link: #6D28D9;
}

body.view-parent {
  --bg: #F6F3FF;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 700; }

:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.amount, .price, .balance__amount, .tile__amount, .booking__amount {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.app {
  width: min(100%, 440px);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  padding: calc(8px + env(safe-area-inset-top)) 20px 12px;
  min-height: 60px;
  gap: 12px;
}

.top__side { width: 44px; flex-shrink: 0; }
.top__title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.hello { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.hello__greet { font-size: 22px; font-weight: 700; line-height: 1.2; }
.hello__greet span { font-weight: 500; }

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  font-weight: 800;
  line-height: 1;
}
.avatar--lg {
  width: 48px;
  height: 48px;
  background: #fff;
  border: 3px solid var(--julius);
  color: var(--julius-fg);
  font-size: 20px;
}
.child-charlie .avatar--lg { border-color: var(--charlie); color: var(--charlie-fg); }
.avatar--sm { width: 28px; height: 28px; font-size: 13px; }
.avatar--julius, .avatar.julius, .avatar--mama, .avatar.mama { background: var(--julius); color: var(--julius-fg); }
.avatar--charlie, .avatar.charlie, .avatar--papa, .avatar.papa { background: var(--charlie); color: var(--charlie-fg); }

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.icon-btn svg, .icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.icon-btn:active { background: var(--icon-bg); }

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px 20px 28px;
}
body.has-dock .page { padding-bottom: 8px; }
body.has-dock .app { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

.balance {
  position: relative;
  overflow: hidden;
  background: var(--balance-bg);
  color: var(--balance-label);
  border-radius: var(--radius-card);
  padding: 22px 20px 20px;
  min-height: 118px;
  box-shadow: var(--shadow);
}
.balance__deco {
  position: absolute;
  right: -36px;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  height: 160px;
  pointer-events: none;
}
.balance__label, .balance__amount { position: relative; z-index: 1; }
.balance__label { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.balance__amount {
  font-size: 48px;
  line-height: 1.05;
  color: var(--balance-amount);
  letter-spacing: -0.02em;
}

h2.section, .section { margin-top: 22px; font-size: 15px; font-weight: 700; color: var(--muted); }
h2.section { margin-bottom: 12px; }
.section__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
}
.stack { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card--child {
  background:
    linear-gradient(var(--child-stripe), var(--child-stripe)) top / 100% 4px no-repeat,
    var(--card);
  padding-top: 22px;
}
.card--julius { --child-stripe: var(--julius); }
.card--charlie { --child-stripe: var(--charlie); }
.child-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.task-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
}
.task-line .ico { flex: 0 0 44px; }
.task__title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
}
.task__hint { font-size: 16px; font-weight: 500; color: var(--muted); margin-top: 10px; }
.task__foot { display: flex; justify-content: flex-end; width: 100%; margin-top: 4px; }
.card > .chip { margin-top: 10px; }
.card > .btn { margin-top: 14px; }
.catalog-add { margin-bottom: 14px; }
.catalog-tools { display: flex; justify-content: flex-end; gap: 0; margin: -8px -8px 8px; }

.ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--icon-bg);
  color: var(--icon-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ico svg, .ico .icon { width: 24px; height: 24px; }

.price {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  flex-shrink: 0;
  position: static;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--price-bg);
  color: var(--price-fg);
  font-size: 14px;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.chip .icon, .chip svg { width: 14px; height: 14px; stroke-width: 2.25; }
.chip--wait { background: var(--chip-wait-bg); color: var(--chip-wait-fg); }
.chip--done { background: var(--chip-done-bg); color: var(--chip-done-fg); }
.chip--rej { background: var(--chip-rej-bg); color: var(--chip-rej-fg); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  min-height: 44px;
  padding: 0 16px;
  width: 100%;
  text-decoration: none;
}
.btn .icon, .btn svg { width: 20px; height: 20px; stroke-width: 2.25; }
.btn-accent, .btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border: 1.5px solid transparent; }
.btn-accent:hover, .btn-primary:hover { background: var(--btn-primary-hover); }
.btn-ghost { background: transparent; color: var(--btn-secondary-fg); border: 1.5px solid var(--btn-secondary-border); }
.btn-no { background: transparent; color: var(--danger); border: none; }
.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
  border: 1.5px solid var(--btn-secondary-border);
}
.btn-done { height: 52px; min-height: 52px; margin-top: 14px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1 1 0; width: auto; height: 48px; min-height: 48px; }
.btn-text { background: transparent; border: none; color: var(--danger); }
.btn-text:hover { background: var(--chip-rej-bg); }
.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 4px;
  color: var(--link);
  font-size: 16px;
  font-weight: 700;
  background: none;
  border: none;
  width: auto;
}
.btn:active { transform: scale(0.98); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.tile {
  border-radius: var(--radius-card);
  padding: 16px;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  box-shadow: var(--shadow);
}
.tile--julius { background: var(--julius); color: var(--julius-fg); }
.tile--charlie { background: var(--charlie); color: var(--charlie-fg); }
.tile__name { font-size: 14px; font-weight: 700; }
.tile__amount { font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; }

.bookings { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 20px; }
.booking { display: grid; grid-template-columns: 88px 1fr; column-gap: 10px; }
.booking__amount { font-size: 16px; line-height: 1.3; }
.booking__amount--plus { color: var(--plus); }
.booking__amount--minus { color: var(--minus); }
.booking__title { font-size: 16px; font-weight: 700; }
.booking__meta { font-size: 14px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.empty-line { font-size: 16px; font-weight: 500; color: var(--muted); }

.field { margin-bottom: 14px; }
.field label, label.field { display: block; font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.field input, .stack input[type="text"], .stack input[type="password"], input[type="text"], input[type="password"] {
  display: block;
  width: 100%;
  height: 48px;
  min-height: 44px;
  padding: 0 14px;
  background: #fff;
  border: 1.5px solid var(--field-border);
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}
input::placeholder { color: var(--muted); opacity: 1; }
input.pin { letter-spacing: 0.35em; text-align: center; font-size: 20px; font-weight: 700; }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 440px);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--tab-bar-border);
  box-shadow: 0 -2px 10px rgba(46, 16, 101, 0.04);
  z-index: 20;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 8px 6px;
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.tab__icon { position: relative; width: 24px; height: 24px; display: flex; }
.tab .icon { width: 22px; height: 22px; }
.tab__badge {
  position: absolute;
  top: -7px;
  right: -11px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--julius);
  color: var(--julius-fg);
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.tab.on { background: var(--tab-active-bg); color: var(--tab-active-fg); }

.hero { padding: 28px 20px 8px; text-align: center; }
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; }
.brand { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; margin-top: 12px; }
.logo { border-radius: 28px; box-shadow: var(--shadow); }
.people { display: grid; gap: 16px; padding: 8px 20px 24px; }
.people-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.person {
  min-height: 148px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.person .avatar { width: 64px; height: 64px; font-size: 24px; }
.section-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  margin: 4px 4px 0;
}

.icon-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.icon-opt {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--card-border);
  background: #fff;
  color: var(--icon-fg);
}
.icon-opt input { position: absolute; opacity: 0; }
.icon-opt:has(input:checked) { border-color: var(--btn-primary-bg); background: var(--icon-bg); }

.set-title { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 8px; }
.family { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; }
.family li { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.note-push {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.note-push p { font-size: 16px; }
.note-push .btn { width: auto; }
.note-push[hidden], [hidden] { display: none !important; }

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top));
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 400px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(46, 16, 101, 0.16);
}
.toast.ok { background: var(--chip-done-bg); color: var(--chip-done-fg); }
.toast.bad { background: var(--chip-rej-bg); color: var(--chip-rej-fg); }
.flash-mark {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--chip-done-fg);
  color: #fff;
}
.toast.ok { animation: hh-pop 0.4s ease; }
.toast.ok .flash-mark { animation: hh-check 0.45s ease; }
@keyframes hh-pop {
  from { transform: translateX(-50%) translateY(-8px); opacity: 0; }
  to { transform: translateX(-50%); opacity: 1; }
}
@keyframes hh-check {
  0% { transform: scale(0.4); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.btn:active, .person:active, .icon-btn:active { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) {
  .toast.ok, .toast.ok .flash-mark, .btn:active, .person:active, .icon-btn:active {
    animation: none;
    transform: none;
  }
  .toast { transform: translateX(-50%); }
}

dialog.sheet {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(92vw, 400px);
  box-shadow: 0 16px 40px rgba(46, 16, 101, 0.18);
}
dialog.sheet::backdrop { background: rgba(30, 27, 46, 0.45); }
.sheet-body { padding: 18px; }
.center { text-align: center; padding: 8px 20px 24px; }
.linkish {
  color: var(--link);
  font-weight: 700;
  background: none;
  border: 0;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
