:root {
  color-scheme: light;
  --bg: #faf5f3;
  --card: #ffffff;
  --ink: #30282c;
  --muted: #908589;
  --line: #efe6e5;
  --rose: #a94f68;
  --rose-dark: #894156;
  --rose-soft: #f7e6e9;
  --rose-pale: #fdf3f3;
  --green: #487a63;
  --green-soft: #e7f2eb;
  --red: #a84f55;
  --shadow: 0 10px 30px rgba(68, 43, 48, .06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.app-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  min-height: 100vh;
  padding: max(14px, env(safe-area-inset-top)) 18px calc(92px + env(safe-area-inset-bottom));
}
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 5px 1px 18px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 15px; background: linear-gradient(145deg, #bb6c82, #9a4d66);
  color: white; font-family: Georgia, serif; font-size: 24px; font-style: italic;
  box-shadow: 0 5px 14px rgba(169, 79, 104, .2);
}
.brand-name { font-family: Georgia, "Times New Roman", serif; font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.brand-caption { font-size: 11px; color: var(--muted); margin-top: 2px; }
.icon-button {
  border: 0; border-radius: 14px; width: 42px; height: 42px; background: white;
  box-shadow: var(--shadow); color: var(--rose); font-size: 24px; cursor: pointer;
}
.month-strip { display: flex; align-items: center; justify-content: space-between; margin: 2px 1px 15px; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.month-title { font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 700; margin-top: 3px; }
.month-picker { width: 38px; height: 38px; display: grid; place-items: center; position: relative; border-radius: 13px; background: white; color: var(--rose); box-shadow: var(--shadow); }
.month-picker span { font-size: 21px; transform: translateY(-2px); pointer-events: none; }
.month-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.content { display: flex; flex-direction: column; gap: 14px; }
.hero-card {
  position: relative; overflow: hidden; border-radius: 24px; padding: 22px 22px 21px;
  color: #fff; background: linear-gradient(135deg, #b7637b 0%, #98506a 60%, #81465d 100%);
  box-shadow: 0 12px 28px rgba(148, 70, 94, .2);
}
.hero-card::after { content: ""; width: 190px; height: 190px; border-radius: 50%; position: absolute; right: -62px; top: -72px; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 0 0 22px rgba(255,255,255,.035), 0 0 0 44px rgba(255,255,255,.025); }
.hero-label { position: relative; z-index: 1; color: rgba(255,255,255,.8); font-size: 13px; }
.hero-value { position: relative; z-index: 1; margin: 10px 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 9vw, 43px); line-height: 1.08; font-weight: 700; letter-spacing: -.8px; }
.hero-sub { position: relative; z-index: 1; color: rgba(255,255,255,.78); font-size: 12px; }
.hero-meta { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin-top: 20px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.2); font-size: 12px; }
.trend { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 20px; background: rgba(255,255,255,.15); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.stat-card { background: var(--card); border: 1px solid rgba(239,230,229,.7); border-radius: 18px; padding: 15px 15px 14px; box-shadow: var(--shadow); min-width: 0; }
.stat-head { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.stat-icon { width: 25px; height: 25px; border-radius: 9px; display: grid; place-items: center; background: var(--rose-soft); color: var(--rose); font-size: 13px; }
.stat-card.expense .stat-icon { background: #f7eeee; color: #a85b5d; }
.stat-card.profit .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card.visits .stat-icon { background: #f1ebf6; color: #785b91; }
.stat-value { font-size: clamp(18px, 5.2vw, 23px); font-weight: 700; margin-top: 9px; letter-spacing: -.4px; white-space: nowrap; }
.stat-note { color: var(--muted); font-size: 10px; margin-top: 3px; }
.section-card { background: var(--card); border: 1px solid rgba(239,230,229,.7); border-radius: 20px; padding: 17px; box-shadow: var(--shadow); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
.section-title { font-size: 15px; font-weight: 700; }
.section-link { padding: 5px 0 5px 6px; background: transparent; border: 0; color: var(--rose); font-size: 12px; cursor: pointer; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-button {
  border: 0; border-radius: 16px; min-height: 54px; padding: 11px 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer; transition: transform .12s ease, opacity .12s ease;
}
.action-button:active, .primary-button:active, .small-button:active { transform: scale(.98); }
.action-income { color: white; background: var(--rose); box-shadow: 0 6px 14px rgba(169,79,104,.17); }
.action-expense { color: var(--ink); background: #f2ecea; }
.action-symbol { font-size: 18px; }
.chart { height: 124px; display: flex; align-items: end; gap: 5px; padding: 4px 0 19px; position: relative; }
.chart-bar-wrap { flex: 1; height: 100%; display: flex; align-items: end; position: relative; min-width: 0; }
.chart-bar { width: 100%; min-height: 3px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg,#d68b9c,#b15d76); }
.chart-bar.zero { background: #f2e8e9; }
.chart-day { position: absolute; bottom: -19px; width: 100%; text-align: center; font-size: 9px; color: #a49a9d; }
.chart-empty { width: 100%; align-self: center; text-align: center; color: var(--muted); font-size: 12px; }
.activity-list { display: flex; flex-direction: column; }
.activity-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid #f3eded; }
.activity-row:first-child { border-top: 0; padding-top: 0; }
.activity-icon { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto; font-size: 16px; background: var(--green-soft); color: var(--green); }
.activity-icon.out { background: #f7eeee; color: var(--red); }
.activity-main { flex: 1; min-width: 0; }
.activity-name { font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-date { color: var(--muted); font-size: 10px; margin-top: 4px; }
.activity-amount { font-weight: 700; font-size: 13px; white-space: nowrap; }
.activity-amount.in { color: var(--green); }
.activity-amount.out { color: var(--red); }
.empty-state { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.6; }
.empty-emoji { display: block; font-size: 25px; margin-bottom: 6px; }
.page-heading { margin: 2px 1px 0; }
.page-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 25px; }
.page-heading p { color: var(--muted); margin: 5px 0 0; font-size: 12px; }
.filter-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.filter-chip { border: 1px solid var(--line); border-radius: 20px; padding: 8px 12px; background: white; color: var(--muted); font-size: 11px; white-space: nowrap; cursor: pointer; }
.filter-chip.selected { border-color: var(--rose); background: var(--rose-soft); color: var(--rose-dark); font-weight: 700; }
.search-box, .field input, .field select, .field textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); padding: 10px 12px; outline: none;
}
.search-box { font-size: 13px; }
.search-box:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: #d79aaa; box-shadow: 0 0 0 3px rgba(215,154,170,.14); }
.record-card { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-top: 1px solid #f2ebea; }
.record-card:first-child { border-top: 0; }
.record-info { flex: 1; min-width: 0; }
.record-title { font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-sub { color: var(--muted); font-size: 10px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-actions { display: flex; gap: 5px; }
.tiny-button { border: 1px solid var(--line); background: white; color: var(--rose); border-radius: 10px; min-width: 32px; height: 32px; font-size: 13px; cursor: pointer; }
.tiny-button.delete { color: var(--red); }
.metric-list { display: flex; flex-direction: column; gap: 13px; }
.metric-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.metric-line span:first-child { color: var(--muted); }
.metric-line strong { white-space: nowrap; }
.compare-card { background: var(--rose-pale); border: 1px solid #f4e5e7; border-radius: 15px; padding: 13px; font-size: 12px; line-height: 1.55; }
.progress-list { display: flex; flex-direction: column; gap: 12px; }
.progress-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; align-items: center; }
.progress-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.progress-value { font-size: 11px; font-weight: 700; }
.progress-track { grid-column: 1 / -1; height: 6px; border-radius: 5px; overflow: hidden; background: #f1e9e9; }
.progress-fill { height: 100%; background: linear-gradient(90deg,#d891a2,#ad5b74); border-radius: inherit; }
.service-row { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-top: 1px solid #f2ebea; }
.service-row:first-child { border-top: 0; }
.service-flower { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--rose-soft); color: var(--rose); flex: 0 0 auto; }
.service-info { flex: 1; min-width: 0; }
.service-name { font-size: 12px; font-weight: 650; }
.service-category { color: var(--muted); font-size: 10px; margin-top: 4px; }
.service-price { font-size: 12px; font-weight: 700; white-space: nowrap; }
.service-controls { display: flex; gap: 5px; }
.primary-button, .secondary-button, .danger-button {
  border: 0; border-radius: 13px; min-height: 46px; padding: 0 16px; cursor: pointer; font-size: 13px; font-weight: 700;
}
.primary-button { color: white; background: var(--rose); box-shadow: 0 6px 15px rgba(169,79,104,.17); }
.secondary-button { color: var(--rose-dark); background: var(--rose-soft); }
.danger-button { color: white; background: var(--red); }
.full-button { width: 100%; }
.modal-backdrop { position: fixed; z-index: 20; inset: 0; background: rgba(38,28,31,.42); display: flex; align-items: end; justify-content: center; padding: 0; }
.modal-sheet { width: min(100%, 560px); max-height: min(92vh, 860px); overflow-y: auto; background: var(--bg); border-radius: 23px 23px 0 0; padding: 10px 18px max(20px, env(safe-area-inset-bottom)); box-shadow: 0 -10px 35px rgba(40,27,30,.15); animation: rise .18s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.sheet-grab { width: 39px; height: 4px; border-radius: 4px; background: #ddcecf; margin: 0 auto 15px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.modal-title { font-family: Georgia, "Times New Roman", serif; font-size: 21px; font-weight: 700; }
.close-button { border: 0; width: 34px; height: 34px; border-radius: 12px; background: white; color: var(--muted); font-size: 19px; cursor: pointer; }
.form-stack { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label { font-size: 11px; color: #71676b; font-weight: 650; }
.field input, .field select, .field textarea { font-size: 13px; }
.field textarea { min-height: 74px; resize: vertical; }
.field-hint { color: var(--muted); font-size: 10px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.service-editor-list { display: flex; flex-direction: column; gap: 8px; }
.service-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) 82px 34px; gap: 6px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.service-editor-row select, .service-editor-row input { min-width: 0; width: 100%; height: 38px; border: 0; border-radius: 9px; background: #faf7f6; padding: 0 8px; font-size: 11px; color: var(--ink); outline: none; }
.service-editor-row .custom-name { grid-column: 1 / -1; }
.remove-row { border: 0; width: 32px; height: 34px; border-radius: 9px; color: var(--red); background: #f9eded; cursor: pointer; }
.add-line { border: 1px dashed #d7a5b0; background: transparent; color: var(--rose); border-radius: 12px; min-height: 39px; font-size: 11px; font-weight: 700; cursor: pointer; }
.total-box { display: flex; align-items: center; justify-content: space-between; padding: 12px 13px; border-radius: 14px; background: #f4e6e8; color: var(--rose-dark); font-size: 12px; }
.total-box strong { font-size: 16px; }
.payment-split { display: none; }
.payment-split.visible { display: grid; }
.notice { border-radius: 12px; padding: 11px 12px; background: #fff5e6; color: #765b31; font-size: 11px; line-height: 1.5; }
.loading-card, .error-card { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 130px; background: white; border-radius: 18px; color: var(--muted); font-size: 12px; box-shadow: var(--shadow); text-align: center; padding: 20px; }
.error-card { display: block; color: var(--red); line-height: 1.6; }
.loader { width: 19px; height: 19px; border: 2px solid #f0dfe2; border-top-color: var(--rose); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bottom-nav {
  position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100%, 560px); padding: 8px 8px max(9px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4,1fr); background: rgba(255,255,255,.95);
  border-top: 1px solid #eee5e5; backdrop-filter: blur(16px);
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: transparent; color: #9b9093; padding: 4px 2px 2px; font-size: 9px; cursor: pointer; }
.nav-item.active { color: var(--rose-dark); font-weight: 700; }
.nav-icon { font-size: 20px; line-height: 22px; }
.toast { position: fixed; z-index: 40; bottom: calc(78px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; background: #322a2e; color: white; padding: 11px 16px; border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 12px; max-width: calc(100% - 32px); text-align: center; transition: opacity .16s ease, transform .16s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 520px) {
  .app-shell { padding-left: 22px; padding-right: 22px; }
  .modal-backdrop { align-items: center; padding: 16px; }
  .modal-sheet { border-radius: 23px; }
}

.tip-presets { display: flex; gap: 6px; margin-top: 7px; }
.tip-chip { flex: 1; border: 1px solid #efdce0; border-radius: 9px; min-height: 30px; background: #fff8f8; color: var(--rose-dark); font-size: 10px; cursor: pointer; }
.tip-chip:active { background: var(--rose-soft); }
