/* Sri Chaitanya SPSSNIGVT Connect - brand: deep red, gold, cream, green */
:root {
  --red: #b3141c; --red-dark: #8a0f15; --red-soft: #fbe9e9;
  --gold: #e0a526; --gold-soft: #fdf3d8; --cream: #fbf6e9; --cream-2: #f4ecd6;
  --green: #2f7d32; --green-soft: #e5f3e5; --blue: #1e6bb8; --blue-soft: #e4effa;
  --amber: #b26a00; --amber-soft: #fff1d6; --grey: #6b6257;
  --ink: #2a211b; --muted: #7a6f63; --line: #e8dfcb; --card: #ffffff; --bg: #f8f3e7;
  --chat-bg: #efe7d4; --bubble-me: #fde9c3; --bubble: #ffffff;
  --radius: 12px; --shadow: 0 1px 2px rgba(60, 30, 10, .06), 0 4px 14px rgba(60, 30, 10, .06);
  --font: 'Inter', 'Noto Sans Kannada', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.lang-kn { font-family: 'Noto Sans Kannada', 'Inter', system-ui, sans-serif; }
a { color: var(--red); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.boot { height: 100vh; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--red); font-weight: 600; }
.boot img { width: 96px; border-radius: 50%; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--cream); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3a2400; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: #efc4c4; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, .05); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.icon { padding: 7px; width: 36px; height: 36px; border-radius: 50%; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 11px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224, 165, 38, .2); }
textarea.input { resize: vertical; min-height: 70px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid-form .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--red); }
.error-box { background: var(--red-soft); color: var(--red-dark); padding: 10px 12px; border-radius: 9px; font-size: 13px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand { background: radial-gradient(circle at 20% 20%, #c81d25, var(--red-dark) 70%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 22px; position: relative; overflow: hidden; }
.login-brand::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(224, 165, 38, .16); }
.login-brand img.logo { width: 150px; height: 150px; border-radius: 50%; background: #fff; padding: 4px; box-shadow: 0 8px 30px rgba(0, 0, 0, .3); }
.login-brand h1 { font-size: 30px; font-family: 'Noto Sans Kannada', var(--font); }
.login-brand h2 { font-size: 17px; font-weight: 600; color: #ffd978; letter-spacing: .3px; }
.login-brand p { color: #f6dcdc; max-width: 460px; }
.login-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--cream); }
.login-card { width: 100%; max-width: 390px; background: #fff; border-radius: 16px; padding: 30px; box-shadow: var(--shadow); border-top: 5px solid var(--gold); }
.login-card h3 { font-size: 21px; margin-bottom: 4px; }
.login-card form { display: grid; gap: 14px; margin-top: 18px; }
.lang-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.lang-toggle button { border: 0; background: transparent; padding: 5px 12px; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.lang-toggle button.on { background: var(--red); color: #fff; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--red-dark), #6d0b10); color: #f7e3e3; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.brand img { width: 46px; height: 46px; border-radius: 50%; background: #fff; padding: 2px; flex: none; }
.brand b { display: block; color: #fff; font-size: 14px; line-height: 1.2; }
.brand small { color: #ffd978; font-size: 11px; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; color: #f2d6d6; padding: 9px 12px; border-radius: 9px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.on { background: var(--gold); color: #3a2400; font-weight: 700; }
.nav .ic { width: 20px; text-align: center; font-size: 16px; }
.nav .badge { margin-left: auto; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #e6a9a9; padding: 14px 12px 4px; }
.sidebar .foot { margin-top: auto; padding: 12px 14px; font-size: 11px; color: #d9a3a3; border-top: 1px solid rgba(255, 255, 255, .1); }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { height: 60px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 18px; }
.topbar .mobile-brand { display: none; }
.content { flex: 1; overflow-y: auto; padding: 20px; }
.content.flush { padding: 0; overflow: hidden; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; }
.badge.red { background: var(--red); }
.bell { position: relative; }
.bell .badge { position: absolute; top: -3px; right: -3px; height: 17px; min-width: 17px; font-size: 10px; background: var(--red); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold-soft); color: var(--red-dark); display: inline-grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; position: relative; font-size: 14px; border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 30px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-wrap { position: relative; display: inline-block; }
.avatar-wrap .dot { position: absolute; bottom: 1px; right: 1px; width: 11px; height: 11px; border-radius: 50%; background: #3cb043; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 6px; border-radius: 10px; }
.user-chip:hover { background: var(--cream); }
.user-chip b { display: block; font-size: 13px; line-height: 1.1; }
.user-chip small { color: var(--muted); font-size: 11.5px; }
.bottom-nav { display: none; }

/* Dropdowns */
.dropdown { position: absolute; right: 12px; top: 56px; width: 340px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 34px rgba(40, 20, 0, .18); z-index: 40; max-height: 70vh; overflow-y: auto; }
.dropdown header { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.dropdown .item { display: block; padding: 10px 14px; border-bottom: 1px solid #f3ecdd; color: var(--ink); cursor: pointer; }
.dropdown .item:hover { background: var(--cream); }
.dropdown .item.unread { background: #fffaf0; border-left: 3px solid var(--gold); }
.dropdown .menu-item { display: flex; gap: 10px; padding: 11px 14px; cursor: pointer; color: var(--ink); }
.dropdown .menu-item:hover { background: var(--cream); }

/* ---------- Cards / KPI ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > header { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card > header h3 { font-size: 15px; }
.card > .body { padding: 16px; }
.card > .body.flush { padding: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { font-size: 21px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; box-shadow: var(--shadow); display: block; color: var(--ink); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--red)); }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.kpi .ico { position: absolute; right: 12px; top: 12px; font-size: 22px; opacity: .85; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.welcome { background: linear-gradient(110deg, var(--red) 0%, var(--red-dark) 60%, #5e090d 100%); color: #fff; border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.welcome img { width: 58px; height: 58px; border-radius: 50%; background: #fff; padding: 2px; }
.welcome h2 { font-size: 20px; }
.welcome p { margin: 2px 0 0; color: #ffd978; font-size: 13px; }
.welcome .filters { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.welcome .filters .input { padding: 6px 9px; width: auto; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; padding: 10px 14px; background: #fcf8ee; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid #f2ebdb; vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fffaf0; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-draft { background: #eee9e1; color: var(--grey); }
.s-submitted { background: var(--blue-soft); color: var(--blue); }
.s-under_review { background: #ece6fb; color: #5b3fb3; }
.s-documents_required { background: var(--amber-soft); color: var(--amber); }
.s-pending_board { background: var(--gold-soft); color: #8a5a00; }
.s-approved { background: var(--green-soft); color: var(--green); }
.s-rejected { background: var(--red-soft); color: var(--red); }
.s-returned { background: #fde7dc; color: #b4471a; }
.list-item { display: flex; gap: 11px; align-items: center; padding: 11px 16px; border-bottom: 1px solid #f2ebdb; color: var(--ink); cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fffaf0; }
.list-item .grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--red); border-color: var(--red); color: #fff; }
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters-bar .input { width: auto; min-width: 140px; }
.filters-bar .input.grow { flex: 1; min-width: 200px; }

/* Charts */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut-wrap svg { width: 160px; flex: none; }
.bars-h .bar-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.bars-h .track { height: 10px; background: var(--cream-2); border-radius: 999px; overflow: hidden; }
.bars-h .fill { height: 100%; background: var(--gold); border-radius: 999px; }

/* Loan detail */
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 20px; }
.info-grid .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.info-grid .v { font-weight: 600; margin-top: 2px; word-break: break-word; }
.loan-hero { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.loan-hero .amt { font-size: 26px; font-weight: 800; color: var(--red-dark); }
.actions-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.doc { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #f2ebdb; }
.doc .ficon { width: 38px; height: 38px; border-radius: 8px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; }
.doc .ficon.img { background: var(--green-soft); color: var(--green); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.timeline li.ok::before { background: var(--green); }
.timeline li.bad::before { background: var(--red); }
.timeline .c { background: var(--cream); border-radius: 8px; padding: 6px 10px; margin-top: 4px; font-size: 13px; }
.tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tally div { border-radius: 10px; padding: 10px; text-align: center; }
.tally b { display: block; font-size: 22px; }
.tally .a { background: var(--green-soft); color: var(--green); }
.tally .r { background: var(--red-soft); color: var(--red); }
.tally .x { background: #eee9e1; color: var(--grey); }
.progress { height: 8px; background: var(--cream-2); border-radius: 999px; overflow: hidden; margin: 6px 0 12px; }
.progress div { height: 100%; background: var(--gold); }
.voter { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.vote-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.vote-choices label { border: 1.5px solid var(--line); border-radius: 9px; padding: 8px 4px; text-align: center; cursor: pointer; font-weight: 600; font-size: 13px; }
.vote-choices input { display: none; }
.vote-choices input:checked + span { color: #fff; }
.vote-choices label:has(input:checked) { border-color: transparent; color: #fff; }
.vote-choices label.va:has(input:checked) { background: var(--green); }
.vote-choices label.vr:has(input:checked) { background: var(--red); }
.vote-choices label.vx:has(input:checked) { background: var(--grey); }
.notice { padding: 10px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 12px; }
.notice.gold { background: var(--gold-soft); color: #7a4f00; }
.notice.green { background: var(--green-soft); color: var(--green); }
.notice.red { background: var(--red-soft); color: var(--red-dark); }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: var(--gold-soft); }

/* ---------- Chat ---------- */
.chat { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100%; background: #fff; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-list .head { padding: 12px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); background: #fcf8ee; }
.chat-list .head .input { padding: 7px 11px; border-radius: 999px; }
.chat-list .convs { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 11px; padding: 11px 14px; cursor: pointer; border-bottom: 1px solid #f4eee2; align-items: center; }
.conv:hover { background: #fffaf0; }
.conv.on { background: var(--gold-soft); }
.conv .grow { flex: 1; min-width: 0; }
.conv .top { display: flex; gap: 6px; align-items: baseline; }
.conv .top b { flex: 1; min-width: 0; font-size: 14px; }
.conv .time { font-size: 11.5px; color: var(--muted); }
.conv .time.unread { color: var(--green); font-weight: 700; }
.conv .bottom { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.conv .bottom span.ellipsis { flex: 1; min-width: 0; }
.conv-type { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; padding: 1px 6px; border-radius: 5px; background: var(--cream-2); color: var(--muted); font-weight: 700; }
.group-ico { background: var(--red); color: #fff; border: 0; }
.group-ico.board { background: var(--gold); color: #3a2400; }
.group-ico.loan { background: var(--green); }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat-bg); background-image: radial-gradient(rgba(179, 20, 28, .05) 1px, transparent 1px); background-size: 18px 18px; }
.thread-head { display: flex; gap: 10px; align-items: center; padding: 9px 14px; background: #fff; border-bottom: 1px solid var(--line); min-height: 60px; }
.thread-head .grow { flex: 1; min-width: 0; cursor: pointer; }
.thread-head b { display: block; }
.thread-head small { color: var(--muted); }
.thread-head small.typing { color: var(--green); font-weight: 600; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 6%; display: flex; flex-direction: column; gap: 3px; }
.day-sep { align-self: center; background: #fff8e6; color: var(--muted); font-size: 12px; padding: 3px 12px; border-radius: 8px; margin: 10px 0; box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }
.msg { max-width: min(560px, 78%); align-self: flex-start; background: var(--bubble); padding: 6px 9px 4px; border-radius: 4px 12px 12px 12px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--bubble-me); border-radius: 12px 4px 12px 12px; }
.msg.cont { margin-top: -1px; border-radius: 12px; }
.msg .who { font-size: 12.5px; font-weight: 700; color: var(--red); margin-bottom: 1px; }
.msg .text { white-space: pre-wrap; font-size: 14.5px; }
.msg .meta { float: right; margin: 6px 0 -2px 10px; font-size: 11px; color: #8e8375; display: flex; gap: 3px; align-items: center; }
.msg .tick { font-size: 12px; letter-spacing: -3px; color: #9b9184; }
.msg .tick.read { color: #2f8fdd; }
.msg.system { align-self: center; background: #fff3d1; font-size: 12.5px; color: #6a5a40; padding: 4px 12px; border-radius: 8px; box-shadow: none; }
.msg .att-img { display: block; max-width: 280px; max-height: 280px; border-radius: 8px; margin: 2px 0 4px; cursor: zoom-in; }
.msg .att-file { display: flex; gap: 9px; align-items: center; padding: 8px; background: rgba(0, 0, 0, .04); border-radius: 8px; margin-bottom: 4px; color: var(--ink); min-width: 220px; }
.msg.hl { animation: hl 1.6s ease; }
@keyframes hl { 0%, 60% { box-shadow: 0 0 0 3px var(--gold); } }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; background: #f6f0e1; border-top: 1px solid var(--line); position: relative; }
.composer textarea { flex: 1; resize: none; border: 0; border-radius: 22px; padding: 10px 16px; max-height: 140px; min-height: 42px; outline: none; background: #fff; line-height: 1.4; }
.composer .send { background: var(--red); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 18px; flex: none; }
.composer .readonly { flex: 1; text-align: center; color: var(--muted); padding: 10px; font-size: 13px; }
.attach-preview { position: absolute; bottom: 64px; left: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); font-size: 13px; }
.emoji-panel { position: absolute; bottom: 64px; left: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; box-shadow: var(--shadow); z-index: 5; }
.emoji-panel button { border: 0; background: transparent; font-size: 21px; cursor: pointer; border-radius: 6px; height: 34px; }
.emoji-panel button:hover { background: var(--cream); }
.no-chat { flex: 1; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); text-align: center; padding: 20px; }
.no-chat img { width: 120px; border-radius: 50%; opacity: .9; }
.info-panel { position: absolute; right: 0; top: 0; bottom: 0; width: 340px; max-width: 100%; background: #fff; border-left: 1px solid var(--line); z-index: 8; display: flex; flex-direction: column; box-shadow: -8px 0 20px rgba(0, 0, 0, .08); }
.info-panel header { display: flex; align-items: center; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.info-panel .body { overflow-y: auto; padding: 14px; flex: 1; }
.thread-wrap { position: relative; display: flex; min-width: 0; min-height: 0; }
.thread-wrap > .thread { flex: 1; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(30, 15, 5, .5); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 980px; }
.modal header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { font-size: 16px; flex: 1; min-width: 0; }
.modal .body { padding: 18px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal .preview-frame { width: 100%; height: 75vh; border: 0; background: #f4f4f4; }
.modal .preview-img { max-height: 75vh; display: block; margin: 0 auto; }
.pick-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick-list label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #f3ecdd; cursor: pointer; }
.pick-list label:hover { background: var(--cream); }
@keyframes fade { from { opacity: 0; } }

/* Toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #2a211b; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: 360px; font-size: 13.5px; animation: slide .2s; cursor: pointer; border-left: 4px solid var(--gold); }
.toast.err { border-left-color: #ff6b6b; }
.toast b { display: block; }
@keyframes slide { from { transform: translateY(12px); opacity: 0; } }

/* Permissions matrix */
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix input { width: 17px; height: 17px; accent-color: var(--red); }

/* Print */
.print-doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 32px; border: 1px solid var(--line); }
.print-head { display: flex; gap: 16px; align-items: center; border-bottom: 3px double var(--red); padding-bottom: 12px; margin-bottom: 16px; }
.print-head img { width: 80px; height: 80px; }
.print-head h1 { color: var(--red); font-size: 20px; font-family: 'Noto Sans Kannada', var(--font); }
.print-head h2 { font-size: 15px; color: var(--ink); }
.print-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.print-doc table { width: 100%; border-collapse: collapse; margin: 10px 0 18px; font-size: 13px; }
.print-doc td, .print-doc th { border: 1px solid #d9cfba; padding: 6px 9px; text-align: left; }
.print-doc th { background: #faf4e4; width: 32%; }
.sign-row { display: flex; justify-content: space-between; margin-top: 60px; font-size: 13px; }
.sign-row div { border-top: 1px solid #999; padding-top: 6px; width: 28%; text-align: center; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .bottom-nav, .no-print, #toasts { display: none !important; }
  .shell { display: block; height: auto; }
  .main, .content { height: auto; overflow: visible; padding: 0; }
  .print-doc { border: 0; padding: 0; max-width: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 30px 20px; text-align: center; align-items: center; }
  .login-brand img.logo { width: 104px; height: 104px; }
  .login-brand h1 { font-size: 22px; }
  .login-brand .hide-sm { display: none; }
  .shell { grid-template-columns: 1fr; height: 100dvh; }
  .sidebar { display: none; }
  .main { height: 100dvh; }
  .topbar { padding: 0 10px; gap: 8px; background: var(--red); color: #fff; border: 0; height: 56px; }
  .topbar h1 { font-size: 16px; color: #fff; }
  .topbar .mobile-brand { display: block; width: 36px; height: 36px; border-radius: 50%; background: #fff; padding: 1px; }
  .topbar .btn.ghost { color: #fff; }
  .topbar .user-chip .who { display: none; }
  .topbar .lang-toggle { display: none; }
  .content { padding: 14px 12px 80px; }
  .content.flush { padding: 0 0 62px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 62px; background: #fff; border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); gap: 1px; position: relative; font-weight: 600; }
  .bottom-nav a .ic { font-size: 20px; }
  .bottom-nav a.on { color: var(--red); }
  .bottom-nav a .badge { position: absolute; top: 5px; left: 54%; height: 17px; min-width: 17px; font-size: 10px; }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat.has-thread .chat-list { display: none; }
  .chat:not(.has-thread) .thread-wrap { display: none; }
  .msgs { padding: 12px 10px; }
  .msg { max-width: 86%; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi .value { font-size: 21px; }
  .welcome .filters { margin-left: 0; width: 100%; }
  .tbl .hide-sm { display: none; }
  .modal { max-height: 96vh; }
  .print-doc { padding: 14px; }
}
.bottom-only { display: none; }
@media (max-width: 860px) { .bottom-only { display: block; } }
body.offline .topbar::after { content: '●'; color: #ff6b6b; font-size: 12px; }
.or-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0 12px; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
/* Labelled date filters (empty date boxes look blank on Android) */
.date-lbl { display: inline-flex; flex-direction: column; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.welcome .date-lbl { color: #ffd978; }
@media (max-width: 860px) {
  .date-lbl { flex: 1; min-width: 130px; }
  .date-lbl .input { width: 100%; }
  /* Loan lists as compact cards: file no. + amount, then applicant + status */
  .loan-tbl thead { display: none; }
  .loan-tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid #f2ebdb; }
  .loan-tbl td { padding: 0; border: 0; }
  .loan-tbl td.hide-sm { display: none; }
  .loan-tbl td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .loan-tbl td:nth-child(4) { grid-column: 2; grid-row: 1; }
  .loan-tbl td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .loan-tbl td:nth-child(7) { grid-column: 2; grid-row: 2; align-self: center; justify-self: end; }
  /* Open chat uses the whole screen */
  body.in-thread .bottom-nav { display: none; }
  body.in-thread .content.flush { padding-bottom: 0; }
}
/* Documents section in the loan form */
.doc-upload { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
.doc-upload h3 { font-size: 15px; margin-bottom: 4px; }
.doc-row { display: grid; grid-template-columns: minmax(170px, 260px) auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f3ecdd; }
.doc-row .doc-names { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .doc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .doc-row select { grid-column: 1 / -1; }
  .doc-row .doc-names { grid-column: 1; grid-row: 3; white-space: normal; }
}
