/* ===========================================================
   Our Little Ledger — pastel pink design system
   My Melody / LinaBell mood · soft, rounded, minimal
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Nunito:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  /* ---- palette ---- */
  --bg:           #FFF3F7;   /* soft pink wash */
  --bg-2:         #FDEBF2;
  --surface:      #FFFFFF;
  --surface-soft: #FFF7FB;
  --line:         #FBDCE8;   /* hairline pink */
  --line-soft:    #F7E7EE;

  --pink:         #FFB8D4;   /* my melody bow pink */
  --pink-soft:    #FFD7E6;
  --pink-wash:    #FFEAF2;
  --rose:         #EC6F9E;   /* deep accent / buttons */
  --rose-deep:    #DB5A8C;
  --cream:        #FCE7D8;   /* warm cream */
  --cream-deep:   #F6D3BC;
  --lav:          #E5C9F2;   /* linabell lavender */
  --lav-deep:     #C79BE0;
  --mint:         #BCE8D2;   /* positive */
  --mint-deep:    #6BC39A;
  --sky:          #C6E2F5;

  --ink:          #5A4750;   /* warm plum-grey text */
  --ink-soft:     #8A7682;
  --ink-faint:    #B5A3AD;

  /* ---- accent (tweakable) ---- */
  --accent:       var(--rose);
  --accent-soft:  var(--pink-soft);
  --accent-wash:  var(--pink-wash);

  /* ---- shape ---- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;
  --r-pill: 999px;

  /* ---- shadow ---- */
  --sh-sm: 0 2px 8px rgba(220,120,160,.10);
  --sh-md: 0 8px 24px rgba(220,120,160,.13);
  --sh-lg: 0 18px 48px rgba(220,120,160,.18);
  --sh-pop: 0 24px 70px rgba(180,90,130,.26);

  --ease: cubic-bezier(.34, 1.32, .44, 1);   /* gentle overshoot */
  --ease-soft: cubic-bezier(.4, 0, .2, 1);

  --font-ui: 'Quicksand', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--pink-soft); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--pink); background-clip: content-box; }

h1,h2,h3,h4 { font-family: var(--font-ui); font-weight: 700; margin: 0; letter-spacing: -.01em; }

/* ============ shell layout ============ */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- sidebar ---------- */
.side {
  background: linear-gradient(185deg, #FFFFFF 0%, #FFF6FA 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 6px;
  overflow: hidden;
}
.mobile-side-close, .mobile-menu-btn, .mobile-side-scrim { display: none; }
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 16px;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--pink) 0%, var(--rose) 100%);
  box-shadow: var(--sh-sm);
  flex-shrink: 0;
}
.brand-name { font-family: var(--font-ui); font-weight: 700; font-size: 18px; line-height: 1.05; }
.brand-name small { display: block; font-size: 11px; font-weight: 600; color: var(--ink-faint); letter-spacing: .04em; }

.side-label {
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint);
  padding: 12px 10px 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.side-label button { color: var(--ink-faint); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 8px; transition: .15s; }
.side-label button:hover { background: var(--pink-wash); color: var(--rose); }

.proj-list { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.proj {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: var(--r-md);
  transition: background .15s, transform .15s;
  text-align: left; width: 100%;
  position: relative;
}
.proj:hover { background: var(--pink-wash); }
.proj.active { background: var(--accent-wash); box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.proj-emoji {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 17px;
  background: var(--surface); box-shadow: var(--sh-sm);
}
.proj-meta { flex: 1; min-width: 0; }
.proj-name { font-family: var(--font-ui); font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-sub { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; }
.proj.active .proj-name { color: var(--rose-deep); }

.side-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.side-btn {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: var(--r-md);
  font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: var(--ink-soft);
  transition: .15s; width: 100%; text-align: left;
}
.side-btn:hover { background: var(--pink-wash); color: var(--rose); }
.side-btn.danger:hover { background: #FEEAEA; color: #E06363; }

.owners-row { display: flex; gap: 6px; padding: 8px 6px 2px; }
.owner-chip {
  flex: 1; display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; border-radius: var(--r-pill);
  background: var(--surface-soft); box-shadow: var(--sh-sm);
  font-family: var(--font-ui); font-weight: 600; font-size: 12.5px;
}
.avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-family: var(--font-ui);
  font-weight: 700; font-size: 11px;
}

/* ---------- main ---------- */
.main { overflow-y: auto; position: relative; }
.main-inner { max-width: 920px; margin: 0 auto; padding: 26px 34px 80px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(255,243,247,.82);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner { max-width: 920px; margin: 0 auto; padding: 16px 34px; display: flex; align-items: center; gap: 14px; }
.proj-title { font-family: var(--font-ui); font-weight: 700; font-size: 23px; display: flex; align-items: center; gap: 11px; }
.proj-title .proj-emoji { width: 38px; height: 38px; font-size: 20px; border-radius: 12px; }
.spacer { flex: 1; }

.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: var(--r-pill); box-shadow: var(--sh-sm); }
.tab {
  padding: 8px 18px; border-radius: var(--r-pill);
  font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: var(--ink-soft);
  transition: .18s var(--ease);
}
.tab.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(220,90,140,.32); }
.tab:not(.active):hover { background: var(--pink-wash); color: var(--rose); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 18px; border-radius: var(--r-pill);
  font-family: var(--font-ui); font-weight: 600; font-size: 14.5px;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(220,90,140,.32); }
.btn-primary:hover { box-shadow: 0 10px 24px rgba(220,90,140,.4); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--rose); box-shadow: var(--sh-sm); }
.btn-ghost:hover { background: var(--pink-wash); }
.btn-soft { background: var(--accent-wash); color: var(--rose-deep); }
.btn-soft:hover { background: var(--accent-soft); }
.btn-sm { padding: 8px 13px; font-size: 13px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 50%; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-md); padding: 22px;
}
.card-soft { background: var(--surface-soft); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-sm); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 2px 14px; }
.section-head h3 { font-size: 16px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* ---------- stat cards ---------- */
.stat {
  border-radius: var(--r-lg); padding: 20px 22px; position: relative; overflow: hidden;
  box-shadow: var(--sh-md);
}
.stat .stat-label { font-family: var(--font-ui); font-weight: 700; font-size: 12.5px; letter-spacing: .03em; opacity: .85; }
.stat .stat-val { font-family: var(--font-ui); font-weight: 700; font-size: 30px; line-height: 1.1; margin-top: 6px; letter-spacing: -.02em; }
.stat .stat-sub { font-size: 12.5px; font-weight: 600; margin-top: 4px; opacity: .72; }
.stat-deco { position: absolute; right: -12px; bottom: -16px; opacity: .22; }

/* ---------- entries ---------- */
.entry-list { display: flex; flex-direction: column; gap: 9px; }
.entry {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: var(--r-md);
  padding: 13px 16px; box-shadow: var(--sh-sm);
  transition: transform .15s var(--ease), box-shadow .2s;
  cursor: pointer; position: relative;
}
.entry:hover { transform: translateX(2px); box-shadow: var(--sh-md); }
.entry-ico { width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; display: grid; place-items: center; }
.entry-body { flex: 1; min-width: 0; }
.entry-name { font-family: var(--font-ui); font-weight: 600; font-size: 15px; }
.entry-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 12px; color: var(--ink-faint); font-weight: 600; flex-wrap: wrap; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-faint); opacity: .6; }
.entry-amt { text-align: right; flex-shrink: 0; }
.entry-amt .amt { font-family: var(--font-ui); font-weight: 700; font-size: 16px; white-space: nowrap; }
.entry-amt .amt.blank { color: var(--ink-faint); font-weight: 600; font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: .02em;
}
.chip-spent  { background: #FEEAF0; color: #D9568A; }
.chip-have   { background: #E7F6EE; color: #3FA277; }
.chip-recv   { background: #EAF1FB; color: #5683C4; }

/* type pill */
.type-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 5px; border-radius: var(--r-pill); font-family: var(--font-ui); font-weight: 600; font-size: 12px; }

/* ---------- modal ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(120,70,95,.28); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 24px;
  animation: fade .2s var(--ease-soft);
}
.modal {
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--sh-pop); width: 100%; max-width: 480px;
  max-height: 88vh; overflow-y: auto;
  animation: pop .32s var(--ease);
}
.modal-wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 6px; }
.modal-head h2 { font-size: 19px; flex: 1; }
.modal-body { padding: 12px 24px 24px; }
.modal-x { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); transition: .15s; }
.modal-x:hover { background: var(--pink-wash); color: var(--rose); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- form ---------- */
.field { margin-bottom: 15px; }
.field > label { display: block; font-family: var(--font-ui); font-weight: 600; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 7px; padding-left: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 15px; border-radius: var(--r-md);
  background: var(--surface-soft); border: 1.5px solid var(--line);
  font-size: 14.5px; font-weight: 600; transition: .16s; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-soft); background: #fff; box-shadow: 0 0 0 4px var(--accent-wash); }
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); font-weight: 500; }
.textarea { resize: vertical; min-height: 64px; font-family: var(--font-body); }
.row { display: flex; gap: 11px; }
.row > * { flex: 1; }

/* segmented */
.seg { display: flex; gap: 5px; background: var(--surface-soft); padding: 5px; border-radius: var(--r-md); border: 1.5px solid var(--line); }
.seg button { flex: 1; padding: 9px; border-radius: 11px; font-family: var(--font-ui); font-weight: 600; font-size: 13px; color: var(--ink-soft); transition: .15s; display:flex; align-items:center; justify-content:center; gap:6px; }
.seg button.on { background: #fff; color: var(--rose-deep); box-shadow: var(--sh-sm); }

/* selectable grid (types / icons / currencies) */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px,1fr)); gap: 9px; }
.pick {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 8px; border-radius: var(--r-md);
  background: var(--surface-soft); border: 1.5px solid var(--line); transition: .15s;
}
.pick:hover { border-color: var(--accent-soft); }
.pick.on { border-color: var(--accent); background: var(--accent-wash); box-shadow: 0 0 0 3px var(--accent-wash); }
.pick span { font-family: var(--font-ui); font-weight: 600; font-size: 11.5px; text-align: center; }

.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.icon-cell { aspect-ratio: 1; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-soft); border: 1.5px solid var(--line); transition: .15s; }
.icon-cell:hover { border-color: var(--accent-soft); }
.icon-cell.on { border-color: var(--accent); background: var(--accent-wash); }

.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; transition: .15s; position: relative; }
.swatch.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ink); }
.swatch:hover { transform: scale(1.12); }

/* config list rows */
.cfg-row { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-soft); margin-bottom: 8px; }
.cfg-row .grip { color: var(--ink-faint); cursor: grab; }
.cfg-actions { display: flex; gap: 5px; }
.icn-btn { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-soft); transition: .15s; }
.icn-btn:hover { background: #fff; color: var(--rose); box-shadow: var(--sh-sm); }
.icn-btn.danger:hover { color: #E06363; }

/* empty state */
.empty { text-align: center; padding: 56px 24px; }
.empty-art { width: 92px; height: 92px; margin: 0 auto 18px; border-radius: 28px; display: grid; place-items: center; background: linear-gradient(160deg, var(--pink-wash), var(--cream)); box-shadow: var(--sh-md); }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--ink-soft); font-size: 14px; max-width: 320px; margin: 0 auto 18px; line-height: 1.5; }

/* mini bar chart */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 12px; }
.bar-label { display: flex; align-items: center; gap: 8px; font-family: var(--font-ui); font-weight: 600; font-size: 13px; }
.bar-track { height: 11px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .6s var(--ease); }
.bar-val { font-family: var(--font-ui); font-weight: 700; font-size: 13px; }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--r-pill);
  font-family: var(--font-ui); font-weight: 600; font-size: 14px; box-shadow: var(--sh-lg);
  display: flex; align-items: center; gap: 9px; animation: rise .3s var(--ease); }

.fade-in { animation: rise .35s var(--ease) both; }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .side {
    display: flex; position: fixed; inset: 0 auto 0 0; z-index: 90;
    width: min(86vw, 320px); padding-top: max(18px, env(safe-area-inset-top));
    transform: translateX(-105%); visibility: hidden;
    transition: transform .24s var(--ease-soft), visibility 0s linear .24s;
    box-shadow: 18px 0 48px rgba(90,71,80,.18);
  }
  .side.mobile-open {
    transform: translateX(0); visibility: visible;
    transition: transform .24s var(--ease-soft), visibility 0s;
  }
  .mobile-side-close {
    display: grid; place-items: center; width: 36px; height: 36px; margin-left: auto;
    border-radius: 12px; color: var(--ink-soft); background: var(--surface-soft);
  }
  .mobile-side-scrim {
    display: block; position: fixed; inset: 0; z-index: 85;
    background: rgba(90,71,80,.30); backdrop-filter: blur(2px);
  }
  .mobile-menu-btn {
    display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px;
    border-radius: 13px; color: var(--rose-deep); background: var(--surface);
    box-shadow: var(--sh-sm);
  }
  .topbar-inner { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .topbar-inner > .spacer { display: none; }
  .topbar-inner > .tabs { width: 100%; order: 3; }
  .topbar-inner > .tabs .tab { flex: 1; }
  .proj-title { flex: 1; min-width: 0; font-size: 19px; gap: 9px; }
  .proj-title .proj-emoji { width: 36px; height: 36px; font-size: 19px; }
  .main-inner { padding: 18px 16px 96px; }
  .main > .btn-primary[style*="position: fixed"] { right: 16px !important; bottom: max(18px, env(safe-area-inset-bottom)) !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 92px 1fr auto; gap: 8px; }
  .card { padding: 19px; }
  .scrim { padding: 12px; }
  .modal { max-height: 94vh; border-radius: 26px; }
  .modal-head { padding: 18px 18px 6px; }
  .modal-body { padding: 12px 18px 20px; }
  .row { flex-direction: column; gap: 0; }
}
