/* The drafting page, in Material 3 Expressive: black and white, Google Sans
   Flex (Noto Sans Devanagari for Marathi), as Project-C. One column on a
   phone (the list, a notice or Deleted); the list beside the notice on a
   computer, and the preview beside both on a wide screen. */
:root {
  --font: "Google Sans Flex", "Google Sans", "Noto Sans Devanagari", Roboto, Arial, sans-serif;
  --font-mr: "Noto Sans Devanagari", "Google Sans Flex", sans-serif;

  --surface: #ffffff;
  --surface-1: #f5f5f4;   /* cards */
  --surface-2: #efefee;   /* the list beside a notice */
  --surface-3: #e8e8e7;   /* search, groups */
  --on-surface: #111111;
  --on-surface-var: #48484a;
  --outline: #79797b;
  --outline-var: #d3d3d2;
  --primary: #000000;
  --on-primary: #ffffff;
  --sec-container: #dededc;
  --inverse-surface: #2e2e2e;
  --inverse-on: #f3f3f1;
  --hover: rgba(0, 0, 0, .08);
  --press: rgba(0, 0, 0, .12);
  --alert: #b3261e;
  --elev-1: 0 1px 2px rgba(0,0,0,.16), 0 1px 3px 1px rgba(0,0,0,.08);
  --elev-3: 0 1px 3px rgba(0,0,0,.18), 0 4px 8px 3px rgba(0,0,0,.10);

  --ease: cubic-bezier(.2, 0, 0, 1);
  --spring: cubic-bezier(.34, 1.36, .44, 1);
  --shape-full: 999px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface: #000000; --surface-1: #121212; --surface-2: #161616; --surface-3: #2c2c2b;
    --on-surface: #e6e6e3; --on-surface-var: #b8b8b5;
    --outline: #8e8e8c; --outline-var: #3a3a39;
    --primary: #e6e6e3; --on-primary: #000000; --sec-container: #3a3a39;
    --inverse-surface: #e6e6e3; --inverse-on: #1a1a1a;
    --hover: rgba(255, 255, 255, .08); --press: rgba(255, 255, 255, .12);
    --alert: #ef6a5f;
    --elev-1: 0 1px 2px rgba(0,0,0,.5); --elev-3: 0 4px 12px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #000000; --surface-1: #121212; --surface-2: #161616; --surface-3: #2c2c2b;
  --on-surface: #e6e6e3; --on-surface-var: #b8b8b5;
  --outline: #8e8e8c; --outline-var: #3a3a39;
  --primary: #e6e6e3; --on-primary: #000000; --sec-container: #3a3a39;
  --inverse-surface: #e6e6e3; --inverse-on: #1a1a1a;
  --hover: rgba(255, 255, 255, .08); --press: rgba(255, 255, 255, .12);
  --alert: #ef6a5f;
  --elev-1: 0 1px 2px rgba(0,0,0,.5); --elev-3: 0 4px 12px rgba(0,0,0,.6);
}

/* Scroll bars, as Material 3 draws them: thin, round, grey, no track. */
* { scrollbar-width: thin; scrollbar-color: var(--outline) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface); color: var(--on-surface);
  font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--on-surface); outline-offset: 2px; }
::selection { background: var(--primary); color: var(--on-primary); }

.ms {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal;
  font-size: 24px; line-height: 1; display: inline-block; white-space: nowrap;
  -webkit-font-smoothing: antialiased; user-select: none;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 24px; border: 1px solid var(--outline); border-radius: var(--shape-full);
  background: transparent; color: var(--on-surface); font-size: 14px; font-weight: 500;
  transition: background-color 150ms var(--ease), border-radius 250ms var(--spring), box-shadow 150ms var(--ease);
}
.btn .ms { font-size: 18px; }
.btn:hover { background: var(--hover); }
.btn:active { border-radius: 12px; }
.btn.filled { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn.filled:hover { box-shadow: var(--elev-1); }
.btn.big { min-height: 56px; padding: 0 32px; font-size: 16px; min-width: 280px; }
.btn.big .ms { font-size: 24px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  width: 48px; height: 48px; flex: none; border: 0; border-radius: var(--shape-full);
  background: transparent; color: var(--on-surface-var);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 150ms var(--ease), border-radius 250ms var(--spring);
}
.icon-btn:hover { background: var(--hover); color: var(--on-surface); }
.icon-btn:active { border-radius: 12px; }

/* ---------- signing in ---------- */
.gate {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 32px; background: var(--surface);
}
html:not(.gated) .gate { display: none; }
.gate-choices { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.gate-shape {
  width: 120px; height: 120px; border-radius: 40% 60% 55% 45% / 50% 45% 55% 50%;
  background: var(--sec-container); display: flex; align-items: center; justify-content: center;
}
.gate-shape .ms { font-size: 48px; }
.gate-name { display: flex; flex-direction: column; gap: 4px; }
.gate-name h1 { font-size: 28px; font-weight: 500; }
.gate-name p { font-size: 14px; color: var(--on-surface-var); }
.gate-say { max-width: 300px; font-size: 14px; color: var(--alert); }
.gate-theme { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; }
.loader {
  width: 200px; height: 4px; border-radius: 2px; background: var(--surface-3); position: relative; overflow: hidden;
}
.loader::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 2px; background: var(--primary);
  animation: sweep 1.2s var(--ease) infinite;
}
@keyframes sweep { from { left: -40%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .loader::after { animation-duration: 3s; } }

/* ---------- the panes ---------- */
.app { min-height: 100dvh; }
html.gated .app { display: none; }
.pane { display: none; flex-direction: column; min-width: 0; }
.app[data-view="list"] .list-pane,
.app[data-view="form"] .form-pane,
.app[data-view="deleted"] .deleted-pane { display: flex; }
.bar {
  display: flex; align-items: center; gap: 4px; min-height: 64px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px 16px;
  position: sticky; top: 0; z-index: 2; background: inherit;
}
.list-pane, .form-pane, .deleted-pane { background: var(--surface); }
.bar-title { flex: 1; min-width: 0; font-size: 22px; font-weight: 500; line-height: 1.3; }
.form-bar, .deleted-pane .bar { padding-left: 4px; }
.form-bar .bar-title { font-size: 18px; }
.status { font-size: 12px; color: var(--on-surface-var); white-space: nowrap; padding: 0 4px; }
.status.bad { color: var(--alert); }
.wide-only { display: none; }

/* the list */
.search {
  display: flex; align-items: center; gap: 12px; height: 56px; margin: 4px 16px 12px; padding: 0 16px;
  border-radius: var(--shape-full); background: var(--surface-3); color: var(--on-surface-var);
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; color: var(--on-surface); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 12px; }
.chip {
  height: 32px; padding: 0 16px; border: 1px solid var(--outline); border-radius: 8px;
  background: transparent; font-size: 14px; font-weight: 500;
}
.chip[aria-checked="true"] { background: var(--sec-container); border-color: transparent; }
.list { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 120px; }
.month { margin: 8px 4px 4px; font-size: 14px; font-weight: 500; color: var(--on-surface-var); }
.item {
  display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px; border: 0; border-radius: 16px;
  background: var(--surface-1); text-align: left; transition: background-color 150ms var(--ease);
}
.item:hover { background: var(--surface-3); }
.item[aria-current="true"] { background: var(--sec-container); }
.item-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--sec-container);
  display: flex; align-items: center; justify-content: center;
}
.item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-name { font-family: var(--font-mr); font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.item-meta { font-size: 13px; color: var(--on-surface-var); }
.item-amount { font-size: 15px; font-weight: 500; white-space: nowrap; }
.item .btn { flex: none; }
.empty { padding: 32px 16px; text-align: center; color: var(--on-surface-var); font-size: 14px; }
.fab {
  position: fixed; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 3;
  height: 56px; padding: 0 20px 0 16px; border: 0; border-radius: 16px;
  background: var(--primary); color: var(--on-primary); box-shadow: var(--elev-3);
  display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 500;
  transition: border-radius 250ms var(--spring);
}
.fab:active { border-radius: 24px; }

/* the form */
.form { display: flex; flex-direction: column; gap: 12px; padding: 4px 12px 32px; }
.card { display: flex; flex-direction: column; gap: 20px; padding: 20px 16px; border-radius: 24px; background: var(--surface-1); }
.card h2 { font-size: 16px; font-weight: 500; }
.row { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 12px; }
.row.person { grid-template-columns: 112px minmax(0, 1fr) 40px; align-items: center; }
.row.titled { grid-template-columns: 112px minmax(0, 1fr); }
.group { display: flex; flex-direction: column; gap: 20px; padding: 16px; border-radius: 16px; background: var(--surface-3); }
.group-title { font-size: 14px; font-weight: 500; }
.f { position: relative; display: flex; flex-direction: column; min-width: 0; }
.f > .f-label {
  position: absolute; top: -8px; left: 12px; padding: 0 4px; z-index: 1;
  font-size: 12px; line-height: 16px; color: var(--on-surface-var); background: var(--surface-1);
  max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.group .f > .f-label { background: var(--surface-3); }
.f input, .f select, .f textarea {
  width: 100%; min-height: 56px; padding: 16px; border: 1px solid var(--outline); border-radius: 4px;
  background: transparent; font-size: 16px; color: var(--on-surface); resize: vertical;
}
.f select { appearance: auto; }
.f select option { background: var(--surface); color: var(--on-surface); }
.f :is(input, select, textarea):focus { outline: none; border: 2px solid var(--primary); padding: 15px; }
.f [lang="mr"] { font-family: var(--font-mr); }
.f.bad :is(input, select, textarea) { border-color: var(--alert); }
.segmented {
  display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  border: 1px solid var(--outline); border-radius: var(--shape-full); overflow: hidden;
}
.segmented button { min-height: 48px; border: 0; background: transparent; color: var(--on-surface-var); font-size: 14px; font-weight: 500; }
.segmented button + button { border-left: 1px solid var(--outline); }
.segmented button[aria-checked="true"] { background: var(--sec-container); color: var(--on-surface); }
.add { align-self: flex-start; padding: 0 20px 0 16px; }
.download { min-height: 56px; font-size: 16px; }
.nothing-open { display: none; }

/* the preview: a page of the notice */
.preview-pane { padding: 16px 24px 32px 0; gap: 8px; }
.preview-label { margin: 8px 4px 0; font-size: 14px; font-weight: 500; color: var(--on-surface-var); }
.paper {
  padding: 56px 32px 32px; border-radius: 8px; background: #ffffff; color: #111111;
  box-shadow: var(--elev-1); font-family: var(--font-mr); font-size: 13px; line-height: 1.8;
}
.paper p { margin: 0 0 6px; }
.paper p.gap { height: 4px; margin: 0; }
.paper .tab { display: inline-block; width: 3em; }
.paper table { width: 100%; border-collapse: collapse; margin: 4px 0 10px; }
.paper td { border: 1px solid #111111; padding: 2px 6px; vertical-align: top; }
.paper td p { margin: 0; }
.paper mark { background: #dededc; color: #000000; padding: 0 2px; border-radius: 3px; }

/* the message at the bottom */
.snack {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 8px; max-width: min(560px, calc(100vw - 32px));
  min-height: 48px; padding: 8px 8px 8px 16px; border-radius: 4px;
  background: var(--inverse-surface); color: var(--inverse-on); box-shadow: var(--elev-3); font-size: 14px;
}
.snack-act {
  border: 0; background: transparent; color: var(--inverse-on); font-weight: 600; font-size: 14px;
  padding: 8px 12px; border-radius: var(--shape-full); text-decoration: underline;
}

/* ---------- a computer: the list beside the notice ---------- */
@media (min-width: 1000px) {
  .app { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100dvh; }
  .pane { overflow: auto; height: 100dvh; }
  .list-pane { display: flex; background: var(--surface-2); }
  .list-pane .bar { background: var(--surface-2); }
  .list-pane .search { background: var(--surface); }
  .list-pane .item { background: transparent; }
  .list-pane .item:hover { background: var(--surface-3); }
  .list-pane .item[aria-current="true"] { background: var(--sec-container); }
  .list-pane .list { padding-bottom: 24px; }
  .fab { position: static; order: -1; align-self: flex-start; margin: 0 16px 12px; box-shadow: none; }
  .list-pane .bar { order: -3; }
  .list-pane .fab { order: -2; }
  .form-pane, .deleted-pane { grid-column: 2; grid-row: 1; }
  .app[data-view="list"] .form-pane { display: flex; }
  .form-pane.empty .form, .form-pane.empty .form-bar { display: none; }
  .form-pane.empty .nothing-open {
    display: flex; flex: 1; align-items: center; justify-content: center; color: var(--outline-var);
  }
  .form-pane.empty .nothing-open .ms { font-size: 96px; }
  .form-bar .back { display: none; }
  .form-bar { padding-left: 24px; }
  .form { padding: 4px 24px 32px; }
  .form-pane .wide-only { display: inline-flex; }
  .card { padding: 20px; }
  .snack { bottom: 24px; }
}

/* ---------- a wide screen: the preview too ---------- */
@media (min-width: 1280px) {
  .app[data-view="form"] { grid-template-columns: 320px minmax(0, 1fr) minmax(400px, 42%); }
  .app[data-view="form"] .preview-pane { display: flex; grid-column: 3; grid-row: 1; }
}
