/* Vimarsha: the one project that is an app rather than a document.
 *
 * Loaded after site.css, scoped under body.vimarsha, and built from the tokens site.css
 * already defines -- so light and dark, the theme toggle and the accent all keep
 * working. The only colours added here are the heatmap ramp and two shadow strengths,
 * each given its own dark value.
 *
 * One layout, two shapes:
 *   phone   a sticky header, one column, and a bottom tab bar over the safe area.
 *   laptop  the same header, a sidebar in place of the tab bar, and pages that use
 *           a main column and a side column (.layout) where they have two kinds of
 *           content -- things to do, and things to read.
 *
 * Sections that open are native <details> styled as sheets, so everything degrades to
 * a plain scrolling document when JavaScript is off; nothing here depends on script.
 */

body.vimarsha {
  --page-max: 90rem;
  --header-h: 3.5rem;
  --tabbar-height: 4rem;
  /* Space under the tab bar's labels: the phone's own bottom inset (an iPhone's home
     line), or --tabbar-gap, whichever is larger. The gap is 0 in a browser, whose own
     toolbar already sits below the page, and a little more when installed (below). */
  --tabbar-gap: 0px;
  --tabbar-bottom: max(env(safe-area-inset-bottom, 0px), var(--tabbar-gap));
  --side-w: 15rem;
  --r-card: 12px;
  --r-ctl: 8px;
  --sheet-radius: var(--r-card);
  --pad-card: 1.25rem;
  --shadow-1: 0 1px 2px rgb(23 20 15 / 0.06), 0 1px 3px rgb(23 20 15 / 0.04);
  --shadow-2: 0 12px 32px -12px rgb(23 20 15 / 0.28), 0 2px 6px rgb(23 20 15 / 0.06);
  --ok: var(--accent-green);
  --bad: var(--accent-madder);
  background: var(--paper);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="gold"]) body.vimarsha {
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.35);
    --shadow-2: 0 16px 40px -12px rgb(0 0 0 / 0.7), 0 2px 6px rgb(0 0 0 / 0.4);
  }
}

:root[data-theme="dark"] body.vimarsha {
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-2: 0 16px 40px -12px rgb(0 0 0 / 0.7), 0 2px 6px rgb(0 0 0 / 0.4);
}

body.vimarsha .app-main {
  padding-top: var(--s5);
  padding-bottom: var(--s7);
}

/* Installed on a home screen there is no browser toolbar under the page, so the tab bar
   would sit on the very bottom edge, against the gesture bar. Lift it a little. */
@media (display-mode: standalone) {
  body.vimarsha { --tabbar-gap: 0.75rem; }
}

/* With viewport-fit=cover (_shell.html) a notch or a status bar may overlap the page on
   an installed app or in landscape; these insets are 0 everywhere else. */
body.vimarsha {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Room for the fixed tab bar, plus the space under it. */
body.vimarsha.has-tabbar .app-main {
  padding-bottom: calc(var(--tabbar-height) + var(--tabbar-bottom) + var(--s6));
}

/* Text in this app is data, not prose: the 68ch reading measure would strand half of
   every table and stat row. */
body.vimarsha .app-main p,
body.vimarsha .app-main li,
body.vimarsha .app-main dd {
  max-width: none;
}

body.vimarsha h2 { margin-top: 0; }

.icon { width: 1.25rem; height: 1.25rem; flex: none; }

/* ------------------------------------------------------------------------- header */

body.vimarsha .site-header {
  position: sticky;
  top: 0;
  padding-top: env(safe-area-inset-top, 0px);
  z-index: 30;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
}

body.vimarsha .site-header-inner {
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--s3);
  min-height: var(--header-h);
  padding-block: var(--s2);
}

body.vimarsha .wordmark { align-items: baseline; white-space: nowrap; }
body.vimarsha .wordmark-deva { font-size: 1.4rem; }

body.vimarsha .site-header-project {
  font-size: var(--step--1);
  color: var(--muted);
  padding-left: var(--s3);
  border-left-color: var(--rule-strong);
  white-space: nowrap;
}

.app-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.app-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
}

.app-icon-btn:hover { background: var(--wash); color: var(--ink); }

.app-bell-count {
  position: absolute;
  top: 0.2rem;
  right: 0.15rem;
  font: 600 0.65rem / 1 var(--font-sans);
  background: var(--bad);
  color: var(--paper);
  border-radius: 999px;
  padding: 0.2em 0.4em;
  min-width: 1.4em;
  text-align: center;
  box-shadow: 0 0 0 2px var(--paper);
}

/* The theme toggle is a compact pill in the app bar: the word "Theme:" stays in the
   accessible name but not on screen, and a half-disc stands in for it. */
body.vimarsha .theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0;
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  min-height: 2.25rem;
  color: var(--muted);
  background: var(--surface);
}

body.vimarsha .theme-toggle::before { content: "\25D0"; font-size: 0.95rem; line-height: 1; }
body.vimarsha .theme-toggle [data-theme-label] { font-size: var(--step--1); }
body.vimarsha .theme-toggle:hover { color: var(--ink); border-color: var(--rule-strong); }
body.vimarsha .app-actions + .theme-toggle { margin-left: 0; }

@media (max-width: 26rem) {
  body.vimarsha .site-header-project { display: none; }
  body.vimarsha .theme-toggle [data-theme-label] { display: none; }
  body.vimarsha .theme-toggle { padding-inline: 0.6rem; }
}

/* ------------------------------------------------------------------------- avatar */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  font: 600 var(--step--1) / 1 var(--font-sans);
  letter-spacing: 0.02em;
}

.avatar.is-large { width: 4rem; height: 4rem; font-size: var(--step-1); }

/* ------------------------------------------------------------- navigation: phone */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--rule);
  padding-bottom: var(--tabbar-bottom);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.appnav-heading, .appnav-more { display: none; }

.appnav-main {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.appnav-main li { flex: 1 1 0; min-width: 0; }

.appnav-main a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: var(--tabbar-height);
  text-decoration: none;
  color: var(--muted);
}

.tab-mark {
  display: grid;
  place-items: center;
  min-width: 3.25rem;
  height: 1.9rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: var(--step-0);
  line-height: 1;
  transition: background-color 120ms ease, color 120ms ease;
}

.tab-label {
  font-size: 0.72rem;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Current tab is marked three ways, never by colour alone: a filled indicator behind
   its mark, darker text, and bolder type. */
.appnav-main a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.appnav-main a[aria-current="page"] .tab-mark { background: var(--accent); color: var(--paper); }
.appnav-main a:hover .tab-mark { background: var(--wash); }
.appnav-main a[aria-current="page"]:hover .tab-mark { background: var(--accent); }

.tabbar a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ------------------------------------------------------------ navigation: laptop */

@media (min-width: 64rem) {
  body.vimarsha.has-tabbar .app-main { padding-bottom: var(--s7); }

  body.vimarsha.has-tabbar #app {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    column-gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
  }

  .tabbar {
    position: sticky;
    top: calc(var(--header-h) + var(--s5));
    left: auto;
    right: auto;
    bottom: auto;
    max-height: calc(100vh - var(--header-h) - var(--s6));
    overflow-y: auto;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 0;
    padding: 0;
  }

  .appnav-main { flex-direction: column; gap: 2px; }

  .appnav-main a,
  .appnav-more a {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--s3);
    height: 2.625rem;
    padding: 0 var(--s2);
    border-radius: var(--r-ctl);
    color: var(--muted);
    text-decoration: none;
  }

  .appnav-main a:hover, .appnav-more a:hover { background: var(--wash); color: var(--ink); }

  .tab-mark {
    min-width: 0;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border-radius: 7px;
    background: var(--wash);
    color: var(--ink);
    font-size: 0.95rem;
  }

  .appnav-main a:hover .tab-mark { background: var(--rule); }

  .tab-label { font-size: var(--step-0); line-height: 1.2; }

  .appnav-main a[aria-current="page"] {
    background: var(--surface);
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--rule);
  }

  .appnav-heading {
    display: block;
    margin: var(--s5) 0 var(--s2);
    padding: 0 var(--s2);
    font-size: var(--step--2);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .appnav-more {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .appnav-more a {
    display: flex;
    align-items: center;
    height: 2.25rem;
    font-size: var(--step--1);
  }

  .appnav-more .icon { width: 1.05rem; height: 1.05rem; margin-inline: 0.45rem; }

  .appnav-more a[aria-current="page"] { background: var(--wash); color: var(--ink); font-weight: 600; }

  .appnav-count {
    margin-left: auto;
    font: 600 0.7rem / 1 var(--font-sans);
    background: var(--bad);
    color: var(--paper);
    border-radius: 999px;
    padding: 0.25em 0.5em;
  }

  /* On a laptop the sidebar carries the community links, so the header's copies go. */
  body.vimarsha .app-actions .app-icon-btn:first-child { display: none; }
}

.app-content { min-width: 0; }

/* --------------------------------------------------------------------- page heads */

.app-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s2) var(--s5);
  align-items: end;
  margin-bottom: var(--s5);
}

.app-head > * { grid-column: 1; margin: 0; }

.app-head h1 {
  font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.35rem);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.app-head h1 a { text-decoration: none; }

.app-sub, .gate-head p {
  margin: 0;
  color: var(--muted);
  max-width: 60rem;
}

/* The page's own buttons: under the title on a phone, level with it on a laptop. */
.app-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

@media (min-width: 48rem) {
  .app-head-actions {
    grid-column: 2;
    grid-row: 1 / span 6;
    justify-content: flex-end;
  }
}

.app-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}

/* "← Sewa": where this page sits, and the way back up. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  justify-self: start;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: var(--s1) !important;
}

.back-link .icon { width: 1rem; height: 1rem; }
.back-link:hover { color: var(--ink); }

/* A label the brief asks to be unmistakable: PRIVATE on sadhana, PUBLIC on swadhyaya. */
.scope-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  justify-self: start;
  font: 600 var(--step--2) / 1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4em 0.75em;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  white-space: nowrap;
}

.scope-flag .icon { width: 0.95em; height: 0.95em; }
.scope-flag.is-private { background: var(--gold-wash); border-color: var(--gold); color: var(--gold-deep); }

/* Small uppercase headings that group the cards below them. */
.section-title,
.group-title {
  font: 600 var(--step--2) / 1.2 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: var(--s6) 0 var(--s3);
  padding: 0;
  border: 0;
}

.layout-main > .group-title:first-child,
.layout-side > .group-title:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ page layouts
 *
 * .layout holds a main column and a side column. On a phone the two simply follow
 * each other; .m-first lifts one card of the side column to the top, which the flat
 * flex order below allows because both columns are display: contents until there is
 * room for them to be columns.
 */

.layout {
  display: flex;
  flex-direction: column;
}

.layout-main, .layout-side { display: contents; }
.layout .m-first { order: -1; }

@media (min-width: 78rem) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22rem;
    column-gap: var(--s6);
    align-items: start;
  }

  .layout-main, .layout-side { display: block; min-width: 0; }
  .layout .m-first { order: 0; }

  .layout.is-side-left { grid-template-columns: 17rem minmax(0, 1fr); }
  .layout.is-side-left .layout-side { grid-column: 1; grid-row: 1; }
  .layout.is-side-left .layout-main { grid-column: 2; grid-row: 1; }
  .layout.is-side-left .layout-side .panel { position: sticky; top: calc(var(--header-h) + var(--s5)); }
}

/* A page that is one thing to read -- a thread, a record -- keeps a readable width. */
.narrow-page { max-width: 52rem; }

/* ---------------------------------------------------------------------- panels */

body.vimarsha .panel {
  max-width: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: var(--pad-card);
  margin: 0 0 var(--s4);
  box-shadow: var(--shadow-1);
}

.panel > h2,
.panel-head h2,
.panel > h3 {
  font: 600 var(--step-0) / 1.3 var(--font-sans);
  margin: 0 0 var(--s3);
}

.panel h3 {
  font: 600 var(--step--1) / 1.3 var(--font-sans);
  color: var(--muted);
  margin: var(--s4) 0 var(--s2);
}

.panel > :last-child { margin-bottom: 0; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s3);
  margin-bottom: var(--s3);
}

.panel-head h2 { margin: 0; display: inline-flex; align-items: center; gap: var(--s2); }
.panel-head h2 .icon { color: var(--muted); width: 1.1rem; height: 1.1rem; }
.panel-head a { font-size: var(--step--1); font-weight: 600; }

/* A card whose only job is a short list of places to go. */
.link-list {
  list-style: none;
  margin: 0 calc(-1 * var(--pad-card)) calc(-1 * var(--pad-card));
  padding: 0;
}

.link-list li { border-top: 1px solid var(--rule); }

.link-list a {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0.7rem var(--pad-card);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--step--1);
}

.link-list a .icon { color: var(--muted); width: 1.1rem; height: 1.1rem; }
.link-list a::after { content: "\203A"; margin-left: auto; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.link-list a:hover { background: var(--wash); color: var(--ink); }
.link-list li:last-child a { border-radius: 0 0 var(--r-card) var(--r-card); }

/* ------------------------------------------------------------------- sheets
 *
 * <details> does the work: open state lives in the DOM, survives no-JS, and the
 * browser handles the keyboard. Closed, a sheet is a row with a title, a line of
 * hint and a chevron; open, it is a card with a form in it.
 */

.sheet {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  margin-bottom: var(--s3);
  box-shadow: var(--shadow-1);
}

.sheet > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "icon title chev" "icon hint chev";
  column-gap: var(--s3);
  align-items: center;
  padding: 0.85rem var(--pad-card);
  min-height: 3.5rem;
  cursor: pointer;
  list-style: none;
  border-radius: var(--r-card);
  transition: background-color 120ms ease;
}

.sheet > summary:not(:has(.sheet-icon)) {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title chev" "hint chev";
}

.sheet > summary::-webkit-details-marker { display: none; }
.sheet > summary:hover { background: color-mix(in srgb, var(--wash) 55%, transparent); }

/* The affordance the brief describes as "a v like shape". It turns when open. */
.sheet > summary::after {
  content: "";
  grid-area: chev;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0.35rem 0.25rem var(--s2);
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 150ms ease;
}

.sheet[open] > summary::after { transform: rotate(-135deg); margin-bottom: -0.25rem; }

.sheet[open] > summary {
  border-bottom: 1px solid var(--rule);
  border-radius: var(--r-card) var(--r-card) 0 0;
}

.sheet > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.sheet-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-ctl);
  background: var(--wash);
  color: var(--ink);
}

.sheet-icon .icon { width: 1.1rem; height: 1.1rem; }

.sheet-title {
  grid-area: title;
  font: 600 var(--step-0) / 1.3 var(--font-sans);
}

.sheet-hint {
  grid-area: hint;
  font: 400 var(--step--1) / 1.35 var(--font-sans);
  color: var(--muted);
}

.sheet-body { padding: var(--pad-card); }
.sheet-body > :first-child { margin-top: 0; }
.sheet-body > :last-child { margin-bottom: 0; }

.sheet-body h3 {
  font: 600 var(--step--1) / 1.3 var(--font-sans);
  color: var(--muted);
  margin: var(--s5) 0 var(--s2);
}

.sheet-body > h3:first-child { margin-top: 0; }

/* A sheet inside a sheet (Register → tag / author / text) sits flatter. */
.sheet .sheet { box-shadow: none; background: var(--paper); }
.sheet .sheet > summary { min-height: 3rem; padding-block: 0.6rem; }

/* A running timer is the one sheet that should catch the eye when you come back. */
.sheet.is-live { border-color: var(--ok); box-shadow: var(--shadow-1), 0 0 0 1px var(--ok); }
.sheet.is-live .sheet-icon { background: var(--ok); color: var(--paper); }

/* ---------------------------------------------------------------------- forms */

body.vimarsha .field { margin-bottom: var(--s4); max-width: 40rem; }

body.vimarsha .field label,
body.vimarsha .levels legend {
  display: block;
  font-weight: 600;
  font-size: var(--step--1);
  margin-bottom: var(--s1);
}

body.vimarsha input[type="text"], body.vimarsha input[type="password"],
body.vimarsha input[type="search"], body.vimarsha input[type="number"],
body.vimarsha input[type="date"], body.vimarsha input[type="url"],
body.vimarsha input[type="email"], body.vimarsha input:not([type]),
body.vimarsha select, body.vimarsha textarea {
  width: 100%;
  min-height: 2.75rem;
  font: inherit;
  font-size: var(--step-0);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-ctl);
  padding: 0.5rem 0.75rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

body.vimarsha select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23878070' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
}

body.vimarsha select[multiple] {
  min-height: 9rem;
  padding-right: 0.75rem;
  background-image: none;
}

body.vimarsha input:hover, body.vimarsha select:hover, body.vimarsha textarea:hover {
  border-color: var(--muted);
}

body.vimarsha input:focus-visible, body.vimarsha select:focus-visible,
body.vimarsha textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent);
}

body.vimarsha input[aria-invalid="true"] { border-color: var(--bad); }

body.vimarsha input[type="checkbox"], body.vimarsha input[type="radio"] {
  accent-color: var(--accent);
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  margin: 0;
}

body.vimarsha .field-hint {
  margin: 0 0 var(--s2);
  font-size: var(--step--1);
  color: var(--muted);
  line-height: 1.5;
}

body.vimarsha .field-error {
  margin: var(--s2) 0 0;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--bad);
}

body.vimarsha .field-error::before { content: "\25A0  "; color: var(--bad); }

/* Two fields that belong together on one row: a from and a to, a date and minutes. */
.pair, .field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--s3);
  max-width: 40rem;
}

.pair .field, .field-row .field { max-width: none; }

@media (max-width: 22rem) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  margin-top: var(--s5);
}

.form-actions .field-hint { margin: 0; }

/* A group of options: radio levels, checkbox filters. */
.levels {
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  padding: var(--s2) var(--s3) var(--s1);
  margin: 0 0 var(--s4);
  max-width: 40rem;
}

.levels legend { padding: 0 var(--s1); margin-bottom: 0; }

.level-choice {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-right: var(--s4);
  min-height: 2.5rem;
  cursor: pointer;
}

.level-choice input { width: auto; min-height: 0; }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  margin-bottom: var(--s3);
  padding: 0.7rem var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  max-width: 40rem;
  cursor: pointer;
}

.check:hover { background: color-mix(in srgb, var(--wash) 55%, transparent); }
body.vimarsha .check input { margin-top: 0.25em; }

.field-inline { font-weight: 600; font-size: var(--step--1); margin: 0; white-space: nowrap; }

body.vimarsha input.narrow { width: 6rem; }

/* ---------------------------------------------------------------------- buttons */

body.vimarsha .btn {
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  gap: var(--s2);
  border-radius: var(--r-ctl);
  font-size: var(--step--1);
  font-weight: 600;
  box-shadow: var(--shadow-1);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

body.vimarsha .btn .icon { width: 1.05rem; height: 1.05rem; }
body.vimarsha .btn:hover { background: var(--wash); border-color: var(--rule-strong); }

body.vimarsha .btn-strong {
  width: 100%;
  min-height: 2.75rem;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

body.vimarsha .btn-strong:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }

body.vimarsha .btn-quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}

body.vimarsha .btn-quiet:hover { background: var(--wash); color: var(--ink); border-color: transparent; }

body.vimarsha .btn-danger { color: var(--bad); }
body.vimarsha .btn-danger:hover { border-color: var(--bad); color: var(--bad); background: transparent; }

body.vimarsha .btn[disabled] { box-shadow: none; }

@media (min-width: 34rem) {
  body.vimarsha .btn-strong { width: auto; min-width: 10rem; }
}

@media (pointer: coarse) {
  body.vimarsha .btn { min-height: 2.75rem; }
}

/* .btn sets display, which would otherwise beat the hidden attribute. */
body.vimarsha .btn[hidden] { display: none; }

body.vimarsha .btn-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--ok) 14%, var(--surface));
  border-color: var(--ok);
}

/* A button that has to sit inside running text. */
.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--gold-deep);
  text-decoration: underline;
  cursor: pointer;
}

.signout-form { display: inline; }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  margin-top: var(--s3);
}

.row-actions form { margin: 0; }
.row-actions > input, .row-actions > select { width: auto; flex: 0 1 auto; }

/* A filter or search bar: the controls on one line where they fit. */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s3);
}

.toolbar .field { margin: 0; flex: 1 1 10rem; max-width: none; }
.toolbar .field.is-grow { flex: 3 1 16rem; }
.toolbar .btn { flex: none; }
.panel.toolbar, form.panel.row-actions { margin-top: 0; }
form.panel.row-actions > input:not([type="hidden"]) { flex: 1 1 14rem; }

/* ---------------------------------------------------------------------- notices */

body.vimarsha .notice {
  max-width: none;
  margin: 0 0 var(--s4);
  padding: 0.75rem var(--s4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--ok);
  border-radius: var(--r-ctl);
  box-shadow: var(--shadow-1);
}

body.vimarsha .notice.is-bad {
  border-left-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 7%, var(--surface));
}

/* A saved message that would otherwise sit above the fold after an in-place update
   floats briefly over the tab bar instead (vimarsha.js). */
.notice.is-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + var(--tabbar-bottom) + var(--s3));
  transform: translateX(-50%);
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 2rem);
  margin: 0;
  box-shadow: var(--shadow-2) !important;
  transition: opacity 0.6s ease;
}

.notice.is-toast.is-leaving { opacity: 0; }

@media (min-width: 64rem) {
  .notice.is-toast { bottom: var(--s5); }
}

.muted-note { color: var(--muted); font-size: var(--step--1); }

/* ------------------------------------------------------------ key/value listings */

.kv {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
  margin: 0;
}

.kv dt, .kv dd {
  margin: 0;
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule);
}

.kv dt { color: var(--muted); font-size: var(--step--1); padding-right: var(--s3); padding-top: 0.7rem; }
.kv dd { overflow-wrap: anywhere; }
.kv dd > p:last-child { margin-bottom: 0; }
.kv > dt:first-of-type, .kv > dt:first-of-type + dd { border-top: 0; padding-top: 0; }

@media (max-width: 30rem) {
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { padding-bottom: 0; }
  .kv dd { border-top: 0; padding-top: 0.15rem; }
  .kv > dt:first-of-type + dd { padding-top: 0.15rem; }
}

/* ---------------------------------------------------------------- list groups
 *
 * A list of things to open: records, members, conversations, notifications. On its
 * own it is one card with rows; inside a panel or a sheet it runs edge to edge.
 */

.record-links {
  list-style: none;
  margin: 0 0 var(--s4);
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.record-links > li { border-top: 1px solid var(--rule); }
.record-links > li:first-child { border-top: 0; }

.record-link {
  display: block;
  padding: 0.85rem var(--pad-card);
  text-decoration: none;
  color: inherit;
}

a.record-link:hover { background: color-mix(in srgb, var(--wash) 60%, transparent); color: inherit; }
a.record-link:hover .record-title { text-decoration: underline; text-decoration-color: var(--gold); }
a.record-link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.record-title { display: block; font-weight: 600; line-height: 1.4; }

.record-note, .record-when {
  display: block;
  font-size: var(--step--1);
  color: var(--muted);
  line-height: 1.5;
  margin-top: 0.15rem;
}

.record-link.is-soon { opacity: 0.55; }

.record-link.is-unread {
  background: color-mix(in srgb, var(--gold-wash) 60%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.panel .record-links,
.sheet-body .record-links,
.scrollbox .record-links {
  margin-inline: calc(-1 * var(--pad-card));
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  box-shadow: none;
  background: none;
}

.panel > .record-links:last-child,
.sheet-body > .record-links:last-child { margin-bottom: calc(-1 * var(--pad-card)); }

.scrollbox .record-links { margin: 0; border-top: 0; }
.scrollbox .record-link { padding-inline: var(--s4); }

/* A row that carries its own remove button. */
.record-row { display: flex; align-items: center; gap: var(--s2); padding-right: var(--s3); }
.record-row .record-link { flex: 1 1 auto; min-width: 0; }
.record-row form { margin: 0; }

/* A ranked list numbers itself in a gutter. */
ol.record-links { counter-reset: rank; }
ol.record-links > li { counter-increment: rank; display: flex; align-items: center; }

ol.record-links > li::before {
  content: counter(rank);
  flex: none;
  width: 2.75rem;
  padding-left: var(--pad-card);
  font: 600 var(--step--1) / 1 var(--font-sans);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

ol.record-links .record-link { flex: 1 1 auto; min-width: 0; padding-left: var(--s3); }

/* Members and people as a grid of cards. */
.card-list {
  list-style: none;
  margin: 0 0 var(--s4);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--s3);
}

.person-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  height: 100%;
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  text-decoration: none;
}

a.person-card:hover { border-color: var(--rule-strong); color: inherit; }
.person-card .record-note { margin: 0; }
.person-card > span:last-child { min-width: 0; }

/* ---------------------------------------------------------------------- tags */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.4rem 0.3rem 0.8rem;
  max-width: 100%;
  font-size: var(--step--1);
}

.tag:not(:has(form)) { padding-right: 0.5rem; }
.tag form { margin: 0; display: inline-flex; }
.tag-name { font-weight: 600; text-decoration: none; }
a.tag-name:hover { text-decoration: underline; }

.tag-remove {
  display: inline-grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 0;
  font: 600 var(--step-0) / 1 var(--font-sans);
  color: var(--muted);
  cursor: pointer;
  min-width: 1.9rem;
  min-height: 1.9rem;
}

.tag-remove:hover, .tag-remove:focus-visible { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }

/* Level is a word, always. The fill is a second, redundant cue, never the only one --
   the ladder has to be readable in greyscale and to a screen reader. */
.level {
  font: 600 0.62rem / 1 var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35em 0.6em;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  color: var(--muted);
  white-space: nowrap;
}

.level-advanced, .level-pro, .level-native {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--paper);
}

/* ---------------------------------------------------------------------- pills */

body.vimarsha .pill {
  align-items: center;
  gap: 0.4em;
  padding: 0.2em 0.65em;
  font-size: var(--step--2);
  font-weight: 600;
  line-height: 1.5;
  border-radius: 999px;
  background: var(--wash);
  color: var(--muted);
}

body.vimarsha .pill .glyph { font-size: 0.7em; }
body.vimarsha .pill-running { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
body.vimarsha .pill-activating { color: var(--gold-deep); background: var(--gold-wash); }
body.vimarsha .pill-stopped { color: var(--gold-deep); background: var(--gold-wash); box-shadow: none; }
body.vimarsha .pill-failed { background: var(--ink); color: var(--paper); }
body.vimarsha .pill-unknown { background: transparent; border: 1px dashed var(--rule-strong); }

/* ------------------------------------------------------------------ threads */

.thread {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.bubble {
  border: 1px solid var(--rule);
  border-radius: 14px;
  border-top-left-radius: 4px;
  padding: var(--s3) var(--s4);
  max-width: min(42rem, 88%);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

/* Sender is named in words as well as placed, so the conversation still reads when the
   bubbles are not side by side -- on a narrow screen, or in a screen reader. */
.bubble.is-mine {
  margin-left: auto;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 22%, var(--rule));
  border-top-left-radius: 14px;
  border-top-right-radius: 4px;
}

.bubble-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--s2);
  margin: 0 0 var(--s1);
  font-weight: 600;
  font-size: var(--step--1);
}

.bubble-who a { text-decoration: none; }
.bubble-who a:hover { text-decoration: underline; }
.bubble-who form { margin-left: auto; }
.bubble-when { font-weight: 400; color: var(--muted); font-size: var(--step--2); }
.bubble p:last-child { margin-bottom: 0; }

.composer { margin-bottom: var(--s5); }
.composer textarea { min-height: 6rem; }
.composer .field { max-width: none; }

.paging {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  flex-wrap: wrap;
  margin: var(--s5) 0;
}

.paging-where { color: var(--muted); font-size: var(--step--1); }

/* ------------------------------------------------------------ stats and tables */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--s3);
  margin: 0 0 var(--s4);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: var(--s4);
  box-shadow: var(--shadow-1);
  min-width: 0;
}

.panel .stat { background: var(--paper); box-shadow: none; }

.stat dt {
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s2);
}

.stat dd {
  margin: 0;
  font: 600 clamp(1.3rem, 1.1rem + 0.8vw, var(--step-2)) / 1.1 var(--font-display);
  font-variant-numeric: tabular-nums;
}

.stat-unit { font-size: var(--step--1); color: var(--muted); font-weight: 400; font-family: var(--font-sans); }

.stat dd.stat-sub,
.stat-sub {
  margin-top: var(--s1);
  font: 400 var(--step--1) / 1.4 var(--font-sans);
  color: var(--muted);
}

body.vimarsha .table-scroll {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  margin: 0 0 var(--s4);
}

body.vimarsha .table-scroll table { margin: 0; }

body.vimarsha th {
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--wash) 50%, transparent);
  border-bottom: 1px solid var(--rule);
  padding: 0.65rem var(--s4);
  white-space: nowrap;
}

body.vimarsha td { padding: 0.7rem var(--s4); border-bottom-color: var(--rule); }
body.vimarsha tbody tr:last-child td { border-bottom: 0; }
body.vimarsha tbody tr:hover td { background: color-mix(in srgb, var(--wash) 40%, transparent); }
body.vimarsha td a { text-decoration-color: var(--rule-strong); }

.panel .table-scroll, .sheet-body .table-scroll { box-shadow: none; }

body.vimarsha td.num, body.vimarsha th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

body.vimarsha td.when { color: var(--muted); font-size: var(--step--1); white-space: nowrap; }

/* Leaderboards: rank one, two and three get a quiet medal ground. */
.board td.rank { width: 3rem; color: var(--muted); font-weight: 600; }
.board tr:nth-child(1) td.rank span,
.board tr:nth-child(2) td.rank span,
.board tr:nth-child(3) td.rank span {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--gold-wash);
  color: var(--gold-deep);
}

/* --------------------------------------------------------------- calendar heatmap
 *
 * A sequential scale: one hue, five steps, light to dark. Dark mode gets its own
 * steps rather than an inversion of these, each checked against the dark surface.
 * Colour is never the only carrier -- every cell prints its own number and names
 * itself to a screen reader -- so the palest steps may sit quietly under the text.
 */

body.vimarsha {
  --heat-0: var(--wash);
  --heat-1: #F4E3E5;
  --heat-2: #E0B4B9;
  --heat-3: #C2757F;
  --heat-4: #9A4653;
  --heat-ink-low: var(--ink);    /* on steps 0-3 */
  --heat-ink-high: var(--paper); /* on step 4, where dark ground needs light text */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="gold"]) body.vimarsha {
    --heat-1: #3A1D23;
    --heat-2: #5B2B34;
    --heat-3: #833E49;
    --heat-4: #B96874;
  }
}

:root[data-theme="dark"] body.vimarsha {
  --heat-1: #3A1D23;
  --heat-2: #5B2B34;
  --heat-3: #833E49;
  --heat-4: #B96874;
}

/* Gold gets its own ramp too: pale gold to maroon through saffron, so an empty day is
   the palest cell (the light ramp's pale pink would vanish on the gold ground). Checked:
   ink on steps 0-3 is 10.7, 8.7, 6.7 and 5.2:1, the ground on step 4 is 5.7:1, and each
   step is darker than the one before. */
:root[data-theme="gold"] body.vimarsha {
  --heat-0: #E6C582;
  --heat-1: #DAAE62;
  --heat-2: #CE9446;
  --heat-3: #C27A3A;
  --heat-4: #5E1E1E;
  --shadow-1: 0 1px 2px rgb(58 34 10 / 0.14), 0 1px 3px rgb(58 34 10 / 0.10);
  --shadow-2: 0 12px 32px -12px rgb(58 34 10 / 0.45), 0 2px 6px rgb(58 34 10 / 0.12);
}

.heat {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--s5) var(--s4);
  margin-bottom: var(--s4);
}

.heat-month {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;   /* the surface gap that keeps adjacent cells distinct */
  margin: 0;
}

.heat-month caption {
  font: 600 var(--step--1) / 1.3 var(--font-sans);
  text-align: left;
  padding: 0 0 var(--s2) 3px;
}

body.vimarsha .heat-month th {
  font-size: var(--step--2);
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
}

.heat-month th abbr { text-decoration: none; border: 0; }

body.vimarsha td.heat-cell {
  border: 0;
  border-radius: 4px;
  padding: 3px;
  aspect-ratio: 1;
  vertical-align: top;
  background: var(--heat-0);
  color: var(--heat-ink-low);
  font-size: var(--step--2);
  line-height: 1.1;
}

body.vimarsha tbody tr:hover td.heat-cell { background: var(--heat-0); }
body.vimarsha td.heat-cell.is-empty,
body.vimarsha tbody tr:hover td.heat-cell.is-empty { background: transparent; }

body.vimarsha td.heat-1, body.vimarsha tbody tr:hover td.heat-1 { background: var(--heat-1); }
body.vimarsha td.heat-2, body.vimarsha tbody tr:hover td.heat-2 { background: var(--heat-2); }
body.vimarsha td.heat-3, body.vimarsha tbody tr:hover td.heat-3 { background: var(--heat-3); }
body.vimarsha td.heat-4, body.vimarsha tbody tr:hover td.heat-4 { background: var(--heat-4); color: var(--heat-ink-high); }

.heat-day { display: block; opacity: 0.7; font-size: 0.6rem; }

.heat-value {
  display: block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.heat-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  font-size: var(--step--1);
  color: var(--muted);
  margin: 0;
}

.heat-legend-label { font-weight: 600; color: var(--ink); }

.heat-key {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 3px;
  vertical-align: -0.15em;
  background: var(--heat-0);
  border: 1px solid var(--rule);
}

.heat-key.heat-1 { background: var(--heat-1); }
.heat-key.heat-2 { background: var(--heat-2); }
.heat-key.heat-3 { background: var(--heat-3); }
.heat-key.heat-4 { background: var(--heat-4); }

/* A month grid never squeezes below a readable size: on a phone it is one to a row. */
@media (max-width: 30rem) {
  .heat { grid-template-columns: 1fr; }
}

/* The small year strip on a profile: a column per week, a row per weekday. It keeps
   its size and scrolls sideways inside its own box on a narrow phone, so the page
   itself never does. */
.contrib-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s3);
  margin-bottom: var(--s2);
}

.contrib-head h2 { margin: 0; }
.contrib-year { display: flex; gap: var(--s2); align-items: center; }
.contrib-year select { width: auto; min-height: 2.25rem !important; padding-block: 0.25rem !important; }

.contrib { margin: var(--s4) 0 0; }

.contrib figcaption {
  font-size: var(--step--1);
  color: var(--muted);
  margin-bottom: var(--s2);
}

.contrib figcaption strong { color: var(--ink); }

.contrib-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: var(--s1);
}

.contrib-grid {
  --cell: 0.72rem;
  display: grid;
  grid-template-columns: repeat(var(--weeks, 53), var(--cell));
  grid-template-rows: auto repeat(7, var(--cell));
  gap: 3px;
  width: max-content;
}

@media (min-width: 78rem) {
  .contrib-grid { --cell: 0.78rem; }
}

.contrib-month {
  grid-row: 1;
  font-size: var(--step--2);
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
}

.contrib-cell {
  width: var(--cell);
  height: var(--cell);
  border-radius: 2px;
  background: var(--heat-0);
}

.contrib-cell.is-empty { background: transparent; }
.contrib-cell.heat-1 { background: var(--heat-1); }
.contrib-cell.heat-2 { background: var(--heat-2); }
.contrib-cell.heat-3 { background: var(--heat-3); }
.contrib-cell.heat-4 { background: var(--heat-4); }

.contrib-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin: var(--s1) 0 0;
  font-size: var(--step--2);
  color: var(--muted);
}

.contrib-legend .heat-key { width: 0.75rem; height: 0.75rem; }

/* ----------------------------------------------------------------------- sewa */

/* A generated id is long, unbreakable and quoted verbatim in chats. It gets to wrap
   anywhere rather than pushing the page sideways. */
.ref {
  font-size: var(--step--2);
  word-break: break-all;
  overflow-wrap: anywhere;
  background: var(--wash);
  color: var(--muted);
}

/* The newsroom and the notices box: a fixed window you scroll inside, so the page below
   stays reachable on a phone. */
.scrollbox {
  max-height: 24rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  background: var(--paper);
}

.panel > .scrollbox { margin-bottom: var(--s3); }
.scrollbox > .news { padding: 0 var(--s4); }

.news {
  margin: 0;
  padding: 0;
  list-style: none;
}

.news li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--step--1);
  line-height: 1.5;
}

.news li:last-child { border-bottom: 0; }

.news-when {
  display: block;
  font-size: var(--step--2);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.1rem;
}

/* A log that is a page of its own reads as one card. */
.app-content > .news {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  padding: 0 var(--pad-card);
  margin-bottom: var(--s4);
}

/* Completion. The number beside it does the work; the bar is the quick glance. */
.meter {
  height: 0.5rem;
  background: var(--wash);
  border-radius: 999px;
  overflow: hidden;
  margin: var(--s2) 0 var(--s1);
}

.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.meter-label {
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.live-clock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  margin: 0 0 var(--s3);
  padding: var(--s4);
  border-radius: var(--r-ctl);
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--muted);
  font-size: var(--step--1);
}

.live-clock strong {
  display: block;
  width: 100%;
  font: 600 var(--step-3) / 1.1 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.divider { border: 0; border-top: 1px solid var(--rule); margin: var(--s5) 0; width: auto; }
body.vimarsha .sheet-body hr { border-top-color: var(--rule); width: auto; margin: var(--s5) 0; }

/* ------------------------------------------------------------------ swadhyaya */

/* Tabs across a section: real links, current one marked by weight, ground and a
   raised edge, never by colour on its own. */
.segmented {
  display: flex;
  gap: 2px;
  margin-bottom: var(--s5);
  padding: 3px;
  border-radius: calc(var(--r-ctl) + 3px);
  background: var(--wash);
  max-width: 30rem;
}

.segmented a {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 2.5rem;
  padding: var(--s2);
  border-radius: var(--r-ctl);
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--muted);
}

.segmented a:hover { color: var(--ink); }

.segmented a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-1), 0 0 0 1px var(--rule);
}

.segmented a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ------------------------------------------------------------------- profile */

.profile-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4) var(--s5);
  margin-bottom: var(--s5);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
}

.profile-head-text { flex: 1 1 16rem; min-width: 0; }
.profile-head h1 { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); margin: 0 0 var(--s1); }
.profile-head .app-sub { font-size: var(--step--1); }
.profile-head .app-sub code { background: var(--wash); }
.profile-head .app-head-meta { margin-top: var(--s2); }

/* ------------------------------------------------------------------------- gate */

body.is-gate .app-main { padding-top: var(--s5); }

.gate-wrap {
  display: grid;
  gap: var(--s5);
  max-width: 68rem;
  margin: 0 auto;
}

.gate-brand {
  position: relative;
  overflow: hidden;
  padding: var(--s5);
  border-radius: var(--r-card);
  background: var(--accent);
  color: var(--paper);
}

.gate-brand-mark {
  font: 600 clamp(3rem, 2rem + 5vw, 5.5rem) / 1.1 var(--font-display);
  margin: 0;
}

.gate-brand-name {
  font: 400 var(--step-1) / 1.2 var(--font-display);
  margin: var(--s1) 0 var(--s4);
  opacity: 0.85;
}

.gate-brand-line { margin: 0; max-width: 32rem; opacity: 0.92; }

.gate-pillars {
  display: none;
  list-style: none;
  margin: var(--s6) 0 0;
  padding: 0;
}

.gate-pillars li {
  display: flex;
  gap: var(--s3);
  align-items: baseline;
  padding: var(--s3) 0;
  border-top: 1px solid color-mix(in srgb, var(--paper) 25%, transparent);
}

.gate-pillars strong { font-family: var(--font-display); font-size: var(--step-1); min-width: 7.5rem; }
.gate-pillars span { opacity: 0.85; font-size: var(--step--1); }

.gate-head { margin-bottom: var(--s4); }
.gate-head h1 { font-size: var(--step-3); margin: 0 0 var(--s1); }
.gate { margin-bottom: var(--s4); }
.gate .sheet-body { padding-bottom: var(--s5); }

@media (min-width: 60rem) {
  body.is-gate .app-main { padding-top: var(--s7); }

  .gate-wrap {
    grid-template-columns: minmax(0, 1fr) minmax(0, 28rem);
    gap: var(--s7);
    align-items: start;
  }

  .gate-brand {
    padding: var(--s7) var(--s6);
    min-height: 32rem;
    position: sticky;
    top: calc(var(--header-h) + var(--s5));
  }

  .gate-pillars { display: block; }
}

/* -------------------------------------------------------------- the admin console
 *
 * The console shares this stylesheet because it is the same project and the same
 * palette, but it looks plainer on purpose: no tab bar, denser tables, and pins set in
 * mono at a size that can be read off a screen and retyped into a chat.
 */

body.vimarsha.console { --page-max: 84rem; }
body.vimarsha.console table { font-size: var(--step--1); }
body.vimarsha.console .site-footer { border-top: 1px solid var(--rule); }

/* The member app has no footer (sign-out lives on the profile page); the console keeps
   its own. */
body.vimarsha:not(.console) .site-footer { display: none; }

.app-foot {
  font-size: var(--step--1);
  color: var(--muted);
}

.code-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin: var(--s3) 0;
  padding: 0;
  list-style: none;
}

.code-list code {
  font-size: var(--step-0);
  letter-spacing: 0.06em;
  user-select: all;   /* one tap selects the whole pin */
}

.codes { border-left: 3px solid var(--accent) !important; }

tr.is-frozen td { background: var(--wash); }

.log-table td { vertical-align: top; }
.log-table tr.log-failed td, .log-table tr.log-locked td { background: var(--gold-wash); }

/* ----------------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  .sheet > summary::after, .notice.is-toast, .tab-mark { transition: none; }
}

/* ------------------------------------------------------------ page-specific parts */

/* A sewa project in a list: what it is on the left, how far along on the right. */
.project-line { display: flex; align-items: center; gap: var(--s3) var(--s5); }
.project-line-main { flex: 1 1 auto; min-width: 0; }
.project-line-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.project-line-meta .scope-flag { font-size: 0.6rem; }
.project-line-done { flex: 0 0 9rem; text-align: right; }
.project-line-done .meter { margin: 0 0 var(--s1); }

@media (max-width: 34rem) {
  .project-line { flex-direction: column; align-items: stretch; }
  .project-line-done { flex-basis: auto; text-align: left; }
}

/* Filters that sit in a panel's heading row. */
.cal-filter, .category-filter { margin: 0; gap: var(--s2); }
.cal-filter select { width: auto; min-height: 2.5rem; }
.category-filter { margin-bottom: var(--s3); }
.calendar-panel .panel-head { margin-bottom: var(--s4); }
.calendar-panel .heat-legend { padding-top: var(--s3); border-top: 1px solid var(--rule); }

.record-title .scope-flag { margin-left: var(--s2); font-size: 0.6rem; vertical-align: 0.15em; }

/* Controls on one line (filters, sort, a percent) keep their own width: the full-width
   rule above is for stacked forms. */
body.vimarsha .row-actions select,
body.vimarsha .row-actions input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  width: auto;
  flex: 0 1 auto;
}
body.vimarsha form.panel.row-actions > input:not([type="hidden"]) { flex: 1 1 14rem; }
body.vimarsha .row-actions input.narrow { width: 6rem; }

.contrib-head h2 { font: 600 var(--step-0) / 1.3 var(--font-sans); }
.category-filter .level-choice { font-size: var(--step--1); margin-right: var(--s2); min-height: 2.25rem; }

@media (min-width: 48rem) {
  .app-head-actions { align-self: start; padding-top: 0.35rem; }
}

/* Filters in their own column (sewa projects): the options wrap as chips of text. */
.filters .field { max-width: none; }
.filters .levels { display: flex; flex-wrap: wrap; column-gap: var(--s3); max-width: none; }
.filters .levels legend { width: 100%; }
.filters .level-choice { margin-right: 0; min-height: 2.25rem; font-size: var(--step--1); }
body.vimarsha .filters .btn-strong { width: 100%; }

.works-filter .field { max-width: none; }
.works-filter .row-actions { margin-top: 0; }

/* People found by skill: two or three to a row on a laptop. */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: var(--s4);
  align-items: start;
}

.people-grid .panel { margin: 0; }
.person-panel h2 { font: 600 var(--step-0) / 1.3 var(--font-sans); margin-bottom: var(--s2); }
.person-panel h2 a { text-decoration: none; }
.person-panel h2 a:hover { text-decoration: underline; }
.person-panel h3 { margin-top: var(--s3); }

/* Sadhana analysis: a card per month, side by side where there is room. */
.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr));
  gap: var(--s4);
}

.month-grid .panel { margin: 0; }
.month-grid .panel > h3 { margin-top: 0; color: var(--ink); font-size: var(--step-0); }
.month-grid .stats { grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: var(--s2); }
.month-grid .stat { padding: var(--s3); }
.month-grid .stat dd { font-size: var(--step-1); }

@media (max-width: 30rem) {
  .month-grid { grid-template-columns: minmax(0, 1fr); }
}

/* A row with a person's initials in front: conversations. */
.record-link.has-avatar { display: flex; align-items: flex-start; gap: var(--s3); }
.record-link.has-avatar .avatar { margin-top: 0.1rem; }
.record-body { display: block; min-width: 0; flex: 1 1 auto; }

.notice-body { font-size: var(--step-0); line-height: 1.7; }
.app-sub .icon { width: 1em; height: 1em; vertical-align: -0.125em; }

/* A sheet with no hint line centres its title on the icon. */
.sheet > summary:not(:has(.sheet-hint)) { grid-template-areas: "icon title chev"; }
.sheet > summary:not(:has(.sheet-hint)):not(:has(.sheet-icon)) { grid-template-areas: "title chev"; }

/* On a phone the page's own buttons are one row you can swipe, not a stack. */
@media (max-width: 47.99rem) {
  .app-head-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: calc(-1 * var(--gutter));
    padding: var(--s1) var(--gutter);
    scrollbar-width: none;
  }
  .app-head-actions::-webkit-scrollbar { display: none; }
  .app-head-actions .btn { flex: none; }
}

body.vimarsha .composer .field { max-width: none; }
.bubble-who .signout-form { display: inline-flex; }

/* In dark mode the accent is a pale tint; as a whole panel it would glare, so the brand
   panel becomes a deep wash of it with the accent kept for the rule and the mark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="gold"]) .gate-brand {
    background: color-mix(in srgb, var(--accent) 16%, var(--surface));
    color: var(--ink);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  }
  :root:not([data-theme="light"]):not([data-theme="gold"]) .gate-brand-mark { color: var(--accent); }
}
:root[data-theme="dark"] .gate-brand {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
:root[data-theme="dark"] .gate-brand-mark { color: var(--accent); }

/* Buttons inside a table row line up with the row's text. */
td .row-actions, td > form.row-actions { margin-top: 0; }
body.vimarsha td .btn { min-height: 2rem; padding-block: 0.3rem; }

.app-avatar-btn { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 999px; text-decoration: none; }
.app-avatar-btn .avatar { width: 2rem; height: 2rem; font-size: 0.72rem; }
.app-avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--wash); }

/* ------------------------------------------------------------------ pickers
 *
 * A long list you tick from (templates/_picker.html): the chosen ones as chips on top,
 * a search box, then the list in its own scrolling window so the form below stays
 * reachable. Without JavaScript the chips and the search box are not drawn and it is a
 * plain checkbox list.
 */

.picker {
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-ctl);
  padding: var(--s3);
  margin: 0 0 var(--s4);
  max-width: 40rem;
  background: var(--surface);
}

.picker legend {
  padding: 0 var(--s1);
  font-weight: 600;
  font-size: var(--step--1);
}

.picker-count { font-weight: 400; color: var(--muted); }
.picker .field-hint { margin-bottom: var(--s2); }

.picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s2);
  min-height: 2rem;
  align-items: center;
}

.picker-none { font-size: var(--step--1); color: var(--muted); }

.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-height: 2rem;
  padding: 0.2rem 0.35rem 0.2rem 0.75rem;
  font: 600 var(--step--1) / 1.2 var(--font-sans);
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule));
  border-radius: 999px;
  cursor: pointer;
}

.picker-chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.picker-chip-x {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
}

.picker-chip:hover .picker-chip-x,
.picker-chip:focus-visible .picker-chip-x { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

body.vimarsha .picker-search,
body.vimarsha input.combo-input {
  min-height: 2.5rem;
  padding-left: 2.25rem;
  font-size: var(--step--1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23878070' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
}

body.vimarsha .picker-search { margin-bottom: var(--s2); }
body.vimarsha .picker-search[hidden] { display: none; }

.picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 14.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  background: var(--paper);
}

.picker-list > li { border-top: 1px solid var(--rule); }
.picker-list > li:first-child { border-top: 0; }

.picker-option {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 2.75rem;
  padding: 0.4rem var(--s3);
  cursor: pointer;
}

.picker-option:hover { background: color-mix(in srgb, var(--wash) 70%, transparent); }
.picker-option:has(input:checked) { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.picker-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.picker-label { font-weight: 600; font-size: var(--step--1); }
.picker-sub { margin-left: auto; font: var(--step--2) / 1.2 var(--font-mono); color: var(--muted); }

.picker-empty { margin: var(--s2) 0 0; font-size: var(--step--1); color: var(--muted); }

/* ------------------------------------------------------------------ combos
 *
 * A single choice from a list that grows (templates/_picker.html, `combo`). With
 * JavaScript the <select> is hidden and a text box stands in for it; the list opens
 * below it, in the flow of the page, so nothing is clipped by the sheet around it and
 * nothing covers the form on a phone.
 */

.combo { max-width: 40rem; }
.js .combo > select { display: none; }
.combo-field { position: relative; }
body.vimarsha input.combo-input { width: 100%; min-height: 2.75rem; padding-right: 2.75rem; font-size: var(--step-0); }

.combo-toggle {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--r-ctl);
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.combo-toggle svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.combo-toggle:hover { color: var(--ink); background: var(--wash); }
.combo-input[aria-expanded="true"] + .combo-toggle svg { transform: rotate(180deg); }

.combo-list {
  list-style: none;
  margin: var(--s1) 0 0;
  padding: 0;
  max-height: 16rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.combo-list[hidden] { display: none; }

.combo-option {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.45rem var(--s3);
  border-top: 1px solid var(--rule);
  cursor: pointer;
}
.combo-option:first-child { border-top: 0; }
.combo-option:hover { background: color-mix(in srgb, var(--wash) 70%, transparent); }
.combo-option.is-active { background: color-mix(in srgb, var(--accent) 11%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.combo-label { font-weight: 600; font-size: var(--step--1); line-height: 1.35; }
.combo-option[aria-selected="true"] .combo-label::after { content: "  ✓"; color: var(--ok); }
.combo-sub { font: var(--step--2) / 1.35 var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.combo-note { padding: 0.6rem var(--s3); font-size: var(--step--1); color: var(--muted); border-top: 1px solid var(--rule); }
.combo-note:first-child { border-top: 0; }

.row-actions > .combo { flex: 1 1 14rem; }

/* A row a search box has filtered out is gone, whatever display its own class gives it. */
[data-search][hidden] { display: none !important; }

/* A searchable list of rows that each carry their own button (Add somebody to the sewa). */
.search-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 20rem;
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  background: var(--paper);
}

.search-rows > li { border-top: 1px solid var(--rule); }
.search-rows > li:first-child { border-top: 0; }

.search-rows form {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0;
  padding: 0.35rem 0.35rem 0.35rem var(--s3);
}

.search-rows form > span { flex: 1 1 auto; min-width: 0; font-size: var(--step--1); font-weight: 600; }
.search-rows code { font-weight: 400; margin-left: var(--s1); }

/* The strip as the main calendar (sadhana): the same shape as on a profile, but its
   weeks stretch to fill the card, so a laptop shows the whole year at a readable size.
   Below its minimum it scrolls sideways inside its own box, like the small one. */
.contrib.is-large { margin-top: 0; }
.contrib.is-large figcaption { font-size: var(--step-0); margin-bottom: var(--s3); }

.contrib.is-large .contrib-grid {
  width: 100%;
  min-width: calc(var(--weeks, 53) * 0.95rem);
  grid-template-columns: repeat(var(--weeks, 53), minmax(0, 1fr));
  grid-template-rows: auto;
  grid-auto-rows: auto;
  gap: 3px;
}

.contrib.is-large .contrib-cell {
  width: auto;
  height: auto;
  aspect-ratio: 1;
  border-radius: 3px;
}

.contrib.is-large .contrib-month { font-size: var(--step--2); padding-bottom: 2px; }
.contrib-scroll { position: relative; }
.calendar-panel .heat-legend { margin-top: var(--s3); }
.calendar-hint { margin: var(--s2) 0 0 !important; }

/* ------------------------------------------------------------ the More tab (phone)
 *
 * The fifth tab opens the community links as a sheet that rises above the bar. It is a
 * <details>, so it opens and closes without script; vimarsha.js also closes it on a tap
 * outside, on Escape, and when a link in it is followed. On a laptop the sidebar lists
 * the same links and the tab is not drawn.
 */

.more-sheet > summary {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: var(--tabbar-height);
  color: var(--muted);
  list-style: none;
  cursor: pointer;
}

.more-sheet > summary::-webkit-details-marker { display: none; }
.more-sheet > summary .icon { width: 1.1rem; height: 1.1rem; }
.more-sheet > summary:hover .tab-mark { background: var(--wash); }
.more-sheet > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Open is marked like a current tab: the filled indicator, darker text, bolder type. */
.more-sheet[open] > summary { color: var(--ink); font-weight: 600; }
.more-sheet[open] > summary .tab-mark { background: var(--accent); color: var(--paper); }

.more-dot {
  position: absolute;
  top: 0.55rem;
  left: calc(50% + 0.75rem);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--bad);
  box-shadow: 0 0 0 2px var(--surface);
}

/* The tab bar is the containing block (it is fixed), so the sheet sits just above it. */
.more-panel {
  position: absolute;
  left: var(--s3);
  right: var(--s3);
  bottom: calc(100% + var(--s2));
  max-height: calc(100vh - var(--header-h) - var(--tabbar-height) - var(--tabbar-bottom) - 2rem);
  overflow-y: auto;
  padding: var(--s2);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-2);
  animation: more-rise 140ms ease-out;
}

@keyframes more-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.more-panel-title {
  margin: var(--s1) var(--s2) var(--s2);
  font: 600 var(--step--2) / 1.2 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.more-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s1);
}

.more-panel a {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 3rem;
  padding: 0 var(--s3);
  border-radius: var(--r-ctl);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.more-panel a .icon { width: 1.1rem; height: 1.1rem; color: var(--muted); }
.more-panel a:hover { background: var(--wash); }
.more-panel a[aria-current="page"] { background: var(--wash); box-shadow: inset 3px 0 0 var(--accent); }
.more-panel .appnav-count { margin-left: auto; font: 600 0.7rem / 1 var(--font-sans); background: var(--bad); color: var(--paper); border-radius: 999px; padding: 0.25em 0.5em; }

@media (max-width: 22rem) {
  .more-panel ul { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 64rem) {
  .appnav-more-tab { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .more-panel { animation: none; }
}

/* The sheet sits inside the tab list, so undo the tab rules for its own links. */
.appnav-main .more-panel a {
  flex-direction: row;
  justify-content: flex-start;
  height: auto;
  min-height: 3rem;
  gap: var(--s2);
  color: var(--ink);
  font-weight: 600;
}

.appnav-main .more-panel a[aria-current="page"] { color: var(--ink); }
.appnav-main .more-panel li { flex: none; }

/* ------------------------------------------------------------------ mini cards
 *
 * What somebody is involved in, on their profile: the projects they manage or do sewa
 * on, the works they have finished. Title first, then a line of pills, then how far
 * along. Two or three to a row where there is room, one on a phone.
 */

.panel-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--wash);
  color: var(--muted);
  font: 600 var(--step--2) / 1.6 var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.mini-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--s3);
}

.mini-cards.is-page { margin-bottom: var(--s4); }

.mini-card {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  height: 100%;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  background: var(--paper);
  color: inherit;
  text-decoration: none;
}

.mini-cards.is-page .mini-card { background: var(--surface); box-shadow: var(--shadow-1); }

a.mini-card:hover { border-color: var(--rule-strong); background: color-mix(in srgb, var(--wash) 50%, var(--paper)); color: inherit; }
a.mini-card:hover .mini-card-title { text-decoration: underline; text-decoration-color: var(--gold); }
a.mini-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.mini-card-title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.mini-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); font-size: var(--step--1); color: var(--muted); }
.mini-card-meta .scope-flag { font-size: 0.6rem; }
.mini-card-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.mini-card-foot .meter { flex: 1 1 100%; margin: 0; }

/* What is already registered (tags, authors), under the form that adds one more: a box
   of names that scrolls once it is full, narrowed by typing in the field above it. */
.registry { margin-top: var(--s4); }
.registry-head { margin: 0 0 var(--s2); font-size: var(--step--1); font-weight: 600; color: var(--muted); }
.registry-list {
  list-style: none;
  margin: 0;
  padding: var(--s2);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: var(--s2);
  max-height: 9.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  background: var(--paper);
}
.registry-list > li {
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--step--1);
  line-height: 1.5;
}

/* A row that looks like a closed sheet but opens a page of its own (the whiteboards).
   Its chevron points onward rather than down. */
a.sheet-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "icon title chev" "icon hint chev";
  column-gap: var(--s3);
  align-items: center;
  padding: 0.85rem var(--pad-card);
  min-height: 3.5rem;
  color: inherit;
  text-decoration: none;
  transition: background-color 120ms ease;
}
a.sheet-link::after {
  content: "";
  grid-area: chev;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0.45rem 0 var(--s2);
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
}
a.sheet-link:hover { background: color-mix(in srgb, var(--wash) 55%, var(--surface)); color: inherit; }
a.sheet-link:hover .sheet-title { text-decoration: underline; text-decoration-color: var(--gold); }
a.sheet-link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ----------------------------------------------------------------- whiteboards */

.whiteboard-body { font-size: var(--step-0); line-height: 1.7; overflow-wrap: anywhere; }
.whiteboard-body > :first-child { margin-top: 0; }
.whiteboard-body > :last-child { margin-bottom: 0; }
.whiteboard-body h2 { font: 600 var(--step-1) / 1.3 var(--font-sans); margin: var(--s5) 0 var(--s2); }
.whiteboard-body h3 { font: 600 var(--step-0) / 1.3 var(--font-sans); margin: var(--s4) 0 var(--s2); }
.whiteboard-body h4 { font: 600 var(--step--1) / 1.3 var(--font-sans); color: var(--muted); margin: var(--s4) 0 var(--s2); }
.whiteboard-body ul, .whiteboard-body ol { padding-left: 1.4rem; }
.whiteboard-body li + li { margin-top: 0.2rem; }
.whiteboard-body blockquote {
  margin: var(--s3) 0;
  padding: var(--s1) var(--s4);
  border-left: 3px solid var(--gold);
  color: var(--muted);
}
.whiteboard-body pre {
  padding: var(--s3);
  overflow-x: auto;
  border-radius: var(--r-ctl);
  background: var(--wash);
  font-size: var(--step--1);
}
.whiteboard-body hr { border: 0; border-top: 1px solid var(--rule-strong); margin: var(--s5) 0; }

/* A board of cards: one column on a phone, as many as fit on a laptop. The order reads
   along the rows, so "the top" is the first card. The writer's own cards carry a gold
   edge and say "(you)", never the colour alone. */
.wb-rules { margin: 0 0 var(--s4); }
.wb-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: var(--s4);
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}
body.vimarsha .wb-card {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin: 0;
  padding: var(--s3) var(--s4) var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
body.vimarsha .wb-card.is-mine { border-left: 3px solid var(--gold); }
.wb-card-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 1.9rem;
  font-size: var(--step--1);
  color: var(--muted);
}
.wb-who { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.wb-who a { color: inherit; font-weight: 600; }
.wb-who time { white-space: nowrap; }
.wb-remove { margin: 0 -0.4rem 0 0; flex: none; }
.wb-grip {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  margin-left: -0.5rem;
  border-radius: var(--r-ctl);
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}
.wb-grip:hover { background: var(--wash); color: var(--ink); }
.wb-grip .icon { width: 18px; height: 18px; }
.wb-card-body { font-size: var(--step-0); line-height: 1.6; }
.wb-move { font-size: var(--step--1); }
.wb-move > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  color: var(--muted);
  list-style: none;
}
.wb-move > summary::-webkit-details-marker { display: none; }
.wb-move > summary .icon { width: 16px; height: 16px; }
.wb-move > summary:hover { color: var(--ink); }
.wb-move form { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
body.vimarsha .wb-move .btn { min-height: 2.25rem; padding: 0.2rem 0.6rem; font-size: var(--step--1); border-color: var(--rule); }
body.vimarsha .wb-move .btn:disabled { opacity: 0.45; cursor: default; }
/* While a card is being dragged: where it will land, and the card under the finger. */
body.vimarsha .wb-card.is-ghost { opacity: 0.35; border-style: dashed; box-shadow: none; }
body.vimarsha .wb-card.is-dragging { box-shadow: var(--shadow-2); cursor: grabbing; }

.md-help { margin: 0 0 var(--s3); font-size: var(--step--1); }
.md-help summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.md-help table { margin-top: var(--s2); }
.md-help td { padding: 0.3rem var(--s3) 0.3rem 0; vertical-align: top; }
.whiteboard-body blockquote p { margin: 0; }
.registry-list:not(:has(> li:not([hidden]))) { display: none; }

/* ----------------------------------------------------------------- copy fields
 *
 * A value to copy with one tap (a project's id and link, for somebody's own sheet).
 * The value stays visible in a read-only box, so it can be checked and, without
 * JavaScript, selected by hand.
 */

.copy-field + .copy-field { margin-top: var(--s3); }
.copy-field label { display: block; margin-bottom: var(--s1); font-size: var(--step--1); font-weight: 600; }
.copy-field .field-hint { margin: 0 0 var(--s1); }
.copy-control { display: flex; gap: var(--s2); align-items: stretch; }
body.vimarsha .copy-control input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  font: var(--step--1) / 1.4 var(--font-mono);
  color: var(--muted);
  background: var(--paper);
}
.copy-control .btn { flex: none; white-space: nowrap; }
.copy-control .btn.is-copied { color: var(--ok); border-color: var(--ok); }
