/* Theme aligned to BharatRouter / Ola Electric brand: light gray surfaces,
   #181e22 ink, Ola green #16aa51 accent, Figtree (SIL OFL, self-hosted). */
@font-face {
  font-family: "Figtree";
  src: url("/fonts/Figtree-Variable.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}
:root {
  --ink: #181e22;
  --slate: #41515c;
  --muted: #687986;
  --bg: #f3f4f5;
  --panel: #e9ecef;
  --card: #ffffff;
  --line: #e1e5e8;
  --green: #16aa51;
  --emerald: #0e7d3b;
  --mint: #d9f2e3;
  --shadow: 0 1px 2px rgb(15 23 42 / .08);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Figtree", "Helvetica Neue", Helvetica, Arial, ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; overflow: hidden;
}

/* top bar — BharatRouter nav: white, sticky, subtle blur, green brand accent */
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; height: 60px; flex: 0 0 60px;
  background: #ffffffcc; backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
#topbar .brand { font-weight: 700; font-size: 1.05rem; color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
/* On tablet/phone the header controls wrap instead of overflowing the viewport. */
@media (max-width: 900px) {
  #topbar { flex: 0 0 auto; height: auto; min-height: 56px; flex-wrap: wrap; padding: 9px 12px; gap: 8px; }
  #topbar .spacer { display: none; }
  #boardPicker { max-width: 44vw; }
}
#topbar .brand b { color: var(--green); }
#topbar .spacer { flex: 1; }
#boardPicker {
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
}
#who { font-size: 13px; color: var(--slate); margin-left: 6px; }
#who:hover { color: var(--emerald); }

button { font-family: inherit; cursor: pointer; border: 0; border-radius: 8px; font-size: 14px; }
button.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); padding: 6px 12px; }
button.ghost:hover { border-color: var(--green); color: var(--emerald); }
button.ghost.small { padding: 3px 8px; font-size: 12px; }
button.primary { background: var(--green); color: #fff; padding: 8px 16px; font-weight: 600; }
button.primary:hover { background: var(--emerald); }
button.danger { background: #fff; color: #d23f31; border: 1px solid #f3c9c4; padding: 8px 16px; }
button.danger:hover { background: #fdecea; }

/* board */
#board {
  flex: 1; display: flex; align-items: flex-start; gap: 14px;
  padding: 18px; overflow-x: auto; overflow-y: hidden;
}
.list {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: 290px; flex: 0 0 auto;
  max-height: 100%; display: flex; flex-direction: column;
}
.list-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 6px; }
.list-head input {
  flex: 1; border: 1px solid transparent; background: transparent; font-weight: 700; font-size: 14px;
  color: var(--ink); padding: 4px 6px; border-radius: 6px; font-family: inherit;
}
.list-head input:focus { background: #fff; outline: none; border-color: var(--green); }
.list-count {
  color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .5rem;
}
.list-del { background: transparent; color: var(--muted); padding: 2px 6px; }
.list-del:hover { background: #dde1e4; color: var(--ink); }
.cards { padding: 6px 10px; overflow-y: auto; flex: 1; min-height: 8px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  margin-bottom: 9px; box-shadow: var(--shadow); cursor: pointer; font-size: 14px; line-height: 1.4;
}
.card:hover { border-color: var(--green); }
.card .labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.card .chip { height: 8px; width: 34px; border-radius: 4px; }
.card .title { font-weight: 600; color: var(--ink); }
.card .next {
  margin-top: 4px; font-size: 12.5px; color: var(--slate); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .due {
  display: inline-block; margin-top: 7px; font-size: 12px; padding: 2px 8px;
  border-radius: 999px; background: #eef1f3; color: var(--muted); font-variant-numeric: tabular-nums;
}
.card .due.soon { background: #fdf3d1; color: #97700a; }
.card .due.over { background: #fdecea; color: #c4382c; }
.add-card, .add-list-btn {
  margin: 2px 10px 10px; padding: 8px 10px; text-align: left; color: var(--muted);
  background: transparent; border-radius: 8px; font-weight: 500;
}
.add-card:hover { background: #dde1e4; color: var(--ink); }
.add-list { width: 290px; flex: 0 0 auto; background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; }
.add-list-btn { width: 100%; color: var(--slate); }
.add-list-btn:hover { background: #dde1e4; color: var(--ink); }
.composer { padding: 8px 10px 10px; }
.composer textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-family: inherit;
  font-size: 14px; resize: vertical; margin-bottom: 6px; background: #fff; color: var(--ink);
}
.composer textarea:focus { outline: none; border-color: var(--green); }
.composer .row { display: flex; gap: 6px; align-items: center; }

/* drag state */
.sortable-ghost { opacity: .4; }
.sortable-drag { transform: rotate(2deg); }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgb(12 12 21 / .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 50;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 540px;
  padding: 24px; position: relative; box-shadow: 0 16px 50px rgb(15 23 42 / .22);
  max-height: calc(100vh - 80px); overflow-y: auto;   /* tall modal scrolls instead of cutting off */
}
.modal-close { position: absolute; top: 14px; right: 14px; background: transparent; color: var(--muted); font-size: 16px; }
.card-title-input {
  width: 100%; font-size: 19px; font-weight: 700; border: 0; border-bottom: 2px solid var(--line);
  padding: 4px 2px; margin: 2px 0 18px; color: var(--ink); font-family: inherit;
}
.card-title-input:focus { outline: none; border-bottom-color: var(--green); }
.modal-section { margin-bottom: 16px; }
.modal-section > label { display: block; font-size: .72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px; }
.modal-section textarea, .modal-section input[type=date] {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px; font-family: inherit;
  font-size: 14px; color: var(--ink); background: #fff;
}
.modal-section textarea:focus, .modal-section input[type=date]:focus { outline: none; border-color: var(--green); }
.modal-section input[type=date] { width: auto; }
.label-row { display: flex; gap: 6px; flex-wrap: wrap; }
.label-pill {
  padding: 6px 12px; border-radius: 999px; color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; opacity: .42; user-select: none;
}
.label-pill.on { opacity: 1; box-shadow: inset 0 0 0 2px rgb(0 0 0 / .22); }
.modal-actions { display: flex; justify-content: space-between; margin-top: 20px; }

.share-add { display: flex; gap: 8px; margin: 14px 0; }
.share-add input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 9px; font-size: 14px; font-family: inherit; }
.share-add input:focus { outline: none; border-color: var(--green); }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.member { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.member .role {
  color: var(--emerald); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  background: var(--mint); border-radius: 999px; padding: .1rem .5rem;
}
.member .rm { margin-left: auto; background: transparent; color: #c4382c; }
#memberList .member:first-child { border-top: 0; }
h3 { margin: 0 0 4px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgb(15 23 42 / .25); z-index: 100;
}
.toast.hidden { display: none; }
.hidden { display: none; }

/* header pipeline total + delayed alert */
.board-total { font-size: 13px; font-weight: 700; color: var(--emerald); background: var(--mint);
  border-radius: 999px; padding: 3px 11px; white-space: nowrap; }
.board-alert:not(:empty) { font-size: 13px; font-weight: 700; color: #c4382c; background: #fdecea;
  border-radius: 999px; padding: 3px 11px; white-space: nowrap; }

/* delayed (overdue) card alert */
.card.overdue { border-left: 3px solid #c4382c; }

/* invite-only gate */
.gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 16px; z-index: 60; }
.gate.hidden { display: none; }
.gate-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 40px;
  width: 400px; max-width: 100%; text-align: center; box-shadow: 0 16px 50px rgb(15 23 42 / .10); }
.gate-card .brand { font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.gate-card .brand b { color: var(--green); }
.gate-card h2 { font-size: 20px; margin: 16px 0 8px; color: var(--ink); }
.gate-card p { color: var(--slate); font-size: 14px; line-height: 1.5; margin: 0 0 22px; }
.gate-card .primary { width: 100%; padding: 11px; }
.gate-signout { display: inline-block; margin-top: 16px; color: var(--muted); font-size: 13px; }
.list-val { font-size: 11.5px; font-weight: 700; color: var(--emerald); }

/* card meta row: nodes / value / source / due */
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 7px; }
.card-meta .tag { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 8px; }
.card-meta .tag.hw  { background: #eef1f3; color: var(--slate); }
.card-meta .tag.val { background: var(--mint); color: var(--emerald); font-variant-numeric: tabular-nums; }
.card-meta .tag.src { color: #fff; }
.card-meta .tag.who { background: #eef1f3; color: var(--slate); font-weight: 600; }
.card-meta .tag.prio { color: #fff; font-weight: 800; letter-spacing: .02em; }
.card-meta .tag.prio.p0 { background: #e5484d; }
.card-meta .tag.prio.p1 { background: #f76808; }
.card-meta .tag.prio.p2 { background: #f5a623; }

/* priority pill selector in the modal */
.prio-row { display: flex; gap: 6px; }
.prio-btn { border: 1px solid var(--line); background: #fff; color: var(--slate); padding: 7px 16px;
  border-radius: 8px; font-weight: 700; font-size: 13px; font-family: inherit; }
.prio-btn:hover { border-color: #c7ccd1; }
.prio-btn.active { color: #fff; border-color: transparent; }
.prio-btn[data-prio=""].active { background: var(--slate); }
.prio-btn.p0.active { background: #e5484d; }
.prio-btn.p1.active { background: #f76808; }
.prio-btn.p2.active { background: #f5a623; }
.card-meta .due { margin-top: 0; }

/* action owner input */
#cardAssignee { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font-family: inherit; font-size: 14px; color: var(--ink); background: #fff; }
#cardAssignee:focus { outline: none; border-color: var(--green); }

/* modal: two-column + HW grid */
.modal-section.two-col { display: flex; gap: 24px; }
.modal-section.two-col > div { flex: 1; }
.modal-section.two-col label { display: block; font-size: .72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
#cardSource {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 34px 9px 11px;
  font-family: inherit; font-size: 14px; color: var(--ink); cursor: pointer; line-height: 1.3;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23687986' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
}
#cardSource:focus { outline: none; border-color: var(--green); }
#cardSource:hover { border-color: #c7ccd1; }

/* move-to-board row */
.move-row { display: flex; gap: 8px; align-items: center; }
.move-row select {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px 30px 9px 11px;
  font-family: inherit; font-size: 14px; color: var(--ink); cursor: pointer;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23687986' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
}
.move-row select:focus { outline: none; border-color: var(--green); }
.move-row #moveCard { flex: 0 0 auto; white-space: nowrap; }
.hw-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.hw-grid label.hw { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--slate);
  text-transform: none; letter-spacing: 0; min-width: 0; }
.hw-grid input { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--line); border-radius: 7px;
  padding: 7px 6px; font-family: inherit; font-size: 14px; text-align: center; }
.hw-grid input:focus { outline: none; border-color: var(--green); }
.deal-value { margin-top: 10px; font-size: 14px; font-weight: 700; color: var(--emerald); }

/* dashboard */
.modal.dash { max-width: 680px; }
.dash-totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 20px; }
.dash-total { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.dash-total .dt-v { font-size: 17px; font-weight: 800; color: var(--ink); }
.dash-total .dt-k { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.25; }
.dash-funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel-row { display: grid; grid-template-columns: 180px 1fr 120px; align-items: center; gap: 10px; }
.fr-label { display: flex; flex-direction: column; }
.fr-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.fr-count { font-size: 11px; color: var(--muted); }
.fr-bar-wrap { background: #eef1f3; border-radius: 6px; height: 22px; overflow: hidden; }
.fr-bar { height: 100%; background: var(--green); border-radius: 6px; min-width: 2px; transition: width .3s; }
.fr-val { font-size: 12.5px; font-weight: 700; color: var(--slate); text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .dash-totals { grid-template-columns: repeat(2, 1fr); }
  .funnel-row { grid-template-columns: 110px 1fr 84px; }
}
