/* Copied from docs/design/mockup.html: tokens, top bar, menus, fold, Ctrl K, your menu, cards,
   tables, chips, switches and the Settings screens. Lines marked "app" are ours (phone sheet,
   sign-in page, status footer). Company colors and font are set at run time (app/shell/brand.ts). */
:root {
  --bg: #e3eff2;
  --card: #ffffff;
  --fg: #191820;
  --muted: #3f5566;
  --line: #b9c7cf;
  --quiet: #e7e9eb;
  --primary: #073e5a;
  --on-primary: #ffffff;
  --accent: #4096ab;
  --accent-text: #286f81;
  --tint: #eef5f7;
  --ok: #1d6b45;
  --ok-bg: #e2f2e8;
  --warn: #7a4e00;
  --warn-bg: #fff1d1;
  --bad: #b13924;
  --bad-bg: #fbe7e3;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r: 8px;
  --rc: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1a20;
    --card: #15252d;
    --fg: #e9eff2;
    --muted: #a9bcc6;
    --line: #35505c;
    --quiet: #1e323c;
    --primary: #5bb2c8;
    --on-primary: #06222f;
    --accent: #5bb2c8;
    --accent-text: #7cc6d8;
    --tint: #1a2e37;
    --ok: #7fd3a3;
    --ok-bg: #163527;
    --warn: #f2c46b;
    --warn-bg: #3a2d10;
    --bad: #f29a88;
    --bad-bg: #3d1c16;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1a20;
  --card: #15252d;
  --fg: #e9eff2;
  --muted: #a9bcc6;
  --line: #35505c;
  --quiet: #1e323c;
  --primary: #5bb2c8;
  --on-primary: #06222f;
  --accent: #5bb2c8;
  --accent-text: #7cc6d8;
  --tint: #1a2e37;
  --ok: #7fd3a3;
  --ok-bg: #163527;
  --warn: #f2c46b;
  --warn-bg: #3a2d10;
  --bad: #f29a88;
  --bad-bg: #3d1c16;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--card);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--accent-text);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
  line-height: 1.25;
}
h1 {
  font-size: 1.45rem;
  font-weight: 700;
}
h2 {
  font-size: 1.05rem;
  font-weight: 700;
}
h3 {
  font-size: 0.95rem;
  font-weight: 600;
}
p {
  margin: 0;
}
.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}

/* Icons (Octicons, drawn by app/ui/icons.ts) */
.oi {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: currentColor;
}
@media (forced-colors: active) {
  .oi {
    fill: CanvasText;
  }
}
.oi.big {
  font-size: 2rem;
  color: var(--muted);
}
.h1i {
  color: var(--accent-text);
  margin-right: 8px;
  font-size: 1.1rem;
  vertical-align: -0.1em;
}

/* Top bar */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
  min-width: 0;
}
.brand svg {
  width: 26px;
  height: 26px;
  flex: none;
}
.brand img {
  height: 26px;
  max-width: 96px;
  object-fit: contain;
  flex: none;
}
.brand span small {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.switch {
  display: flex;
  gap: 4px;
  background: var(--quiet);
  border-radius: 999px;
  padding: 4px;
  flex-wrap: wrap;
}
.switch button {
  border: 0;
  background: none;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
  min-height: 32px;
}
.switch button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary);
}
.switch button .oi {
  margin-right: 2px;
}
.swsep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 4px 6px;
}
.topright {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--r);
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 500;
  min-height: 34px;
  font-size: 0.9rem;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover {
  border-color: var(--accent);
}
.btn.pri {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.btn.pri:hover {
  filter: brightness(1.1);
}
.btn.ghost {
  border-color: transparent;
  background: none;
  color: var(--accent-text);
}
.btn.danger {
  color: var(--bad);
}
.btn.sm {
  padding: 4px 10px;
  min-height: 28px;
  font-size: 0.82rem;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn .oi {
  font-size: 1rem;
}
.btn.ib {
  padding: 6px;
  min-width: 34px;
  justify-content: center;
}
.btn.ib-wide {
  gap: 8px;
  color: var(--muted);
}
.kbd {
  font-size: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  color: var(--muted);
  font-weight: 500;
  background: var(--card);
}
.inboxbtn {
  position: relative;
}
.ibadge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #cf222e;
  color: #fff;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}
#tip {
  position: fixed;
  z-index: 60;
  max-width: 260px;
  background: var(--fg);
  color: var(--card);
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 6px 9px;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

/* Your menu */
.amwrap {
  position: relative;
}
.avatar-btn,
.avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: 0.8rem;
  border: 0;
  cursor: pointer;
  flex: none;
}
.avatar-btn[aria-expanded="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.amenu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: 270px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--rc);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 6px;
}
.amenu button {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  border: 0;
  background: none;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  color: var(--fg);
}
.amenu button:hover {
  background: var(--tint);
}
.amenu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 0;
}
.amhead {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.amhead small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}
.amlab {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 10px 4px;
  font-weight: 600;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--card);
  flex-wrap: wrap;
}
.seg button {
  border: 0;
  background: none;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.seg button + button {
  border-left: 1px solid var(--line);
}
.seg button[aria-pressed="true"] {
  background: var(--tint);
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.seg.big button {
  padding: 10px 16px;
}
.fsrow {
  padding: 4px 10px 8px;
}
.fsrow .amlab {
  padding: 4px 0 6px;
}
.fsrow .seg {
  width: 100%;
}
.amenu .fsrow .seg button {
  flex: 1;
  justify-content: center;
  padding: 5px 6px;
  width: auto;
  border-radius: 0;
}
.amenu .fsrow .seg button + button {
  border-left: 1px solid var(--line);
}
@media (max-width: 560px) {
  .amenu {
    position: fixed;
    left: 12px;
    right: 12px;
    width: auto;
    top: 60px;
  }
}

/* Shell: left menu (folds to icons) and the working area */
.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 60px);
}
.rail {
  border-right: 1px solid var(--line);
  background: var(--card);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail .eyebrow {
  padding: 4px 10px 8px;
}
.rail button {
  text-align: left;
  border: 0;
  background: none;
  padding: 8px 10px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.rail button:hover {
  background: var(--tint);
}
.rail button[aria-current="page"] {
  background: var(--tint);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.rail .rl {
  display: flex;
  gap: 8px;
  align-items: center;
}
.rail .rl .oi {
  color: var(--muted);
}
.rail button[aria-current="page"] .rl .oi {
  color: var(--accent-text);
}
.rail hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 10px 4px;
  width: auto;
}
.rail .railtog {
  color: var(--muted);
  align-self: flex-end;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  margin: -6px -2px 2px 0;
  font-size: 1.05rem;
}
.rail .railtog:hover {
  color: var(--fg);
}
.shell.rmin .rail .railtog {
  align-self: center;
  margin: -6px 0 6px;
}
@media (min-width: 761px) {
  .shell.rmin {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .shell.rmin .rail {
    padding: 16px 6px;
  }
  .shell.rmin .rail .eyebrow,
  .shell.rmin .rail .rl > span {
    display: none;
  }
  .shell.rmin .rail button {
    justify-content: center;
    padding: 8px;
  }
}
main {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 60px;
  min-width: 0;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}
.crumbs {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.crumbs button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-text);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
}
.head .t {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 48px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--rc);
  background: var(--card);
}

/* Home */
.wsgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.ws {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ws .top2 {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

/* Cards, grids, tables, chips */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--rc);
  padding: 16px;
  min-width: 0;
}
.card > h2,
.card > h3 {
  margin-bottom: 10px;
}
.cardhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  background: var(--quiet);
  color: var(--fg);
}
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.chip.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.chip.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.chip.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.chip.info {
  background: var(--tint);
  color: var(--accent-text);
}
.chip.plain::before {
  display: none;
}
.tw {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--rc);
  background: var(--card);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}
th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--card);
}
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--quiet);
  vertical-align: top;
}
tr:last-child td {
  border-bottom: 0;
}
td.num,
th.num {
  text-align: right;
}
td b {
  font-weight: 600;
}
.mx td,
.mx th {
  text-align: center;
  padding: 6px 8px;
}
.mx td:first-child,
.mx th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--card);
}
.note {
  border-left: 3px solid var(--accent);
  background: var(--tint);
  padding: 10px 12px;
  border-radius: 0 var(--r) var(--r) 0;
  font-size: 0.88rem;
}
.note[hidden] {
  display: none;
}
.ptask {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.92rem;
}
.linkrow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.chipbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 4px 11px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--fg);
}
.chipbtn:hover {
  border-color: var(--accent);
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 560px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field label,
.field .label {
  font-weight: 600;
  font-size: 0.85rem;
}
.hint,
.field .hint {
  font-size: 0.78rem;
  color: var(--muted);
}
input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--r);
  padding: 8px 10px;
  min-height: 38px;
  width: 100%;
}
textarea {
  min-height: 70px;
}
.checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checks label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 400;
  font-size: 0.9rem;
}
.switch-l {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.switch-l input {
  appearance: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  cursor: pointer;
  transition: 0.15s;
  margin: 0;
}
.switch-l input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: 0.15s;
}
.switch-l input:checked {
  background: var(--ok);
}
.switch-l input:checked::after {
  left: 19px;
}
.colorpick {
  display: flex;
  gap: 8px;
  align-items: center;
}
.colorpick input {
  width: 44px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  background: var(--card);
}
.sw {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.bprev {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.logo-prev {
  width: 120px;
  height: 60px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
}
.modcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modcard .cardhead {
  margin: 0;
}
.modname {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}
.swl {
  display: block;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Dialogs, Ctrl K, toast */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 32, 0.45);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--card);
  border-radius: var(--rc);
  border: 1px solid var(--line);
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal.wide {
  width: min(820px, 100%);
}
.dlg {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cmdk {
  padding: 0;
  gap: 0;
  width: min(620px, 100%);
}
.cmdk-in {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.cmdk-in input {
  border: 0;
  min-height: 30px;
  font-size: 1rem;
  outline: none;
  background: transparent;
  flex: 1;
  min-width: 0;
  padding: 0;
}
.flist {
  display: flex;
  flex-direction: column;
  padding: 6px;
  max-height: 60vh;
  overflow-y: auto;
}
.flist p {
  padding: 10px;
}
.fitem {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 0;
  background: none;
  text-align: left;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}
.fitem .oi {
  color: var(--muted);
}
.fitem span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.fitem:hover,
.fitem:focus-visible,
.fitem.first {
  background: var(--tint);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  transition: 0.25s;
  background: var(--fg);
  color: var(--card);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 50;
  max-width: calc(100% - 32px);
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast small {
  opacity: 0.75;
}
@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}

/* app: phone menu sheet (the top menu and the left menu at phone width) */
.phonly {
  display: none;
}
.modal.sheet {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(320px, 86vw);
  max-height: none;
  border-radius: 0 var(--rc) var(--rc) 0;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 12px 16px
    max(12px, env(safe-area-inset-left, 0px));
}
.msheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msheet nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msheet nav + nav {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.msheet .eyebrow {
  padding: 4px 10px 6px;
}
.msheet nav button {
  text-align: left;
  border: 0;
  background: none;
  padding: 9px 10px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
}
.msheet nav button:hover {
  background: var(--tint);
}
.msheet nav button[aria-current="page"] {
  background: var(--tint);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.msheet .rl {
  display: flex;
  gap: 8px;
  align-items: center;
}
.msheet .rl .oi {
  color: var(--muted);
}

/* app: sign-in page and the status line under it */
.signin-page {
  flex: 1;
  width: 100%;
}
.signin {
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.signin .form {
  margin: 4px 0;
}
.signin .form .btn {
  align-self: flex-start;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.foot {
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  text-align: center;
}
#status[data-db="ok"] b {
  color: var(--ok);
}
#status[data-db="down"] b {
  color: var(--bad);
}

@media (max-width: 980px) {
  .grid3 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .rail,
  .switch,
  .swsep {
    display: none;
  }
  .phonly {
    display: inline-flex;
  }
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }
  .brand span small {
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topright {
    gap: 6px;
  }
  .btn.ib-wide .kbd {
    display: none;
  }
  .btn.ib-wide {
    padding: 6px;
    min-width: 34px;
    justify-content: center;
  }
}

/* UI kit (brief 1A-6), copied from the mockup: List/Board switch, stage chips, bulk bar, table
   with checkboxes, sortable headers and the filter row, board, stage strip, activity panel,
   autosave and folding sections. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.vbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
}
.seg2 {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--card);
}
.seg2 button {
  border: 0;
  background: none;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.85rem;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  color: var(--fg);
}
.seg2 button + button {
  border-left: 1px solid var(--line);
}
.seg2 button[aria-pressed="true"] {
  background: var(--tint);
  color: var(--accent-text);
  font-weight: 600;
}
.stagef {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.chipbtn.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.bulk {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: var(--fg);
  color: var(--card);
  border-radius: var(--rc);
  padding: 8px 10px;
  margin: 0 0 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.bulk b {
  margin-right: 6px;
}
.bulk .btn {
  background: transparent;
  color: inherit;
  border-color: rgba(255, 255, 255, 0.35);
}
.bulk .btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.seltable td.cbx,
.seltable th.cbx {
  width: 36px;
  text-align: center;
  padding-left: 10px;
  padding-right: 4px;
}
.seltable td.cbx {
  cursor: pointer;
}
.seltable input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.seltable tr.sel td {
  background: var(--tint);
}
tr.go {
  cursor: pointer;
}
tr.go:hover td {
  background: var(--tint);
}
tr.go:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover {
  color: var(--accent-text);
}
th[aria-sort="ascending"]:after {
  content: " ▲";
  font-size: 0.7em;
}
th[aria-sort="descending"]:after {
  content: " ▼";
  font-size: 0.7em;
}
.tw.hasf {
  position: relative;
}
.tfbtn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
}
.tfbtn:hover,
.tfbtn[aria-expanded="true"] {
  color: var(--accent-text);
}
.tw.hasf thead tr:first-child th:last-child {
  padding-right: 38px;
}
.filterrow th {
  padding: 4px 6px !important;
  background: var(--tint);
}
.filterrow input,
.filterrow select {
  width: 100%;
  min-width: 60px;
  min-height: 0;
  font: inherit;
  font-size: 0.8rem;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--fg);
}
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.col {
  background: var(--quiet);
  border-radius: var(--rc);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}
.col h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  padding: 2px 4px;
}
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.84rem;
  width: 100%;
}
.tile:hover {
  border-color: var(--accent);
}
.tile b {
  font-size: 0.9rem;
}
.trail {
  display: grid;
  grid-template-columns: repeat(var(--steps, 6), minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--rc);
  overflow: hidden;
  background: var(--card);
}
.trail button,
.trail .step {
  border: 0;
  border-right: 1px solid var(--line);
  background: none;
  text-align: left;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.trail .step {
  cursor: default;
}
.trail > :last-child {
  border-right: 0;
}
.trail button:hover {
  background: var(--tint);
}
.trail .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-text);
  font-weight: 600;
}
.trail .v {
  font-size: 1.25rem;
  font-weight: 700;
}
.trail .s {
  font-size: 0.78rem;
  color: var(--muted);
}
.trail > :not(:last-child) .k::after {
  content: " →";
  color: var(--muted);
}
.kv {
  display: grid;
  grid-template-columns: minmax(120px, 40%) minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0;
  font-size: 0.9rem;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  font-weight: 500;
}
.h3s {
  font-size: 0.9rem;
  margin: 12px 0 6px;
}
.actpanel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.acttab {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--fg);
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.08);
}
.acttab .cnt {
  background: var(--quiet);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 0.7rem;
}
.acttab .cnt.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
/* A record's open flags and blocks in its activity panel (brief 1B-7). */
.flaglist {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.flaglist li {
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.86rem;
}
.flaglist small {
  color: var(--muted);
}
.actbody {
  width: min(340px, 88vw);
  max-height: calc(100vh - 140px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: -6px 6px 24px rgba(0, 0, 0, 0.14);
}
.actbody h2:focus {
  outline: none;
}
.actpanel.open .acttab {
  display: none;
}
.saved {
  color: var(--ok);
  margin: 0 0 8px;
}
.actlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.actlist li {
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--line);
  padding-left: 8px;
}
.actlist small {
  color: var(--muted);
}
.autosave {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 0.75rem;
  color: var(--ok);
}
.autosave.bad {
  color: var(--bad);
  max-width: 420px;
}
.asec {
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-top: 8px;
  background: var(--card);
}
.asec > summary {
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  list-style: none;
}
.asec > summary::-webkit-details-marker {
  display: none;
}
.asec > summary:after {
  content: "›";
  margin-left: auto;
  color: var(--muted);
  transition: 0.2s;
}
.asec[open] > summary:after {
  transform: rotate(90deg);
}
.asb {
  padding: 4px 12px 12px;
}
/* app: header buttons that sort keep the header's look */
.sortbtn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.modal:focus {
  outline: none;
}
@media (max-width: 980px) {
  .trail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .trail > :nth-child(3n) {
    border-right: 0;
  }
  .trail > * {
    border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 760px) {
  /* app: at phone width a modal fills the screen as a sheet, and activity opens along the bottom */
  .scrim:has(.modal.kit) {
    padding: 0;
    align-items: stretch;
  }
  .modal.kit {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: 0;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px
      calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .actpanel.open {
    left: 0;
    right: 0;
    bottom: 0;
  }
  .actpanel.open .actbody {
    width: 100%;
    max-height: 70vh;
    border-radius: 12px 12px 0 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 460px) {
  .trail {
    grid-template-columns: 1fr 1fr;
  }
  .trail > * {
    border-right: 0 !important;
  }
}

/* Uploads (brief 1A-7): progress as the mockup's .meter; a file dragged over shows the mockup's
   drop outline (.dropok). */
.meter {
  height: 8px;
  border-radius: 4px;
  background: var(--quiet);
  overflow: hidden;
}
.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.upload {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: var(--r);
}
.upload .row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.upload .meter {
  max-width: 260px;
}
.upload.dropok {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}
.logo-prev img {
  max-height: 100%;
  max-width: 100%;
}

/* ---- Client records (brief 1B-1): the stage card and choice pills, as the mockup ------------ */
.stagebox {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stepper {
  list-style: none;
  margin: 0;
  padding: 0 0 4px;
  display: flex;
  overflow-x: auto;
}
.stepper li {
  flex: 1 0 auto;
  min-width: 96px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  padding-right: 8px;
}
.stepper .bar {
  height: 6px;
  border-radius: 3px;
  background: var(--quiet);
}
.stepper li.done .bar {
  background: var(--accent);
}
.stepper li.cur .bar {
  background: var(--primary);
}
.stepper li.cur {
  font-weight: 700;
}
.stepper .lab {
  display: flex;
  gap: 4px;
  align-items: baseline;
}
.stepper .n {
  color: var(--muted);
  font-weight: 500;
}
.nextstep {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: var(--tint);
  border-radius: var(--r);
  padding: 10px 12px;
}
.nextstep p {
  margin: 0;
}
/* Radio or checkbox choices as pills (mockup .seg label). */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 0;
  margin: 0;
  padding: 0;
}
.pills legend {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0;
  margin-bottom: 4px;
}
.pills label {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 500;
}
.pills input {
  accent-color: var(--primary);
  margin: 0;
}
.pills label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.recgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.recgrid > .card {
  margin: 0;
}
.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.formgrid .wide {
  grid-column: 1 / -1;
}
.rowacts {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
@media (max-width: 760px) {
  .recgrid,
  .formgrid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.flip svg {
  transform: scaleX(-1);
}
.record {
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* Room under the last card, so the floating Activity tab never covers its buttons. */
  padding-bottom: 72px;
}
.record > .card,
.record > .head {
  margin: 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
/* People (brief 1B-2): the record's four boxes, levels and plain lists (mockup .grid4, .lvl). */
.grid4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.grid4 > .card {
  margin: 0;
}
@media (max-width: 980px) {
  .grid4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.lvl {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--tint);
  color: var(--accent-text);
}
.dot {
  color: var(--muted);
}
.plainlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---- Shared inbox (brief 1B-3, mockup V12 inbox) ---- */
.inboxbtn.on {
  border-color: var(--primary);
}
.rail .cnt {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--quiet);
  border-radius: 999px;
  padding: 0 7px;
  font-weight: 600;
}
.shell.rmin .rail .cnt {
  display: none;
}
.inbox {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--rc);
  overflow: hidden;
  background: var(--card);
}
.imsg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  width: 100%;
}
.imsg:last-child {
  border-bottom: 0;
}
.imsg:hover {
  background: var(--tint);
}
.imsg.read {
  opacity: 0.65;
}
.ich {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--quiet);
  display: grid;
  place-items: center;
  flex: none;
  color: var(--muted);
}
.imain {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.itop {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.itop small {
  color: var(--muted);
  white-space: nowrap;
}
.isub {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ilab {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.bizt {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.stagecards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.scard {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--rc);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  min-width: 110px;
}
.scard b {
  font-size: 1.3rem;
}
.scard span {
  font-size: 0.78rem;
  color: var(--muted);
}
.scard:hover {
  border-color: var(--primary);
}
.aisug {
  border-left: 4px solid var(--accent);
}
/* AI is off (mockup .noai .aisug): the card asks a person to decide. */
.aisug.off {
  border-style: dashed;
}
.aisug.off::before {
  content: "AI is off. Decide where this goes.";
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
}
.warnnote {
  border-left: 4px solid var(--warn);
  background: var(--warn-bg);
}
.plist2 {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.plist2 li {
  font-size: 0.9rem;
}
.docprev {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.docimg {
  aspect-ratio: 3/2;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--tint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82em;
  text-align: center;
  padding: 6px;
  font-family: inherit;
  cursor: pointer;
}
.docimg .oi {
  width: 28px;
  height: 28px;
}
.convo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 12px;
}
.convo .msg p {
  white-space: pre-wrap;
  margin: 4px 0 0;
}
.convo .msg.out {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}
.picks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.picks button {
  text-align: left;
}
@media (max-width: 640px) {
  .docprev {
    grid-template-columns: 1fr;
  }
}
/* Tabs (mockup .tabs): the Send sheet's channels and the Outbox's filters (brief 1B-4). */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tabs button {
  border: 0;
  background: none;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: inherit;
  font: inherit;
}
.tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--primary);
  font-weight: 600;
}
.tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.filerow {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
/* The secure link page (brief 1B-4): one card, like sign-in. */
.linkpage .card {
  max-width: 560px;
  width: 100%;
}
.linkfiles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
/* In a dialog the six Send tabs fit on one line at desktop width. */
.dlg .tabs {
  gap: 0;
}
.dlg .tabs button {
  padding: 8px 9px;
}
/* Conversations (brief 1B-5, mockup v20): the thread, notes, calls, the two columns. */
.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
  margin: 0 0 12px;
}
.msg {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--quiet);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: flex-start;
}
.msg .body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.out {
  align-self: flex-end;
  background: var(--tint);
  border: 1px solid var(--line);
}
.msg .meta {
  font-size: 0.72rem;
  color: var(--muted);
}
.msg.note-m {
  align-self: stretch;
  max-width: 100%;
  background: var(--warn-bg);
  border: 1px dashed var(--warn);
}
.msg.call-m {
  align-self: center;
  max-width: 90%;
  background: var(--card);
  border: 1px solid var(--line);
}
/* A missed call's voicemail (brief 1B-6): the player, then the transcript. */
.msg .vm {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.msg .vm audio {
  width: 100%;
  max-width: 360px;
  height: 36px;
}
.cvgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}
.cvside {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cvbar {
  justify-content: space-between;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.mentions {
  flex-direction: row;
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .cvgrid {
    grid-template-columns: 1fr;
  }
  .msg {
    max-width: 92%;
  }
}

/* AI on every text box (brief 1B-8, mockup v10): the mic and the AI menu sit inside the box. */
textarea.hasdict {
  padding-bottom: 34px;
}
.dictwrap {
  position: relative;
  display: block;
  width: 100%;
}
.composer .dictwrap {
  flex: 1 1 240px;
  min-width: 0;
}
.dictwrap > textarea {
  width: 100%;
  box-sizing: border-box;
}
.dictbar {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: flex;
  gap: 4px;
  align-items: center;
  z-index: 1;
}
.dictbar button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  height: 26px;
  min-width: 26px;
  padding: 0 7px;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
}
.dictbar button:hover {
  color: var(--accent-text);
  border-color: var(--accent);
}
.dictbar button.paused {
  opacity: 0.55;
  cursor: not-allowed;
}
.dictbtn.rec {
  background: #cf222e;
  border-color: #cf222e;
  color: #fff;
  animation: dictpulse 1.4s infinite;
}
/* The last minute: amber from 9:00, red for the last 30 seconds. */
.dictbtn.rec.amber {
  background: var(--warn);
  border-color: var(--warn);
}
.dictbtn.rec.red {
  background: #a40e26;
  border-color: #a40e26;
}
@keyframes dictpulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(207, 34, 46, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(207, 34, 46, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dictbtn.rec {
    animation: none;
  }
}
.aimenu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 210px;
}
.aimenu button {
  white-space: nowrap;
  border: 0;
  background: none;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--fg);
}
.aimenu button:hover,
.aimenu button:focus-visible {
  background: var(--tint);
}
/* AI's version beside the original: nothing changes until Use it. */
.aiprop {
  margin: 8px 0;
  padding: 10px 12px;
}
.aicols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 6px 0 8px;
}
.aitext {
  margin: 2px 0 0;
  white-space: pre-wrap;
  font-size: 0.9rem;
}
@media (max-width: 760px) {
  .aicols {
    grid-template-columns: 1fr;
  }
}
/* Settings › AI (mockup v14): the company switch turns amber when AI is off. */
.aimaster.off {
  border-color: var(--warn);
  background: var(--warn-bg);
}
/* A field AI filled from an upload, until a person saves it. */
.airead input {
  border-color: var(--accent);
  background: var(--tint);
}
.aiflag {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 0.75rem;
  color: var(--accent-text);
  margin-top: 2px;
}

/* The file viewer (brief 1B-9, mockup v23 attModal): the pages on the left, what to do with it on
   the right; one column at phone width, with the actions under the pages. */
.modal.viewer {
  width: min(1100px, 96vw);
}
.attgrid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
}
.attpane {
  background: var(--quiet);
  border-radius: 8px;
  padding: 14px;
  max-height: 62vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.atttools {
  display: flex;
  gap: 6px;
  align-self: flex-end;
  position: sticky;
  top: 0;
  z-index: 1;
}
.attpages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  min-height: 200px;
}
.attpage {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}
.attpage canvas,
.attimg {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  max-width: none;
}
.attimg {
  transition: transform 0.15s;
}
.attpage figcaption {
  align-self: flex-end;
}
.attother {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 220px;
}
.attside {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.attfile {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.attfiled {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.attor {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.attcard {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.attchip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 4px 4px 10px;
}
.attchip .filed {
  flex-basis: 100%;
}
/* Long file names (brief 1D-6): the chip never grows past its row; the name ends in "…" and the
   icons beside it stay on screen, down to a 390 px phone. */
.attchip,
.chipbtn,
.filerow {
  max-width: 100%;
  min-width: 0;
}
.attchip > .ib,
.attchip > svg,
.chipbtn > svg,
.filerow > * {
  flex-shrink: 0;
}
.filerow > .chipbtn {
  flex-shrink: 1;
}
.fname {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg .linkrow {
  max-width: 100%;
  min-width: 0;
}
@media (max-width: 800px) {
  .attgrid {
    grid-template-columns: 1fr;
  }
  .attpane {
    max-height: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .attimg {
    transition: none;
  }
}
.attor .rowacts {
  justify-content: flex-start;
}

/* The patient record (brief 1C-1, mockup caseRec): the stage fold, the step strip (.parts), the
   avatar, the billing card's edge, the admission bar. */
.stagefold {
  margin: 6px 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.stagefold > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--rc);
  background: var(--card);
}
.stagefold > summary::-webkit-details-marker {
  display: none;
}
.stagefold[open] > summary {
  margin-bottom: 8px;
}
.stagefold .stepper {
  overflow-x: auto;
}
.parts {
  display: flex;
  align-items: stretch;
  gap: 4px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.part {
  flex: 1 1 130px;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--rc);
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  position: relative;
}
.part:hover {
  border-color: var(--accent);
}
.part.on {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.part small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}
.pn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent-text);
  font-weight: 700;
  flex: none;
}
.part.on .pn {
  background: var(--primary);
  color: var(--on-primary);
}
.parr {
  display: flex;
  align-items: center;
  color: var(--muted);
}
.pdot2 {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.pdot2.ok {
  background: #2da44e;
}
.pdot2.warn {
  background: #d4a72c;
}
.pdot2.bad {
  background: #cf222e;
}
.pav {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  margin-right: 10px;
  vertical-align: middle;
  flex: none;
}
.pav.big {
  width: 52px;
  height: 52px;
  font-size: 1.1rem;
  margin: 0;
}
.billto {
  border-left: 4px solid var(--accent);
}
.admbar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--ok-bg);
  color: var(--ok);
  border-radius: var(--r);
  padding: 8px 12px;
  margin-bottom: 10px;
}
.admbar.no {
  background: var(--warn-bg);
  color: var(--warn);
}
.tabs2 {
  margin: 4px 0 12px;
}
.newasm {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .parr {
    display: none;
  }
}
/* The record's Messages card sits inside the lower card's tabs (brief 1C-1): one card, not two. */
.lowercard > .card {
  border: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
  background: none;
}
.lowercard > .card > h2:first-child {
  display: none;
}
/* The Assessment tab (brief 1C-2, mockup v7, v9 and the drug database note). */
.sn {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--quiet);
  font-size: 0.75rem;
  font-weight: 700;
}
.recbar {
  display: flex;
  gap: 10px;
  align-items: center;
  border-radius: var(--r);
  padding: 8px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
}
.recbar span {
  flex: 1;
}
.recbar.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.recbar.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.recbar.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--quiet);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: var(--muted);
}
.thumb.add {
  border-style: dashed;
}
.thumb img,
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mnote-t {
  color: var(--muted);
  margin-top: 3px;
  max-width: 340px;
}
.wound {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.wound:first-child {
  border-top: 0;
}
.wph {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.wph .ph {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e8c9b8, #d9a990);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #5a3a2a;
  cursor: pointer;
  padding: 0;
  border: 0;
  overflow: hidden;
  position: relative;
}
.wph .ph small {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.65rem;
  text-align: center;
}
.wph .ph.add {
  background: var(--quiet);
  color: var(--muted);
  border: 1.5px dashed var(--line);
}
.drugdb {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: var(--tint);
  border-radius: var(--r);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}
.drugdb ul {
  margin: 4px 0;
  padding-left: 18px;
}
.photopick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.matchpick label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  margin-top: 6px;
  cursor: pointer;
}
@media (max-width: 640px) {
  .wound {
    grid-template-columns: 1fr;
  }
}
/* The Care plan tab, the hold banner and authorizations (brief 1C-3, mockup v9 .holdbar, .burn,
   .authrow, .rpick and .rcard). Colors are the theme's, so the banner reads in dark mode too. */
.holdbar {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--warn-bg);
  border: 2px solid var(--warn);
  color: var(--warn);
  border-radius: var(--rc);
  padding: 12px 14px;
  margin: 8px 0;
}
.holdbar > .oi {
  font-size: 1.5rem;
}
.holdbar div {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.holdbar b {
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.burn {
  height: 10px;
  border-radius: 5px;
  background: var(--quiet);
  overflow: hidden;
}
.burn i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.burn.low i {
  background: var(--bad);
}
.authrow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.authrow.arch {
  opacity: 0.6;
}
.authrow .top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.rowbtns {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.rpick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rcard {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px;
  cursor: pointer;
}
.rcard small {
  display: block;
  color: var(--muted);
}
.rcard:has(input:checked) {
  border-color: var(--primary);
  background: var(--tint);
}
tr.archived td {
  opacity: 0.6;
}
@media (max-width: 640px) {
  .holdbar {
    flex-wrap: wrap;
  }
  .holdbar .btn {
    width: 100%;
  }
}

/* Scheduling visits (brief 1D-1): availability rows, the month calendar (mockup .prow, .cal,
   .legend, .dotk) and the flags a visit carries. */
.prow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--quiet);
}
.cal {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.cal-h,
.cal-g {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-h span {
  font-size: 0.7rem;
  text-align: center;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.cal-g > div {
  min-height: 38px;
  border-right: 1px solid var(--quiet);
  border-bottom: 1px solid var(--quiet);
  padding: 3px;
  font-size: 0.72rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-content: flex-start;
}
.cal-d b {
  width: 100%;
  font-weight: 600;
  color: var(--muted);
}
.cal-d.on {
  background: var(--tint);
}
.cal-d.on b {
  color: var(--fg);
}
.cal-d.sched {
  box-shadow: inset 0 0 0 2px var(--primary);
}
.cal-dot,
.dotk {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.dotk {
  width: 10px;
  height: 10px;
  margin-right: 4px;
  vertical-align: -1px;
}
.cal-dot.s0 {
  background: #e0a800;
}
.cal-dot.s1 {
  background: var(--accent);
}
.cal-dot.s2 {
  background: var(--primary);
}
.cal-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.82rem;
  margin-top: 6px;
}
.vflags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.vacts {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.vdates {
  max-height: 220px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.vdates li {
  padding: 4px 0;
  border-bottom: 1px solid var(--quiet);
  font-size: 0.85rem;
}
.cal-legend .cal-dot,
.cal-legend .dotk {
  margin-right: 4px;
}

/* Home Care › Visits: the week board, chips, summary, suggestions and month (brief 1D-2, mockup v38 .vk*). */
.vkbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
}
.vkbar > span {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.vkwrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
.vkgrid {
  display: grid;
  /* --days: the last week before a new week start has more than seven (brief 1D-5). */
  grid-template-columns: 190px repeat(var(--days, 7), minmax(118px, 1fr));
  min-width: 1020px;
}
.vkgrid > div {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 6px;
  min-height: 46px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vkgrid > div:nth-child(8n) {
  border-right: 0;
}
.vkh {
  background: var(--quiet);
  font-size: 0.85rem;
}
.vkh b {
  display: block;
}
.vkrow {
  font-size: 0.88rem;
}
.vkrow > span:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.vkchip {
  all: unset;
  cursor: pointer;
  display: block;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.78rem;
  line-height: 1.25;
  background: var(--tint);
  border-left: 3px solid var(--accent);
  color: inherit;
}
.vkchip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.vkchip.draft {
  background: transparent;
  border: 1px dashed var(--accent);
  border-left: 3px dashed var(--accent);
}
.vkchip.cannot_work {
  background: var(--bad-bg);
  border-left-color: var(--bad);
}
.vkchip.waiting {
  border-left-color: var(--warn);
}
.vkchip.unassigned {
  background: var(--warn-bg);
  border-left-color: var(--warn);
}
.vkchip .oi {
  width: 12px;
  height: 12px;
  vertical-align: -2px;
}
.vkun {
  background: color-mix(in srgb, var(--warn-bg) 45%, var(--card));
}
.vksum {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.88rem;
  margin: 0 0 10px;
}
.vksum span b {
  margin-left: 4px;
}
.vksum .chip {
  cursor: pointer;
  border: 0;
  font: inherit;
}
.vksg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vksg .sg {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.vksg .sg.auto {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.vksg .why {
  font-size: 0.8rem;
  color: var(--muted);
}
.vksg .why.miss,
.why.miss {
  color: var(--warn);
}
.vksg .rk {
  font-weight: 700;
  margin-right: 6px;
}
.vkmonth {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.vkmonth > div,
.vkmonth > button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  min-height: 58px;
  font-size: 0.8rem;
  background: var(--card);
  color: inherit;
  text-align: left;
  font: inherit;
}
.vkmonth > button {
  cursor: pointer;
}
.vkmonth > .blank {
  border: 0;
  background: none;
}
.vkday .prow {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.vkday .prow .vkchip {
  min-width: 90px;
}
.prow {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.mftable select,
.mftable input {
  max-width: 140px;
}
.numin {
  width: 70px;
  display: inline-block;
  margin: 0 4px;
}
@media (max-width: 700px) {
  .vkgrid {
    grid-template-columns: 130px repeat(var(--days, 7), minmax(110px, 1fr));
  }
}

/* ---- The top bar's company mark and the bottom of the left menu (brief 1D-3, mockup v40) ---- */
.brandmark {
  display: inline-flex;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  flex: none;
}
.brandname {
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.poweredby {
  margin-top: auto;
  padding: 14px 10px 6px;
  font-size: 0.72rem;
  opacity: 0.8;
}
.modeTog {
  display: inline-flex;
  gap: 2px;
  background: var(--quiet);
  border-radius: 999px;
  padding: 3px;
}
.modeTog button {
  border: 0;
  background: none;
  border-radius: 999px;
  padding: 5px 10px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--fg);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.modeTog button[aria-pressed="true"] {
  background: var(--card);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
@media (max-width: 760px) {
  .modeTog {
    display: none;
  }
}

/* ---- The field app (brief 1D-3, mockup v41 .papp): full screen on a phone, framed on a desk ---- */
body.in-field .foot,
body.in-field #top {
  display: none;
}
.papp {
  --pbar: #1c1d1f;
  --pacc: #5bc8c0;
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 12px auto 24px;
  height: max(560px, min(860px, calc(100vh - 24px)));
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}
@media (max-width: 760px) {
  .papp {
    margin: 0;
    max-width: none;
    border: 0;
    border-radius: 0;
    height: 100vh;
    height: 100dvh;
    box-shadow: none;
  }
}
.phd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: var(--card);
  box-shadow: 0 1px 0 var(--line);
}
.phd-t b {
  display: block;
  font-size: 1.05rem;
}
.phd-t span {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.phd-r {
  display: flex;
  gap: 6px;
}
.pdot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3fb950;
  display: inline-block;
}
.phq {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--fg);
}
.pbody {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pcol {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ptabs {
  display: flex;
  justify-content: space-around;
  background: var(--pbar);
  color: #fff;
  padding: 10px 6px calc(12px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
}
.ptabs button {
  position: relative;
  flex: 1;
  border: 0;
  background: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 4px 0;
}
.ptabs button .oi {
  width: 20px;
  height: 20px;
}
.ptabs button[aria-current="true"] {
  color: var(--pacc);
}
.pcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  display: block;
  text-align: left;
  font: inherit;
  color: var(--fg);
  width: 100%;
}
button.pcard {
  cursor: pointer;
}
.pcard.hero {
  border-left: 4px solid var(--accent);
}
.pcard.dim {
  opacity: 0.55;
}
.ph2 {
  font-size: 0.95rem;
  margin: 6px 2px 0;
}
.prow2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.prow2 + .prow2 {
  border-top: 1px solid var(--line);
}
.prow3 {
  display: flex;
  gap: 8px;
}
.pbtn {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--fg);
  background: var(--card);
  color: var(--fg);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.pbtn.pri {
  background: var(--fg);
  color: var(--card);
}
.pbtn.big {
  padding: 14px;
  font-size: 1.05rem;
}
.pbtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}
.pstat2 {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}
.pempty {
  text-align: center;
  padding: 30px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.nv-when {
  font-size: 1.6rem;
  font-weight: 800;
}
.ftask {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.seg4 {
  display: flex;
  gap: 4px;
}
.seg4 button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 7px 4px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--fg);
}
.seg4 button[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.seg4 button:disabled {
  opacity: 0.5;
}
.attest {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.attest input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: none;
}
.sigpad {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-top: 8px;
}
.sigcv {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  background: #fff;
  width: 100%;
  height: 120px;
  touch-action: none;
}
.warnline {
  color: var(--warn);
}
.psheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 8;
}
.psheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 8px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 80%;
  overflow: auto;
}
.psheet.tall {
  max-height: 92%;
}
.psh-grab {
  width: 40px;
  height: 5px;
  border-radius: 9px;
  background: var(--line);
  margin: 4px auto 8px;
}
.psh-item {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 0;
  background: none;
  padding: 12px 6px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
}
.psh-item .oi:last-child {
  margin-left: auto;
}
.farow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.farow > b {
  width: 40px;
}
.fatimes input {
  width: 7.5em;
}
.pchat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pmsg {
  background: var(--tint);
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 85%;
}
.pmsg.mine {
  align-self: flex-end;
  background: var(--quiet);
}
.pmsg p {
  margin: 2px 0;
}
.pcompose {
  display: flex;
  gap: 6px;
}
.pcompose input {
  flex: 1;
}
.tbprev {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}
.tbrow {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card);
}
.tblogo {
  height: 30px;
  max-width: 96px;
  object-fit: contain;
}
/* 24/7 coverage (brief 1D-4, mockup cov247): Not covered, and a note missing. */
.vkchip.no {
  background: var(--bad-bg);
  border-left-color: var(--bad);
}
.vkchip.wait {
  border-left-color: var(--warn);
}

/* Brief 1D-5: "Did you know?" hints, the questions sheet's rows and Fine-tune (mockup v50). */
.dyk {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--tint);
  font-size: 0.9rem;
  margin: 0 0 10px;
}
.dyk > .oi {
  margin-top: 3px;
}
.dyk > div {
  flex: 1;
}
.qrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.ftg {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
}
details.fine summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
}
.jobchips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.jobchips .chip {
  cursor: pointer;
  border: 0;
  font: inherit;
  font-size: 0.85rem;
}

/* ---- Home Care money (brief 1E-1): the invoice preview as a letter, the tiles (mockup .letter,
   .invdoc, .ivt, .ivg; the invoice record's grid4 tiles) ---------------------------------------- */
.letter {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: #191820;
  padding: 18px;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.letter .lh {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.letter .ft {
  border-top: 1px solid #ccd;
  padding-top: 6px;
  color: #3f5566;
  font-size: 0.7rem;
}
.ivt {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
  font-size: 0.85rem;
}
.ivt th,
.ivt td {
  border-bottom: 1px solid #ddd;
  padding: 5px 6px;
  text-align: left;
}
.ivt .num {
  text-align: right;
}
.ivg td {
  background: #f4f6f8;
}
.modal.invprev {
  width: min(860px, 100%);
}
.tilev {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 4px;
}
.tilev.big {
  font-size: 1.4rem;
}
.flaglist {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.weeknav {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
/* Who gets paid what (mockup .paychain, .pc): the pay chain, the first that's set wins. */
.paychain {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin: 6px 0 10px;
}
.pc {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--card);
}
.pc.win {
  border-color: var(--ok);
  background: var(--ok-bg);
}
.pcn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--quiet);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  font-weight: 600;
}
.pcv {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pcarrow {
  align-self: center;
  color: var(--muted);
  line-height: 1;
}

/* The CMS-1500 (brief 1E-2, mockup v8 "CMS-1500"): the setup's steps, the setup card's red edge,
   and the review sheet's form drawn from the same values that print. */
.psteps {
  display: flex;
  gap: 4px;
}
.psteps span {
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  padding: 6px 2px;
  border-radius: 8px;
  background: var(--quiet);
  color: var(--muted);
  display: flex;
  gap: 3px;
  justify-content: center;
  align-items: center;
}
.psteps span.done {
  background: var(--ok-bg);
  color: var(--ok);
}
.cmsset {
  border-left: 4px solid #c8102e;
}
.cmsmodal {
  width: min(980px, 100%);
}
.cmswrap {
  overflow: auto;
  max-height: min(56vh, 620px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.cms {
  --red: #c8102e;
  min-width: 820px;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  border: 1.5px solid var(--red);
  background: #fff;
}
.cmstop {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px;
  border-bottom: 1.5px solid var(--red);
  color: var(--red);
}
.cmstop b {
  font-size: 15px;
  letter-spacing: 0.02em;
}
.cmstop small {
  display: block;
  font-size: 8px;
}
.cmsqr {
  border: 2px solid var(--red);
  font-weight: 800;
  font-size: 16px;
  padding: 6px 8px;
}
.cms .carrier {
  margin-left: auto;
  text-align: left;
  min-width: 240px;
  color: #111;
}
.cr {
  display: flex;
  border-bottom: 1px solid var(--red);
}
.cb {
  flex: 1;
  padding: 3px 6px 5px;
  border-right: 1px solid var(--red);
  min-height: 34px;
}
.cb:last-child {
  border-right: 0;
}
.cb.w2 {
  flex: 2;
}
.cl {
  display: block;
  color: var(--red);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}
.cv {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #0b1f6b;
  border-radius: 3px;
}
.cv[role="button"] {
  cursor: pointer;
  outline: 1px dashed transparent;
}
.cv[role="button"]:hover,
.cv[role="button"]:focus-visible {
  outline-color: #0b1f6b;
  background: #eef3ff;
}
.cv.empty {
  display: inline-block;
  min-width: 2.5em;
  min-height: 1em;
}
.cv.fixed {
  background: #fff4c2;
}
.cx {
  display: inline-grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border: 1px solid var(--red);
  font-family: "Courier New", monospace;
  font-weight: 700;
  color: #0b1f6b;
  font-size: 11px;
  vertical-align: -2px;
}
.cms small {
  font-size: 8px;
  color: var(--red);
}
.cmsl {
  width: 100%;
  border-collapse: collapse;
}
.cmsl th {
  color: var(--red);
  font-size: 8px;
  text-align: left;
  padding: 3px 6px;
  border-bottom: 1px solid var(--red);
  border-right: 1px solid var(--red);
  font-weight: 700;
  background: #fff;
}
.cmsl td {
  height: 24px;
  padding: 2px 6px;
  border-bottom: 1px solid var(--red);
  border-right: 1px solid var(--red);
}
.cmsl tr.sh td {
  background: #fce8ea;
}
.cmsl td.num {
  text-align: right;
}
.cmsfoot {
  color: var(--red);
  font-size: 8px;
  padding: 4px 8px;
}
.cmsset > .actions {
  margin-top: 10px;
}
.cmsset .codes input {
  width: 80px;
}

/* ---- Pay and billing this week on the schedule (brief 1E-4, mockup v56 mnyStrip) ---- */
.mnygrid .vkh {
  background: transparent;
}
.mnygrid > div {
  min-height: 0;
}
.mny {
  font-size: 0.78rem;
  line-height: 1.35;
}
.mny b {
  font-weight: 600;
}
.otl {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* My profile (brief 1E-5, mockup v57): the date like the other fields, Yes/No as pills. */
.myprof input[type="date"] {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--r);
  padding: 8px 10px;
  min-height: 38px;
  width: 100%;
}
.myprof .seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 0;
  background: none;
}
.myprof .seg label {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  gap: 6px;
  align-items: center;
}
.myprof .seg input {
  accent-color: var(--primary);
}

/* The tenant banner and the View as banner (brief 1E-6, mockup v59 .tbanner, .vabanner). */
.tbanner {
  flex-basis: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
}
.tbanner b {
  color: var(--fg);
}
.tbanner .btn {
  margin-left: auto;
}
body.in-field .vabar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 8px max(12px, env(safe-area-inset-left, 0px)) 0;
}
.modicons {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
/* Care task schedule (brief 1E-10, mockup v60 .tsf, .tsgrid, .tsr, .ftag, .fwhy, .tsother). */
.tsf {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 10px;
  margin: 0;
}
.tsf legend {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0 4px;
}
.tsgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
}
.tsr {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 0.9rem;
  cursor: pointer;
}
@media (max-width: 460px) {
  .tsgrid {
    grid-template-columns: 1fr;
  }
}
.tstime,
.tsn {
  margin-top: 6px;
  gap: 8px;
}
.tsn {
  max-width: 180px;
}
.tsdays {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.tsday {
  cursor: pointer;
  position: relative;
}
.tsday input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.tsday:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.tsf [hidden] {
  display: none !important;
}
.ftag {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}
.fwhy {
  margin-top: 6px;
  width: 100%;
}
.tsother {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
