/* ============================================================
   FONUS CEBU — Funeral Management System
   Palette derived from the federation mark: oxblood #8B0003
   on warm limestone, with the lancet arch as a structural motif.
   ============================================================ */
:root{
  --brand:      #8B0003;   /* exact logo oxblood            */
  --brand-deep: #63000A;   /* sidebar, headers              */
  --brand-soft: #A32B2C;   /* hover states                  */
  --brand-wash: #F6EBEA;   /* tinted fills                  */

  --paper:      #F7F4F0;   /* warm limestone background     */
  --surface:    #FFFFFF;
  --ink:        #241C1B;   /* warm near-black               */
  --muted:      #7A6F6D;
  --line:       #E6DFD9;
  --line-soft:  #F0EBE6;

  --ok:         #2F6B4F;   /* settled / paid                */
  --ok-wash:    #E8F0EB;
  --amber:      #9A7020;   /* partial / in progress         */
  --amber-wash: #F5EEDE;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(36,28,27,.05), 0 8px 26px rgba(36,28,27,.05);

  /* One family throughout. Inter is built for screen UI: open apertures,
     unambiguous 1/l/I, and a full set of numeric features. --serif is kept
     as an alias so older rules keep working. */
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: var(--sans);

  /* Figures that cannot be misread: columns line up, zero is slashed. */
  --figures: tabular-nums slashed-zero;
}

*{ box-sizing: border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4{ font-family: var(--sans); font-weight:600; letter-spacing:-.021em; margin:0; }
a{ color: var(--brand); }
button{ font-family: inherit; }

/* ---------- Login ----------
   Signature: the card crown is a lancet arch, echoing the mark. */
.login-wrap{ min-height:100vh; display:grid; place-items:center; padding:24px; }
.login-card{
  width:100%; max-width:392px; background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow); padding:46px 38px 34px;
}
.brandmark{ text-align:center; margin-bottom:26px; }
.brandmark img{ width:150px; height:auto; display:block; margin:0 auto; }
.brandmark .rule{ width:34px; height:1px; background:var(--brand); opacity:.45; margin:18px auto 0; }
.brandmark small{
  display:block; color:var(--muted); font-size:11px;
  letter-spacing:.18em; text-transform:uppercase; margin-top:12px;
}

/* ---------- Forms ---------- */
label{ display:block; font-size:12.5px; color:var(--muted); margin:0 0 6px; letter-spacing:.02em; }
input,select,textarea{
  width:100%; padding:10px 12px; font-size:14.5px; color:var(--ink);
  background:var(--surface); border:1px solid var(--line);
  border-radius:8px; outline:none; transition:border-color .15s, box-shadow .15s;
}
input:focus,select:focus,textarea:focus{
  border-color:var(--brand); box-shadow:0 0 0 3px rgba(139,0,3,.10);
}
.field{ margin-bottom:16px; }
.row{ display:flex; gap:14px; } .row > *{ flex:1; }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 18px; font-size:14px; font-weight:500; cursor:pointer;
  border:1px solid var(--brand); border-radius:8px;
  background:var(--brand); color:#fff; transition:background .15s, transform .04s;
}
.btn:hover{ background:var(--brand-soft); }
.btn:active{ transform:translateY(1px); }
.btn.block{ width:100%; }
.btn.ghost{ background:transparent; color:var(--brand); }
.btn.ghost:hover{ background:var(--brand-wash); }
.btn.small{ padding:6px 12px; font-size:12.5px; }

.msg{ font-size:13px; padding:10px 12px; border-radius:8px; margin-bottom:14px; display:none; }
.msg.error{ display:block; background:var(--brand-wash); color:var(--brand); border:1px solid #EBD5D4; }
.msg.info{ display:block; background:var(--ok-wash); color:var(--ok); border:1px solid #D5E3DA; }

/* ---------- App shell ---------- */
.shell{ display:grid; grid-template-columns:238px 1fr; min-height:100vh; }
.sidebar{
  background:var(--brand-deep); color:#E7D6D6; padding:24px 16px 18px;
  display:flex; flex-direction:column; position:sticky; top:0;
  height:100vh;
  /* 13 nav items can exceed the viewport on a laptop. Without this the
     content ran past the coloured panel instead of scrolling inside it. */
  overflow-y:auto; overscroll-behavior:contain;
  scrollbar-width:thin; scrollbar-color:rgba(255,255,255,.22) transparent;
}
.sidebar::-webkit-scrollbar{ width:8px; }
.sidebar::-webkit-scrollbar-track{ background:transparent; }
.sidebar::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.18); border-radius:4px;
  border:2px solid transparent; background-clip:content-box;
}
.sidebar:hover::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.3); background-clip:content-box; }
.sidebar .wordmark{ padding:0 8px 16px; }
.sidebar .wordmark img{ width:132px; height:auto; display:block; }
.sidebar .wordmark span{
  display:block; font-size:10px; letter-spacing:.2em; text-transform:uppercase;
  color:#C09B9B; margin-top:10px;
}
.nav{ display:flex; flex-direction:column; gap:2px; margin-top:4px; }
.nav a{
  display:flex; align-items:center; gap:10px; padding:7.5px 12px; border-radius:8px;
  color:#DCC4C4; text-decoration:none; font-size:14px; cursor:pointer;
}
.nav a:hover{ background:rgba(255,255,255,.07); color:#fff; }
.nav a.active{ background:rgba(255,255,255,.13); color:#fff; }
/* active marker is a miniature arch, not a generic dot */
.nav a .arch{ width:6px; height:9px; background:#fff; opacity:0; border-radius:3px 3px 0 0; }
.nav a.active .arch{ opacity:1; }
.sidebar .foot{ margin-top:auto; border-top:1px solid rgba(255,255,255,.12); padding-top:14px; flex:0 0 auto; font-size:12.5px; color:#C09B9B; }
.sidebar .foot b{ color:#fff; display:block; font-weight:500; }
.sidebar .foot a{ color:#DCC4C4; cursor:pointer; }

/* min-width:0 is load-bearing. A grid track is min-width:auto by default,
   so one wide table inside stretches the track, and with it the whole
   page — which is why a phone could scroll the screen sideways and drag
   the sidebar into view. With this, wide content scrolls inside its own
   panel instead of pushing the layout. */
/* Desktop/laptop: the content auto-sizes to the window — it fills a laptop
   and, on a wide monitor, caps and centres with balanced margins. Phones and
   tablets get their own margins from the mobile block lower down. */
.main{ padding:26px 32px 60px; max-width:1600px; margin-inline:auto; min-width:0; }
.topbar{ display:flex; align-items:baseline; justify-content:space-between; gap:18px; margin-bottom:22px; }
.topbar h2{ font-size:24px; }
.topbar .sub{ color:var(--muted); font-size:13px; margin-top:2px; }
/* Several actions sit here on a record screen. Keep each on one line and
   let the row wrap as a whole, rather than breaking words inside buttons. */
.topbar .actions{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; flex-shrink:0; }
.topbar .btn{ white-space:nowrap; }

/* ---------- Cards & stats ---------- */
.cards{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:26px; }
.stat{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow); }
.stat .k{ font-size:11.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.stat .v{ font-family:var(--sans); font-size:30px; font-weight:600; letter-spacing:-.025em;
          color:var(--ink); margin-top:5px; font-variant-numeric:var(--figures); }
.stat .v.small{ font-size:23px; }
.stat.accent{ border-color:#E7D2D1; }
.stat.accent .v{ color:var(--brand); }

.panel{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); margin-bottom:22px; overflow:hidden; }
.panel .head{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--line-soft); }
.panel .head h3{ font-size:16px; }
.panel .body{ padding:6px 0; }

/* ---------- Tables ---------- */
table{ width:100%; border-collapse:collapse; font-size:14px; }
thead th{ text-align:left; font-size:11.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); font-weight:600; padding:12px 20px; border-bottom:1px solid var(--line); }
tbody td{ padding:14px 20px; border-bottom:1px solid var(--line-soft); }
tbody tr:last-child td{ border-bottom:none; }
tbody tr:hover{ background:#FCF9F7; }
.mono{ font-variant-numeric:var(--figures); font-feature-settings:"cv05" 1,"cv08" 1; }

/* ---------- Status pills ----------
   Oxblood carries "needs attention"; green settles; amber is mid-flight. */
.pill{ display:inline-block; padding:3px 10px; border-radius:999px; font-size:11.5px; font-weight:500; border:1px solid transparent; }
.pill.intake{ background:#F2EDE9; color:var(--muted); border-color:var(--line); }
.pill.arranging,.pill.partial{ background:var(--amber-wash); color:var(--amber); border-color:#E9DCC0; }
.pill.scheduled{ background:var(--brand-wash); color:var(--brand); border-color:#EBD5D4; }
.pill.completed,.pill.paid,.pill.confirmed{ background:var(--ok-wash); color:var(--ok); border-color:#D5E3DA; }
.pill.archived,.pill.cancelled,.pill.void{ background:#F2EDE9; color:#9C918F; }
.pill.unpaid,.pill.draft,.pill.low{ background:var(--brand-wash); color:var(--brand); border-color:#EBD5D4; }

/* ---------- Toolbar ---------- */
.toolbar{ display:flex; gap:12px; align-items:center; margin-bottom:16px; }
.toolbar input,.toolbar select{ max-width:260px; }
.spacer{ flex:1; }

/* ---------- Modal ---------- */
.overlay{ position:fixed; inset:0; background:rgba(36,28,27,.44); display:none; place-items:center; padding:24px; z-index:50; }
.overlay.open{ display:grid; }
/* The body scrolls, not the whole dialog, so the title and the buttons
   stay put on a long form — and a message shown by the buttons is always
   where the person is already looking. */
.modal{ width:100%; max-width:560px; background:var(--surface); border-radius:var(--radius);
        box-shadow:0 24px 60px rgba(0,0,0,.28); max-height:90vh;
        display:flex; flex-direction:column; overflow:hidden; }
.modal .head{ padding:18px 22px; border-bottom:1px solid var(--line-soft); display:flex; justify-content:space-between; align-items:center; flex-shrink:0; }
.modal .body{ padding:22px; overflow-y:auto; flex:1 1 auto; }
.modal .foot{ padding:16px 22px; border-top:1px solid var(--line-soft);
              display:flex; justify-content:flex-end; align-items:center; gap:10px;
              flex-wrap:wrap; flex-shrink:0; }
.modal .foot .formerr{ flex:1 1 100%; margin:0 0 4px; }

/* ---------- Wide, tabbed form ----------
   The registration form carries about forty fields. In a 560px dialog
   that is one long scroll with the Save button far from whatever you
   are typing. Wide plus five tabs means each group fits on screen. */
.modal.wide{ max-width:1040px; height:92vh; max-height:92vh; }
/* A middle size, for forms built around a list of lines (purchase and
   equipment requests). The ordinary 560px box leaves no room for an
   item name once the quantity and cost boxes have taken their width. */
.modal.midw{ max-width:860px; }
.modal.wide .body{ padding:0; display:flex; flex-direction:column; }

.tabnav{
  display:flex; gap:2px; padding:0 22px; flex-shrink:0;
  border-bottom:1px solid var(--line); background:var(--bg, #FAF7F4);
  overflow-x:auto; scrollbar-width:none;
}
.tabnav::-webkit-scrollbar{ display:none; }
.tabnav .tab{
  padding:13px 18px; font-size:13.5px; font-weight:500; color:var(--muted);
  cursor:pointer; white-space:nowrap; border-bottom:2px solid transparent;
  margin-bottom:-1px; user-select:none;
}
.tabnav .tab:hover{ color:var(--ink); }
.tabnav .tab.on{ color:var(--brand); border-bottom-color:var(--brand); font-weight:600; }

.panes{ flex:1 1 auto; overflow-y:auto; padding:20px 22px 24px; }
.pane{ display:none; }
.pane.on{ display:block; }
/* A pane that leads with a divider does not need the rule above it. */
.pane > .formsec:first-child{ border-top:none; margin-top:0; padding-top:0; }

/* Three columns once there is room. The pane itself is the grid and the
   .row wrappers dissolve into it (display:contents), so fields flow and
   fill the width instead of leaving half the dialog empty. */
@media (min-width:900px){
  /* .on only — a bare .pane rule would beat "display:none" and show
     every tab at once. */
  .modal.wide .pane.on{
    display:grid; grid-template-columns:repeat(3, 1fr); column-gap:20px; align-content:start;
  }
  .modal.wide .pane.on > .row{ display:contents; }
  /* Things that need the full width of the pane. */
  .modal.wide .pane.on > .formsec,
  .modal.wide .pane.on > #newKin,
  .modal.wide .pane.on > .chk,
  .modal.wide .pane.on > .field:has(textarea),
  .modal.wide .pane.on > .field:has(#effectRows){ grid-column:1 / -1; }
  /* An address or a place name needs more room than a date does. */
  .modal.wide .pane.on > .field:has(#c_addr),
  .modal.wide .pane.on > .field:has(#c_retrieve),
  .modal.wide .pane.on > .field:has(#c_place),
  .modal.wide .pane.on > .field:has(#c_transfer){ grid-column:span 2; }
  .modal.wide #newKin .row{ display:grid; grid-template-columns:1fr 1fr; gap:0 20px; }
}
.badfield{ border-color:var(--brand) !important; box-shadow:0 0 0 3px rgba(122,26,32,.12); }

/* The same tab strip used on a page rather than inside a dialog. */
.tabnav.plain{
  background:transparent; border-bottom:1px solid var(--line);
  padding:0; margin:0 0 20px;
}
/* A right-aligned numeric column, and a second line of detail in a cell. */
table.inner td.r, table.inner th.r{ text-align:right; font-variant-numeric:tabular-nums; }
.sub2{ font-size:11.5px; color:var(--muted); margin-top:2px; }
td.nowrap{ white-space:nowrap; }
/* A row still waiting on somebody. */
tr.rowwait > td{ background:#FFF9EC; }
/* One line of a purchase request: what, where it lands, how many, cost. */
/* One line of a purchase request. A grid rather than flex so the item
   name keeps the width it needs: with flex the fixed boxes ate the row
   and the name showed as "Metal caske". */
.prline{
  display:grid; gap:8px; margin-bottom:8px; align-items:center;
  grid-template-columns:16px minmax(140px,1fr) auto 68px 62px 96px 32px;
}
.prline .n{ color:var(--muted); font-size:13px; text-align:right; }
.prline .desc{ margin:0; min-width:0; }
.prline .qty{ margin:0; min-width:0; text-align:right; }
.prline .cost{ margin:0; min-width:0; text-align:right; }
.prline .tag{
  flex:0 0 auto; font-size:11px; padding:3px 8px; border-radius:20px;
  background:var(--brand-wash, #F7EFEE); color:var(--brand); white-space:nowrap;
}
.prline .x{
  border:1px solid var(--line); background:#fff; color:var(--muted);
  border-radius:7px; width:32px; height:34px; cursor:pointer; font-size:17px; line-height:1;
}
.prline .x:hover{ border-color:var(--brand); color:var(--brand); }
/* =====================================================================
   OPERATION FLOW — the board, as a product surface
   KPI tiles, a connected pipeline rail, and one rich card per deceased.
   Stage accents give the board a little life without leaving the palette.
   ===================================================================== */
:root{
  --st-pickup:#8B0003; --st-arrange:#A8562A; --st-prepare:#9A7020;
  --st-wake:#4B6A2E;    --st-inter:#2F6B6B;  --st-closing:#3C4C8A;
}

/* ---- KPI tiles ---- */
.bkpis{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:16px; }
.bkpi{
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  padding:16px 18px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:2px;
  position:relative; overflow:hidden;
}
.bkpi::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--brand); opacity:.5; }
.bkpi .k{ font-size:11px; letter-spacing:.07em; text-transform:uppercase; color:var(--muted); }
.bkpi .v{ font-size:34px; font-weight:700; line-height:1.05; letter-spacing:-.03em;
          color:var(--ink); font-variant-numeric:var(--figures); }
.bkpi .s{ font-size:12px; color:var(--muted); }
.bkpi.alert::before{ background:var(--brand); opacity:1; }
.bkpi.alert .v{ color:var(--brand); }
.bkpi.calm::before{ background:var(--ok); opacity:.8; }

/* ---- pipeline rail ---- */
.pipe{
  display:flex; align-items:stretch; gap:0; margin-bottom:16px;
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  padding:8px; box-shadow:var(--shadow); overflow-x:auto;
}
.pstage{
  flex:1 1 0; min-width:96px; cursor:pointer; font:inherit; text-align:center;
  background:transparent; border:1px solid transparent; border-radius:10px;
  padding:12px 8px 11px; display:flex; flex-direction:column; align-items:center; gap:3px;
  position:relative; transition:background .14s, border-color .14s, transform .08s;
}
.pstage:hover{ background:var(--brand-wash); }
.pstage:active{ transform:translateY(1px); }
.pstage .pnum{
  width:22px; height:22px; border-radius:50%; display:grid; place-items:center;
  font-size:11px; font-weight:700; color:#fff; background:var(--brand); opacity:.9;
}
.pstage .pcount{ font-size:26px; font-weight:700; line-height:1; letter-spacing:-.02em;
                 color:var(--ink); font-variant-numeric:var(--figures); }
.pstage .pname{ font-size:12px; color:var(--muted); font-weight:500; }
.pstage .pflag{
  position:absolute; top:7px; right:10px; min-width:18px; height:18px; padding:0 5px;
  border-radius:9px; background:var(--brand); color:#fff; font-size:11px; font-weight:700;
  display:grid; place-items:center; box-shadow:0 0 0 2px var(--surface);
}
.pstage.empty .pcount{ color:var(--line); }
.pstage.empty .pnum{ opacity:.35; }
.pstage.on{ background:var(--brand-wash); border-color:var(--brand); }
.pjoin{ align-self:center; flex:0 0 14px; height:2px; background:var(--line);
        position:relative; }
.pjoin::after{ content:"›"; position:absolute; inset:0; display:grid; place-items:center;
        color:var(--line); font-size:15px; top:-10px; }

/* ---- attention / all-clear banners ---- */
.attention, .allclear{
  display:flex; align-items:center; gap:9px; flex-wrap:wrap;
  border-radius:12px; padding:12px 16px; margin-bottom:16px; font-size:13.5px;
}
.attention{ background:var(--brand-wash); border:1px solid #E8CFCE; color:#5A1416; }
.attention em{ color:var(--brand); font-style:normal; }
.allclear{ background:var(--ok-wash); border:1px solid #CDE2D4; color:#2C4A38; }
.attention .asep{ color:#C99; }
.adot{ width:9px; height:9px; border-radius:50%; flex:0 0 auto; }
.attention .adot{ background:var(--brand); box-shadow:0 0 0 4px rgba(139,0,3,.12); }
.allclear .adot{ background:var(--ok); box-shadow:0 0 0 4px rgba(47,107,79,.14); }

/* ---- the case cards ---- */
.caselist{ display:flex; flex-direction:column; gap:10px; }
.ccard{
  display:grid; grid-template-columns:auto 1fr auto auto; align-items:center; gap:16px;
  width:100%; text-align:left; font:inherit; cursor:pointer;
  background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--line);
  border-radius:14px; padding:14px 16px; box-shadow:var(--shadow);
  transition:box-shadow .14s, transform .08s, border-color .14s;
}
.ccard:hover{ box-shadow:0 2px 6px rgba(36,28,27,.08), 0 14px 34px rgba(36,28,27,.10);
              transform:translateY(-1px); }
.ccard.s-pickup{ border-left-color:var(--st-pickup); }
.ccard.s-arrange{ border-left-color:var(--st-arrange); }
.ccard.s-prepare{ border-left-color:var(--st-prepare); }
.ccard.s-wake{ border-left-color:var(--st-wake); }
.ccard.s-inter{ border-left-color:var(--st-inter); }
.ccard.s-closing{ border-left-color:var(--st-closing); }
.ccard.flag{ background:linear-gradient(90deg, #FDF5F0 0%, var(--surface) 55%); }

.cmono{
  width:44px; height:44px; border-radius:50%; display:grid; place-items:center;
  font-size:15px; font-weight:700; color:#fff; letter-spacing:.02em; flex:0 0 auto;
  background:var(--brand);
}
.cmono.s-pickup{ background:var(--st-pickup); }
.cmono.s-arrange{ background:var(--st-arrange); }
.cmono.s-prepare{ background:var(--st-prepare); }
.cmono.s-wake{ background:var(--st-wake); }
.cmono.s-inter{ background:var(--st-inter); }
.cmono.s-closing{ background:var(--st-closing); }

.cmain{ display:flex; flex-direction:column; gap:3px; min-width:0; }
.cname{ font-size:15.5px; font-weight:600; color:var(--ink); }
.cmeta{ font-size:12px; color:var(--muted); }
.cprog{ display:flex; gap:3px; margin:3px 0 1px; max-width:240px; }
.cprog i{ height:5px; flex:1 1 0; border-radius:3px; background:var(--line-soft); }
.cprog i.done{ background:var(--brand); opacity:.38; }
.cprog i.now{ background:var(--brand); }
.cstage{ font-size:12px; color:var(--muted); }
.cstage b{ color:var(--ink); font-weight:600; }
.crole{ display:inline-block; margin-left:6px; padding:1px 8px; border-radius:20px;
        background:var(--brand-wash); color:var(--brand); font-size:11px; font-weight:600; }

.cside{ display:flex; flex-direction:column; align-items:flex-end; gap:4px; text-align:right; white-space:nowrap; }
.cwait{ font-size:12px; font-weight:600; padding:3px 10px; border-radius:20px; }
.cwait.good{ background:var(--ok-wash); color:var(--ok); }
.cwait.warn{ background:var(--amber-wash); color:var(--amber); }
.cwait.bad{ background:#FBE7E6; color:var(--brand); }
.cserv{ font-size:12px; color:var(--muted); }
.cgo{ font-size:22px; color:var(--line); font-weight:400; padding:0 2px; }
.ccard:hover .cgo{ color:var(--brand); }

@media (max-width:860px){
  .bkpis{ grid-template-columns:repeat(2,1fr); }
  .pstage{ min-width:86px; }
}
@media (max-width:620px){
  .ccard{ grid-template-columns:auto 1fr auto; gap:12px; }
  .cside{ grid-column:2 / -1; flex-direction:row; align-items:center;
          justify-content:flex-start; flex-wrap:wrap; gap:8px; text-align:left; margin-top:2px; }
  .cgo{ display:none; }
  .cprog{ max-width:none; }
}

/* =====================================================================
   CASE TRACKER — the per-deceased 16-step timeline, as a product surface
   ===================================================================== */
.cfhero{
  display:flex; align-items:center; gap:20px; margin-bottom:20px;
  background:var(--surface); border:1px solid var(--line); border-left:5px solid var(--brand);
  border-radius:16px; padding:20px 22px; box-shadow:var(--shadow);
}
.cfhero.s-pickup{ border-left-color:var(--st-pickup); }
.cfhero.s-arrange{ border-left-color:var(--st-arrange); }
.cfhero.s-prepare{ border-left-color:var(--st-prepare); }
.cfhero.s-wake{ border-left-color:var(--st-wake); }
.cfhero.s-inter{ border-left-color:var(--st-inter); }
.cfhero.s-closing{ border-left-color:var(--st-closing); }
.cfmono{
  width:58px; height:58px; border-radius:50%; display:grid; place-items:center;
  font-size:20px; font-weight:700; color:#fff; flex:0 0 auto; background:var(--brand);
}
.cfmono.s-pickup{ background:var(--st-pickup); } .cfmono.s-arrange{ background:var(--st-arrange); }
.cfmono.s-prepare{ background:var(--st-prepare); } .cfmono.s-wake{ background:var(--st-wake); }
.cfmono.s-inter{ background:var(--st-inter); } .cfmono.s-closing{ background:var(--st-closing); }
.cfid{ flex:1 1 auto; min-width:0; }
.cfname{ font-size:21px; font-weight:700; letter-spacing:-.02em; color:var(--ink); }
.cfmeta{ font-size:13px; color:var(--muted); margin-top:1px; }
.cfchips{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.cfchip{ display:inline-flex; align-items:center; gap:6px; font-size:13px; color:var(--ink);
  background:var(--paper); border:1px solid var(--line); border-radius:9px; padding:5px 10px; }
.cfchip i{ font-style:normal; font-size:10px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.cfring{ position:relative; flex:0 0 auto; width:72px; height:72px; }
.cfring .rbg{ fill:none; stroke:var(--line-soft); stroke-width:7; }
.cfring .rfg{ fill:none; stroke:var(--brand); stroke-width:7; stroke-linecap:round;
  transition:stroke-dashoffset .6s ease; }
.cfpct{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.cfpct b{ font-size:17px; font-weight:700; color:var(--ink); line-height:1; }
.cfpct span{ font-size:10px; color:var(--muted); margin-top:2px; }

/* Retrieval status trigger — the button group on the registration's
   Retrieval tab. One tap sets the status; it saves with the form. */
.segbtns{ display:flex; flex-wrap:wrap; gap:8px; }
.segbtn{
  font:inherit; font-size:13.5px; font-weight:600; cursor:pointer;
  padding:9px 15px; border-radius:10px;
  border:1px solid var(--line); background:var(--surface); color:var(--ink);
  transition:background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.segbtn:hover{ border-color:var(--brand); }
.segbtn.on{ background:var(--brand); border-color:var(--brand); color:#fff;
  box-shadow:0 1px 3px rgba(139,0,3,.25); }
/* The "retrieved" choice reads as the positive, completed state. */
.segbtn.seg-retrieved.on{ background:var(--ok); border-color:var(--ok);
  box-shadow:0 1px 3px rgba(42,122,74,.28); }
.segbtn.seg-cancelled.on{ background:var(--muted); border-color:var(--muted);
  box-shadow:none; }

/* Coverage Desk (Marketing) — case cards, checklist, attachments. */
.covcase{ display:flex; align-items:center; gap:14px; cursor:pointer;
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  padding:12px 16px; margin-bottom:10px; box-shadow:var(--shadow);
  transition:border-color .12s, box-shadow .12s; }
.covcase:hover{ border-color:var(--brand); box-shadow:0 2px 8px rgba(0,0,0,.08); }
.covmono{ flex:0 0 auto; width:40px; height:40px; border-radius:10px;
  background:var(--st-pickup); color:#fff; font-weight:700; font-size:14px;
  display:flex; align-items:center; justify-content:center; }
.covmain{ flex:1 1 auto; min-width:0; }
.covname{ font-weight:600; color:var(--ink); }
.covmeta{ font-size:12.5px; color:var(--muted); margin-top:2px; }
.covside{ flex:0 0 auto; display:flex; align-items:center; gap:10px; }
.covfiles{ font-size:12.5px; color:var(--muted); }

/* Coverage review dialog — roomy, sectioned, easy to read top to bottom. */
.covwrap{ max-width:720px; margin:0 auto; }
.covsub{ color:var(--muted); font-size:13px; margin:0 0 16px; }
.covcard{ border:1px solid var(--line); border-radius:12px; background:var(--paper);
  padding:14px 16px; margin-bottom:20px; }
.covcardhd{ display:flex; align-items:center; gap:10px; font-weight:700;
  font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted);
  margin-bottom:12px; }
.covcells{ display:grid; grid-template-columns:repeat(2,1fr); gap:12px 24px; }
.covcell span{ display:block; font-size:10.5px; letter-spacing:.06em;
  text-transform:uppercase; color:var(--muted); margin-bottom:2px; }
.covcell b{ font-size:14px; color:var(--ink); font-weight:600; }
.covby{ margin-top:12px; padding-top:10px; border-top:1px solid var(--line-soft);
  font-size:12px; color:var(--muted); }
.covsec{ font-weight:700; font-size:13.5px; color:var(--ink);
  padding-bottom:7px; margin:0 0 4px; border-bottom:2px solid var(--brand); }
.covhint{ color:var(--muted); font-size:12px; margin:0 0 10px; }
.covchecks{ display:grid; grid-template-columns:1fr 1fr; gap:9px 20px; margin:0 0 20px; }
.covchecks .chk{ font-size:13.5px; align-items:flex-start; line-height:1.35; }
.covrow2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:20px; }
.covup{ display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.covfiles-list{ display:flex; flex-direction:column; gap:8px; }
.covfile{ display:flex; align-items:center; gap:10px;
  border:1px solid var(--line); border-radius:9px; padding:9px 12px; background:var(--surface); }
.cficon{ font-size:17px; }
.cfmain{ flex:1 1 auto; min-width:0; }
.cfmain a{ color:var(--brand); font-weight:600; cursor:pointer; text-decoration:none; }
.cfmain a:hover{ text-decoration:underline; }
.cfmeta{ display:block; font-size:11.5px; color:var(--muted); margin-top:1px; }
@media (max-width:620px){
  .covcells, .covchecks, .covrow2{ grid-template-columns:1fr; }
}

/* Preparation Desk (embalmer / mortician). */
.prtag{ font-size:11px; letter-spacing:.04em; color:var(--muted);
  border:1px solid var(--line); border-radius:999px; padding:1px 9px; text-transform:uppercase; }
.prbtns{ display:flex; gap:8px; flex-wrap:wrap; margin:2px 0 4px; }
.prdecided{ display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  font-size:13.5px; color:var(--ink); background:var(--paper);
  border:1px solid var(--line); border-radius:9px; padding:9px 12px; }
/* A note recorded on a flow step (e.g. the pull-out condition). */
.ftlnote{ font-size:12.5px; color:var(--muted); margin-top:5px;
  background:var(--paper); border:1px solid var(--line-soft); border-radius:7px; padding:5px 9px; display:inline-block; }
/* The close-the-case panel stands out a touch while the case is still open. */
.panel.closepanel{ border-color:#E9DCC0; }

/* The step panels (Negotiation, Interment follow-up, Close the case) put
   their text straight in the panel body, which has no side padding — so
   line everything up with the 20px inset the headers and buttons use. */
.panel .body > .sub2{ padding-left:20px; padding-right:20px; }

/* Interment follow-up / close checklist — roomy two columns that fold to one,
   on the same 20px inset as the rest of the panel. */
.fuchecks{ display:grid; grid-template-columns:1fr 1fr; gap:12px 28px; padding:0 20px; }
.fuchecks .chk{ font-size:14px; align-items:flex-start; line-height:1.4; }
@media (max-width:640px){ .fuchecks{ grid-template-columns:1fr; } }

.chk-ro{ color:var(--muted); cursor:default; }
.chk-ro input{ cursor:not-allowed; }
.prdocgrp{ margin-bottom:14px; }

/* Dispatch Desk (maintenance / guard / driver). */
.ddot{ font-size:10px; font-weight:700; letter-spacing:.02em; padding:2px 7px;
  border-radius:999px; border:1px solid var(--line); color:var(--muted); }
.ddot.ok{ background:var(--ok-wash); color:var(--ok); border-color:#D5E3DA; }
.ddot.prog{ background:var(--amber-wash); color:var(--amber); border-color:#E9DCC0; }
.ddot.pend{ background:var(--paper); }
.dlist{ display:flex; flex-direction:column; gap:6px; margin-bottom:18px; }
.dline{ display:flex; justify-content:space-between; gap:12px;
  border:1px solid var(--line); border-radius:8px; padding:8px 12px; font-size:13.5px; }
.dline b{ color:var(--ink); white-space:nowrap; }
.dticket{ border:1px solid var(--line); border-radius:10px; padding:11px 13px; margin-bottom:10px; }
.dtk{ font-size:14px; color:var(--ink); }
.dchks{ display:flex; flex-wrap:wrap; gap:7px; margin-top:6px; }
.dchk{ font-size:12px; padding:2px 9px; border-radius:999px; border:1px solid var(--line); color:var(--muted); }
.dchk.on{ background:var(--ok-wash); color:var(--ok); border-color:#D5E3DA; }
.prdoch{ font-size:11px; letter-spacing:.06em; text-transform:uppercase;
  color:var(--muted); font-weight:700; margin:0 0 7px; }

/* Equipment return check rows (maintenance edit + front-desk view). */
.eqrow{ display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  border:1px solid var(--line); border-radius:9px; padding:8px 12px; margin-bottom:8px; }
.eqname{ flex:1 1 160px; min-width:120px; font-size:13.5px; color:var(--ink); }
.eqname i{ font-style:normal; color:var(--muted); font-size:12px; }
.eqrow .eqcond{ flex:0 0 auto; width:130px; }
.eqrow .eqrem{ flex:1 1 200px; min-width:140px; }
.eqrem-ro{ flex:1 1 180px; font-size:12.5px; color:var(--muted); }

/* Decision buttons: a clear positive and a clear negative. */
.btn.ok{ background:var(--ok); border-color:var(--ok); color:#fff; }
.btn.ok:hover{ filter:brightness(1.05); }
.btn.danger{ background:var(--surface); border-color:#D9A3A2; color:var(--brand); }
.btn.danger:hover{ background:var(--brand-wash); }

/* the timeline, grouped by stage */
.ftl{ display:flex; flex-direction:column; gap:14px; }
/* A generic .done rule elsewhere centres text; a completed stage/step must
   stay left-aligned. Higher specificity than the bare .done wins here. */
.ftl .ftlgroup, .ftl .ftlghead, .ftl .ftlitem, .ftl .ftlcard{ text-align:left; }
.ftlgroup{
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  box-shadow:var(--shadow); overflow:hidden;
}
.ftlghead{
  display:flex; align-items:center; gap:10px; padding:13px 18px;
  border-bottom:1px solid var(--line-soft); background:var(--paper);
}
.ftlgnum{ width:24px; height:24px; border-radius:50%; display:grid; place-items:center;
  font-size:12px; font-weight:700; color:#fff; background:var(--muted); flex:0 0 auto; }
.ftlgroup.s-pickup .ftlgnum{ background:var(--st-pickup); }
.ftlgroup.s-arrange .ftlgnum{ background:var(--st-arrange); }
.ftlgroup.s-prepare .ftlgnum{ background:var(--st-prepare); }
.ftlgroup.s-wake .ftlgnum{ background:var(--st-wake); }
.ftlgroup.s-inter .ftlgnum{ background:var(--st-inter); }
.ftlgroup.s-closing .ftlgnum{ background:var(--st-closing); }
.ftlgname{ font-size:15px; font-weight:600; color:var(--ink); flex:1 1 auto; }
.ftlgcount{ font-size:12px; font-weight:600; color:var(--muted); font-variant-numeric:var(--figures); }
.ftlgroup.done .ftlgcount{ color:var(--ok); }
.ftlitems{ padding:6px 18px 14px; }

/* each step, as a timeline row with a connecting rail */
.ftlitem{ display:grid; grid-template-columns:28px 1fr; gap:14px; position:relative; padding-top:14px; }
.ftlitem::before{ content:""; position:absolute; left:13px; top:0; bottom:0; width:2px; background:var(--line-soft); }
.ftlitem:first-child::before{ top:14px; }
.ftlitem:last-child::before{ bottom:auto; height:14px; }
.ftlnode{
  position:relative; z-index:1; width:28px; height:28px; border-radius:50%;
  display:grid; place-items:center; font-size:12px; font-weight:700;
  background:var(--surface); border:2px solid var(--line); color:var(--muted);
}
.ftlitem.done .ftlnode{ background:var(--ok); border-color:var(--ok); color:#fff; }
.ftlitem.active .ftlnode{ border-color:var(--brand); color:var(--brand);
  box-shadow:0 0 0 4px rgba(139,0,3,.12); }
.ftlitem.active .ftlnode::after{ content:""; width:8px; height:8px; border-radius:50%; background:var(--brand); }
.ftlitem.skipped .ftlnode{ color:var(--line); }
.ftlcard{ padding-bottom:4px; min-width:0; }
.ftltop{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ftltop b{ font-size:14.5px; font-weight:600; color:var(--ink); }
.ftlitem.done .ftltop b{ color:var(--muted); }
.ftlcode{ font-size:11px; color:var(--muted); font-variant-numeric:var(--figures); }
.ftlrole{ font-size:11px; font-weight:600; color:var(--brand); background:var(--brand-wash);
  border-radius:20px; padding:2px 9px; }
.fpill{ font-size:11px; font-weight:600; border-radius:20px; padding:2px 9px; text-transform:capitalize; }
.fpill.ok{ background:var(--ok-wash); color:var(--ok); }
.fpill.no{ background:#FBE7E6; color:var(--brand); }
.ftldesc{ font-size:13px; color:var(--muted); margin-top:4px; line-height:1.5; }
.ftlmeta{ font-size:12px; color:var(--ok); margin-top:6px; font-weight:500; }
.ftlact{ display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }

@media (max-width:620px){
  .cfhero{ flex-wrap:wrap; gap:14px; }
  .cfring{ order:-1; }
  .cfid{ flex-basis:60%; }
}

/* =====================================================================
   LIAISON DESK — the officer's worklist
   ===================================================================== */
.lsec{ margin-bottom:22px; }
.lsec h3{ font-size:14px; color:var(--muted); font-weight:600; margin:0 2px 10px;
  letter-spacing:.01em; }
.lwork{
  display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:16px;
  background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--st-inter);
  border-radius:14px; padding:14px 16px; box-shadow:var(--shadow); margin-bottom:10px;
}
.lwork.cert{ border-left-color:var(--st-closing); }
.lwork.permit{ border-left-color:var(--st-inter); }
.lwmono{
  width:42px; height:42px; border-radius:11px; display:grid; place-items:center;
  font-size:14px; font-weight:700; color:#fff; flex:0 0 auto;
}
.lwork.cert .lwmono{ background:var(--st-closing); }
.lwork.permit .lwmono{ background:var(--st-inter); }
.lwmain{ min-width:0; }
.lwname{ font-size:15.5px; font-weight:600; color:var(--ink); }
.lwmeta{ font-size:12px; color:var(--muted); margin-top:1px; }
.lwfacts{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.lwfacts span{ font-size:12px; color:var(--ink); background:var(--paper);
  border:1px solid var(--line); border-radius:8px; padding:3px 9px; }
.lwfacts i{ font-style:normal; font-size:10px; letter-spacing:.05em; text-transform:uppercase;
  color:var(--muted); margin-right:5px; }
.lwfacts .lwtag{ background:var(--brand-wash); border-color:#E8CFCE; color:var(--brand); font-weight:600; }
.lwact{ display:flex; flex-direction:column; gap:7px; align-items:stretch; flex:0 0 auto; }
.lwact .btn{ white-space:nowrap; }

@media (max-width:720px){
  .lwork{ grid-template-columns:auto 1fr; }
  .lwact{ grid-column:2 / -1; flex-direction:row; flex-wrap:wrap; }
}

/* ---- Liaison Desk v2: coordination tasks per case ---- */
.lsec > .lcase, .lsec > .lpend{ margin-bottom:10px; }

/* status colours shared by dots, chips and pills */
:root{
  --lt-pend:#9A7020; --lt-prog:#2F6B6B; --lt-ok:#2F6B4F; --lt-na:#9a9390;
}
.lcase{
  display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:16px;
  background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--st-inter);
  border-radius:14px; padding:14px 16px; box-shadow:var(--shadow); cursor:pointer;
  transition:box-shadow .14s, transform .08s;
}
.lcase:hover{ box-shadow:0 2px 6px rgba(36,28,27,.08),0 14px 34px rgba(36,28,27,.10); transform:translateY(-1px); }
.lcmono{ width:42px; height:42px; border-radius:50%; display:grid; place-items:center;
  font-size:14px; font-weight:700; color:#fff; background:var(--st-inter); flex:0 0 auto; }
.lcmain{ min-width:0; }
.lcname{ font-size:15.5px; font-weight:600; color:var(--ink); }
.lcmeta{ font-size:12px; color:var(--muted); margin-top:1px; text-transform:capitalize; }
.ldots{ display:flex; gap:5px; margin-top:9px; flex-wrap:wrap; }
.ldot{ width:12px; height:12px; border-radius:50%; background:var(--line); border:1px solid var(--line); }
.ldot.pend{ background:var(--lt-pend); border-color:var(--lt-pend); opacity:.5; }
.ldot.prog{ background:var(--lt-prog); border-color:var(--lt-prog); }
.ldot.ok{ background:var(--lt-ok); border-color:var(--lt-ok); }
.ldot.na{ background:#fff; border-color:var(--line); }
.lcside{ display:flex; flex-direction:column; align-items:flex-end; gap:7px; flex:0 0 auto; }
.lcopen{ font-size:12px; font-weight:600; padding:3px 10px; border-radius:20px; white-space:nowrap; }
.lcopen.has{ background:var(--amber-wash); color:var(--amber); }
.lcopen.none{ background:var(--ok-wash); color:var(--ok); }

/* pending-documents flat rows */
.lpend{
  display:grid; grid-template-columns:auto 1fr auto auto; align-items:center; gap:14px;
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  padding:11px 15px; box-shadow:var(--shadow);
}
.lptype{ font-size:12px; font-weight:600; color:var(--brand); background:var(--brand-wash);
  border-radius:8px; padding:4px 10px; white-space:nowrap; }
.lptype.prog{ color:var(--lt-prog); background:#E4EEEE; }
.lpmain{ min-width:0; display:flex; flex-direction:column; }
.lpmain b{ font-size:14px; color:var(--ink); }
.lpmeta{ font-size:12px; color:var(--muted); }
.lpstat{ font-size:11px; font-weight:600; padding:2px 9px; border-radius:20px; white-space:nowrap; }
.lpstat.pend{ background:var(--amber-wash); color:var(--amber); }
.lpstat.prog{ background:#E4EEEE; color:var(--lt-prog); }
.lpact{ display:flex; gap:7px; }

/* ---- Pick-ups (driver facility) ---- */
.pucard{
  display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:16px;
  background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--lt-pend);
  border-radius:14px; padding:14px 16px; box-shadow:var(--shadow); margin-bottom:10px;
}
.pucard.prog{ border-left-color:var(--lt-prog); }
.pucard.ok{ border-left-color:var(--lt-ok); }
.pumono{ width:42px; height:42px; border-radius:50%; display:grid; place-items:center;
  font-size:14px; font-weight:700; color:#fff; background:var(--lt-pend); flex:0 0 auto; }
.pucard.prog .pumono{ background:var(--lt-prog); }
.pucard.ok .pumono{ background:var(--lt-ok); }
.pumain{ min-width:0; }
.puname{ font-size:15.5px; font-weight:600; color:var(--ink); }
.pumeta{ font-size:12px; color:var(--muted); margin-top:1px; }
.puwhere{ font-size:13px; color:var(--ink); margin-top:5px; }
.punote{ font-size:12.5px; color:var(--muted); font-style:italic; margin-top:4px; }
.pudone{ font-size:12px; color:var(--lt-ok); margin-top:4px; font-weight:500; }
.puside{ display:flex; flex-direction:column; align-items:flex-end; gap:8px; flex:0 0 auto; }
.pustat{ font-size:11px; font-weight:700; padding:3px 10px; border-radius:20px; white-space:nowrap; }
.pustat.pend{ background:var(--amber-wash); color:var(--amber); }
.pustat.prog{ background:#E4EEEE; color:var(--lt-prog); }
.pustat.ok{ background:var(--ok-wash); color:var(--lt-ok); }
.pudonetag{ font-size:13px; color:var(--lt-ok); font-weight:600; }

@media (max-width:620px){
  .pucard{ grid-template-columns:auto 1fr; }
  .puside{ grid-column:2 / -1; flex-direction:row; align-items:center; justify-content:space-between; }
}

/* per-case editor table inside the modal */
.lttable{ display:flex; flex-direction:column; gap:8px; }
.ltrow{ display:grid; grid-template-columns:1.4fr .9fr 1fr 1fr; gap:8px; align-items:center; }
.ltrow.lthead{ font-size:11px; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); }
.ltrow.lthead > div{ padding:0 2px; }
.ltlabel{ font-size:13px; font-weight:600; color:var(--ink); }
.ltrow select, .ltrow input{ margin:0; min-width:0; }

@media (max-width:720px){
  .lcase{ grid-template-columns:auto 1fr; }
  .lcside{ grid-column:2 / -1; flex-direction:row; align-items:center; justify-content:space-between; }
  .lpend{ grid-template-columns:1fr auto; }
  .lptype{ grid-column:1 / -1; justify-self:start; }
  .lpact{ grid-column:1 / -1; }
  .ltrow{ grid-template-columns:1fr 1fr; }
  .ltrow .ltlabel{ grid-column:1 / -1; }
  .ltrow.lthead{ display:none; }
}

.prtotal{ text-align:right; font-size:13px; color:var(--muted); margin-top:4px; }
/* On a phone the seven columns cannot fit, so the name takes its own
   row above the numbers instead of being crushed to nothing. */
@media (max-width:640px){
  .prline{
    gap:6px;
    grid-template-columns:14px auto minmax(0,1fr) minmax(0,.8fr) minmax(0,1.2fr) 30px;
  }
  .prline .desc{ grid-column:2 / -1; }
  .prline .tag{ grid-column:2; justify-self:start; }
  .prline .x{ width:30px; }
  .prline input{ padding-left:8px; padding-right:8px; }
}
tr.rowwait:hover > td{ background:#FDF2DC; }
td.nowrap .btn{ margin-left:6px; }

@media (max-width:900px){
  .modal.wide{ max-width:100%; height:94vh; }
  .tabnav{ padding:0 14px; }
  .tabnav .tab{ padding:12px 13px; font-size:13px; }
  .panes{ padding:16px 14px 20px; }
}

/* A stray click on the backdrop while the form has unsaved typing: the
   dialog stays and gives a short nudge, so it is clear the click landed
   and the form is deliberately not going anywhere. */
@keyframes modalshake{
  0%,100%{ transform:translateX(0); }
  20%{ transform:translateX(-7px); } 40%{ transform:translateX(6px); }
  60%{ transform:translateX(-4px); } 80%{ transform:translateX(3px); }
}
.modal.shake{ animation:modalshake .42s ease; }
.modal.shake .head{ border-bottom-color:var(--brand); }
@media (prefers-reduced-motion:reduce){
  .modal.shake{ animation:none; outline:2px solid var(--brand); outline-offset:-2px; }
}
.close{ background:none; border:none; font-size:20px; color:var(--muted); cursor:pointer; line-height:1; }

/* ---------- Empty state: arch silhouette ---------- */
.empty{ padding:44px 20px; text-align:center; color:var(--muted); font-size:14px; }
.empty em{ font-family:var(--sans); font-style:normal; font-weight:600; display:block;
           font-size:16px; color:var(--ink); margin-bottom:6px; }
.empty .arches{ display:block; margin:0 auto 14px; opacity:.22; }

.hide{ display:none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 860px){
  /* Sidebar / nav layout for phones is handled by the drawer block near the
     end of this file. Only non-conflicting tweaks remain here. */
  .cards{ grid-template-columns:repeat(2,1fr); }
  /* The buttons refuse to shrink (so their words never break), which on a
     narrow screen pushed the page sideways. Give them a row of their own
     under the title instead. */
  .topbar{ flex-wrap:wrap; }
  .topbar .actions{ width:100%; justify-content:flex-start; flex-shrink:1; min-width:0; }
  /* Any table wider than the phone is swiped inside its panel. */
  .panel .body{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .login-card{ padding:30px 22px 24px; }
}
@media (prefers-reduced-motion: reduce){ *{ transition:none !important; } }
:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; }

/* ---------- Operation flow tracker ----------
   One row per step of OPERATION_PROCESS_FLOW. The rail down the left
   makes the sequence readable at a glance; colour marks what is done. */
.progressbar{ height:5px; background:var(--line-soft); border-radius:3px; overflow:hidden; margin:-6px 0 22px; }
.progressbar span{ display:block; height:100%; background:var(--brand); border-radius:3px; }

.fstep{ display:flex; gap:14px; padding:14px 0; border-bottom:1px solid var(--line-soft); position:relative; }
.fstep:last-child{ border-bottom:none; }
.fnum{
  flex:0 0 28px; height:28px; border-radius:50%; display:grid; place-items:center;
  font-size:12px; font-weight:600; background:var(--line-soft); color:var(--muted);
  border:1px solid var(--line);
}
.fstep.done  .fnum{ background:var(--ok-wash); color:var(--ok);    border-color:#CFE2D5; }
.fstep.active .fnum{ background:var(--brand);  color:#fff;         border-color:var(--brand); }
.fbody{ flex:1; min-width:0; }
.fhead{ display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
.fhead b{ font-size:14px; font-weight:600; }
.fstep.done .fhead b{ color:var(--muted); }
.fdesc{ font-size:13px; color:var(--muted); margin-top:3px; }
.fmeta{ font-size:12px; color:var(--muted); margin-top:5px; font-style:italic; }
.factions{ display:flex; gap:8px; margin-top:9px; flex-wrap:wrap; }

@media (max-width:640px){
  .fhead{ gap:6px; } .fdesc{ font-size:12.5px; }
}

/* ---------- OPE contract form ----------
   Laid out to mirror the paper form so staff can transcribe
   top-to-bottom without hunting for fields. */
.formsec{ border-top:1px solid var(--line-soft); margin-top:20px; padding-top:16px; }
.formsec:first-child{ border-top:none; margin-top:0; padding-top:0; }
.formsec > h4{
  font-family:var(--sans); font-size:11px; letter-spacing:.1em; text-transform:uppercase;
  color:var(--brand); font-weight:600; margin:0 0 12px;
}
.checkrow{ display:flex; gap:18px; flex-wrap:wrap; align-items:center; margin-bottom:10px; }
.chk{ display:flex; align-items:center; gap:7px; font-size:14px; cursor:pointer; }
.chkrow{ display:flex; flex-wrap:wrap; gap:10px 18px; }
.chkrow .chk{ font-size:13.5px; }
.chk input{ width:auto; margin:0; accent-color:var(--brand); }

/* money panel: derived figures are visually distinct from typed ones */
.money{ background:#FBF8F5; border:1px solid var(--line); border-radius:8px; padding:14px 16px; }
.moneyrow{ display:flex; justify-content:space-between; align-items:center; gap:14px; padding:6px 0; }
.moneyrow label{ margin:0; flex:1; font-size:13.5px; color:var(--ink); }
.moneyrow input{ max-width:150px; text-align:right; font-variant-numeric:tabular-nums; }
.moneyrow.derived{ border-top:1px solid var(--line); margin-top:6px; padding-top:11px; }
.moneyrow.derived span{
  font-family:var(--sans); font-size:19px; font-weight:600; color:var(--brand);
  font-variant-numeric:tabular-nums; min-width:150px; text-align:right;
}
.moneyrow.derived label{ font-weight:600; }
.moneyrow small{ color:var(--muted); font-size:12px; display:block; font-weight:400; }

/* ---------- Deceased registration record ----------
   A read view, not a form: label above value, in columns that reflow.
   Values use tabular numerals so dates and ages line up down a column. */
.kvgrid{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:16px 26px; padding:18px 20px;
}
.kv{ min-width:0; }
.kv > span{
  display:block; font-size:10.5px; letter-spacing:.09em; text-transform:uppercase;
  color:var(--muted); font-weight:600; margin-bottom:3px;
}
.kv > b{
  display:block; font-size:14.5px; font-weight:500; color:var(--ink);
  font-variant-numeric:tabular-nums; word-break:break-word; line-height:1.45;
}
.kv > b:empty::after{ content:'—'; color:var(--muted); }

/* A registration starts nearly empty and fills over days. In "tidy" mode
   the blanks fold away so the few known facts are not lost among dashes;
   a count below the group says how many are still outstanding. */
.kvgrid.tidy .kv.empty{ display:none; }
.kvgrid.tidy:empty{ padding:0; }
.kv.empty > b{ color:var(--muted); font-weight:400; }
.blankcount{
  padding:0 20px 16px; font-size:12.5px; color:var(--muted);
  font-style:italic;
}
.kvgrid.tidy:empty + .blankcount{ padding-top:14px; }
.warnnote{ color:var(--amber, #9A6A00); font-weight:500; }

/* Why a save failed, shown where the person is already looking. */
.formerr{
  background:#FDF3F3; border:1px solid #E3B7B7; border-left:3px solid var(--brand);
  color:#6E2020; border-radius:8px; padding:11px 14px; margin-bottom:16px;
  font-size:13.5px; line-height:1.5;
}
.btn:disabled{ opacity:.6; cursor:progress; }

/* A divider inside one panel, for a block that belongs with what is
   above it but reads as its own group (contracting party / first call). */
.subhead{
  font-family:var(--sans); font-size:10.5px; letter-spacing:.1em;
  text-transform:uppercase; color:var(--brand); font-weight:600;
  padding:16px 20px 0; margin-top:4px;
  border-top:1px solid var(--line-soft);
}
.panel .body > .subhead:first-child{ border-top:none; margin-top:0; }
.subhead + .kvgrid{ padding-top:12px; }

/* Actions that belong to one panel, under its contents. */
.panelactions{ display:flex; gap:9px; flex-wrap:wrap; padding:4px 20px 18px; }
.emptyrow{
  padding:16px 20px 18px; font-size:13.5px; color:var(--muted); line-height:1.6;
  display:flex; align-items:center; gap:14px; flex-wrap:wrap;
}

/* Search above a register — families call with a name, not a number. */
.search{
  width:100%; max-width:380px; margin-bottom:14px;
  padding:9px 13px; border:1px solid var(--line); border-radius:8px;
  font-family:var(--sans); font-size:14px; color:var(--ink); background:#fff;
}
.search:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px rgba(122,26,32,.10); }
.search::placeholder{ color:var(--muted); }

/* ---------- Printable contract ----------
   Screen shows it framed like paper; print drops the chrome. */
.contract-paper{
  background:#fff; border:1px solid var(--line); border-radius:10px;
  padding:40px 44px; box-shadow:var(--shadow); max-width:840px; margin:0 auto;
  font-size:13.5px; line-height:1.65;
}
.contract-paper .ch{ display:flex; align-items:center; gap:16px; border-bottom:2px solid var(--brand); padding-bottom:16px; margin-bottom:22px; }
.contract-paper .ch img{ width:88px; height:auto; }
.contract-paper .ch h2{ font-size:20px; margin:0; }
.contract-paper .ch .sub{ font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); margin-top:4px; }
.contract-paper .ch .no{ margin-left:auto; text-align:right; font-size:12px; color:var(--muted); }
.contract-paper .ch .no b{ display:block; font-size:15px; color:var(--brand); font-variant-numeric:tabular-nums; }
.cfield{ display:flex; gap:8px; padding:4px 0; }
.cfield .k{ color:var(--muted); min-width:180px; flex:0 0 auto; }
.cfield .v{ flex:1; border-bottom:1px solid var(--line); min-height:21px; font-weight:500; }
.cgrid{ display:grid; grid-template-columns:1fr 1fr; gap:0 34px; }
.contract-paper h5{ font-family:var(--sans); font-size:10.5px; letter-spacing:.1em; text-transform:uppercase;
  color:var(--brand); font-weight:600; margin:20px 0 8px; border-top:1px solid var(--line-soft); padding-top:14px; }
.ctable{ width:100%; border-collapse:collapse; font-size:13px; margin-top:6px; }
.ctable th{ text-align:left; font-size:10.5px; padding:6px 8px; border-bottom:1px solid var(--line); }
.ctable td{ padding:6px 8px; border-bottom:1px solid var(--line-soft); }
.ctable td.r, .ctable th.r{ text-align:right; font-variant-numeric:tabular-nums; }
.csum{ margin-left:auto; width:290px; margin-top:14px; }
.csum .row{ display:flex; justify-content:space-between; padding:5px 0; }
.csum .row.tot{ border-top:1px solid var(--line); margin-top:5px; padding-top:9px; font-weight:600; }
.csum .row.bal{ border-top:2px solid var(--brand); margin-top:5px; padding-top:9px;
  font-family:var(--sans); font-size:17px; font-weight:600; color:var(--brand); }
.csign{ display:grid; grid-template-columns:1fr 1fr; gap:44px; margin-top:52px; }
.csign .line{ border-top:1px solid var(--ink); padding-top:7px; font-size:11.5px; color:var(--muted); }
.cnote{ margin-top:26px; font-size:11px; color:var(--muted); line-height:1.6; }

/* ---------- Service Contract (printed) ----------
   A reproduction of the federation's own Service Contract, laid out to
   fill an A4 page the way the Word document does: fields on ruled lines,
   the terms as running text, three signature blocks at the foot. */
.sc-paper{
  background:#fff; border:1px solid var(--line); border-radius:10px;
  box-shadow:var(--shadow); max-width:210mm; margin:0 auto;
  padding:16mm 16mm 18mm;
  font-family:var(--sans);
  font-size:11.2pt; line-height:1.5; color:#111;
}
.sc-paper .sch{ display:flex; align-items:center; gap:14px; margin-bottom:10px; }
.sc-paper .sch img{ width:66px; height:auto; }
.sc-paper .scorg{ display:flex; flex-direction:column; line-height:1.35; }
.sc-paper .scorg b{ font-size:12pt; letter-spacing:.01em; }
.sc-paper .scorg span{ font-size:9pt; color:#444; }

.sctitle{
  text-align:center; font-size:14pt; font-weight:700; letter-spacing:.02em;
  margin:6px 0 2px;
}
.scno{ text-align:left; font-size:10.5pt; margin:0 0 10px; }
.scno b{ font-weight:700; }
.scno.center{ text-align:center; }
.sc-paper .scorg .reg{ font-size:8.4pt; color:#333; letter-spacing:.01em; }
.sc-paper .scorg .tagline{ font-size:9pt; font-style:italic; color:var(--brand); margin-top:2px; }

}

/* ---------- Agreement on the Preparation of the Cadaver ----------
   The companion sheet. Running text with ruled blanks written into the
   sentences, as on the paper form. */
.sc-paper.cadaver{ margin-top:22px; }
.cadaver .sctitle{ font-size:12.5pt; letter-spacing:0; margin-bottom:4px; }
.cadaver .known{ font-weight:700; font-size:10.5pt; margin:16px 0 12px; }
.cadbody{ font-size:10.5pt; line-height:2.1; text-align:justify; margin:0 0 14px; }
.cadlist{ margin:0 0 16px 20px; padding:0; }
.cadlist li{ font-size:10.5pt; line-height:1.95; text-align:justify; margin-bottom:9px; }
/* A blank on the form: a ruled line that grows to fit what is typed in. */
.fill{
  display:inline-block; min-width:110px; border-bottom:1px solid #222;
  padding:0 5px; font-weight:600; text-align:center; line-height:1.3;
}
.fill.wide{ min-width:280px; }
.fill.narrow{ min-width:46px; }
.witnesshead{ font-size:10.5pt; font-weight:700; margin:26px 0 6px; }

/* ---------- Authorization letter (to the Local Civil Registrar) ----------
   A letter, not a form: the registrar's office at the top, one paragraph
   of authority, two signatures. Generously spaced because it is signed by
   hand at a counter. */
/* A one-inch margin all round, as a formal letter to a government
   office is expected to have. On screen the panel keeps its own frame;
   in print the page margin and this padding add up to 25mm. */
.sc-paper.letter{ padding:25mm 25mm 22mm; }
.lcrhead{ text-align:center; line-height:1.5; margin-bottom:26px; }
.lcrhead span{ display:block; font-size:10.5pt; }
.lcrhead b{ display:block; font-size:11.5pt; font-weight:700; letter-spacing:.01em; }
.letter .sctitle{ font-size:13pt; letter-spacing:.06em; margin-bottom:2px; }
.letterdate{ margin:44px 0 40px; width:220px; }
.letterdate .fill{ display:block; min-width:0; width:100%; }
.letterdate span{ display:block; font-size:9.5pt; margin-top:3px; }
/* Justified, with the blanks sized so each line still carries enough
   words to justify cleanly. Oversized blanks were forcing an early line
   break and leaving three words stretched across the full measure. */
.letterbody{
  font-size:11pt; line-height:2.5; text-align:justify; text-justify:inter-word;
  margin:0 0 56px; hyphens:none;
}
/* Narrower blanks pack more words onto each line, so justification has
   more spaces to spread the slack across and no single gap yawns open.
   max-width lets an unusually long name wrap inside its own rule instead
   of jumping to the next line whole and leaving three words stretched
   across the full measure behind it. */
.letterbody .fill{ min-width:78px; max-width:100%; white-space:normal; }
.letterbody .fill.wide{ min-width:144px; }
.letterbody .fill.narrow{ min-width:40px; }
/* The closing line of a justified paragraph is left alone — that is the
   browser default, and the full-width ::after trick I first used here
   forced the opposite, stretching "certificate of the deceased" across
   the page. Stated explicitly so it is not "fixed" back. */
.letterbody{ text-align-last:left; }
.lettersigns{ display:flex; gap:56px; margin-top:40px; }
.lettersigns .sig{ flex:1; max-width:290px; }
.lettersigns .rule{ border-bottom:1px solid #222; height:0; margin-bottom:4px; }
.lettersigns .sig b{ display:block; font-size:10.5pt; font-weight:700; }
.lettersigns .sig span{ display:block; font-size:9.5pt; color:#333; }
.lettersigns .sig span.sub{ font-size:8.6pt; color:#555; margin-top:1px; }

/* Personal-effects editor (on screen) */
.effectrow{ display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.effectrow .n{ width:20px; color:var(--muted); font-size:13px; text-align:right; }
.effectrow .desc{ flex:2; margin:0; }
.effectrow .ret{ flex:1.2; margin:0; }
.effectrow .x{
  border:1px solid var(--line); background:#fff; color:var(--muted);
  border-radius:7px; width:32px; height:34px; cursor:pointer; font-size:17px; line-height:1;
}
.effectrow .x:hover{ border-color:var(--brand); color:var(--brand); }

/* A table nested inside a panel body. */
table.inner{ width:100%; border-collapse:collapse; }
table.inner th{
  text-align:left; font-size:10.5px; letter-spacing:.07em; text-transform:uppercase;
  color:var(--muted); font-weight:600; padding:10px 20px; border-bottom:1px solid var(--line-soft);
}
table.inner td{ padding:10px 20px; font-size:13.5px; border-bottom:1px solid var(--line-soft); }
table.inner tr:last-child td{ border-bottom:none; }
table.inner tr.muted td{ color:var(--muted); }
.scsign.one.center{ display:flex; justify-content:center; }
.scsign.one.center .sig{ max-width:320px; text-align:center; }

/* A field is a label followed by a ruled line the value sits on, so a
   blank prints as something to be filled in by hand. */
.scrow{ display:flex; gap:22px; margin-bottom:4px; }
.scf{ display:flex; align-items:baseline; gap:6px; flex:1; min-width:0; }
.scf .l{ white-space:nowrap; font-size:10.5pt; }
.scf .u, .scline .u{
  flex:1; min-width:0; border-bottom:1px solid #222; padding:0 4px 1px;
  font-weight:600; min-height:1.25em; overflow-wrap:break-word;
}
.scline{ display:flex; align-items:baseline; gap:10px; margin:6px 0 4px; flex-wrap:wrap; }
.scline.indent{ padding-left:52px; }
.scline .u.grow{ flex:1; min-width:120px; }
.scbox{ white-space:nowrap; font-size:10.5pt; }
.scnote{ font-size:9pt; color:#555; white-space:nowrap; }

.scdetails{ margin:10px 0 6px; }
.scdetails ul{ margin:4px 0 0 20px; padding:0; }
.scdetails li{ font-size:10.5pt; }
.scfree{ font-size:10.5pt; margin-top:4px; }

/* Money block: right-aligned figures on ruled lines, as typed on the form. */
.scmoney{ margin:10px 0 14px; max-width:330px; }
.scmoney .r{ display:flex; justify-content:space-between; gap:16px; padding:2px 0;
             font-variant-numeric:tabular-nums; }
.scmoney .r span:last-child{ min-width:130px; text-align:right;
  border-bottom:1px solid #222; padding:0 4px 1px; font-weight:600; }
.scmoney .tot span:last-child, .scmoney .bal span:last-child{ font-weight:700; }
.scmoney .bal{ margin-top:2px; }

.scterms h4{ font-size:10.5pt; font-weight:700; margin:12px 0 4px; }
.scterms ol{ margin:0 0 10px 22px; padding:0; }
.scterms li{ font-size:10pt; margin-bottom:2px; }
.scterms p{ font-size:10pt; text-align:justify; margin:0 0 8px; }
.scterms .accept{ margin-top:12px; }

.scsign{ display:flex; gap:40px; margin-top:22px; }
.scsign.one{ margin-top:26px; }
.scsign .sig{ flex:1; }
.scsign .cap{ font-size:10pt; margin-bottom:22px; }
.scsign .rule{ border-bottom:1px solid #222; height:0; margin-bottom:4px; }
.scsign .sig b{ display:block; font-size:10.5pt; font-weight:700; }
.scsign .sig span{ display:block; font-size:9pt; color:#333; }
.scsign.one .sig{ max-width:320px; }

/* Screen only. An A4 page is about 794px wide, so an unscoped
   max-width rule here would collapse the printed form into one column. */
@media screen and (max-width:820px){
  .sc-paper{ padding:20px; font-size:11pt; }
  .scrow{ flex-direction:column; gap:4px; }
  .scsign{ flex-direction:column; gap:26px; }
}

@media print{
  body{ background:#fff; }
  .sidebar, .topbar, .note, .btn, .overlay, .search, .blankcount{ display:none !important; }
  .shell{ display:block; } .main{ padding:0; max-width:none; }
  .contract-paper{ border:none; box-shadow:none; border-radius:0; padding:0; max-width:none; }

  /* The contract prints as the page itself, with no app chrome and no
     page break inside a signature block or a paragraph of the terms. */
  .sc-paper{ border:none; box-shadow:none; border-radius:0; padding:0; max-width:none; }
  /* The letter keeps a full one-inch margin: 15mm from @page plus 10mm. */
  .sc-paper.letter{ padding:10mm 10mm 0; }
  .letterbody{ orphans:2; widows:2; }
  .lettersigns{ break-inside:avoid; page-break-inside:avoid; }
  /* The cadaver agreement is its own sheet — it is signed separately. */
  .sc-paper.cadaver{ break-before:page; page-break-before:always; margin-top:0; }
  .scterms p, .scterms ol, .scsign, .scmoney, .scdetails{ break-inside:avoid; page-break-inside:avoid; }
  .cadlist li, .cadbody{ break-inside:avoid; page-break-inside:avoid; }
  .scterms{ orphans:3; widows:3; }
  @page{ size:A4; margin:14mm 15mm; }
}

/* ---------- Login: sign in / request access ---------- */
.switch{ margin:18px 0 0; font-size:13.5px; color:var(--muted); text-align:center; }
.switch a{ color:var(--brand); font-weight:500; text-decoration:none; }
.switch a:hover{ text-decoration:underline; }
.paneNote{
  margin:0 0 20px; font-size:13px; color:var(--muted); line-height:1.55;
  background:var(--brand-wash); border:1px solid #EBD5D4; border-radius:8px; padding:11px 13px;
}
.hint{ font-size:12px; color:var(--muted); margin-top:5px; }
.hint.warn{ color:var(--amber); }
.hint.ok{ color:var(--ok); }
.done{ text-align:center; padding:8px 0 4px; }
.done .tick{
  width:44px; height:44px; margin:0 auto 14px; border-radius:50%;
  background:var(--ok-wash); color:var(--ok); border:1px solid #CFE2D5;
  display:grid; place-items:center; font-size:20px;
}
.done h3{ font-size:17px; margin-bottom:8px; }
.done p{ font-size:13.5px; color:var(--muted); margin:0 0 18px; line-height:1.55; }
/* the request form is taller than the sign-in form */
#registerPane .row{ gap:12px; }

/* ---------- Staff & access requests ---------- */
.reqcard{
  border:1px solid #E7D2D1; background:#FEFAF9; border-radius:var(--radius);
  padding:16px 18px; margin-bottom:12px;
}
.reqcard .top{ display:flex; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.reqcard .who b{ font-size:15px; font-weight:600; display:block; }
.reqcard .who span{ font-size:13px; color:var(--muted); }
.reqcard .meta{ margin-left:auto; text-align:right; font-size:12px; color:var(--muted); }
.reqcard .grid{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:10px 18px; margin:14px 0 4px; font-size:13.5px;
}
.reqcard .grid .k{ font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.reqcard .act{ display:flex; gap:9px; align-items:flex-end; flex-wrap:wrap; margin-top:14px;
  border-top:1px solid var(--line-soft); padding-top:14px; }
.reqcard .act .field{ margin:0; min-width:170px; }
.reqcard .act label{ margin-bottom:4px; }

.badge{
  display:inline-block; min-width:18px; padding:1px 6px; margin-left:7px;
  border-radius:999px; background:#fff; color:var(--brand-deep);
  font-size:11px; font-weight:600; text-align:center; font-variant-numeric:var(--figures);
}
.sidebar .foot .pos{ color:#C09B9B; font-size:12px; display:block; margin-top:1px; }

/* ---------- Grouped sidebar ----------
   Thirteen items need signposting; the labels are quiet dividers,
   not headings competing with the items themselves. */
.navgroup{
  font-size:10px; letter-spacing:.16em; text-transform:uppercase;
  color:#A97F7F; font-weight:600; margin:14px 0 5px; padding:0 12px;
}
.nav > .navgroup:first-of-type{ margin-top:16px; }

/* ---------- Calendar ---------- */
.calbar{ display:flex; align-items:center; gap:12px; margin-bottom:16px; }
.calbar h3{ font-size:17px; min-width:180px; }
.cal{ display:grid; grid-template-columns:repeat(7,1fr); gap:1px; background:var(--line);
  border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; }
.cal .dow{ background:var(--surface); padding:9px 8px; font-size:10.5px; letter-spacing:.08em;
  text-transform:uppercase; color:var(--muted); font-weight:600; text-align:center; }
.cal .day{ background:var(--surface); min-height:108px; padding:7px 8px; }
.cal .day.out{ background:#FAF8F6; }
.cal .day .n{ font-size:12.5px; color:var(--muted); font-variant-numeric:var(--figures); }
.cal .day.today .n{ background:var(--brand); color:#fff; border-radius:50%;
  width:22px; height:22px; display:grid; place-items:center; font-weight:600; }
.ev{ display:block; margin-top:4px; padding:3px 6px; border-radius:5px; font-size:11.5px;
  line-height:1.3; cursor:pointer; border-left:2px solid; text-align:left; width:100%;
  background:none; border-top:none; border-right:none; border-bottom:none; }
.ev b{ display:block; font-weight:600; }
.ev.service{ background:var(--brand-wash); border-color:var(--brand); color:var(--brand-deep); }
.ev.trip{ background:var(--ok-wash); border-color:var(--ok); color:#24503B; }
.ev small{ color:inherit; opacity:.75; }
.legend{ display:flex; gap:16px; font-size:12.5px; color:var(--muted); margin-top:12px; }
.legend i{ width:11px; height:11px; border-radius:3px; display:inline-block; margin-right:5px; }

/* ---------- Facility cards ---------- */
.fgrid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(236px,1fr)); gap:14px; margin-bottom:22px; }
.fcard{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px 18px; box-shadow:var(--shadow); }
.fcard .hd{ display:flex; align-items:baseline; gap:8px; }
.fcard b{ font-size:15px; font-weight:600; }
.fcard .sub{ font-size:12.5px; color:var(--muted); margin-top:3px; }
.fcard .foot{ margin-top:12px; padding-top:11px; border-top:1px solid var(--line-soft);
  font-size:12.5px; color:var(--muted); display:flex; justify-content:space-between; align-items:center; }
.warnrow{ background:var(--brand-wash); border:1px solid #EBD5D4; border-radius:8px;
  padding:9px 12px; font-size:13px; color:var(--brand); margin-bottom:14px; }

/* Cash Advance list rows. */
.carow{ display:flex; align-items:center; gap:14px; cursor:pointer;
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  padding:12px 16px; margin-bottom:10px; box-shadow:var(--shadow);
  transition:border-color .12s, box-shadow .12s; }
.carow:hover{ border-color:var(--brand); box-shadow:0 2px 8px rgba(0,0,0,.08); }
.camain{ flex:1 1 auto; min-width:0; }
.cahead{ display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
.cahead b{ font-size:14px; color:var(--ink); }
.cameta{ font-size:12.5px; color:var(--muted); margin-top:3px; }
.caamt{ flex:0 0 auto; text-align:right; }
.caamt b{ display:block; font-size:15px; color:var(--ink); }
.caamt span{ font-size:11px; letter-spacing:.03em; text-transform:uppercase; color:var(--muted); }
.req{ color:var(--brand); }

/* ── Whereabouts — what is out on a gate pass ─────────────────── */
/* .okrow is the calm "nothing pending" line used across the desks. */
.okrow{ background:var(--surface); border:1px solid var(--line-soft); border-radius:10px;
  padding:14px 16px; color:var(--muted); font-size:13.5px; }
.okrow.warn{ background:var(--brand-wash); border-color:#EBD5D4; color:var(--brand); }

.whrow{ display:flex; align-items:center; gap:14px; cursor:pointer;
  background:var(--surface); border:1px solid var(--line); border-radius:12px;
  padding:12px 16px; margin-bottom:10px; box-shadow:var(--shadow);
  transition:border-color .12s, box-shadow .12s; }
.whrow:hover{ border-color:var(--brand); box-shadow:0 2px 8px rgba(0,0,0,.08); }
.whmono{ flex:0 0 auto; width:40px; height:40px; border-radius:10px;
  background:var(--brand); color:#fff; font-weight:700; font-size:14px;
  display:flex; align-items:center; justify-content:center; }
.whmain{ flex:1 1 auto; min-width:0; }
.whtop{ display:flex; align-items:baseline; gap:10px; justify-content:space-between; }
.whname{ font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.whsince{ flex:0 0 auto; font-size:11.5px; color:var(--muted); font-variant-numeric:var(--figures); }
.whmeta{ font-size:12.5px; color:var(--muted); margin-top:2px; }
.whbits{ display:flex; flex-wrap:wrap; gap:6px; margin-top:7px; }
.whbits span{ font-size:11.5px; color:var(--ink); background:var(--paper);
  border:1px solid var(--line-soft); border-radius:6px; padding:2px 8px; }
.whside{ flex:0 0 auto; display:flex; flex-direction:column; align-items:flex-end; gap:8px; }
.whpill{ font-size:11px; font-weight:600; letter-spacing:.03em; text-transform:uppercase;
  padding:3px 9px; border-radius:999px; }
.whpill.out{ background:var(--brand-wash); color:var(--brand); border:1px solid #EBD5D4; }
.whpax{ display:flex; flex-wrap:wrap; gap:6px; }
.whpax span{ font-size:12.5px; color:var(--ink); background:var(--paper);
  border:1px solid var(--line-soft); border-radius:6px; padding:3px 9px; }
.whback{ display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  padding:10px 14px; border:1px solid var(--line-soft); border-radius:10px;
  background:var(--surface); margin-bottom:8px; font-size:13px; color:var(--ink); }
.whback b{ color:var(--brand); }
.whback .whsince{ margin-left:auto; }

/* ── Reports ──────────────────────────────────────────────────── */
.repctl{ display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; margin-bottom:22px; }
.repctl label{ display:flex; flex-direction:column; gap:5px; font-size:11.5px; font-weight:600;
  color:var(--muted); text-transform:uppercase; letter-spacing:.03em; }
.repctl select, .repctl input{ padding:8px 11px; border:1px solid var(--line); border-radius:8px;
  font-size:13.5px; background:var(--surface); color:var(--ink); font-family:inherit; min-width:150px; }
.repdates{ display:flex; gap:14px; }
.repsp{ flex:1 1 auto; }
.rephead{ margin-bottom:16px; }
.rephead h2{ margin:0; font-family:inherit; font-size:19px; color:var(--ink); }
.repsub{ font-size:12px; color:var(--muted); margin-top:4px; }
.rtblwrap{ overflow-x:auto; border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); }
.rtbl{ width:100%; border-collapse:collapse; font-size:13px; }
.rtbl th, .rtbl td{ padding:9px 13px; text-align:left; border-bottom:1px solid var(--line-soft); white-space:nowrap; }
.rtbl th{ background:var(--paper); color:var(--muted); font-weight:600; font-size:11px;
  text-transform:uppercase; letter-spacing:.03em; }
.rtbl td.r, .rtbl th.r{ text-align:right; font-variant-numeric:var(--figures); }
.rtbl tbody tr:last-child td{ border-bottom:none; }
.rtbl tbody tr:hover{ background:var(--paper); }

/* ── Print — show only the report, hide the app chrome ────────── */
@media print{
  .sidebar, .noprint, #overlay, .topbar .prbtns{ display:none !important; }
  .shell{ display:block !important; }
  .main{ max-width:none !important; padding:0 !important; margin:0 !important; }
  .rtblwrap{ border:none; box-shadow:none; overflow:visible; }
  .rtbl th{ background:#eee !important; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .bkpi{ break-inside:avoid; }
  .rtbl, .rtbl tr{ break-inside:avoid; }
  @page{ margin:14mm; }
}

/* Amber notice — used for a contract pending approval. */
.msg.warn{ display:block; background:#FBF3E3; color:#8A5A00; border:1px solid #EAD9B0; }

/* Report picker as buttons (replaces the dropdown) */
.repchips{ display:flex; flex-wrap:wrap; gap:16px 24px; margin-bottom:20px; }
.repgrp{ display:flex; flex-direction:column; gap:8px; }
.repgrplbl{ font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.repgrpchips{ display:flex; flex-wrap:wrap; gap:8px; }
.repchip{ padding:7px 14px; border:1px solid var(--line); border-radius:999px; background:var(--surface);
  color:var(--ink); font-size:13px; font-family:inherit; cursor:pointer; white-space:nowrap; transition:border-color .12s, background .12s, color .12s; }
.repchip:hover{ border-color:var(--brand); }
.repchip.on{ background:var(--brand); border-color:var(--brand); color:#fff; }

/* Report letterhead (logo + org details) — shows on screen and on print */
.rpthdr{ display:flex; align-items:center; gap:16px; padding-bottom:14px; margin-bottom:16px;
  border-bottom:2px solid var(--brand); }
.rpthdr-badge{ flex:0 0 auto; background:var(--brand); border-radius:10px; padding:10px 13px;
  display:flex; align-items:center; justify-content:center; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
.rpthdr-badge img{ height:42px; width:auto; display:block; }
.rpthdr-org{ flex:1 1 auto; min-width:0; }
.rpthdr-name{ font-family:inherit; font-size:20px; font-weight:700; color:var(--brand); letter-spacing:.01em; }
.rpthdr-sub{ font-size:12.5px; color:var(--ink); margin-top:1px; }
.rpthdr-lines{ font-size:11px; color:var(--muted); margin-top:6px; line-height:1.55; }
@media print{
  .rpthdr{ border-bottom:2px solid #7a1420; }
  .rpthdr-name{ color:#7a1420; }
}

/* ============================================================
   MOBILE / PHONE LAYOUT  —  the sidebar becomes a tap-open menu,
   stat grids stack, and wide tables scroll. Everything a role can
   see on desktop, it sees here too.
   ============================================================ */
.mtopbar{ display:none; }
.navscrim{ display:none; }

@media (max-width: 860px){
  /* Top app bar with the menu button (only on phones/tablets) */
  .mtopbar{ display:flex; align-items:center; gap:12px; position:sticky; top:0; z-index:140;
    background:var(--brand); color:#fff; padding:0 14px; height:54px; }
  .mtopbar .mburger{ background:none; border:0; color:#fff; font-size:26px; line-height:1;
    cursor:pointer; padding:6px 8px; margin-left:-4px; }
  .mtopbar .mtitle{ font-weight:700; letter-spacing:.02em; font-size:16px; }

  .shell{ grid-template-columns:1fr; min-height:100vh; }

  /* Sidebar slides in from the left as a drawer */
  .sidebar{ position:fixed; top:0; left:0; bottom:0; width:272px; max-width:86vw; z-index:160;
    transform:translateX(-100%); transition:transform .24s ease; overflow-y:auto; }
  .sidebar.open{ transform:translateX(0); box-shadow:0 0 44px rgba(0,0,0,.45); }
  .navscrim{ display:block; position:fixed; inset:0; background:rgba(0,0,0,.46); z-index:150;
    opacity:0; visibility:hidden; transition:opacity .2s; }
  .navscrim.show{ opacity:1; visibility:visible; }

  .main{ padding:18px 15px 72px; max-width:none; margin:0; }

  /* Stat / KPI grids stack two-up, then one-up on small phones */
  .cards, .bkpis{ grid-template-columns:1fr 1fr !important; gap:12px; }

  .topbar{ flex-wrap:wrap; }
  .topbar h2{ font-size:21px; }
  .topbar .actions{ width:100%; justify-content:flex-start; margin-top:4px; }

  /* Any wide table scrolls sideways inside its container instead of
     breaking the layout */
  .panel .body, .rtblwrap, .tablewrap{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  table{ font-size:12.5px; }

  /* Report picker + letterhead breathe a little tighter on a phone */
  .repchips{ gap:12px 16px; }
  .rpthdr{ gap:12px; }
  .rpthdr-badge img{ height:34px; }
  .rpthdr-name{ font-size:17px; }
}

@media (max-width: 540px){
  .cards, .bkpis{ grid-template-columns:1fr !important; }
  .main{ padding:16px 13px 72px; }
  .topbar h2{ font-size:20px; }
}

/* On a phone the menu and scrim are never printed */
@media print{ .mtopbar, .navscrim{ display:none !important; } }

/* Reports dropdown picker — compact on laptop, full-width on phone */
#repSel{ min-width:230px; }
@media (max-width: 860px){
  .repctl{ gap:12px; }
  .repctl > label.repsel{ width:100%; }
  #repSel{ width:100%; }
  .repdates{ width:100%; }
  .repdates label{ flex:1; }
  .repdates input{ width:100%; min-width:0; }
  .repsp{ display:none; }
}
