:root {
  --ivory: #EAE6DE; --paper: #F4F1EB; --white: #FFFFFF;
  --blue: #226192; --blue-soft: #DCE8F3; --blue-ink: #16324F;
  --coral: #EF8557; --coral-soft: #FBE3D6; --coral-ink: #9A3E17;
  --ink: #1C1917; --muted: #57534E; --line: #D6CFC2; --field: #CFC6B8;
  --green: #15803D; --green-soft: #DCFCE7; --green-ink: #166534;
  --display: 'Archivo', 'Mukta', system-ui, sans-serif;
  --body: 'Mukta', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ivory); color: var(--ink); font-family: var(--body); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.display { font-family: var(--display); font-stretch: 125%; font-weight: 700; color: var(--blue); letter-spacing: -0.01em; }
.kn { font-family: 'Noto Sans Kannada', sans-serif; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* header */
.top { display: flex; align-items: center; gap: 6px; padding: calc(14px + env(safe-area-inset-top)) 12px 8px; position: sticky; top: 0; background: var(--ivory); z-index: 5; }
.top .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top h1 { margin: 0; font-size: 19px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sub { font-size: 14px; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border: none; background: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; flex-shrink: 0; text-decoration: none; }
.icon-btn:active { background: var(--paper); }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* home */
.brand { padding: calc(28px + env(safe-area-inset-top)) 20px 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.brand h1 { margin: 0; font-size: 30px; line-height: 1.1; }
.brand .kn { color: var(--coral-ink); font-size: 15px; }
.section { padding: 8px 20px; display: flex; flex-direction: column; gap: 12px; }
.event-card { display: flex; flex-direction: column; gap: 12px; background: var(--blue); color: var(--white); border-radius: 16px; padding: 18px; text-decoration: none; }
.event-card h2 { margin: 0; font-family: var(--display); font-stretch: 125%; font-size: 20px; line-height: 1.2; }
.event-card .meta { color: var(--blue-soft); font-size: 15px; }
.event-card .bar { background: rgba(255,255,255,0.25); }
.event-card .pill-coral { background: var(--coral); color: var(--ink); }
.event-card .pill-outline { border: 1px solid var(--blue-soft); color: var(--white); }
.event-card.past { background: var(--white); color: var(--ink); border: 1px solid var(--line); }
.event-card.past h2 { color: var(--blue); }
.event-card.past .meta { color: var(--muted); }
.event-card.past .bar { background: var(--paper); }
.bar { height: 8px; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--coral); border-radius: 4px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { font-size: 14px; border-radius: 999px; padding: 3px 10px; font-weight: 600; }

/* tabs and chips */
.tabs { display: flex; gap: 0; margin: 4px 16px 8px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); }
.tabs button { flex: 1; min-height: 44px; border: none; background: none; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--blue); color: var(--white); }
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { display: flex; flex-direction: column; align-items: flex-start; padding: 7px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); flex-shrink: 0; min-height: 52px; cursor: pointer; text-align: left; }
.day b { font-size: 15px; white-space: nowrap; }
.day span { font-size: 13px; white-space: nowrap; color: var(--muted); }
.day[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: var(--white); }
.day[aria-pressed="true"] span { color: var(--blue-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.chip { font-size: 14px; border-radius: 999px; padding: 4px 12px; min-height: 36px; border: 1px solid var(--field); background: var(--white); color: #44403C; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: var(--white); font-weight: 600; }
.chip.coral[aria-pressed="true"] { background: var(--coral); border-color: var(--coral); color: var(--ink); }
.strip { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px; background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.strip .eyebrow { font-size: 12px; }
.link-btn { border: none; background: none; color: var(--blue); font-weight: 600; min-height: 36px; cursor: pointer; padding: 0 4px; }

/* lists */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--paper); background: var(--ivory); }
.item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; border: none; background: none; padding: 0; cursor: pointer; }
.item .name { font-size: 17px; font-weight: 600; line-height: 1.25; }
.item .name small { font-weight: 400; color: var(--muted); font-size: 16px; }
.item .meta { font-size: 14px; color: var(--muted); }
.item.got .name { text-decoration: line-through; color: #78716C; }
.check { width: 30px; height: 30px; border-radius: 15px; border: 2px solid #7A7367; background: var(--white); flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.check.ordered { border-color: var(--blue); background: var(--blue-soft); }
.check.got { border-color: var(--green); background: var(--green); color: var(--white); }
.check svg { width: 16px; height: 16px; }
.avatar { width: 34px; height: 34px; border-radius: 17px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; background: var(--blue-soft); color: var(--blue); border: none; }
.avatar.none { background: var(--white); color: var(--muted); border: 1px dashed #7A7367; font-weight: 500; }
.avatar.lg { width: 44px; height: 44px; border-radius: 22px; font-size: 16px; }
.status-tag { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.status-tag.ordered { background: var(--blue-soft); color: var(--blue); }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }

/* bottom bar */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; background: var(--white); border-top: 1px solid var(--line); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); z-index: 6; }
.bottom .inner { max-width: 528px; margin: 0 auto; display: flex; gap: 10px; }
.btn { min-height: 50px; border-radius: 14px; padding: 0 18px; border: 1px solid var(--field); background: var(--white); font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.btn.wa { background: var(--green); border-color: var(--green); color: var(--white); }
.btn.danger { color: #B91C1C; border-color: #FCA5A5; }
.btn.grow { flex: 1; }
.btn.square { width: 50px; padding: 0; flex-shrink: 0; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(22, 50, 79, 0.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s ease-out; }
.sheet { background: var(--ivory); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: rise 0.2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--field); align-self: center; }
.sheet h2 { margin: 0; font-size: 19px; }
@keyframes rise { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea { font-size: 17px; color: var(--ink); border: 1px solid var(--field); border-radius: 10px; padding: 10px 12px; background: var(--white); width: 100%; min-height: 46px; }
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .chip:focus-visible, .btn:focus-visible, .check:focus-visible { outline: 3px solid var(--coral); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--field); border-radius: 12px; overflow: hidden; }
.seg button { min-height: 46px; border: none; border-left: 1px solid var(--field); background: var(--white); cursor: pointer; }
.seg button:first-child { border-left: none; }
.seg button[aria-pressed="true"] { background: var(--coral-soft); color: var(--coral-ink); font-weight: 700; }
.chips.in-sheet { padding: 0; }
.preview { background: var(--white); border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; padding: 12px 14px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; max-height: 260px; overflow-y: auto; }
.file-drop { border: 1.5px dashed #7A7367; border-radius: 12px; padding: 14px; text-align: center; background: var(--white); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.file-drop b { color: var(--blue); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* expenses */
.total { margin: 4px 16px 10px; padding: 16px; border-radius: 16px; background: var(--blue); color: var(--white); display: flex; flex-direction: column; gap: 4px; }
.total .amt { font-family: var(--display); font-stretch: 125%; font-size: 28px; }
.total .meta { color: var(--blue-soft); font-size: 14px; }
.exp .amt { font-weight: 700; font-size: 17px; white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; background: var(--coral-soft); color: var(--coral-ink); border-radius: 6px; padding: 0 6px; margin-right: 4px; font-weight: 600; }
.bill-ic { color: var(--blue); }

/* people */
.person { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--paper); }
.person .body { flex: 1; min-width: 0; }
.person .name { font-size: 17px; font-weight: 600; }
.person .meta { font-size: 14px; color: var(--muted); }

/* member page */
.member-head { padding: calc(26px + env(safe-area-inset-top)) 20px 16px; background: var(--coral-soft); border-bottom: 1px solid #F6C4A8; display: flex; flex-direction: column; gap: 8px; }
.member-head h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.member-head .bar { background: #F6C4A8; }
.group-h { padding: 14px 16px 4px; }

/* login */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 32px 24px; }
.login h1 { margin: 0; font-size: 34px; }
.login input { font-size: 24px; letter-spacing: 0.4em; text-align: center; }

#toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: 12px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 40; max-width: 90vw; }
#toast.show { opacity: 1; }
