/* Sewa Sankalp Portal. Light theme for daylight use at camps; indigo and saffron carried over from Aashirbadar Bonti. */
:root {
  --indigo: #211650;
  --indigo-2: #2d1f66;
  --saffron: #e8731a;
  --saffron-dark: #c45c0c;
  --gold: #ffb347;
  --gold-soft: #ffd58a;
  --cream: #fbf7ee;
  --paper: #ffffff;
  --ink: #1f1b2e;
  --muted: #6b6780;
  --line: #e6dfd0;
  --green: #1e7d4f;
  --red: #b3202a;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(33, 22, 80, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; color: var(--indigo); }
h3 { font-size: 0.95rem; color: var(--indigo); }
a { color: var(--saffron-dark); }
img { max-width: 100%; }
small, .muted { color: var(--muted); }

/* ---- staff header: scope (block / district / scheme) prominent, operator in the corner ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--indigo); color: #fff;
  border-bottom: 3px solid var(--saffron);
}
.topbar .brand { color: var(--gold-soft); text-decoration: none; font-weight: 700; font-size: 0.85rem; line-height: 1.2; }
.topbar .brand small { display: block; color: #c9bfe0; font-weight: 400; font-size: 0.68rem; }
.topbar .scope { text-align: center; min-width: 0; }
.topbar .scope strong { display: block; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .scope small { color: var(--gold-soft); font-size: 0.72rem; letter-spacing: 0.04em; }
.topbar .who { text-align: right; font-size: 0.8rem; line-height: 1.25; cursor: pointer; position: relative; }
.topbar .who small { display: block; color: #c9bfe0; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
  background: var(--paper); color: var(--ink); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); overflow: hidden; text-align: left;
}
.menu button { display: block; width: 100%; padding: 11px 14px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--cream); }

.tabs { display: flex; gap: 2px; overflow-x: auto; background: var(--indigo-2); padding: 0 10px; position: sticky; top: 0; }
.tabs a { color: #d9d2ee; text-decoration: none; padding: 10px 14px; font-size: 0.9rem; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.on { color: #fff; border-bottom-color: var(--gold); font-weight: 600; }

main.staff { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pagehead p { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; }

/* ---- building blocks ---- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tile { display: block; padding: 16px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.tile strong { display: block; font-size: 1.6rem; color: var(--indigo); }
.tile:hover { border-color: var(--saffron); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--saffron); background: var(--saffron); color: #fff;
  font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--saffron-dark); }
.btn.ghost { background: transparent; color: var(--saffron-dark); }
.btn.ghost:hover { background: #fff3e6; }
.btn.small { padding: 5px 12px; font-size: 0.8rem; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn:disabled { opacity: 0.55; cursor: default; }

label.field { display: block; margin-bottom: 12px; font-size: 0.85rem; font-weight: 600; color: var(--indigo); }
label.field small { font-weight: 400; }
input[type=text], input[type=tel], input[type=password], input[type=url], input[type=number], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 1px solid #cfc7b6; border-radius: 9px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--saffron); }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > * { flex: 1 1 200px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--saffron); }
.picker { border: 1px solid var(--line); border-radius: 9px; background: #fffdf8; padding: 8px; margin-top: 4px; }
.picker input[type=search] { margin: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; align-items: center; font-size: 0.85rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #e7e3f7; color: var(--indigo); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 0.85rem; font-weight: 600; }
.chip button { border: 0; background: rgba(33,22,80,.12); color: var(--indigo); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0; }
.chip button:hover { background: var(--red); color: #fff; }
.picklist { max-height: 220px; overflow: auto; display: grid; gap: 2px; }
.pick { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; text-align: left; width: 100%; border: 0; background: transparent; padding: 7px 10px; border-radius: 7px; cursor: pointer; font: inherit; color: var(--ink); }
.pick:hover, .pick:focus { background: #fff1dc; outline: none; }
.pick small { color: var(--muted); white-space: nowrap; font-size: 0.75rem; }
.checks { display: grid; gap: 6px 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); max-height: 260px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fffdf8; margin-top: 4px; }

/* switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbc5b8; border-radius: 999px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; cursor: default; }

/* tables: become stacked cards on a phone */
.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.list th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:hover td { background: #fffaf0; }
table.list td.num, table.list th.num { text-align: right; }
table.list tr.off td { color: var(--muted); }
code.acct { font-family: ui-monospace, Consolas, monospace; background: #f1ecdf; padding: 2px 7px; border-radius: 6px; font-size: 0.85rem; white-space: nowrap; }
@media (max-width: 640px) {
  table.list thead { display: none; }
  table.list tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.list td, table.list td.num { display: block; position: relative; border: 0; padding: 4px 4px 4px 104px; text-align: left; min-height: 1.9em; overflow-wrap: anywhere; }
  table.list td::before { content: attr(data-th); position: absolute; left: 4px; top: 5px; width: 96px; color: var(--muted); font-size: 0.78rem; }
  table.list td:not([data-th]) { padding-left: 104px; }
  /* header: brand and operator on the first line, the block / district name on a line of its own */
  .topbar { grid-template-columns: 1fr auto; grid-template-areas: "brand who" "scope scope"; row-gap: 4px; }
  .topbar .brand { grid-area: brand; }
  .topbar .who { grid-area: who; }
  .topbar .scope { grid-area: scope; text-align: left; border-top: 1px solid rgba(255,255,255,.15); padding-top: 4px; }
  .topbar .scope strong { white-space: normal; font-size: 1.1rem; }
}

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; background: #eee8da; color: var(--muted); white-space: nowrap; }
.pill.on { background: #dff3e8; color: var(--green); }
.pill.warn { background: #fdecd2; color: var(--saffron-dark); }
.pill.central { background: #e7e3f7; color: var(--indigo); }
.pill.state { background: #fdecd2; color: var(--saffron-dark); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.filters > * { flex: 1 1 170px; margin: 0; }
.filters input, .filters select { margin-top: 0; padding: 8px 10px; font-size: 0.9rem; }

.notice { padding: 10px 14px; border-radius: 9px; background: #fff3e6; border: 1px solid #f5d3a8; font-size: 0.9rem; margin-bottom: 12px; }
.notice.ok { background: #e8f6ee; border-color: #b7dfc7; }
.notice.err { background: #fdeaea; border-color: #f1b9bc; color: var(--red); }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.5rem; letter-spacing: .12em; font-weight: 700; color: var(--indigo); user-select: all; }

/* dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(620px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20, 13, 46, .55); }
dialog form, dialog .body { padding: 20px; }
dialog h2 { margin-bottom: 14px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--indigo); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
#toast.err { background: var(--red); }

/* document checklist editor */
.doclist { display: grid; gap: 8px; }
.docrow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.docrow input[type=text] { margin: 0; }
.thumb { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f1ecdf; }

/* ---- login ---- */
.loginwrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(255, 150, 50, .28), transparent 60%), linear-gradient(180deg, var(--indigo) 0%, #140d2e 100%); }
.loginbox { width: min(400px, 100%); background: var(--paper); border-radius: 18px; padding: 26px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.loginbox .crest { text-align: center; margin-bottom: 18px; }
.loginbox .crest strong { display: block; font-size: 1.3rem; color: var(--indigo); }
.loginbox .crest small { letter-spacing: .04em; }
.loginbox .btn { width: 100%; padding: 12px; font-size: 1rem; margin-top: 4px; }

/* ---- public home (foundation version; the full public portal follows) ---- */
.pubbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: var(--indigo); color: #fff; border-bottom: 3px solid var(--saffron); }
.pubbar strong { color: var(--gold-soft); font-size: 1.05rem; }
.pubbar small { display: block; color: #c9bfe0; font-size: 0.72rem; }
.hero { text-align: center; padding: 46px 18px 40px; color: #fff;
  background: radial-gradient(1000px 500px at 50% -20%, rgba(255, 150, 50, .35), transparent 60%), linear-gradient(180deg, var(--indigo) 0%, #140d2e 100%); }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.8rem); color: var(--gold-soft); }
.hero p { max-width: 640px; margin: 12px auto 0; color: #e6def7; }
main.public { max-width: 1180px; margin: 0 auto; padding: 26px 16px 60px; }
.schemegrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin: 14px 0 30px; }
.scheme { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.scheme .pic { height: 130px; background: linear-gradient(135deg, var(--indigo-2), var(--saffron)); background-size: cover; background-position: center; }
.scheme .txt { padding: 12px 14px 16px; }
.scheme .txt strong { display: block; color: var(--indigo); }
.scheme .txt small { display: block; margin-top: 4px; }
footer.site { text-align: center; padding: 22px; color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--line); }

/* The QR hand-off is for a laptop screen; on the phone itself it only takes up room. */
@media (max-width: 640px) { .qrbox { display: none; } }

/* camp photo gallery (staff dialog and public page) */
.photogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photogrid figure { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.photogrid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #eee8da; }
.photogrid figcaption { padding: 6px 8px; font-size: 0.78rem; line-height: 1.35; display: grid; gap: 2px; }
.photogrid figcaption small { color: var(--muted); }
.photogrid figcaption .btn { justify-self: start; margin-top: 4px; }
