/* Saarthi redesign: shared system. Every screen links this file; screen-only rules stay in the screen. */
/* Amar Ujala's own typeface (amarujala.com self-hosts Noto Sans Devanagari). Google's build adds Latin and digits. */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400..800&display=swap");

:root {
  /* Ground */
  --paper: #F3F4F7;      /* page */
  --surface: #FFFFFF;    /* raised content */
  --sunk: #E9EAF0;       /* wells, tracks, inputs */
  --line: #DCDCE6;
  --ink: #1E1C2E;        /* text */
  --muted: #646278;      /* secondary text, 4.9:1 on paper */
  --faint: #9896AA;      /* tertiary, decoration only */

  /* Indelible-ink violet: the one interface accent (links, focus, primary action, own-campaign UI) */
  --violet: #4E2A8E;
  --violet-soft: #ECE6F7;

  /* Status lamp (EVM ballot-unit lamp): only means "new since you last looked" */
  --lamp: #D93A2B;

  /* Party colours: identify a person, never decorate */
  --bjp: #EE7A12;
  --bjp-text: #8A4500;   /* accessible label contrast; bars and markers keep the brighter saffron */
  --sp: #23864A;
  --inc: #1F5FB5;
  --inc-2: #6E9BD6;      /* second INC person */

  /* Signals */
  --good: #23864A;
  --warn: #A86A00;
  --bad: #C2352A;

  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --gap: 16px;
  --font: "Noto Sans Devanagari", "Noto Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
}
/* Hide each screen's static placeholders until its live data and deferred UI are ready. */
body:not(.live-ready) > :not(#liveLoading) { visibility: hidden; }
body:not(.live-ready):not(.live-loading)::before {
  content: "Loading your workspace…";
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: var(--paper); color: var(--muted);
  pointer-events: none;
}
.live-loading-message {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 0; max-width: none; padding: 24px;
  background: var(--paper); color: var(--muted); font-size: 15px;
  pointer-events: none;
}
.live-loading-spinner {
  width: 18px; height: 18px; flex: none;
  border: 2px solid var(--line); border-top-color: var(--violet); border-radius: 50%;
  animation: live-loading-spin .8s linear infinite;
}
.live-loading-message.is-error .live-loading-spinner { display: none; }
@keyframes live-loading-spin { to { transform: rotate(360deg); } }
a { color: var(--violet); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; border-radius: 4px; }
[lang="hi"] { line-height: 1.7; }

/* Type scale (1.25): 13 / 16 / 20 / 25 / 31 / 39 */
.t-xs { font-size: 13px; }
.t-s { font-size: 14px; }
.t-l { font-size: 20px; line-height: 1.35; }
.t-xl { font-size: 25px; line-height: 1.25; }
.t-2xl { font-size: 31px; line-height: 1.15; }
.t-3xl { font-size: 39px; line-height: 1.08; }
.wide { letter-spacing: -.01em; }
.narrow { }
.w5 { font-weight: 500; } .w6 { font-weight: 600; } .w7 { font-weight: 700; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0; font-weight: 650; }
h1 { font-size: 31px; line-height: 1.15; letter-spacing: -.01em; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.35; }
p { margin: 0; }
.measure { max-width: 68ch; }

/* App shell */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff;
  display: flex; align-items: center; gap: 20px; padding: 0 28px; height: 56px;
}
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; white-space: nowrap; }
.brand b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.brand span { color: #B9B6CC; font-size: 14px; }
.tenant-switcher { display: flex; align-items: center; flex: 0 1 280px; min-width: 0; }
.tenant-switcher select {
  width: min(28vw, 300px); max-width: 100%; min-width: 0; min-height: 36px; padding: 5px 28px 5px 9px;
  border-color: #4A4760; border-radius: 7px; background: #252339; color: #fff;
  font-size: 13px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tenant-switcher select:hover { border-color: #CFCDE0; }
.tenant-switcher option { background: #fff; color: #242136; }
.tenant-static-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.tabs { display: flex; gap: 2px; height: 100%; min-width: 0; }
.tabs a {
  color: #CFCDE0; text-decoration: none; padding: 0 12px; display: flex; align-items: center;
  font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -0px; white-space: nowrap;
}
.tabs a:hover { color: #fff; }
.tabs a[aria-current="page"] { color: #fff; border-bottom-color: #B79CFF; }
.tabs .sm { display: none; }
.pullinfo { margin-left: auto; color: #B9B6CC; font-size: 13px; white-space: nowrap; }
.pullinfo b { color: #fff; font-weight: 500; }

.page { max-width: 1240px; margin: 0 auto; padding: 32px 28px 72px; }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head p { color: var(--muted); font-size: 14px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.pad { padding: 20px 22px; }

/* Controls */
.btn {
  font: 500 15px/1 var(--font); border-radius: var(--r-m); padding: 11px 16px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; min-height: 40px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.primary:hover { background: #3E2073; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--violet); padding-inline: 8px; }
.btn.quiet:hover { background: var(--violet-soft); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.seg { display: inline-flex; background: var(--sunk); border-radius: var(--r-m); padding: 3px; }
.seg button { font: 500 14px/1 var(--font); border: 0; background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(30,28,46,.12); }

input, select, textarea {
  font: 400 15px/1.4 var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 12px; min-height: 40px;
}
input:focus, select:focus, textarea:focus { border-color: var(--violet); outline: none; box-shadow: 0 0 0 3px var(--violet-soft); }
label.field { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
label.field small { color: var(--muted); font-weight: 400; }

/* Person mark: party-colour bar + name. Use wherever a person is named. */
.who { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.who::before { content: ""; width: 4px; height: 1.1em; border-radius: 2px; background: var(--c, var(--faint)); }
.party { font-size: 13px; font-weight: 600; color: var(--c, var(--muted)); }
.own-tag { font-size: 12px; font-weight: 600; color: var(--violet); background: var(--violet-soft); padding: 2px 8px; border-radius: 999px; }

/* The lamp */
.lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); display: inline-block; flex: none; }
.lamp.on { background: var(--lamp); box-shadow: 0 0 0 3px rgba(217,58,43,.18); }

/* Channel states, used in boards and setup */
.ch-missing { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--sunk) 6px 8px); color: var(--muted); }
.ch-found { color: var(--warn); }
.ch-planned { color: var(--faint); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--sunk); color: var(--ink); border: 0; font-family: var(--font); }
button.chip { cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }

.note { font-size: 13px; color: var(--muted); }
.planned { border: 1px dashed var(--line); border-radius: var(--r-l); padding: 16px 18px; color: var(--muted); background: transparent; }
.planned b { color: var(--ink); font-weight: 600; }

.sample-flag { display: inline-flex; align-items: center; flex: none; font-size: 12px; background: var(--ink); color: #fff; padding: 5px 8px; border-radius: 8px; opacity: .95; pointer-events: none; }
.sample-flag .short { display: none; }
/* The workspace label is not a control and disappears while the phone filter sheet is open. */
body.sheet .sample-flag { display: none; }

@media (max-width: 860px) {
  .topbar { gap: 12px; padding: 0 16px; height: 48px; }
  .pullinfo { display: block; font-size: 12px; }
  .pull-status { display: none; }
  .brand span { display: none; }
  .tenant-switcher select { width: min(180px, calc(100vw - 226px)); min-width: 88px; max-width: 180px; min-height: 34px; padding: 4px 22px 4px 7px; font-size: 12px; }
  /* Tabs become a bottom bar on phones: thumb reach, nothing cut off */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; height: 60px; background: var(--ink); justify-content: space-around; gap: 0; padding-bottom: env(safe-area-inset-bottom); z-index: 30; }
  .tabs a { flex: 1; justify-content: center; padding: 0; font-size: 14px; border-bottom: 0; border-top: 3px solid transparent; }
  .tabs a[aria-current="page"] { border-top-color: #B79CFF; }
  .tabs .lg { display: none; } .tabs .sm { display: inline; }
  .page { padding: 22px 16px 96px; }
  .pullinfo { display: flex; align-items: center; gap: 6px; }
  .sample-flag { font-size: 11px; padding: 4px 6px; }
  .sample-flag .long { display: none; }
  .sample-flag .short { display: inline; }
  .signout { margin-left: 0; padding-inline: 6px; }
  h1 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Live app additions */
.signout { margin-left: 0; font: 500 12px/1 var(--font); color: #CFCDE0; background: transparent; border: 1px solid #4A4760; border-radius: 6px; padding: 5px 8px; cursor: pointer; }
.signout:hover { color: #fff; border-color: #CFCDE0; }
.not-collected { border: 1px dashed var(--line); border-radius: var(--r-l); padding: 14px 18px; color: var(--muted); font-size: 14px; }
.not-collected b { color: var(--ink); font-weight: 600; }

@media (min-width: 861px) and (max-width: 1040px) {
  .topbar { gap: 12px; padding-inline: 16px; }
  .tabs { gap: 0; }
  .tabs a { padding-inline: 7px; font-size: 13px; }
  .tenant-switcher { flex-basis: 180px; }
  .tenant-switcher select { width: min(20vw, 180px); }
  .pull-status { display: none; }
  .signout { margin-left: 2px; padding: 5px 6px; }
}

@media (min-width: 1041px) and (max-width: 1200px) {
  .topbar { gap: 14px; padding-inline: 18px; }
  .tabs { gap: 0; }
  .tabs a { padding-inline: 8px; font-size: 13px; }
  .tenant-switcher { flex-basis: 220px; }
  .tenant-switcher select { width: min(24vw, 260px); }
  .pull-status { display: none; }
}

@media (min-width: 1201px) and (max-width: 1360px) {
  .topbar { gap: 16px; padding-inline: 20px; }
  .tabs { gap: 0; }
  .tabs a { padding-inline: 8px; font-size: 14px; }
  .pull-status { display: none; }
}

@media (max-width: 860px) { .signout { padding-inline: 6px; } }

/* Print (Brief "Download PDF"): A4, content only, person colours kept */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff !important; }
  body { font-family: "Noto Sans Devanagari", "Noto Sans", system-ui, sans-serif; font-size: 11pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .tabs, .sample-flag, .toast, .btn, .btns, .seg, .range, .lede-btns, button { display: none !important; }
  .page { max-width: none; padding: 0; margin: 0; }
  .print-head { display: block !important; font-size: 9pt; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 0 0 10px; }
  h1 { font-size: 20pt; }
  .section { margin-top: 18px; }
  .panel, .metric, .act, article, blockquote, tr, .frow, .tp { break-inside: avoid; page-break-inside: avoid; }
  h2, h3 { break-after: avoid; page-break-after: avoid; }
  .panel.todayposts, .panel.tally { break-inside: auto; page-break-inside: auto; }  /* long lists may split, rows stay whole */
  a { color: var(--ink); text-decoration: none; }
  .top, .content, .foot, .ads, .talk { grid-template-columns: 1fr 1fr !important; }
}
