/* Print portal: minimal premium black & white theme, mobile first.
   Same tokens and feel as the payment gateway (payment-gateway/server/.../static/style.css); the components
   below are what the portal adds. Strictly black, white and grey. No colour carries meaning on its own:
   state is always also a word, a shape or a weight. */
:root {
  --ink: #0a0a0a;
  --paper: #ffffff;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --soft: #f6f6f6;
  --mid: #cfcfcf;
  --radius: 14px;
  --gutter: 16px;
  --font: "Inter", "Helvetica Neue", "Noto Sans Bengali", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-underline-offset: 3px; }
h1 { font-size: 1.75rem; letter-spacing: -0.02em; font-weight: 650; margin: 0.2em 0 0.6em; line-height: 1.2; }
h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; margin: 2.2em 0 0.9em; }
h3 { font-size: 1rem; font-weight: 650; margin: 0 0 0.4em; }
p { margin: 0.5em 0; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.label { margin: 0; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; }
.mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-weight: 700; }
.mark.big { width: 3.5rem; height: 3.5rem; font-size: 1.6rem; margin-bottom: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -4rem; background: var(--ink); color: var(--paper);
  padding: 0.6em 1em; border-radius: 999px; z-index: 20; }
.skip:focus { top: 0.6rem; }

/* keyboard focus is always visible */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button:focus-visible, a:focus-visible { outline-offset: 3px; }
button.primary:focus-visible { outline-color: var(--ink); box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--ink); outline: none; }

/* layout helpers */
.stack { display: grid; gap: 1rem; }
.stack.tight { gap: 0.5rem; }
.row { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* controls */
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--mid); border-radius: 10px; padding: 0.75em 0.9em; margin-top: 0.35em;
  min-height: 44px; }
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0,0,0,.12); }
input[aria-invalid="true"] { border-color: var(--ink); border-width: 2px; }
input:disabled, select:disabled, button:disabled { opacity: .5; cursor: not-allowed; }
label { display: block; font-size: 0.85rem; font-weight: 500; }
label.check { display: flex; gap: 0.7em; align-items: center; min-height: 44px; }
label.check input { width: 1.2rem; height: 1.2rem; min-height: 0; margin: 0; accent-color: var(--ink); flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0; min-width: 0; }
legend { font-size: 0.8rem; font-weight: 600; padding: 0 0.4em; }
/* member type (sign-up, profile): student-only fields hide without JS; the server ignores them for a general member */
.segmented { display: flex; flex-wrap: wrap; gap: 0 1.5em; }
.member-type .student-only { margin-top: 0.8rem; }
.member-type:has(input[name="member_type"][value="general"]:checked) .student-only { display: none; }
.hint { color: var(--muted); font-size: 0.78rem; margin: 0.3em 0 0; font-weight: 400; }
.field-error { font-size: 0.8rem; font-weight: 600; margin: 0.3em 0 0; }
.field-error::before { content: "! "; }
button, .button { font: inherit; cursor: pointer; border-radius: 999px; padding: 0.75em 1.4em; border: 1px solid var(--ink);
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  background: var(--paper); color: var(--ink); text-decoration: none; text-align: center; }
button.primary, .button.primary { background: var(--ink); color: var(--paper); font-weight: 600; }
button.primary:hover, .button.primary:hover { background: #262626; }
button.ghost, .button.ghost { background: transparent; color: var(--ink); }
button.ghost:hover, .button.ghost:hover { background: var(--soft); }
button.danger { border-style: dashed; border-width: 2px; font-weight: 600; }
button.link { border: 0; background: none; padding: 0; min-height: 0; text-decoration: underline; color: var(--muted); }
button.small, .button.small { padding: 0.45em 0.9em; font-size: 0.8rem; min-height: 36px; }
button.block, .button.block { width: 100%; }

/* pills: state is a word; the style only adds emphasis */
.pill { display: inline-block; border: 1px solid var(--ink); border-radius: 999px; padding: 0.05em 0.65em;
  font-size: 0.72rem; letter-spacing: 0.04em; white-space: nowrap; line-height: 1.6; }
.pill.solid { background: var(--ink); color: var(--paper); }
.pill.soft { border-color: var(--mid); color: var(--muted); }
.pill.dashed { border-style: dashed; }
.badge { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 0.35em; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-size: 0.7rem; font-weight: 700; }

/* messages */
.alert { border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 0.85em 1em; font-weight: 500; }
.alert.error::before { content: "! "; font-weight: 800; }
.alert.ok::before { content: "\2713  "; font-weight: 800; }
.notice { background: var(--soft); border-radius: var(--radius); padding: 0.85em 1em; display: flex; gap: 0.7em; align-items: center; }
.flash { display: grid; gap: 0.6rem; margin-bottom: 1.2rem; }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%;
  animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } html { scroll-behavior: auto; } }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 0.6rem 1.6rem; padding: 0.7rem var(--gutter);
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 650; text-decoration: none; }
.brand .mark { width: 1.7rem; height: 1.7rem; font-size: 0.9rem; }
.topbar nav { display: flex; gap: 0.2rem 1.2rem; flex: 1 1 100%; order: 3; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; }
.topbar nav a, .filters a { text-decoration: none; color: var(--muted); font-size: 0.9rem; padding: 0.55em 0; border-bottom: 2px solid transparent; }
.topbar nav a:hover { color: var(--ink); }
.topbar nav a[aria-current], .filters a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.who { display: flex; gap: 0.9rem; align-items: center; margin-left: auto; font-size: 0.85rem; }
.who form { margin: 0; }
.who a { text-decoration: none; }
.who .bell { display: inline-flex; gap: 0.35em; align-items: center; }
.lang { color: var(--muted); font-size: 0.85rem; text-decoration: none; }
.lang:hover { color: var(--ink); }

/* page frame */
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px var(--gutter) 64px; flex: 1; }
.page.narrow { max-width: 460px; }
.page.medium { max-width: 720px; }
.footer { border-top: 1px solid var(--line); padding: 1.2rem var(--gutter); color: var(--muted); font-size: 0.78rem;
  display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between; }
.footer a { color: inherit; }
body.auth, body.errorpage { background: var(--soft); }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.card.flat { background: var(--soft); border-color: transparent; }
.card.strong { border: 1.5px solid var(--ink); }
.card > :first-child { margin-top: 0; } .card > :last-child { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; gap: 0.8rem; align-items: flex-start; margin-bottom: 0.8rem; }
.auth-card { display: grid; gap: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; margin: 1.2rem 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--paper); padding: 1.1rem 1.2rem; }
.stat .value { margin: 0.25em 0 0; font-size: 1.7rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.55em 2em; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.85rem; } .facts dd { margin: 0; word-break: break-word; }
.callout { border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 1.2rem; }
.callout pre, .code { background: var(--ink); color: var(--paper); padding: 0.9em 1em; border-radius: 10px; overflow-x: auto;
  white-space: pre-wrap; word-break: break-all; font-family: var(--mono); margin: 0.5em 0; }
.bigcode { font-family: var(--mono); font-size: 2rem; font-weight: 700; letter-spacing: 0.18em; text-align: center;
  border: 2px dashed var(--ink); border-radius: var(--radius); padding: 0.6em; }

/* home */
.hero { padding: 2.2rem 0 1rem; }
.hero h1 { font-size: 2.1rem; max-width: 18em; }
.hero p.lead { font-size: 1.05rem; color: #333; max-width: 36em; }
.hero .actions { margin-top: 1.4rem; }
.steps-3 { list-style: none; padding: 0; margin: 2rem 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  counter-reset: step; }
.steps-3 li { counter-increment: step; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.steps-3 li::before { content: counter(step); display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-weight: 700; margin-bottom: 0.7rem; }
:lang(bn) .steps-3 li::before { content: counter(step, bengali); }
.promises { display: grid; gap: 0.5rem; padding: 0; list-style: none; margin: 0; }
.promises li::before { content: "\2713"; font-weight: 800; margin-right: 0.6em; }

/* lists, tables (collapse to cards on phones) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { text-align: left; font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted);
  background: var(--soft); padding: 0.8em 1em; white-space: nowrap; }
td { padding: 0.8em 1em; border-top: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: #fafafa; }
@media (max-width: 640px) {
  table.stack-phone, table.stack-phone tbody, table.stack-phone tr, table.stack-phone td { display: block; width: 100%; }
  table.stack-phone thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack-phone tr { border-top: 1px solid var(--line); padding: 0.6rem 0.2rem; }
  table.stack-phone tbody tr:first-child { border-top: 0; }
  table.stack-phone td { border: 0; padding: 0.25em 1em; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.stack-phone td::before { content: attr(data-label); color: var(--muted); font-size: 0.72rem; text-transform: uppercase;
    letter-spacing: 0.1em; text-align: left; flex: none; }
  :lang(bn) table.stack-phone td::before { letter-spacing: 0; text-transform: none; }
}
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.list > li { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; background: var(--paper); }
.list > li.unread { border-color: var(--ink); border-width: 1.5px; }

/* timeline of a job's life (ol.timeline > li.done | li.current | li) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.4rem; border-left: 2px solid var(--line); display: grid; gap: 1.1rem; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: calc(-1.4rem - 7px); top: 0.3em; width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--mid); }
.timeline li.done::before { background: var(--ink); border-color: var(--ink); }
.timeline li.current::before { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(0,0,0,.12); }
.timeline li.current { font-weight: 650; }
.timeline li.todo { color: var(--muted); }
.timeline .when { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 400; }

/* progress: <progress value max> styled; a width never needs an inline style */
progress { width: 100%; height: 0.5rem; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); appearance: none; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--ink); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--ink); border-radius: 999px; }
.stepper { display: flex; gap: 0.4rem; list-style: none; padding: 0; margin: 0 0 1.2rem; font-size: 0.78rem; flex-wrap: wrap; }
.stepper li { border: 1px solid var(--mid); color: var(--muted); border-radius: 999px; padding: 0.2em 0.8em; }
.stepper li.current { border-color: var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; }
.stepper li.done { border-color: var(--ink); color: var(--ink); }

/* chat */
.chat { display: grid; gap: 0.5rem; max-height: 60vh; overflow-y: auto; padding: 0.8rem; background: var(--soft); border-radius: var(--radius); }
.bubble { max-width: 82%; padding: 0.55em 0.9em; border-radius: 16px; border: 1px solid var(--line); background: var(--paper);
  word-break: break-word; white-space: pre-wrap; }
.bubble.mine { justify-self: end; background: var(--ink); color: var(--paper); border-color: var(--ink); border-bottom-right-radius: 4px; }
.bubble.theirs { justify-self: start; border-bottom-left-radius: 4px; }
.bubble.system { justify-self: center; background: transparent; border-style: dashed; color: var(--muted); font-size: 0.8rem; text-align: center; }
.bubble .meta { display: block; font-size: 0.68rem; opacity: .7; margin-top: 0.2em; }
.chat-form { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.chat-form input { margin: 0; flex: 1; }

/* map-less location widget: the browser fix becomes a signed token; accuracy is shown in words and numbers */
.locate { border: 1px dashed var(--ink); border-radius: var(--radius); padding: 1rem; display: grid; gap: 0.6rem; }
.locate .status { font-size: 0.85rem; }
.locate[data-state="ok"] { border-style: solid; }
.locate[data-state="error"] { border-width: 2px; }

/* toasts (JS adds .toast elements to #toasts) */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 1rem; display: grid; gap: 0.5rem; z-index: 30;
  width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); border-radius: 12px; padding: 0.75em 1em; font-size: 0.88rem; pointer-events: auto;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.error { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); }

/* forms */
.form { display: grid; gap: 1rem; }
.inline-form { display: flex; gap: 0.8rem; align-items: flex-end; flex-wrap: wrap; margin-top: 1rem; }
.inline-form label { flex: 1 1 200px; } .inline-form select, .inline-form input { flex: 1 1 200px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem 1.4rem; align-items: end; }
.grid-form .wide { grid-column: 1 / -1; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; } .actions form { margin: 0; }
.filters { display: flex; gap: 1.2rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
details summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); padding: 0.5em 0; min-height: 44px; display: flex; align-items: center; }
details[open] summary { color: var(--ink); }

/* error pages */
.errorbox { text-align: center; padding: 14vh 0 4rem; }
.errorbox .code { font-size: 4.5rem; font-weight: 700; letter-spacing: -0.04em; margin: 0; font-variant-numeric: tabular-nums; }
.errorbox .actions { justify-content: center; }
.errorbox .rid { margin-top: 1.5rem; }

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; } .hero h1 { font-size: 1.75rem; }
  .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 0.6em; }
  .page { padding-top: 16px; }
  .bubble { max-width: 92%; }
}
@media (max-width: 380px) {
  .who .who-name { display: none; }
  .bigcode { font-size: 1.5rem; }
}

/* Bangla: letter-spacing breaks conjuncts, and there is no uppercase */
:lang(bn) .label, :lang(bn) h2, :lang(bn) th { letter-spacing: 0; text-transform: none; }
html:lang(bn) body { line-height: 1.7; }

.transcript { white-space: pre-wrap; word-break: break-word; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1em 1.2em; }

@media print { .topbar, .footer, .toasts, .skip { display: none; } body { background: #fff; } }

/* shop sign-up (register.html): the third member choice "Shop" shows the shop block and hides the student details */
.shop-only { display: none; }
form:has(input[name="member_type"][value="shop"]:checked) .shop-only { display: grid; }
.member-type:has(input[name="member_type"][value="shop"]:checked) .student-only,
form:has(input[name="member_type"][value="shop"]:checked) .campus-choice { display: none; }
@supports not selector(:has(a)) { .shop-only { display: grid; } }

/* maps (map.js + vendored Leaflet) */
.map { height: 280px; border: 1px solid var(--line); border-radius: var(--radius); margin: 0.5rem 0; z-index: 0; }
.map-picker .row { align-items: center; gap: 0.8rem; }
.map-links a { white-space: nowrap; }

/* shops and messages */
.shop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.shop-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.shop-actions form { margin: 0; }
.dm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; max-height: 60vh; overflow-y: auto; }
.dm-msg { max-width: 85%; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.55rem 0.8rem; display: grid; gap: 0.25rem; }
.dm-msg.mine { margin-left: auto; background: var(--soft); }
.dm-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-msg audio { width: 100%; min-width: 220px; }
.dm-voice .row { align-items: center; gap: 0.6rem; flex-wrap: wrap; }
