/* Online version: login, shelter portal, phone layout. Builds on style.css tokens. */
#adminApp, #shelter, #gate { display: none; }
.mode-admin #adminApp { display: grid; }
.mode-shelter #shelter { display: block; }
.mode-gate #gate { display: flex; }
body.mode-gate, body.mode-shelter { overflow: auto; }
.mode-admin .app { height: 100dvh; }
.top .menu, .back { display: none; }
.net { position: fixed; top: 0; left: 0; right: 0; z-index: 30; background: #4A1D1A; color: #FFD3CE; border-bottom: 1px solid var(--red); padding: 8px max(16px, env(safe-area-inset-left)); font: 600 13px var(--display); letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.top { padding-top: env(safe-area-inset-top); height: auto; min-height: 56px; }
.app { grid-template-rows: auto minmax(0, 1fr); }

/* ---------- gate ---------- */
.gate { min-height: 100dvh; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 28px max(16px, env(safe-area-inset-left)) 28px max(16px, env(safe-area-inset-right));
  background: var(--bg) repeating-linear-gradient(0deg, transparent 0 31px, rgba(76,155,232,.05) 31px 32px), repeating-linear-gradient(90deg, transparent 0 31px, rgba(76,155,232,.05) 31px 32px); }
.g-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line2); border-radius: 4px; padding: 26px 26px 22px; position: relative; display: flex; flex-direction: column; gap: 14px; }
.g-card::before, .g-card::after { content: ""; position: absolute; width: 14px; height: 14px; border-color: var(--blue-d); border-style: solid; }
.g-card::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.g-card::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.g-mark { display: flex; align-items: center; gap: 10px; color: var(--blue); }
.g-mark svg { width: 36px; height: 36px; }
.g-mark b { display: block; font: 700 22px/1 var(--display); letter-spacing: .14em; color: var(--ink); }
.g-mark span { display: block; font: 500 10.5px/1.4 var(--mono); letter-spacing: .32em; color: var(--blue); }
.g-card h1 { margin: 6px 0 0; font: 700 26px/1.05 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.g-sub { margin: -4px 0 0; color: var(--dim); }
.g-card form { display: flex; flex-direction: column; gap: 12px; }
.g-card .field input { width: 100%; font-size: 16px; padding: 10px 11px; }
.g-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-go { justify-content: center; padding: 11px 14px; font-size: 15px; }
.g-err { color: var(--red); font-weight: 600; min-height: 0; }
.g-err:empty { display: none; }
.g-ok { color: var(--green); border: 1px solid rgba(71,209,138,.4); background: rgba(71,209,138,.08); padding: 8px 10px; border-radius: 3px; }
.g-alt { color: var(--dim); text-align: center; }
.g-alt a, .g-note a { color: var(--blue); }
.g-note { color: var(--faint); font-size: 12px; margin: 0; border-top: 1px dashed var(--line2); padding-top: 10px; }
.g-who { background: var(--bg2); border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; display: flex; flex-direction: column; }
.g-who span { color: var(--dim); font: 12px var(--mono); }
.g-foot { color: var(--faint); font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; margin: 0; }

/* ---------- admin additions ---------- */
.linked { border: 1px solid rgba(168,149,255,.5); background: rgba(168,149,255,.08); border-left: 4px solid var(--violet); border-radius: 3px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.linked b { font: 700 16px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--violet); }
.linked span { color: var(--dim); flex: 1; min-width: 160px; }
.mlist, .slist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mlist li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "ph body sc" "ph act act"; gap: 6px 12px; padding: 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg2); }
.mlist li.sus { border-color: var(--violet); }
.m-ph { grid-area: ph; width: 56px; height: 56px; border-radius: 3px; background: var(--panel2); overflow: hidden; }
.m-ph img, .s-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-body { grid-area: body; display: flex; flex-direction: column; min-width: 0; }
.m-body span { color: var(--dim); font-size: 12.5px; }
.m-body small { color: var(--violet); font-size: 12px; }
.m-sc { grid-area: sc; text-align: right; }
.m-sc b { display: block; font: 700 24px/1 var(--display); color: var(--violet); }
.m-sc span { font: 500 10px var(--mono); color: var(--faint); letter-spacing: .1em; text-transform: uppercase; }
.m-act { grid-area: act; display: flex; gap: 8px; justify-content: flex-end; }
.srow { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; background: var(--bg2); border: 1px solid var(--line); border-radius: 3px; padding: 9px 11px; }
.srow:hover { border-color: var(--violet); }
.srow span { color: var(--dim); font-size: 12.5px; }
.copyrow { display: flex; gap: 8px; }
.copyrow input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line2); border-radius: 3px; padding: 7px 9px; font: 12px var(--mono); color: var(--dim); }
.acct-g { display: flex; flex-direction: column; gap: 8px; }
.acct-g h3 { margin: 6px 0 0; }
.acct { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr); gap: 8px 16px; padding: 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg2); }
.acct.me { opacity: .7; }
.a-who { display: flex; flex-direction: column; min-width: 0; }
.a-who span { color: var(--dim); font-size: 12.5px; }
.a-who small { color: var(--faint); font-size: 11px; overflow-wrap: anywhere; }
.a-ctl, .a-pw { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.a-pw { grid-column: 2; }
.a-ctl input, .a-pw input, .a-ctl select { background: var(--bg); border: 1px solid var(--line2); border-radius: 3px; padding: 6px 8px; min-width: 0; flex: 1; }

/* ---------- shelter portal ---------- */
.shelter { min-height: 100dvh; background: var(--bg); }
.s-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: var(--bg2); border-bottom: 1px solid var(--line); }
.s-top .mark { width: auto; }
.s-top .mark span { letter-spacing: .22em; }
.s-org { flex: 1; min-width: 0; text-align: right; font: 600 14px var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-tabs { display: flex; gap: 6px; align-items: center; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); max-width: 1240px; margin: 0 auto; flex-wrap: wrap; }
.s-tabs .grow { flex: 1; }
.s-tabs [data-stab] { background: transparent; border: 1px solid transparent; border-radius: 3px; padding: 7px 12px; font: 700 15px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.s-tabs [data-stab][aria-current="true"] { color: var(--ink); border-color: var(--line2); background: var(--panel); box-shadow: inset 0 -2px 0 var(--blue); }
.s-tabs [data-stab] b { font: 600 12px var(--mono); color: var(--blue); margin-left: 4px; }
.s-main { max-width: 1240px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 14px; }
.s-intro { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 3px; padding: 11px 14px; color: var(--dim); }
.s-intro b { color: var(--ink); }
.s-filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.s-filter .seg { flex: none; }
.s-filter input[type=search] { flex: 1; min-width: 200px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 3px; padding: 8px 10px; font-size: 15px; }
.s-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.s-card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; }
.s-ph { aspect-ratio: 4 / 3; max-width: 100%; background: var(--bg2) repeating-linear-gradient(45deg, transparent 0 8px, rgba(255,255,255,.02) 8px 16px); display: flex; align-items: center; justify-content: center; color: var(--faint); font: 600 11px var(--display); letter-spacing: .12em; overflow: hidden; }
.s-ph.none { aspect-ratio: auto; height: 40px; }
.s-ph.sm { width: 96px; height: 96px; aspect-ratio: auto; border-radius: 3px; flex: none; }
.s-ph.xs { width: 40px; height: 40px; aspect-ratio: auto; border-radius: 3px; flex: none; display: inline-flex; }
.s-cb { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.s-cb h3, .s-rb h3 { margin: 0; font: 700 21px/1.1 var(--display); letter-spacing: .02em; }
.s-cb h3 small { font: 500 13px var(--body); color: var(--dim); letter-spacing: 0; }
.s-cb p, .s-rb p { margin: 0; }
.s-cb .dim, .s-rb .dim { color: var(--dim); font-size: 13px; }
.s-cno { font-size: 11px; color: var(--blue); letter-spacing: .08em; }
.s-area { font-weight: 700; margin-top: 4px !important; }
.s-when { color: var(--amber); font: 600 12.5px var(--mono); }
.s-when span { color: var(--faint); }
.s-cb .btn { margin-top: auto; justify-content: center; }
.s-cb .s-when + .btn { margin-top: 10px; }
.s-list { display: flex; flex-direction: column; gap: 12px; }
.s-rep { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px; }
.s-rb { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.s-msg { background: rgba(76,155,232,.08); border: 1px solid rgba(76,155,232,.35); border-radius: 3px; padding: 8px 10px; white-space: pre-wrap; }
.s-msg b { display: block; font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--blue); margin-bottom: 2px; }
.s-ra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.s-ra select { background: var(--bg); border: 1px solid var(--line2); border-radius: 3px; padding: 6px 8px; }
.s-sugg { display: flex; flex-direction: column; gap: 6px; }
.s-sugg button { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--bg2); border: 1px solid var(--line2); border-radius: 3px; padding: 6px 10px; }
.s-sugg button:hover { border-color: var(--violet); }
.s-sugg span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.s-sugg small { color: var(--dim); }
.s-sugg em { font: 600 12px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--violet); font-style: normal; }
.shelter .empty { background: var(--panel); border: 1px dashed var(--line2); border-radius: 4px; }

/* ---------- phones and small tablets ---------- */
@media (max-width: 900px) {
  .mode-admin .app { grid-template-columns: minmax(0, 1fr); }
  .top { gap: 8px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .top .menu { display: inline-flex; flex-direction: column; gap: 4px; padding: 10px 8px; }
  .top .menu span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 1px; }
  .mark { width: auto; }
  .mark > div { display: none; }
  .clock, #importBtn, .top kbd, .search kbd, #newBtn em { display: none; }
  .search { min-width: 0; }
  .search input { font-size: 16px; padding-right: 10px; }
  #newBtn { padding: 8px 12px; }
  #newBtn span { font-size: 20px; }
  .rail { position: fixed; z-index: 15; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); padding-top: calc(16px + env(safe-area-inset-top)); transform: translateX(-102%); transition: transform .18s ease; box-shadow: 10px 0 40px rgba(0,0,0,.5); }
  .rail-open .rail { transform: none; }
  .rail-open::after { content: ""; position: fixed; inset: 0; background: rgba(3,6,10,.55); z-index: 14; }
  .rail button { padding: 10px 8px; font-size: 15px; }
  .listcol, .detail { grid-column: 1; grid-row: 2; }
  .listcol { border-right: 0; }
  .detail { display: none; }
  .show-detail .detail { display: block; }
  .show-detail .listcol { display: none; }
  .item { padding: 13px 14px 13px 16px; }
  .back { display: inline-flex; align-self: flex-start; padding-left: 0; }
  .detail-inner { padding: 12px max(14px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); gap: 14px; }
  .case-head { flex-direction: column; gap: 10px; }
  .case-head h1 { font-size: 25px; }
  .case-actions { justify-content: flex-start; }
  .case-actions .btn { padding: 9px 12px; }
  .facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pet { grid-template-columns: minmax(0, 1fr); }
  .pet .ph { max-width: 220px; }
  .tl li { grid-template-columns: 74px 16px minmax(0, 1fr); }
  .tl li::after { left: 91px; }
  .tl .rm { opacity: 1; }
  .kinds button { padding: 8px 10px; }
  .ctl select, .ctl input, .logbox textarea, .field input, .field select, .field textarea { font-size: 16px; }
  .overlay { padding: 0; }
  .modal, .modal.wide { max-width: none; min-height: 100dvh; border-radius: 0; border: 0; }
  .modal > header { position: sticky; top: 0; z-index: 2; background: var(--panel); padding-top: calc(12px + env(safe-area-inset-top)); }
  .modal footer { position: sticky; bottom: 0; background: var(--panel); padding-bottom: calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal .body { padding: 14px; }
  .fs { grid-template-columns: minmax(0, 1fr) !important; }
  .field.s2, .field.s3 { grid-column: auto; }
  .reasons { grid-template-columns: minmax(0, 1fr); }
  .studio { grid-template-columns: minmax(0, 1fr); }
  .studio .controls { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage { max-height: none; height: 62vh; padding: 12px; }
  .imp-in { grid-template-columns: minmax(0, 1fr); }
  .imp-row { grid-template-columns: 1fr 1fr; }
  .imp-h { display: none; }
  .acct { grid-template-columns: minmax(0, 1fr); }
  .a-pw { grid-column: 1; }
  .mlist li { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .m-ph { width: 48px; height: 48px; }
  .s-top .mark > div { display: block; }
  .s-org { font-size: 12px; }
  .s-tabs .btn.primary { width: 100%; justify-content: center; order: 3; }
  .s-tabs .grow { display: none; }
  .s-rep { flex-direction: column; }
  .s-ph.sm { width: 100%; height: auto; aspect-ratio: 4 / 3; }
  .s-ph.sm.none { aspect-ratio: auto; height: 40px; }
  .s-grid { grid-template-columns: minmax(0, 1fr); }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
  .s-top .mark svg { width: 26px; height: 26px; }
}

/* ---------- messages ---------- */
.msgpane { display: none; }
.show-msgs .listcol, .show-msgs .detail { display: none !important; }
.show-msgs .msgpane { display: block; grid-column: 2 / -1; grid-row: 2; min-height: 0; overflow: hidden; }
.msg-wrap { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100%; min-height: 0; }
.msg-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.msg-sh { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.msg-sh b { font: 700 18px var(--display); letter-spacing: .06em; text-transform: uppercase; }
.msg-note { margin: 0; padding: 8px 14px; font-size: 11.5px; color: var(--faint); border-bottom: 1px solid var(--line); }
.msg-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.msg-item { display: grid; gap: 2px; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 11px 40px 11px 14px; position: relative; }
.msg-item:hover { background: var(--bg2); }
.msg-item.on { background: var(--panel); box-shadow: inset 3px 0 0 var(--blue); }
.mi-top { display: flex; gap: 8px; align-items: baseline; }
.mi-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-top time { font: 11px var(--mono); color: var(--faint); }
.mi-who { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-who i { font: 600 10px var(--display); letter-spacing: .1em; font-style: normal; padding: 1px 5px; border: 1px solid var(--line2); border-radius: 3px; margin-right: 5px; }
.mi-pub { color: var(--green); border-color: rgba(71,209,138,.45) !important; }
.mi-ov { color: var(--amber); border-color: rgba(242,169,59,.45) !important; }
.mi-an { color: var(--violet); border-color: rgba(168,149,255,.45) !important; }
.mi-last { font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-item.unread .mi-top b, .msg-item.unread .mi-last { color: var(--ink); }
.mi-badge { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--blue-d); color: #fff; font: 600 11px/20px var(--mono); text-align: center; }
.msg-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.mt-h { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.mt-back { display: none; padding-left: 0; }
.mt-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mt-t b { font: 700 18px/1.15 var(--display); letter-spacing: .03em; }
.mt-t span { color: var(--dim); font-size: 12.5px; }
.mt-an { cursor: pointer; }
.mt-ov { padding: 7px 16px; font-size: 12px; color: var(--amber); background: rgba(242,169,59,.07); border-bottom: 1px solid var(--line); }
.mt-list { flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.mt-day { align-self: center; font: 500 11px var(--mono); color: var(--faint); letter-spacing: .1em; text-transform: uppercase; margin: 6px 0; }
.mt-m { max-width: min(560px, 82%); align-self: flex-start; display: flex; flex-direction: column; gap: 3px; }
.mt-m.me { align-self: flex-end; align-items: flex-end; }
.mt-from { font-size: 11.5px; color: var(--faint); }
.mt-from time { font-family: var(--mono); }
.mt-b { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px 12px 12px 12px; padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mt-m.me .mt-b { background: rgba(46,117,182,.22); border-color: rgba(76,155,232,.45); border-radius: 12px 4px 12px 12px; }
.mt-form { display: flex; gap: 8px; padding: 10px 16px 4px; border-top: 1px solid var(--line); background: var(--bg2); }
.mt-form textarea { flex: 1; min-height: 44px; max-height: 160px; resize: vertical; background: var(--bg); border: 1px solid var(--line2); border-radius: 3px; padding: 9px 10px; outline: none; }
.mt-form textarea:focus { border-color: var(--blue); }
.mt-hint { padding: 0 16px 8px; font-size: 11px; color: var(--faint); background: var(--bg2); }
.msg-empty { margin: auto; max-width: 380px; }
.mc { padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.mc .field input, .mc .field textarea { width: 100%; }
.mc-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 3px; padding: 6px; background: var(--bg2); }
.mc-row { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 3px; cursor: pointer; }
.mc-row:hover { background: var(--panel); }
.mc-row input { accent-color: var(--blue-d); width: 18px; height: 18px; }
.mc-row span { display: flex; flex-direction: column; }
.mc-row small { color: var(--dim); }
.mc-go { display: flex; gap: 8px; justify-content: flex-end; }
.s-tabs b.hot { color: #fff; background: var(--blue-d); border-radius: 9px; padding: 0 6px; }
.s-tabs b.hot:empty { display: none; }
.s-msgs .s-main { height: calc(100dvh - 118px); padding-bottom: 0; }
.s-msgs .s-main .msg-wrap { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg); }

/* network cards */
.s-card.own { border-color: rgba(76,155,232,.45); }
.s-at { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line2); font-size: 13px; }
.s-at b { width: 100%; }
.s-at span { color: var(--dim); }
.s-notes { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.s-btns { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 10px; }
.s-btns .btn, .s-cb > .btn:last-child { justify-content: center; margin-top: 10px; }
.s-filter select { background: var(--bg2); border: 1px solid var(--line2); border-radius: 3px; padding: 8px 10px; }

@media (max-width: 900px) {
  .show-msgs .msgpane { grid-column: 1; }
  .msg-wrap { grid-template-columns: minmax(0, 1fr); }
  .msg-wrap.has-thread .msg-side { display: none; }
  .msg-wrap:not(.has-thread) .msg-main { display: none; }
  .mt-back { display: inline-flex; }
  .mt-m { max-width: 88%; }
  .mt-form textarea { font-size: 16px; }
  .mt-hint { display: none; }
  .s-msgs .s-main { height: calc(100dvh - 160px); padding: 0; }
  .s-msgs .s-main .msg-wrap { border: 0; border-radius: 0; }
  .s-tabs { gap: 2px; }
  .s-tabs [data-stab] { padding: 7px 8px; font-size: 13px; }
  .mc-list { max-height: 40vh; }
}

/* brand */
.mark img.mk { width: 36px; height: 36px; border-radius: 50%; flex: none; display: block; }
.g-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.g-logo { width: 150px; height: auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.5)); }
.g-name b { display: block; font: 700 24px/1 var(--display); letter-spacing: .2em; color: var(--ink); }
.g-name span { display: block; font: 600 13px/1.6 var(--mono); letter-spacing: .5em; color: var(--blue); padding-left: .5em; }
.g-tag { margin: 2px 0 0; font-size: 12.5px; color: var(--dim); }
@media (max-width: 900px) { .g-logo { width: 120px; } .top .mark img.mk { width: 32px; height: 32px; } }

.s-filter .check { flex: none; gap: 6px; }
.s-filter .check input { width: 16px; height: 16px; }
@media (max-width: 900px) {
  .mt-h { flex-wrap: wrap; gap: 6px 10px; }
  .mt-t b { font-size: 16px; }
  .mt-an { order: 3; flex-basis: 100%; text-align: left; }
  .s-filter .check { flex-basis: 100%; }
}

.s-alert { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; background: var(--panel); border: 1px solid var(--line2); border-left: 3px solid var(--amber); border-radius: 3px; padding: 10px 14px; }
.s-alert.hot { border-left-color: var(--red); background: rgba(255,92,80,.08); }
.s-alert b { color: var(--ink); }
.s-county { display: block; font: 500 11.5px var(--mono); color: var(--dim); font-weight: 500; }
.s-cno .tag { margin-left: 6px; vertical-align: 1px; }
.gal { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.gthumb { width: 46px; height: 46px; padding: 0; border: 1px solid var(--line2); border-radius: 3px; overflow: hidden; background: var(--bg2); }
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-lost { justify-content: center; background: rgba(255,92,80,.1); border-color: rgba(255,92,80,.5); color: #FF9A90; }
.pet .gal { grid-column: 1; }
.case-head { flex-wrap: wrap; }
.case-head .ttl { flex: 1 1 420px; }
.g-lost { text-decoration: none; }

/* ---------- menus (revamp) ---------- */
.msgbtn { gap: 6px; position: relative; }
.msgbtn svg { width: 18px; height: 18px; }
.msgbtn[aria-current="true"] { border-color: var(--blue); color: var(--blue); }
.badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font: 600 11px/18px var(--mono); text-align: center; letter-spacing: 0; }
.badge:empty { display: none; }
.rail button[title] .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .ct.hot { color: var(--red); font-weight: 700; }
.listhead { flex-wrap: wrap; }
.listhead select { max-width: 150px; }
.rep-list { gap: 10px; }
.rep { display: flex; flex-direction: column; gap: 4px; text-align: left; background: var(--bg2); border: 1px solid var(--line2); border-radius: 4px; padding: 14px 16px; }
.rep:hover { border-color: var(--blue); }
.rep b { font: 700 17px var(--display); letter-spacing: .06em; text-transform: uppercase; }
.rep span { color: var(--dim); }
/* shelter layout */
.s-top { gap: 12px; }
.s-top .menu { display: none; }
.s-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
.s-rail { position: sticky; top: 58px; height: calc(100dvh - 58px); border-right: 1px solid var(--line); }
.s-add { width: 100%; justify-content: center; margin-top: 10px; }
.s-msgs .s-main { height: calc(100dvh - 60px); max-width: none; padding: 0; }
.s-msgs .s-main .msg-wrap { border: 0; border-radius: 0; }
.s-main { max-width: none; }
/* network pages */
.np { height: 100%; overflow: auto; padding: 18px max(16px, 2vw) 40px; display: flex; flex-direction: column; gap: 14px; max-width: 1240px; }
.mode-shelter .np { height: auto; overflow: visible; padding: 0; }
.np-h { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.np-h h1 { margin: 0; font: 700 28px/1.05 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.np-sub { margin: 4px 0 0; color: var(--dim); max-width: 640px; }
.np-act { display: flex; gap: 8px; }
.np-form { background: var(--panel); border: 1px solid var(--line2); border-left: 3px solid var(--blue); border-radius: 4px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.np-form .fs { border: 0; padding: 0; }
.np-form .field input, .np-form .field select, .np-form .field textarea { width: 100%; }
.np-fa { display: flex; gap: 8px; justify-content: flex-end; }
.np-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.np-tools input[type=search] { flex: 1; min-width: 200px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 3px; padding: 8px 10px; }
.np-tools select { background: var(--bg2); border: 1px solid var(--line2); border-radius: 3px; padding: 8px 10px; }
.np-count { color: var(--faint); font: 12px var(--mono); }
.np-sec { margin: 6px 0 0; font: 600 13px var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.np-thumbs { display: flex; gap: 6px; }
.np-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 3px; }
.ag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ag { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.ag.me { border-color: rgba(76,155,232,.5); }
.ag-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ag-h b { font: 700 19px/1.15 var(--display); letter-spacing: .02em; }
.ag-area { color: var(--blue); font: 500 12px var(--mono); }
.ag dl { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 4px 10px; margin: 0; font-size: 13.5px; }
.ag dt { color: var(--faint); font: 600 11px var(--display); letter-spacing: .1em; text-transform: uppercase; padding-top: 2px; }
.ag dd { margin: 0; overflow-wrap: anywhere; }
.ag a, .vol a { color: var(--blue); text-decoration: none; }
.ag-about { margin: 0; color: var(--dim); white-space: pre-wrap; }
.ag .btn { align-self: flex-start; margin-top: auto; }
.vol-list, .doc-list, .post-list, .ev-list { display: flex; flex-direction: column; gap: 8px; list-style: none; margin: 0; padding: 0; }
.vol { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.4fr) auto; gap: 8px 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px; }
.vol.off { opacity: .6; }
.vol-who, .vol-c, .vol-s { display: flex; flex-direction: column; min-width: 0; }
.vol-who span, .vol-s small { color: var(--dim); font-size: 12.5px; }
.vol-who small { color: var(--blue); font-size: 12px; }
.vol-a { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.doc-list li { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; }
.doc-ic { width: 46px; height: 54px; flex: none; border: 1.5px solid var(--line2); border-radius: 3px 10px 3px 3px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font: 700 11px var(--mono); color: var(--blue); }
.doc-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.doc-b b { font-size: 15px; }
.doc-b p { margin: 0; color: var(--dim); }
.doc-b small { color: var(--faint); }
.doc-a { display: flex; gap: 6px; }
.post { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.post.ev { border-left: 3px solid var(--violet); }
.post-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.post-h span:not(.tag) { color: var(--faint); }
.post-h .btn { margin-left: auto; }
.post h3 { margin: 0; font: 700 21px/1.15 var(--display); }
.post-b { margin: 0; white-space: pre-wrap; }
.ev-box { display: flex; gap: 12px; align-items: center; background: var(--bg2); border: 1px solid var(--line2); border-radius: 4px; padding: 8px 12px; }
.ev-d { display: flex; flex-direction: column; align-items: center; min-width: 46px; border-right: 1px solid var(--line2); padding-right: 12px; }
.ev-d b { font: 700 12px var(--display); letter-spacing: .14em; color: var(--violet); }
.ev-d span { font: 700 26px/1 var(--display); }
.post-ph { display: grid; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; }
.post-ph.n1 { grid-template-columns: minmax(0, 1fr); }
.post-ph div { aspect-ratio: 4 / 3; background: var(--bg2); border-radius: 3px; overflow: hidden; max-width: 100%; }
.post-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 900px) {
  .msgbtn em { display: none; }
  .s-top .menu { display: inline-flex; flex-direction: column; gap: 4px; padding: 10px 8px; }
  .s-top .menu span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 1px; }
  .s-top .mark > div { display: none; }
  .s-body { grid-template-columns: minmax(0, 1fr); }
  .s-rail { height: auto; }
  .s-msgs .s-main { height: calc(100dvh - 58px); }
  .np { padding: 14px max(14px, env(safe-area-inset-left)) 40px; }
  .mode-shelter .np { padding: 0; }
  .np-h h1 { font-size: 23px; }
  .vol { grid-template-columns: minmax(0, 1fr); }
  .vol-a { justify-content: flex-start; }
  .doc-list li { flex-wrap: wrap; }
  .listhead select { max-width: 46%; }
}
@media (max-width: 900px) { .s-rail { position: fixed; top: 0; height: auto; border-right: 0; } }
.np-tools .seg { flex-wrap: wrap; max-width: 100%; }
.np-tools .seg button { flex: 0 1 auto; }
.s-main, .np, .s-body > * { min-width: 0; }
.post-ph.n1 { max-width: 420px; }
.s-ref{text-decoration:none;margin-top:6px}
/* case photo viewer */
.pet .ph.viewer { position: relative; border-style: solid; }
.ph.viewer img { user-select: none; -webkit-user-drag: none; }
.phnav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 44px; border: 0; border-radius: 3px; background: rgba(5, 8, 12, .6); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.phnav:hover { background: rgba(5, 8, 12, .85); }
.phnav.prev { left: 6px; } .phnav.next { right: 6px; }
.phcount, .phmain { position: absolute; bottom: 6px; padding: 3px 7px; border-radius: 3px; font: 600 11px var(--display); letter-spacing: .1em; color: #fff; background: rgba(5, 8, 12, .7); }
.phcount { right: 6px; } .phmain { left: 6px; background: var(--blue); }
.gal { align-items: center; }
.gthumb { cursor: pointer; position: relative; }
.gthumb.on { outline: 2px solid var(--blue); outline-offset: 1px; }
.gthumb.main::after { content: "★"; position: absolute; top: 1px; left: 3px; font-size: 11px; color: #FFD23F; text-shadow: 0 0 3px #000; }
.gal .btn, .gal .phnote { flex-basis: 100%; }
.gal .btn { justify-content: center; margin-top: 2px; }
.phnote { font-size: 12px; color: var(--faint); }
/* flyer photo controls */
.flpics { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.flpics .gthumb { width: 54px; height: 54px; }
.flzoom { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.flzoom span { font-size: 12px; color: var(--muted, var(--faint)); }
.flzoom input { flex: 1; }
/* info pages: photo fills the top of the panel, details below */
.pet, .pet { grid-template-columns: minmax(0, 1fr); }
.pet .ph, .pet .ph.viewer { width: 100%; max-width: none; aspect-ratio: 4 / 3; max-height: 460px; background: #05080C; }
.pet .ph img { object-fit: contain; }
.pet .gal { grid-column: 1; margin-top: -6px; }
.pet .gal .gthumb { width: 56px; height: 56px; }
.pet .gal .btn, .pet .gal .phnote { flex-basis: auto; margin-left: auto; }
.phnav { width: 40px; height: 56px; font-size: 30px; }
@media (max-width: 900px) { .pet .ph, .pet .ph.viewer { max-width: none; max-height: 360px; } }
.ph.viewer img { cursor: zoom-in; }
/* shelter pages fill the space beside the menu (margin:auto made grid items shrink to their content) */
.s-body > .s-main { margin: 0; width: 100%; justify-self: stretch; }

/* volunteer AP numbers, notes, order (Nov19-13) */
.vol-id{display:inline-block;margin-right:8px;padding:1px 8px;border:1px solid var(--blue);border-radius:99px;color:var(--blue);font:600 12px var(--mono, monospace);letter-spacing:.04em;vertical-align:1px}
.vol-who b .vol-id{color:var(--blue);font-size:12px}
.vol-s .vol-notes{display:block;margin-top:4px;white-space:pre-wrap}
.vol-s .vol-notes b{color:var(--ink)}
.vol-mv{min-width:36px;padding:0 8px;justify-content:center}

/* ===== Nov22-3: layout and flow fixes ===== */
#importBtn { display: none !important; }                 /* Import lives under Admin and more (Ctrl I still works) */
/* case card: one title row, one action row, one tools box */
.ttl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prio-chip { white-space: nowrap; }
.act-row { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 8px; margin: 12px 0; }
.act-row .btn { min-height: 44px; width: 100%; justify-content: center; text-align: center; }
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tools-grid .btn { min-height: 44px; width: 100%; justify-content: center; text-align: center; }
.danger-t { color: var(--red) !important; border-color: rgba(255,92,80,.45) !important; }
.hud-b.pet .ph, .hud-b.pet .ph.viewer { max-height: 240px !important; }
/* Inbox and pages inside Beacon */
.show-msgs .msgpane.has-tabs, .show-msgs .msgpane.pg-mode { display: flex; flex-direction: column; }
.inbox-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg2); flex: none; }
.inbox-tabs button { min-height: 44px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel); color: var(--dim); font: 600 15px/1 var(--body); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.inbox-tabs button[aria-pressed="true"] { color: #fff; border-color: var(--blue); background: var(--panel2); }
.inbox-tabs .ib-n { font: 600 12px/1 var(--mono); background: var(--red); color: #fff; border-radius: 999px; padding: 3px 7px; }
.msgbody { flex: 1; min-height: 0; overflow: auto; }
.pgframe { flex: 1; width: 100%; min-height: 0; border: 0; display: block; background: var(--bg); }
/* left menu: Admin and more folds away */
.rail-more > summary { list-style: none; cursor: pointer; padding: 10px 12px; color: var(--dim); font: 600 12px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
.rail-more > summary::-webkit-details-marker { display: none; }
.rail-more > summary::after { content: "+"; font: 600 16px/1 var(--mono); }
.rail-more[open] > summary::after { content: "\2212"; }
/* pilot status: Limited / Off duty ask for a reason */
.fs-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fs-btns .btn { min-height: 44px; justify-content: center; }
@media (max-width: 640px) {
  .act-row { grid-template-columns: 1fr 1fr; }
  .tools-grid { grid-template-columns: 1fr 1fr; }
}
/* Pilot status (Nov22-12): one button + a short list */
.rail .fsw { padding: 10px; }
.rail .fsw h4 { margin: 0 2px 8px; }
.fsw-pill { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg2); color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.fsw-pill i, .fsw-opt i { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--grey); }
.fsw-pill span { flex: 1; min-width: 0; }
.fsw-pill b { display: block; font: 700 18px/1.05 var(--display); letter-spacing: .03em; }
.fsw-pill small, .fsw-opt small { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; }
.fsw-pill em { font: 600 12px/1 var(--body); font-style: normal; color: var(--dim); white-space: nowrap; }
.fsw-pill:hover em { color: var(--ink); }
.fsw.available .fsw-pill { border: 1px solid rgba(71,209,138,.55) !important; background: rgba(71,209,138,.08); } .fsw.available .fsw-pill b { color: var(--green); } .fsw.available .fsw-pill i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.fsw.limited .fsw-pill { border: 1px solid rgba(242,169,59,.55) !important; background: rgba(242,169,59,.08); } .fsw.limited .fsw-pill b { color: var(--amber); } .fsw.limited .fsw-pill i { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.fsw.unavailable .fsw-pill { border: 1px solid rgba(255,92,80,.55) !important; background: rgba(255,92,80,.08); } .fsw.unavailable .fsw-pill b { color: var(--red); } .fsw.unavailable .fsw-pill i { background: var(--red); box-shadow: 0 0 8px var(--red); }
.fsw-list { margin-top: 8px; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: var(--panel2); }
.fsw-opt { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; font: 14px/1.2 var(--body); cursor: pointer; min-height: 44px; }
.fsw-opt:last-child { border-bottom: 0; }
.fsw-opt:hover { background: var(--panel); }
.fsw-opt.available i { background: var(--green); } .fsw-opt.limited i { background: var(--amber); } .fsw-opt.unavailable i { background: var(--red); }
.fsw-opt[aria-selected=true] { background: rgba(76,155,232,.10); }
.fsw-opt[aria-selected=true]::after { content: "\2713"; margin-left: auto; color: var(--blue); font-weight: 700; }
.case-head2 .ttl { flex: 1 1 auto; }
