/* VA Serve — mobile-first styles on top of Bootstrap 5.3.
   No inline styles anywhere (the CSP forbids them); everything lives here. */

:root {
  --vs-brand: #0f6b5c;
  --vs-brand-dark: #0b5246;
  --vs-brand-soft: #e3f2ee;
  --vs-ink: #1d2327;
  --vs-muted: #5f6b73;
  --vs-line: #dfe5e8;
  --vs-bg: #f5f7f8;
  --vs-card: #ffffff;
  --vs-warn: #9a5b00;
  --vs-warn-soft: #fff3dc;
  --vs-ok: #1d7a3a;
  --vs-ok-soft: #e4f5e9;
  --vs-info: #24557a;
  --vs-info-soft: #e6f0f8;
  --vs-danger: #b42318;
  --vs-radius: 14px;
  --vs-bottom-nav: 64px;
  --bs-primary: var(--vs-brand);
  --bs-primary-rgb: 15, 107, 92;
  --bs-link-color: var(--vs-brand);
  --bs-link-hover-color: var(--vs-brand-dark);
}

html { font-size: 16px; }
body {
  background: var(--vs-bg);
  color: var(--vs-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: calc(var(--vs-bottom-nav) + env(safe-area-inset-bottom) + 16px);
  -webkit-text-size-adjust: 100%;
}

.btn-primary { --bs-btn-bg: var(--vs-brand); --bs-btn-border-color: var(--vs-brand); --bs-btn-hover-bg: var(--vs-brand-dark); --bs-btn-hover-border-color: var(--vs-brand-dark); --bs-btn-active-bg: var(--vs-brand-dark); --bs-btn-disabled-bg: var(--vs-brand); --bs-btn-disabled-border-color: var(--vs-brand); }
.btn-outline-primary { --bs-btn-color: var(--vs-brand); --bs-btn-border-color: var(--vs-brand); --bs-btn-hover-bg: var(--vs-brand); --bs-btn-hover-border-color: var(--vs-brand); --bs-btn-active-bg: var(--vs-brand-dark); }
.btn { min-height: 44px; border-radius: 10px; }
.form-control, .form-select { min-height: 44px; border-radius: 10px; font-size: 1rem; }
.visually-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

/* ---------- top bar & navigation ---------- */
.vs-topbar {
  position: sticky; top: 0; z-index: 1020;
  background: var(--vs-brand); color: #fff;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  display: flex; align-items: center; gap: 16px;
}
.vs-brand { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: .2px; }
.vs-brand:hover { color: #fff; }
.vs-topnav { display: none; gap: 4px; flex: 1; }
.vs-topnav a { color: rgba(255,255,255,.85); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.vs-topnav a:hover { color: #fff; background: rgba(255,255,255,.12); }
.vs-topnav a.active { color: #fff; background: rgba(255,255,255,.2); }
.vs-spacer { flex: 1; }
.vs-usermenu { position: relative; }
.vs-usermenu summary { list-style: none; cursor: pointer; color: #fff; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.vs-usermenu summary::-webkit-details-marker { display: none; }
.vs-avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.22); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.vs-usermenu .menu { position: absolute; right: 0; top: 48px; min-width: 200px; background: #fff; color: var(--vs-ink); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.15); padding: 8px; }
.vs-usermenu .menu a, .vs-usermenu .menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; color: var(--vs-ink); text-decoration: none; border-radius: 8px; }
.vs-usermenu .menu a:hover, .vs-usermenu .menu button:hover { background: var(--vs-bg); }
.vs-usermenu .menu .who { padding: 8px 12px; color: var(--vs-muted); font-size: .85rem; border-bottom: 1px solid var(--vs-line); margin-bottom: 4px; }

.vs-bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  background: #fff; border-top: 1px solid var(--vs-line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--vs-bottom-nav) + env(safe-area-inset-bottom));
}
.vs-bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--vs-muted); text-decoration: none; font-size: .72rem; font-weight: 500; }
.vs-bottomnav a svg { width: 24px; height: 24px; }
.vs-bottomnav a.active { color: var(--vs-brand); }

.vs-fab {
  position: fixed; right: 16px; z-index: 1025;
  bottom: calc(var(--vs-bottom-nav) + env(safe-area-inset-bottom) + 16px);
  background: var(--vs-brand); color: #fff; border-radius: 28px; padding: 14px 20px;
  font-weight: 600; text-decoration: none; box-shadow: 0 6px 20px rgba(15,107,92,.35);
  display: inline-flex; align-items: center; gap: 8px;
}
.vs-fab:hover { color: #fff; background: var(--vs-brand-dark); }

main.vs-main { max-width: 1100px; margin: 0 auto; padding: 16px; }

@media (min-width: 768px) {
  body { padding-bottom: 24px; }
  .vs-topnav { display: flex; }
  .vs-bottomnav { display: none; }
  .vs-fab { bottom: 24px; right: 24px; }
  main.vs-main { padding: 24px; }
}

/* ---------- common blocks ---------- */
.vs-page-title { font-size: 1.35rem; font-weight: 700; margin: 4px 0 16px; }
.vs-section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--vs-muted); font-weight: 700; margin: 20px 0 8px; }
.vs-card { background: var(--vs-card); border: 1px solid var(--vs-line); border-radius: var(--vs-radius); padding: 16px; }
.vs-card + .vs-card { margin-top: 12px; }
.vs-empty { color: var(--vs-muted); text-align: center; padding: 28px 16px; background: var(--vs-card); border: 1px dashed var(--vs-line); border-radius: var(--vs-radius); }
.vs-alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.vs-alert.ok { background: var(--vs-ok-soft); color: var(--vs-ok); }
.vs-alert.error { background: #fdecea; color: var(--vs-danger); }
.vs-alert.warn { background: var(--vs-warn-soft); color: var(--vs-warn); }

.vs-badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.vs-badge.info { background: var(--vs-info-soft); color: var(--vs-info); }
.vs-badge.warn { background: var(--vs-warn-soft); color: var(--vs-warn); }
.vs-badge.ok { background: var(--vs-ok-soft); color: var(--vs-ok); }
.vs-badge.muted { background: #eef1f3; color: var(--vs-muted); }

/* list rows (cards on phone, rows on desktop) */
.vs-list { display: flex; flex-direction: column; gap: 8px; }
.vs-row { display: flex; align-items: center; gap: 12px; background: var(--vs-card); border: 1px solid var(--vs-line); border-radius: 12px; padding: 12px 14px; color: inherit; text-decoration: none; }
.vs-row:hover { border-color: var(--vs-brand); color: inherit; }
.vs-row .main { flex: 1; min-width: 0; }
.vs-row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-row .sub { color: var(--vs-muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-row .amount { font-weight: 700; white-space: nowrap; text-align: right; }
.vs-row .badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }

.vs-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.vs-tabs a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--vs-line); color: var(--vs-ink); text-decoration: none; font-weight: 500; font-size: .9rem; }
.vs-tabs a.active { background: var(--vs-brand); border-color: var(--vs-brand); color: #fff; }
.vs-tabs .count { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: rgba(0,0,0,.08); font-size: .75rem; text-align: center; }
.vs-tabs a.active .count { background: rgba(255,255,255,.25); }

/* ---------- capture screen ---------- */
.capture-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capture-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 96px; border-radius: var(--vs-radius); border: 2px solid var(--vs-brand);
  background: #fff; color: var(--vs-brand); font-weight: 600; cursor: pointer; text-align: center; padding: 10px;
  text-decoration: none;
}
.capture-btn:hover { color: var(--vs-brand-dark); }
.capture-btn.primary:hover { color: #fff; background: var(--vs-brand-dark); }
.capture-btn svg { width: 30px; height: 30px; }
.capture-btn.primary { background: var(--vs-brand); color: #fff; }
.capture-btn:focus-within { outline: 3px solid rgba(15,107,92,.35); outline-offset: 2px; }
.dropzone { display: none; margin-top: 10px; border: 2px dashed var(--vs-line); border-radius: var(--vs-radius); padding: 18px; text-align: center; color: var(--vs-muted); }
.dropzone.dragover { border-color: var(--vs-brand); background: var(--vs-brand-soft); color: var(--vs-brand); }
@media (min-width: 768px) { .dropzone { display: block; } }

.thumbs { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.thumb { position: relative; background: #fff; border: 1px solid var(--vs-line); border-radius: 12px; overflow: hidden; }
.thumb .preview { height: 104px; display: flex; align-items: center; justify-content: center; background: #eef1f3; color: var(--vs-muted); font-weight: 700; }
.thumb .preview img { width: 100%; height: 100%; object-fit: cover; }
.thumb .meta { padding: 6px 8px; font-size: .72rem; }
.thumb .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .state { color: var(--vs-muted); }
.thumb .state.failed { color: var(--vs-danger); }
.thumb .state.dup { color: var(--vs-warn); }
.thumb .state.done { color: var(--vs-ok); }
.thumb .bar { height: 3px; background: var(--vs-line); }
.thumb .bar span { display: block; height: 100%; width: 0; background: var(--vs-brand); transition: width .2s; }
.thumb .remove { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; line-height: 1; }
.thumb .retry { display: block; width: 100%; border: 0; background: var(--vs-warn-soft); color: var(--vs-warn); font-size: .75rem; padding: 6px; font-weight: 600; }
.w-0 { width: 0%; } .w-10 { width: 10%; } .w-20 { width: 20%; } .w-30 { width: 30%; } .w-40 { width: 40%; } .w-50 { width: 50%; }
.w-60 { width: 60%; } .w-70 { width: 70%; } .w-80 { width: 80%; } .w-90 { width: 90%; } .w-100p { width: 100%; }

.amount-input { font-size: 1.6rem; font-weight: 700; text-align: left; }
.amount-wrap { position: relative; }
.amount-wrap .rupee { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; font-weight: 700; color: var(--vs-muted); }
.amount-wrap .amount-input { padding-left: 38px; min-height: 58px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--vs-line); background: #fff; font-weight: 500; cursor: pointer; }
.chip input:checked + span { background: var(--vs-brand); border-color: var(--vs-brand); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid rgba(15,107,92,.35); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 576px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tiles .chip span { width: 100%; border-radius: 12px; justify-content: center; text-align: center; padding: 8px; font-size: .9rem; }

.submit-bar {
  position: sticky; bottom: calc(var(--vs-bottom-nav) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--vs-bg) 75%, rgba(245,247,248,0));
  padding: 16px 0 8px; margin-top: 8px;
}
@media (min-width: 768px) { .submit-bar { bottom: 0; } }
.submit-bar .btn { width: 100%; min-height: 54px; font-size: 1.1rem; font-weight: 700; }
.submit-bar .hint { text-align: center; color: var(--vs-muted); font-size: .85rem; margin-top: 6px; }

/* ---------- expense detail ---------- */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.detail-amount { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.kv { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0; }
@media (min-width: 576px) { .kv { grid-template-columns: 1fr 1fr; } }
.kv dt { font-size: .78rem; color: var(--vs-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kv dd { margin: 2px 0 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.gallery a { display: block; border: 1px solid var(--vs-line); border-radius: 12px; overflow: hidden; background: #fff; color: inherit; text-decoration: none; }
.gallery .pic { height: 130px; background: #eef1f3; display: flex; align-items: center; justify-content: center; color: var(--vs-muted); font-weight: 700; }
.gallery .pic img { width: 100%; height: 100%; object-fit: cover; }
.gallery .cap { padding: 6px 8px; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--vs-line); background: #fff; }
.viewer iframe { width: 100%; height: 70vh; border: 1px solid var(--vs-line); border-radius: 12px; background: #fff; }
.viewer + .viewer { margin-top: 12px; }

.notes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.notes li { padding: 10px 12px; border-radius: 12px; background: var(--vs-bg); }
.notes li.Question, .notes li.EvidenceRequest { background: var(--vs-warn-soft); }
.notes li.Reply { background: var(--vs-info-soft); }
.notes .who { font-size: .75rem; color: var(--vs-muted); margin-bottom: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { margin: 0; }
details.action { border: 1px solid var(--vs-line); border-radius: 12px; background: #fff; }
details.action > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; min-height: 44px; display: flex; align-items: center; }
details.action > summary::-webkit-details-marker { display: none; }
details.action[open] > summary { border-bottom: 1px solid var(--vs-line); }
details.action .body { padding: 12px 14px; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--vs-line); }
.timeline .when { color: var(--vs-muted); font-size: .78rem; }
.timeline .changes { margin: 4px 0 0; padding-left: 18px; color: var(--vs-muted); }
.text-pre { white-space: pre-wrap; }

/* ---------- login ---------- */
.login-wrap { max-width: 400px; margin: 40px auto; }
.login-wrap .logo { font-size: 1.8rem; font-weight: 800; color: var(--vs-brand); text-align: center; margin-bottom: 4px; }
.login-wrap .tag { text-align: center; color: var(--vs-muted); margin-bottom: 20px; }
