
  :root {
    --ground:   #F3F4F9;
    --surface:  #FFFFFF;
    --surface-2:#FAFAFD;
    --line:     #E3E6F0;
    --line-2:   #D2D7E6;
    --ink:      #131722;
    --ink-2:    #5A6376;
    --ink-3:    #858DA1;
    --accent:   #3D4EE0;
    --accent-2: #EDEFFE;
    --accent-3: #C9CFFA;
    --over:     #B42318;
    --over-bg:  #FDEDEA;
    --soon:     #A85508;
    --soon-bg:  #FCF0E4;
    --ok:       #0B7A4B;
    --ok-bg:    #E6F5ED;
    --cat:      #B43A6B;
    --cat-bg:   #FAE9F0;
    --on-accent:#FFFFFF;
    --shadow:   0 1px 2px rgba(19,23,34,.06), 0 8px 24px -12px rgba(19,23,34,.14);
    --shadow-up:0 -2px 12px -4px rgba(19,23,34,.12);
    --radius:   12px;
    --tap:      44px;   /* minimum comfortable touch target */
    --appbar-h: 65px;   /* mobile app bar height — the sticky filter strip docks under it */
    color-scheme: light;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --ground:   #0E1117;
      --surface:  #171B24;
      --surface-2:#1D222D;
      --line:     #272D3A;
      --line-2:   #333B4C;
      --ink:      #E8EBF2;
      --ink-2:    #A2AABC;
      --ink-3:    #7A8296;
      --accent:   #8C9BFF;
      --accent-2: #1E2440;
      --accent-3: #39427A;
      --over:     #FF9384;
      --over-bg:  #3A1D1A;
      --soon:     #F0B265;
      --soon-bg:  #362617;
      --ok:       #5FD79E;
      --ok-bg:    #12301F;
      --cat:      #F09EC0;
      --cat-bg:   #39202C;
      --on-accent:#10131C;
      --shadow:   0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
      --shadow-up:0 -2px 12px -4px rgba(0,0,0,.6);
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --ground:   #0E1117;
    --surface:  #171B24;
    --surface-2:#1D222D;
    --line:     #272D3A;
    --line-2:   #333B4C;
    --ink:      #E8EBF2;
    --ink-2:    #A2AABC;
    --ink-3:    #7A8296;
    --accent:   #8C9BFF;
    --accent-2: #1E2440;
    --accent-3: #39427A;
    --over:     #FF9384;
    --over-bg:  #3A1D1A;
    --soon:     #F0B265;
    --soon-bg:  #362617;
    --ok:       #5FD79E;
    --ok-bg:    #12301F;
    --cat:      #F09EC0;
    --cat-bg:   #39202C;
    --on-accent:#10131C;
    --shadow:   0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-up:0 -2px 12px -4px rgba(0,0,0,.6);
    color-scheme: dark;
  }

  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0; background: var(--ground); color: var(--ink);
    font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  }
  body.locked { overflow: hidden; }
  h1, h2, h3 { font-family: "Bricolage Grotesque", "IBM Plex Sans", sans-serif; text-wrap: balance; margin: 0; letter-spacing: -0.015em; }
  .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
  button { font: inherit; color: inherit; cursor: pointer; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
  code { font-family: "IBM Plex Mono", monospace; font-size: .92em; background: var(--ground); padding: 1px 5px; border-radius: 4px; }
  .desktop-only { display: none !important; }
  .desktop-hide { display: block; }

  /* =========================================================================
     MOBILE FIRST. Everything below is the phone layout. The desktop rail,
     two-column grid and dense list live in the min-width block near the end.
     ========================================================================= */

  .shell { min-height: 100vh; }

  /* ---- mobile app bar ---- */
  .appbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .brand { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 19px; letter-spacing: -0.03em; display: flex; align-items: center; gap: 7px; }
  .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-2); }
  .appbar .spacer { flex: 1; }
  .iconbtn {
    width: var(--tap); height: var(--tap); border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--ink-2); display: grid; place-items: center; font-size: 19px;
  }
  .iconbtn:hover { background: var(--surface-2); }
  .avatar-btn { padding: 0; }
  .avatar { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; }

  /* ---- rail (desktop only, hidden here) ---- */
  .rail { display: none; }

  /* ---- desktop top bar (hidden on mobile) ---- */
  .topbar { display: none; }

  /* ---- content ---- */
  .main { min-width: 0; }
  .content { padding: 14px 14px 92px; display: flex; flex-direction: column; gap: 16px; }

  .page-head h1 { font-size: 22px; font-weight: 600; }
  .page-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }

  /* ---- search ---- */
  .search { position: relative; }
  .search input {
    width: 100%; height: var(--tap); padding: 0 12px 0 38px;
    border: 1px solid var(--line-2); border-radius: 10px;
    background: var(--surface); color: var(--ink); font: inherit; font-size: 16px;
  }
  .search input::placeholder { color: var(--ink-3); }
  .search .mag { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 15px; }

  /* ---- filter strip: horizontal scroll, sticky under the app bar ---- */
  .tiles {
    position: sticky; top: var(--appbar-h); z-index: 20;
    display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity;
    padding: 8px 0; margin: -4px -14px; padding-left: 14px; padding-right: 14px;
    background: var(--ground);
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .tiles::-webkit-scrollbar { display: none; }
  .tile {
    flex: 0 0 auto; scroll-snap-align: start; min-height: var(--tap);
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
    padding: 8px 14px; display: flex; align-items: center; gap: 8px;
    text-align: left; position: relative;
  }
  .tile .dotm { width: 8px; height: 8px; border-radius: 50%; background: var(--tint, var(--line-2)); flex: none; }
  .tile .k { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
  .tile .v { font-family: "Bricolage Grotesque", sans-serif; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
  .tile .s { display: none; }
  .tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-2); }
  .tile[aria-pressed="true"] .v { color: var(--accent); }
  .tile.is-ask   { --tint: var(--accent); }
  .tile.is-text  { --tint: var(--over); }
  .tile.is-chase { --tint: var(--over); }
  .tile.is-soon  { --tint: var(--soon); }

  /* ---- panels ---- */
  .cols { display: flex; flex-direction: column; gap: 16px; }
  .aside { display: flex; flex-direction: column; gap: 16px; }
  .panel { background: transparent; }
  .panel-head { display: flex; align-items: baseline; gap: 10px; padding: 2px 2px 10px; flex-wrap: wrap; }
  .panel-head h2 { font-size: 17px; font-weight: 600; }
  .panel-head .sub { color: var(--ink-3); font-size: 13px; }
  .clearfilter { margin-left: auto; }

  /* ---- work rows: tappable cards ---- */
  .rows { display: flex; flex-direction: column; gap: 10px; }
  .grouphead {
    padding: 8px 2px 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
    font-weight: 700; color: var(--ink-3); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  }
  .grouphead .why { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12.5px; }

  .row {
    background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--tint, var(--line));
    border-radius: var(--radius); padding: 13px 14px;
    display: flex; flex-direction: column; gap: 9px;
  }
  .row .stripe { display: none; }        /* stripe is now the left border */
  .row.is-ask   { --tint: var(--accent); }
  .row.is-text  { --tint: var(--over); }
  .row.is-chase { --tint: var(--over); }
  .row.is-wait  { --tint: var(--line-2); }
  .row.is-soon  { --tint: var(--soon); }
  .row.is-sched { --tint: var(--accent); }
  .row.is-off   { --tint: var(--line-2); }
  .row .line1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .row .pet { font-weight: 600; font-size: 16px; }
  .row .species { color: var(--ink-3); font-size: 13px; }
  .row .cust { color: var(--ink-2); font-size: 14px; }
  .row .pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .row .meta { color: var(--ink-3); font-size: 13px; }
  .row .meta .said { color: var(--ink-2); }
  .row .acts { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
  .row .acts .btn { flex: 1; }           /* primary action spans the width on mobile */
  .row .acts .kebab { flex: none; }

  .pill {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
    font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
  }
  .pill .tick { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
  .pill.due    { background: var(--over-bg);  color: var(--over); }
  .pill.soon   { background: var(--soon-bg);  color: var(--soon); }
  .pill.ok     { background: var(--ok-bg);    color: var(--ok); }
  .pill.sched  { background: var(--accent-2); color: var(--accent); }
  .pill.contact { background: transparent; color: var(--ink-2); border-color: var(--line-2); font-weight: 500; }
  .pill.contact.cold { color: var(--over); border-color: var(--over); }
  .pill.ask { background: transparent; color: var(--accent); border: 1px dashed var(--accent); font-weight: 600; }
  .pill.off { background: var(--ground); color: var(--ink-3); border-color: var(--line); font-weight: 500; }

  /* ---- buttons ---- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: var(--tap); padding: 0 15px; border-radius: 10px; font-weight: 600; font-size: 14px;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  }
  .btn:hover { background: var(--surface-2); }
  .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
  .btn-danger { color: var(--over); border-color: var(--over); background: transparent; }
  .btn-danger:hover { background: var(--over-bg); }
  .btn-quiet { border-color: transparent; background: transparent; color: var(--ink-3); font-weight: 500; }
  .btn-quiet:hover { background: var(--ground); color: var(--ink-2); }
  /* Icon-only button. Square at whatever height .btn is currently set to, so it
     lines up with the text buttons beside it in both layouts. */
  .btn-icon { width: var(--tap); padding: 0; flex: 0 0 auto; }
  .btn-icon svg { width: 16px; height: 16px; display: block; }
  /* Destructive, but not shouting about it: grey until hover, red once you are
     actually pointing at it. .btn-danger's permanent red outline made delete the
     loudest thing on a row it should be the quietest part of. */
  .btn-del { color: var(--ink-3); border-color: transparent; background: transparent; }
  .btn-del:hover { color: var(--over); background: var(--over-bg); }
  .btn[disabled] { cursor: default; opacity: .7; }

  /* ---- auth (login / register) : centred card, works at every width ---- */
  .auth-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    position: relative; overflow: hidden;
    background: radial-gradient(1100px 520px at 50% -8%, var(--accent-2), var(--ground) 72%);
  }
  /* Tiled paw prints drawn as a mask, so the fill follows the accent token in
     both themes. Kept faint — texture, not wallpaper. */
  .auth-wrap::before {
    content: ""; position: absolute; inset: 0; background: var(--accent); opacity: .05; pointer-events: none;
    -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g><ellipse cx='32' cy='42' rx='12' ry='9'/><circle cx='14' cy='23' r='6'/><circle cx='26' cy='14' r='6'/><circle cx='38' cy='14' r='6'/><circle cx='50' cy='23' r='6'/></g></svg>") repeat;
    mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g><ellipse cx='32' cy='42' rx='12' ry='9'/><circle cx='14' cy='23' r='6'/><circle cx='26' cy='14' r='6'/><circle cx='38' cy='14' r='6'/><circle cx='50' cy='23' r='6'/></g></svg>") repeat;
    -webkit-mask-size: 96px; mask-size: 96px;
  }
  .auth-card { position: relative; width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; display: flex; flex-direction: column; gap: 18px; }
  .auth-brand { display: flex; align-items: center; gap: 9px; font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); }
  .auth-brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-2); }
  .auth-head h1 { font-size: 20px; font-weight: 600; }
  .auth-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }
  .auth-card form { display: flex; flex-direction: column; gap: 14px; }
  .auth-card .btn { width: 100%; }
  .auth-card a.btn { text-decoration: none; }
  .auth-divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12.5px; }
  .auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  .auth-fb { background: #1877F2; border-color: #1877F2; color: #fff; }
  .auth-fb:hover { filter: brightness(1.05); background: #1877F2; }
  .auth-google { background: #fff; border-color: var(--line-2); color: var(--ink); }
  .auth-google:hover { background: #fff; filter: brightness(0.97); }
  .auth-fb + .auth-google { margin-top: 10px; }
  .auth-err { font-size: 13px; color: var(--over); background: var(--over-bg); border-radius: 8px; padding: 9px 11px; }
  .auth-alt { text-align: center; font-size: 13.5px; color: var(--ink-2); }
  .auth-alt a { color: var(--accent); font-weight: 600; text-decoration: none; }
  .auth-alt a:hover { text-decoration: underline; }
  .auth-hint { font-size: 12px; color: var(--ink-3); }
  .auth-lang { display: flex; justify-content: center; gap: 14px; font-size: 12.5px; }
  .auth-lang a { color: var(--ink-3); text-decoration: none; }
  .auth-lang a:hover { color: var(--ink-2); }
  .auth-lang a.active { color: var(--ink); font-weight: 600; }
  .btn[disabled]:hover { background: transparent; }
  .kebab {
    width: var(--tap); height: var(--tap); flex: none;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3);
    border-radius: 10px; display: grid; place-items: center; font-size: 18px;
  }
  .kebab:hover { background: var(--surface-2); color: var(--ink); }

  /* ---- customers ---- */
  #custRows { display: flex; flex-direction: column; gap: 10px; }
  .cust-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .cust-sum { width: 100%; text-align: left; background: transparent; border: 0; padding: 13px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: var(--tap); }
  .cust-sum:hover { background: var(--surface-2); }
  .chev { color: var(--ink-3); transition: transform .16s ease; font-size: 12px; width: 12px; flex: none; }
  .cust-row[open-state="1"] .chev { transform: rotate(90deg); }
  .cust-name { font-weight: 600; font-size: 15.5px; }
  .pettag {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
    border-radius: 20px; font-size: 12px; font-weight: 500;
    background: var(--accent-2); color: var(--accent); white-space: nowrap;
    transition: opacity .2s ease;              /* fades out on expand, back in on collapse */
  }
  .pettag::before { content: "🐶"; } /* species emoji doubles as the scan cue */
  .pettag.cat { background: var(--cat-bg); color: var(--cat); }
  .pettag.cat::before { content: "🐱"; }
  .cust-row[open-state="1"] .pettag { opacity: 0; }
  .cust-contact { color: var(--ink-2); font-size: 12.5px; margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
  .pets { padding: 0 14px 14px; display: none; flex-direction: column; gap: 7px; }
  .cust-row[open-state="1"] .pets { display: flex; }
  .petline { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); flex-wrap: wrap; }
  .petavatar { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 15px; background: var(--accent-2); }
  .petavatar.cat { background: var(--cat-bg); }
  .petline .nm { font-weight: 600; font-size: 14px; }
  .petline .sp { color: var(--ink-3); font-size: 12px; }
  .petline { flex-direction: column; align-items: stretch; }
  .petmain { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
  .petmain .last { margin-left: auto; color: var(--ink-2); font-size: 12px; }
  .petacts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
  .petline .pill { margin-left: auto; }
  .consent { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; margin-bottom: 3px; }
  .consent.yes { background: var(--ok-bg); color: var(--ok); }
  .consent.no  { background: var(--ground); color: var(--ink-2); }
  .consent.unknown { background: var(--accent-2); color: var(--accent); }

  /* ---- activity ---- */
  .feed { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .ev { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .ev:last-child { border-bottom: 0; }
  .ev .bullet { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--ok); }
  .ev.sched .bullet { background: var(--accent); }
  .ev.book .bullet { background: var(--ink-3); }
  .ev.optout .bullet { background: var(--ink-3); }
  .ev .txt { font-size: 13px; color: var(--ink-2); }
  .ev .txt b { color: var(--ink); font-weight: 600; }
  .ev .when { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

  /* ---- bottom navigation (mobile) ---- */
  .bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: var(--shadow-up); padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .navitem {
    flex: 1; border: 0; background: transparent; color: var(--ink-3);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 8px 0 7px; min-height: 56px; font-size: 11px; font-weight: 600;
  }
  .navitem .ni { font-size: 20px; line-height: 1; }
  .navitem[aria-current="page"] { color: var(--accent); }
  .navitem .badge { position: absolute; }
  .navitem .nlbl { position: relative; }
  .navitem .count { font-size: 10px; background: var(--over); color: #fff; border-radius: 10px; padding: 0 5px; margin-left: 3px; vertical-align: middle; }
  .navitem .navavatar { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 10px; font-weight: 600; }
  .navitem[aria-current="page"] .navavatar { outline: 2px solid var(--accent); outline-offset: 1px; }

  /* ---- sheets (bottom sheet on mobile) ---- */
  .scrim {
    position: fixed; inset: 0; background: rgba(19,23,34,.5); z-index: 60;
    display: none; align-items: flex-end; justify-content: center;
  }
  .scrim[data-open="1"] { display: flex; }
  .sheet {
    background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0;
    border-radius: 16px 16px 0 0; box-shadow: var(--shadow);
    width: 100%; max-height: 92vh; overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 0);
    animation: sheetup .22s ease;
  }
  @keyframes sheetup { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 8px auto 0; }
  .sheet-head { padding: 12px 18px 12px; border-bottom: 1px solid var(--line); }
  .sheet-head h3 { font-size: 17px; font-weight: 600; }
  .sheet-head p { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; }
  .sheet-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 15px; }
  .bubble { background: var(--accent-2); border: 1px solid var(--accent-3); border-radius: 14px 14px 14px 4px; padding: 12px 14px; font-size: 14px; color: var(--ink); line-height: 1.45; }
  .to { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); gap: 10px; }
  .warn { font-size: 13px; color: var(--soon); background: var(--soon-bg); border-radius: 8px; padding: 9px 11px; }

  /* Billing banner on the working pages (board, queue). Those templates carry
     no <style> block of their own, so shared component styles live here. */
  .billnotice { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 11px; margin-bottom: 16px; font-size: 14px; line-height: 1.45; }
  .billnotice .bn-text { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
  .billnotice .bn-hint { font-size: 13px; opacity: .85; }
  /* Banner colors come from the same status token pairs the pills use, so the
     banners adapt to dark mode instead of staying light-theme. */
  .billnotice.warn { background: var(--soon-bg); color: var(--soon); border: 1px solid color-mix(in srgb, var(--soon) 35%, transparent); }
  .billnotice.stop { background: var(--over-bg); color: var(--over); border: 1px solid color-mix(in srgb, var(--over) 35%, transparent); }

  /* Customer has withdrawn SMS consent. */
  .nosms { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--over-bg); color: var(--over); border: 1px solid color-mix(in srgb, var(--over) 35%, transparent); margin-left: 6px; }
  .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.4; }
  .petacts .btn[disabled] { opacity: .45; cursor: not-allowed; }
  .sheet-foot { padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0)); border-top: 1px solid var(--line); display: flex; gap: 10px; background: var(--surface-2); position: sticky; bottom: 0; }
  .sheet-foot .btn { flex: 1; }

  .field { display: flex; flex-direction: column; gap: 9px; }
  .field > label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
  .chips { display: flex; gap: 8px; flex-wrap: wrap; }
  .chip { min-height: var(--tap); padding: 0 15px; border-radius: 22px; border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; font-weight: 500; }
  .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
  .choices { display: flex; flex-direction: column; gap: 8px; }
  .choice { display: flex; align-items: flex-start; gap: 11px; padding: 13px 13px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); text-align: left; }
  .choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-2); }
  .choice .dotmark { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; margin-top: 1px; display: grid; place-items: center; }
  .choice[aria-pressed="true"] .dotmark { border-color: var(--accent); }
  .choice[aria-pressed="true"] .dotmark::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
  .choice .ct { font-size: 14.5px; font-weight: 600; }
  .choice .cs { font-size: 12.5px; color: var(--ink-2); font-weight: 400; }
  .legalnote { font-size: 12.5px; color: var(--ink-3); border-left: 2px solid var(--line-2); padding-left: 10px; }

  /* account sheet rows */
  .acct-id { display: flex; align-items: center; gap: 12px; }
  .acct-id .avatar { width: 44px; height: 44px; font-size: 16px; border-radius: 12px; }
  .acct-id .n { font-weight: 600; font-size: 15px; }
  .acct-id .e { color: var(--ink-3); font-size: 13px; }
  .acct-row { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
  .acct-row .ic { width: 22px; text-align: center; color: var(--ink-3); }
  /* Customer-level actions, set off from the pet actions above them by being
     pushed to the opposite edge. No .addpet-btn rule any more: it carried
     align-self:flex-start, which opted that one button out of the row's stretch
     so it sized to its content while its siblings grew to the line height --
     which is why Add pet came out shorter than Edit and Delete. */
  .custacts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-top: 10px; }
  .logvisit-btn { margin-left: 6px; }
  .ncinput { height: var(--tap); border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--ink); padding: 0 12px; font: inherit; font-size: 16px; width: 100%; }
  .ncinput::placeholder { color: var(--ink-3); }
  .locale-sel { margin-left: auto; height: 40px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--ink); padding: 0 10px; font: inherit; }
  .acct-row.danger { color: var(--over); }
  /* Mobile counterpart of .rail-legal: the rail is hidden below the desktop
     breakpoint, so on a phone this sheet is the bottom of the nav. Same faded
     treatment, and no border-top -- a rule would make a footnote look like one
     more row of the account menu. */
  .acct-legal { display: block; padding: 14px 0 2px; color: rgba(128,128,128,.5); font-size: 9px; font-weight: 400; letter-spacing: .01em; text-align: center; text-decoration: none; }
  .acct-legal:hover { color: rgba(128,128,128,.85); text-decoration: none; }

  /* ---- design notes ---- */
  .noteswrap { display: none; }
  body[data-notes="1"] .noteswrap { display: block; }
  .marker { display: none; width: 18px; height: 18px; border-radius: 50%; flex: none; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; place-items: center; font-family: "IBM Plex Mono", monospace; }
  body[data-notes="1"] .marker { display: grid; }
  .notes { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px; }
  .notes h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
  .notes > p { color: var(--ink-2); margin: 0 0 12px; }
  .notes ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; counter-reset: n; }
  .notes li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
  .notes li::before {
    counter-increment: n; content: counter(n);
    width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
    font-family: "IBM Plex Mono", monospace; margin-top: 1px;
  }
  .notes li b { color: var(--ink); font-weight: 600; }
  .matrix { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12.5px; }
  .matrix th, .matrix td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; }
  .matrix th { background: var(--surface-2); color: var(--ink-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
  .matrix td b { color: var(--ink); }
  .tablewrap { overflow-x: auto; }

  /* ---- empty states: a little warmth instead of a blank hole ---- */
  .empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px 18px; text-align: center; color: var(--ink-3); font-size: 14px; line-height: 1.45; }
  .eemoji { font-size: 32px; line-height: 1.1; }

  /* ---- toasts: action feedback that survives the reload (flash via sessionStorage) ---- */
  .toasts { position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0)); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
  .toast {
    pointer-events: auto; max-width: 430px; padding: 10px 16px; border-radius: 999px;
    background: var(--ink); color: var(--ground); box-shadow: var(--shadow);
    font-size: 13.5px; font-weight: 600; line-height: 1.4;
    animation: toastin .18s ease;
  }
  .toast.err { background: var(--over); color: var(--over-bg); }
  .toast.gone { opacity: 0; transition: opacity .2s ease; }
  @keyframes toastin { from { transform: translateY(10px); opacity: 0; } }

  /* Activity feed marker (today every event is a text sent; the .ev.sched etc.
     bullet classes stay dormant until notifications gain an event type). */
  .ev .eic { flex: none; font-size: 15px; margin-top: 1px; }

  /* Press feedback — a quick settle-in makes taps feel native on phones. */
  .btn, .chip, .choice, .kebab, .iconbtn, .navitem, .tile { transition: transform .08s ease; }
  .btn:active, .chip:active, .choice:active, .kebab:active, .iconbtn:active, .navitem:active, .tile:active { transform: scale(.97); }

  .hidden { display: none !important; }


  /* ---- queued reminders ---- */
  #queueRows { display: flex; flex-direction: column; gap: 10px; }
  .qrow {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  }
  .qrow .qwho { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
  .qrow .qcust { color: var(--ink-2); font-size: 14px; }
  .qrow .qspacer { flex: 1; }
  .qrow .qwhen { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
  .qrow .qwhen b { color: var(--ink-2); font-weight: 600; }
  .qrow .qcancel { flex: none; }
  .qempty { padding: 26px 14px; text-align: center; color: var(--ink-3); display: flex; flex-direction: column; gap: 12px; align-items: center; }
  .qempty .btn { align-self: center; }

  /* =========================================================================
     DESKTOP  (>= 900px). Sidebar rail, top bar, two-column grid, dense rows.
     ========================================================================= */
  @media (min-width: 900px) {
    .desktop-only { display: initial !important; }
    .desktop-hide { display: none !important; }
    body { font-size: 14px; }
    .appbar, .bottomnav { display: none; }

    .shell { display: grid; grid-template-columns: 232px minmax(0,1fr); }

    /* rail */
    .rail {
      display: flex; flex-direction: column; gap: 26px;
      background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px;
      position: sticky; top: 0; height: 100vh;
    }
    .rail .wordmark { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 21px; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; padding: 2px 8px; }
    .rail .wordmark .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-2); }
    .navgroup { display: flex; flex-direction: column; gap: 2px; }
    .navlabel { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 600; padding: 0 8px 6px; }
    .nav { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; border: 1px solid transparent; }
    .nav:hover { background: var(--surface-2); color: var(--ink); }
    .nav[aria-current="page"] { background: var(--accent-2); color: var(--accent); border-color: var(--accent-3); font-weight: 600; }
    .nav .count { margin-left: auto; font-size: 11.5px; font-weight: 600; background: var(--ground); color: var(--ink-2); padding: 1px 7px; border-radius: 20px; }
    .nav[aria-current="page"] .count { background: var(--surface); color: var(--accent); }
    .nav .ic { width: 16px; text-align: center; opacity: .9; }
    .rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
    .who { display: flex; align-items: center; gap: 9px; padding: 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }
    .who:hover { border-color: var(--accent-3); background: var(--accent-2); }
    .who .meta { flex: 1; }
    .who-cog { margin-left: auto; padding-left: 6px; color: var(--ink-3); font-size: 14px; }
    .who .avatar { width: 28px; height: 28px; border-radius: 7px; font-size: 12px; }
    .who .meta { min-width: 0; }
    .who .n { font-weight: 600; font-size: 12.5px; }
    .who .e { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* The legal line under logout. A footnote, not a destination: no icon, no
       underline in either state, and faded well past --ink-3 (the faintest ink
       token) by mixing it toward transparent, which lands correctly on both the
       light and dark grounds. Hover only lifts it to a readable grey, so it can
       still be found when someone goes looking for it. */
    .rail-legal { padding: 0 9px; color: rgba(128,128,128,.5); font-size: 9px; line-height: 1.35; font-weight: 400; letter-spacing: .01em; text-decoration: none; }
    .rail-legal:hover { color: rgba(128,128,128,.85); text-decoration: none; }

    /* desktop top bar */
    .topbar { display: flex; align-items: center; gap: 14px; padding: 14px 26px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
    .topbar .search { flex: 1; max-width: 440px; }
    .topbar .search input { height: 38px; font-size: 14px; }

    .content { padding: 22px 26px 60px; gap: 22px; }
    .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
    .page-head h1 { font-size: 25px; }

    /* filter tiles back to a grid of stat cards */
    .tiles {
      position: static; margin: 0; padding: 0; overflow: visible;
      display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 12px;
    }
    .tile { flex: none; border-radius: var(--radius); flex-direction: column; align-items: stretch; gap: 3px; padding: 14px 15px; }
    .tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tint, var(--line-2)); }
    .tile .dotm { display: none; }
    .tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
    .tile .v { font-size: 30px; line-height: 1.05; color: var(--ink); }
    .tile .s { display: block; font-size: 12.5px; color: var(--ink-2); }
    .tile.is-text .v, .tile.is-chase .v { color: var(--over); }
    .tile.is-ask .v { color: var(--accent); }
    .tile[aria-pressed="true"] { border-color: var(--line-2); background: var(--surface); box-shadow: var(--shadow); }
    .tile[aria-pressed="true"] .v { color: inherit; }
    .tile.is-ask[aria-pressed="true"] .v { color: var(--accent); }
    .tile.is-text[aria-pressed="true"] .v, .tile.is-chase[aria-pressed="true"] .v { color: var(--over); }

    /* two columns */
    .cols { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; align-items: start; }

    /* panels get a card frame again */
    .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
    .panel-head { padding: 13px 16px; border-bottom: 1px solid var(--line); align-items: center; }
    .panel-head h2 { font-size: 15px; }

    /* dense list rows inside the panel */
    .rows { gap: 0; }
    .grouphead { padding: 9px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
    .row {
      border: 0; border-bottom: 1px solid var(--line); border-left: 3px solid var(--tint, transparent);
      border-radius: 0; padding: 12px 14px;
      display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px;
    }
    .row:last-child { border-bottom: 0; }
    .row.is-wait, .row.is-off { --tint: transparent; }
    .row:hover { background: var(--surface-2); }
    .row .pet { font-size: 14.5px; }
    .row .body-wrap { display: contents; }
    .row .line1, .row .pills, .row .meta { grid-column: 1; }
    .row .acts { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; }
    .row .acts .btn { flex: none; }
    .btn { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
    .btn-icon { width: 32px; padding: 0; }
    .kebab { width: 32px; height: 32px; border-color: transparent; background: transparent; }
    .kebab:hover { border-color: var(--line); }

    #custRows { display: block; gap: 0; }
    .cust-row { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
    .cust-row:last-child { border-bottom: 0; }
    .cust-contact { flex-direction: row; align-items: center; gap: 14px; }
    .petline .last { flex-basis: auto; margin-left: auto; }
    .petline .pill { margin-left: 0; }

    .feed { border: 0; border-radius: 0; }
    .notes { padding: 16px 18px; }

    /* queue rows: dense list inside the panel */
    #queueRows { display: block; }
    .qrow { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
    .qrow:last-child { border-bottom: 0; }
    .qrow:hover { background: var(--surface-2); }

    .toasts { bottom: 28px; }   /* no bottom nav on desktop */
  }
  @media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
    .sheet { animation: none; }
  }

  /* desktop sheets: centered dialog, not a bottom sheet */
  @media (min-width: 900px) {
    .scrim { align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
    .sheet { width: min(460px, 100%); max-height: none; margin: auto; border: 1px solid var(--line-2); border-radius: 14px; animation: none; }
    .sheet::before { display: none; }
    .sheet-foot { position: static; }
  }

  @media (prefers-reduced-motion: reduce) { *, .sheet { animation: none !important; transition: none !important; } }

