/* Fufu · one app for the owner — phone first, iPad and laptop too */
:root {
  --ground: #F3F4F8; --surface: #FFFFFF; --line: #E2E5EE; --line-2: #ECEEF4; --ink: #141A2E; --ink-2: #3B4256; --muted: #5A6275;
  --indigo: #3B37C8; --indigo-d: #2A2799; --tint: #ECEBFF; --tint-2: #F7F7FF;
  --green: #0D6E4F; --green-bg: #E3F5EC; --amber: #8A5300; --amber-bg: #FFF1D6; --coral: #A63A12; --coral-bg: #FFE8DF;
  --wa: #1B6B3E; --wa-bg: #E2F1E7; --ns: #0B6B64; --ns-bg: #E0F3F1; --nsa: #4C2A9E; --nsa-bg: #EEE8FF; --nh: #012B67; --nh-bg: #E4ECF7; --nm: #0B5545; --nm-bg: #E3F1EC;
  --head: 'Sora', 'Manrope', system-ui, sans-serif; --body: 'Manrope', 'Noto Sans Tamil', system-ui, sans-serif;
  --r: 16px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--indigo); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- frame ---------- */
.shell { min-height: 100dvh; display: flex; }
.rail { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: calc(70px + var(--safe-b)); }
.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); padding: calc(14px + var(--safe-t)) 16px 12px; display: flex; align-items: center; gap: 12px; }
.top h1 { margin: 0; font-family: var(--head); font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.top .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .grow { flex: 1; min-width: 0; }
.mark { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; background: var(--indigo); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--head); font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.back { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.page { width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.page.wide { max-width: 1080px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 4px calc(6px + var(--safe-b)); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 700; min-height: 52px; justify-content: center; }
.tabbar a[aria-current="page"] { color: var(--indigo); background: var(--tint); }
.tabbar svg { width: 22px; height: 22px; }
.dot { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #D9480F; color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .main { padding-bottom: 0; }
  .rail { display: flex; flex-direction: column; gap: 6px; width: 230px; flex: 0 0 auto; position: sticky; top: 0; height: 100dvh; padding: 18px 12px; background: #141A2E; color: #fff; }
  .rail .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-family: var(--head); font-weight: 800; font-size: 19px; }
  .rail a { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: #C9CDE0; text-decoration: none; font-weight: 700; }
  .rail a[aria-current="page"] { background: var(--indigo); color: #fff; }
  .rail .dot { position: static; margin-left: auto; }
  .rail svg { width: 20px; height: 20px; }
}

/* ---------- bits ---------- */
.chip { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.chip.whatsapp { background: var(--wa-bg); color: var(--wa); } .chip.nammastay { background: var(--ns-bg); color: var(--ns); }
.chip.nammastay-admin { background: var(--nsa-bg); color: var(--nsa); } .chip.nammahealth, .chip.nammahealth-admin { background: var(--nh-bg); color: var(--nh); }
.chip.namma-money, .chip.money { background: var(--nm-bg); color: var(--nm); } .chip.fufu { background: var(--tint); color: var(--indigo-d); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; }
.pill.ready { background: var(--tint); color: var(--indigo-d); } .pill.flag { background: var(--coral-bg); color: var(--coral); } .pill.hold { background: var(--amber-bg); color: var(--amber); }
.pill.booked { background: var(--green-bg); color: var(--green); } .pill.sent, .pill.open, .pill.done { background: #EEF0F5; color: var(--ink-2); } .pill.personal { background: #F4EBDD; color: #6B4210; }
.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--indigo); color: #fff; font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.dark { background: var(--ink); } .btn.green { background: var(--green); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid #CDD2DE; font-weight: 700; }
.btn.link { background: transparent; color: var(--indigo); min-height: 40px; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.grow { flex: 1; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--tint); color: var(--indigo-d); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%); z-index: 20; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px rgba(20,26,46,.25); }
.toast.err { background: var(--coral); }
.switch { width: 52px; height: 30px; flex: 0 0 auto; border-radius: 99px; border: 0; padding: 0; position: relative; background: #C9CEDA; }
.switch[aria-checked="true"] { background: var(--indigo); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 99px; background: #fff; transition: left .15s; }
.switch[aria-checked="true"]::after { left: 25px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid #CDD2DE; background: var(--surface); font-weight: 700; font-size: 14px; }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { border: 2px solid var(--indigo); background: var(--tint); color: var(--indigo-d); font-weight: 800; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 800; }
.input, select.input, textarea.input { min-height: 44px; border-radius: 12px; border: 1px solid #CDD2DE; padding: 0 12px; background: var(--surface); font-weight: 600; font-size: 15px; width: 100%; }
textarea.input { padding: 10px 12px; min-height: 96px; resize: vertical; line-height: 1.45; }
h2.h { margin: 6px 2px 0; font-family: var(--head); font-weight: 700; font-size: 17px; }
.lbl { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--muted); }

/* ---------- chat with Fufu ---------- */
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .s { flex: 0 0 auto; padding: 7px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.strip .s b { color: var(--ink); }
.msgs { display: flex; flex-direction: column; gap: 10px; }
.me { align-self: flex-end; max-width: 84%; background: var(--ink); color: #fff; padding: 9px 13px; border-radius: 16px 16px 4px 16px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fu { align-self: flex-start; max-width: 92%; background: var(--surface); border: 1px solid var(--line); padding: 10px 12px; border-radius: 16px 16px 16px 4px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fu.brief { background: var(--tint); border-color: #D9D7FF; color: #1E1B6B; }
.typing { align-self: flex-start; padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.act { align-self: stretch; }
.act .t { font-family: var(--head); font-weight: 700; font-size: 15px; }
.act .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; font-size: 13px; }
.act .grid .k { color: var(--muted); font-size: 11px; }
.act .draft { font-size: 14px; line-height: 1.5; background: var(--tint-2); border-radius: 10px; padding: 9px 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.act.wa-proposed { border: 2px solid var(--indigo); }
.act .res { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.act .res.ok { color: var(--green); } .act .res.bad { color: var(--coral); } .act .res.off { color: var(--muted); font-weight: 700; }
.composer { position: sticky; bottom: calc(70px + var(--safe-b)); z-index: 4; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 900px) { .composer { bottom: 0; } }
.composer .bar { display: flex; gap: 8px; align-items: center; max-width: 760px; width: 100%; margin: 0 auto; }
.composer .chips { display: flex; gap: 6px; overflow-x: auto; max-width: 760px; width: 100%; margin: 0 auto; scrollbar-width: none; }
.composer .chips::-webkit-scrollbar { display: none; }
.composer .chips button { flex: 0 0 auto; min-height: 38px; padding: 0 12px; border-radius: 99px; border: 1px solid #CDD2DE; background: var(--surface); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.composer input { flex: 1; min-width: 0; min-height: 48px; border-radius: 24px; border: 1px solid #CDD2DE; background: #F7F8FB; padding: 0 16px; font-weight: 600; font-size: 15px; }
.round { width: 48px; height: 48px; flex: 0 0 auto; border-radius: 99px; border: 0; background: var(--indigo); color: #fff; display: flex; align-items: center; justify-content: center; }
.round.dark { background: var(--ink); } .round.live { background: #D9480F; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .65; } }

/* ---------- WhatsApp ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid #CDD2DE; background: var(--surface); font-weight: 800; font-size: 12.5px; white-space: nowrap; }
.tabs button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.item:last-child { border-bottom: 0; }
.av { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 99px; background: #E9ECF3; color: var(--ink-2); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }
.item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .l1 { display: flex; justify-content: space-between; gap: 8px; }
.item .l1 b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .l2 { font-size: 13px; color: #4A5266; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--wa); color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.thread { display: flex; flex-direction: column; gap: 8px; }
.bub { max-width: 84%; padding: 9px 12px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bub.in { align-self: flex-start; background: var(--surface); border-radius: 4px 16px 16px 16px; }
.bub.out { align-self: flex-end; background: #DDF3E6; border-radius: 16px 4px 16px 16px; }
.bub .who { font-size: 11px; font-weight: 800; color: var(--wa); margin-bottom: 2px; }
.bub .at { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.day { align-self: center; font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--muted); padding: 4px 0; }
.note-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.note-line:last-child { border-bottom: 0; }
.note-line input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--indigo); flex: 0 0 auto; }

/* ---------- today ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats .v { font-family: var(--head); font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.stats .l { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.cards2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }

/* ---------- settings ---------- */
.conn { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.conn .who { flex: 1 1 220px; min-width: 0; }
.conn .who b { display: block; font-size: 15px; }
.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.trio > div { border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.5; white-space: pre-line; }
.trio .a { background: #EEF8F2; } .trio .b { background: #FFF4E2; } .trio .c { background: #F4F5F8; }
.trio .h { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; margin-bottom: 4px; }
.trio .a .h { color: var(--green); } .trio .b .h { color: var(--amber); } .trio .c .h { color: var(--ink-2); }
.st { padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.st.ok { background: var(--green-bg); color: var(--green); } .st.no { background: var(--amber-bg); color: var(--amber); } .st.off { background: #EEF0F5; color: var(--ink-2); }
.acts { display: flex; flex-direction: column; }
.acts .a { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px 10px; padding: 12px 2px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.acts .a:last-child { border-bottom: 0; }
.acts .when { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.acts .who { grid-column: 2; font-size: 12px; color: var(--muted); }

/* ---------- sign in ---------- */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(160deg, #ECEBFF 0%, #F3F4F8 60%); }
.login .box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 26px 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(20,26,46,.08); }
.login h1 { margin: 0; font-family: var(--head); font-weight: 800; font-size: 26px; }
.err { color: var(--coral); font-weight: 700; font-size: 13.5px; }

/* ---------- numbers: Hostel page and WhatsApp desk (added 7 Nov) ---------- */
.big { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.big > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-width: 0; }
.big .v { font-family: var(--head); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.big .v small { font-size: 13px; color: var(--muted); font-family: var(--body); font-weight: 700; }
.big .l { font-size: 12.5px; color: var(--muted); }
.meter { position: relative; height: 12px; border-radius: 99px; background: var(--line-2); }
.meter i { display: block; height: 100%; max-width: 100%; border-radius: 99px; background: var(--ns); }
.meter.wa i { background: var(--wa); }
.meter b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; }
.bars { display: grid; grid-template-columns: minmax(84px, max-content) minmax(0, 1fr) auto; gap: 7px 10px; align-items: center; font-size: 13.5px; }
.bars .bar { height: 10px; border-radius: 99px; background: var(--line-2); min-width: 0; }
.bars .bar i { display: block; height: 100%; border-radius: 99px; background: var(--ns); }
.bars.grey .bar i { background: #8E93A8; }
.bars b { text-align: right; font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.open { font-size: 13px; font-weight: 800; color: var(--indigo); text-decoration: none; }
.fu + .links { align-self: flex-start; padding: 0 4px; margin-top: -4px; }
.wk { overflow-x: auto; }
.wk table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wk th { text-align: right; font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.wk td { text-align: right; padding: 8px 4px; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wk th:first-child, .wk td:first-child { text-align: left; }
.wk tr.sum td { border-bottom: 0; font-weight: 800; }
.seg.per button { min-height: 38px; font-size: 13px; padding: 0 12px; }
.dates { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.dates .field { flex: 1 1 140px; }
