/* Matter Tracking Register — mobile-first responsive styles */
:root {
  --navy: #1f3a5f;
  --navy-d: #16283f;
  --ink: #1a2230;
  --muted: #61708a;
  --line: #dbe2ec;
  --bg: #eef2f7;
  --card: #ffffff;
  --accent: #2f6fed;
  --ok: #1f9d55;
  --warn: #d9822b;
  --hold: #b58a00;
  --stop: #b23b3b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 32, 60, .08), 0 1px 2px rgba(16, 32, 60, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: var(--navy); color: #fff;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: #fff; color: var(--navy); font-weight: 800; font-size: 14px;
}
.brand-name { font-weight: 700; letter-spacing: .2px; }
.topnav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topnav a { color: #d7e2f4; font-weight: 600; }
.topnav a:hover { color: #fff; text-decoration: none; }
.topnav .who { color: #9fb3d1; font-size: 13px; }
.topnav .logout { color: #ffd3d3; }

/* ---- layout ---- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 16px; }
.foot { text-align: center; color: var(--muted); padding: 24px 16px; font-size: 13px; }

.flash {
  background: #e7f4ec; border: 1px solid #b7e0c6; color: #1c6b3f;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 14px;
}

/* ---- toolbar ---- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 14px;
}
.toolbar .grow { flex: 1 1 220px; }
.pagetitle { font-size: 20px; font-weight: 800; margin: 0 0 12px; }

/* ---- controls ---- */
input, select, textarea, .btn {
  font: inherit;
}
input[type=text], input[type=search], input[type=email], input[type=password],
input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 84px; }
label { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin: 0 0 5px; }
.field { margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-weight: 700; cursor: pointer;
  min-height: 44px; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(.96); }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.ok { background: var(--ok); }
.btn.block { width: 100%; }

/* ---- cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}

/* ---- status badge ---- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .3px; color: #fff;
  background: var(--muted);
}
.badge.open { background: var(--ok); }
.badge.on-hold { background: var(--hold); }
.badge.completed { background: var(--navy); }
.badge.abandoned { background: var(--stop); }

/* ---- register table (desktop) ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.grid {
  width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
table.grid th, table.grid td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.grid th {
  background: #f4f7fb; font-size: 12px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted);
}
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: #f8fafd; }
.id-cell { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); }
.muted { color: var(--muted); }
.clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- responsive: collapse table into cards on phones/tablets ---- */
@media (max-width: 780px) {
  table.grid, table.grid thead, table.grid tbody,
  table.grid th, table.grid td, table.grid tr { display: block; }
  table.grid thead { display: none; }
  table.grid { border: 0; background: transparent; }
  table.grid tr {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 12px; padding: 6px 4px;
  }
  table.grid td {
    border: 0; padding: 8px 14px; display: flex; justify-content: space-between; gap: 12px;
  }
  table.grid td::before {
    content: attr(data-label); font-weight: 700; color: var(--muted);
    font-size: 12px; text-transform: uppercase; letter-spacing: .3px; flex: 0 0 42%;
  }
  .clip { max-width: none; white-space: normal; text-align: right; }
}

/* ---- form grid ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---- login ---- */
.login-shell { min-height: 70vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; }

/* ---- development history ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  padding: 10px 0 10px 16px; border-left: 2px solid var(--line);
  position: relative; margin-left: 4px;
}
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 16px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
}
.timeline .date { font-weight: 700; color: var(--navy); font-size: 13px; }

/* print */
@media print {
  .topbar, .foot, .toolbar, .actions, .btn { display: none !important; }
  body { background: #fff; }
  .card, table.grid { box-shadow: none; }
}

/* ============================================================= */
/*  MODERN / 3D REFRESH                                          */
/* ============================================================= */
:root {
  --grad-accent: linear-gradient(180deg, #4a86ff 0%, #2f6fed 100%);
  --grad-accent-press: #1f52c0;
  --ring: 0 0 0 4px rgba(47, 111, 237, .18);
}

body {
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(74,134,255,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(31,58,95,.08), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* Sticky glass top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(120deg, rgba(22,40,63,.96), rgba(31,58,95,.96));
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  box-shadow: 0 4px 20px rgba(16,32,60,.18);
}
.brand-mark {
  background: var(--grad-accent); color: #fff;
  box-shadow: 0 3px 8px rgba(47,111,237,.5), inset 0 1px 0 rgba(255,255,255,.4);
}

/* Depth on cards */
.card {
  border-color: rgba(219,226,236,.9);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 8px 24px -12px rgba(16,32,60,.28), 0 2px 6px rgba(16,32,60,.06);
}

/* Tactile 3D buttons */
.btn {
  background: var(--grad-accent);
  box-shadow: 0 2px 0 var(--grad-accent-press), 0 8px 18px -6px rgba(47,111,237,.45), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .1s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover { transform: translateY(-1px); filter: none;
  box-shadow: 0 3px 0 var(--grad-accent-press), 0 12px 24px -6px rgba(47,111,237,.5), inset 0 1px 0 rgba(255,255,255,.4); }
.btn:active { transform: translateY(2px);
  box-shadow: 0 0 0 var(--grad-accent-press), inset 0 3px 8px rgba(0,0,0,.22); }
.btn.ok { background: linear-gradient(180deg,#28b866,#1f9d55); box-shadow: 0 2px 0 #157a40, 0 8px 18px -6px rgba(31,157,85,.45), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.ok:active { box-shadow: 0 0 0 #157a40, inset 0 3px 8px rgba(0,0,0,.22); }
.btn.secondary {
  background: linear-gradient(180deg,#ffffff,#eef2f8); color: var(--ink);
  box-shadow: 0 2px 0 #cdd7e6, 0 6px 14px -8px rgba(16,32,60,.35), inset 0 1px 0 #fff;
}
.btn.secondary:active { transform: translateY(2px); box-shadow: 0 0 0 #cdd7e6, inset 0 3px 8px rgba(16,32,60,.15); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none;
  box-shadow: 0 2px 0 var(--grad-accent-press), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.add-btn::before { content: "＋ "; font-weight: 800; }

/* Inputs: focus glow */
input[type=text], input[type=search], input[type=email], input[type=password],
input[type=date], input[type=number], select, textarea {
  transition: border-color .15s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

/* Badges with a touch of depth */
.badge { box-shadow: 0 2px 6px rgba(16,32,60,.18), inset 0 1px 0 rgba(255,255,255,.25); }

/* ---- Click-to-attach uploader ---- */
.uploader { display: block; }
.uploader-face {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-radius: 16px;
  border: 1.5px dashed #b6c4dc;
  background: linear-gradient(145deg, #ffffff, #eaf0f8);
  box-shadow: inset 0 1px 0 #fff, 0 6px 16px -10px rgba(16,32,60,.4);
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.uploader-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.uploader-ico {
  font-size: 20px; width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--grad-accent); color: #fff;
  box-shadow: 0 4px 10px -3px rgba(47,111,237,.6), inset 0 1px 0 rgba(255,255,255,.4);
}
.uploader-cta { font-weight: 800; color: var(--navy); }
.uploader-hint { color: var(--muted); font-size: 12px; margin-left: auto; }
.uploader:hover .uploader-face { border-color: var(--accent); transform: translateY(-2px);
  box-shadow: 0 14px 28px -14px rgba(47,111,237,.55), inset 0 1px 0 #fff; }
.uploader:active .uploader-face { transform: translateY(0); box-shadow: inset 0 3px 8px rgba(16,32,60,.14); }
.uploader.has-files .uploader-face {
  border-style: solid; border-color: var(--accent);
  background: linear-gradient(145deg, #f2f8ff, #e4eeff);
}
.uploader-files { display: block; margin-top: 8px; font-size: 13px; color: var(--accent); font-weight: 600; word-break: break-word; }
.uploader-files:empty { display: none; }
.attach-row { margin-top: 10px; }
.attach-row .add-btn { margin-top: 10px; }

@media print { .uploader, .add-btn, .attach-row { display: none !important; } }

/* ---- Breadcrumbs ---- */
.crumbs { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:13px; color:var(--muted); margin-bottom:10px; }
.crumbs a { font-weight:600; }
.crumbs span { color:#aab6c8; }
.crumbs strong { color:var(--ink); }

/* ---- Client group cards ---- */
.group-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.group-card { display:flex; align-items:center; gap:14px; text-decoration:none; color:inherit;
  transition:transform .12s ease, box-shadow .2s ease; }
.group-card:hover { text-decoration:none; transform:translateY(-3px);
  box-shadow:0 16px 32px -16px rgba(16,32,60,.4), 0 3px 8px rgba(16,32,60,.08); }
.group-ico { flex:0 0 46px; width:46px; height:46px; border-radius:14px; display:grid; place-items:center;
  font-weight:800; font-size:18px; color:#fff; background:var(--grad-accent);
  box-shadow:0 6px 14px -5px rgba(47,111,237,.6), inset 0 1px 0 rgba(255,255,255,.4); }
.group-body { flex:1 1 auto; min-width:0; }
.group-name { font-weight:800; color:var(--navy); font-size:16px; }
.group-meta { font-size:13px; margin-top:2px; }
.group-chevron { color:#b6c2d4; font-size:26px; font-weight:700; line-height:1; }

/* ============================================================= */
/*  APP SHELL: mobile nav, install prompts, reusable states       */
/* ============================================================= */

/* ---- reusable text/status utilities (replace one-off inline styles) ---- */
.flash.error { background:#fdecec; border-color:#f3c0c0; color:#a33; }
.flash.warn  { background:#fff6e6; border-color:#f0d79a; color:#8a5a00; }
.text-open   { color:var(--ok); font-weight:700; }
.section-title { font-size:16px; font-weight:800; margin:0 0 12px; color:var(--ink); }
.section-title.flush { margin:0; }

/* ---- hamburger toggle (hidden on desktop) ---- */
.nav-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; border-radius: 9px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); cursor: pointer; padding: 0;
}
.nav-toggle span { display: block; width: 18px; height: 2px; background: #fff; margin: 0 auto; border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- install app button (inline in nav) ---- */
.install-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
  color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 6px 12px;
  transition: background .15s ease, transform .1s ease;
}
.install-btn:hover { background: rgba(255,255,255,.24); }
.install-btn:active { transform: translateY(1px); }

/* ---- iOS "add to home screen" tip banner ---- */
.ios-install-tip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(120deg, #eaf1ff, #f5f9ff);
  border-bottom: 1px solid #cfe0ff;
  color: var(--navy-d); font-size: 13px; font-weight: 600;
  padding: 10px 16px;
}
.ios-install-tip .ios-share-ico { display: inline-block; }
.ios-install-tip button {
  border: 0; background: transparent; color: var(--muted); font-size: 15px;
  cursor: pointer; line-height: 1; padding: 4px;
}
@media print { .ios-install-tip, .nav-toggle, .install-btn { display: none !important; } }

.offline-ico { font-size: 40px; margin-bottom: 6px; }

/* ---- responsive top nav: dropdown sheet on phones/tablets ---- */
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .topnav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: linear-gradient(180deg, rgba(22,40,63,.98), rgba(31,58,95,.98));
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    padding: 8px 12px 14px;
    box-shadow: 0 16px 30px -14px rgba(16,32,60,.5);
  }
  .topnav.is-open { display: flex; }
  .topnav a, .topnav .who, .topnav .logout, .install-btn { padding: 10px 6px; border-radius: 8px; }
  .topnav a:hover, .topnav .logout:hover { background: rgba(255,255,255,.08); text-decoration: none; }
  .topnav .who { order: 5; border-top: 1px solid rgba(255,255,255,.14); margin-top: 4px; padding-top: 12px; }
  .install-btn { justify-content: center; margin: 4px 0; }
  .topbar { position: relative; }
}

/* ---- larger desktops: a bit more breathing room ---- */
@media (min-width: 1200px) {
  .wrap { max-width: 1280px; padding: 24px; }
  .pagetitle { font-size: 24px; }
}

/* ---- respect reduced-motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  .btn, .group-card, .uploader-face { transition: none !important; }
}

/* ---- accessibility utility ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- search field with inline clear button ---- */
.search-field { position: relative; }
.search-field input[type=search] { padding-right: 38px; }
.search-field input[type=search]::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); font-size: 14px;
  border-radius: 999px; cursor: pointer;
}
.search-clear:hover { background: #eef2f8; color: var(--ink); }

/* ---- toolbar action group: keeps buttons together as a unit when wrapping ---- */
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- client-group grid: guard against overflow / long names on small phones ---- */
.group-name { overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .group-grid { grid-template-columns: 1fr; }
  .groups-toolbar { flex-direction: column; align-items: stretch; }
  .groups-toolbar .search-field { flex: 0 0 auto; width: 100%; }
  .groups-toolbar .toolbar-actions { justify-content: stretch; }
  .groups-toolbar .toolbar-actions .btn { flex: 1 1 auto; }
}

/* ============================================================= */
/*  PROPCLEAR CONSULTING — FUTURE / 3D INTERFACE                 */
/* ============================================================= */
:root {
  --pc-navy-deep:  #0a1730;
  --pc-navy:       #10213f;
  --pc-teal:       #1fd7c8;
  --pc-teal-d:     #0fb6a8;
  --pc-violet:     #7c6cff;
  --pc-gold:       #f2b544;
  --pc-glass:      rgba(255,255,255,.66);
  --pc-glass-line: rgba(255,255,255,.55);
  --grad-brand: linear-gradient(135deg, var(--pc-teal) 0%, var(--pc-violet) 100%);
  --grad-brand-soft: linear-gradient(135deg, rgba(31,215,200,.16), rgba(124,108,255,.16));
  --shadow-3d: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 40px -18px rgba(10,23,48,.35), 0 3px 10px rgba(10,23,48,.08);
  --shadow-3d-hover: 0 1px 0 rgba(255,255,255,.8) inset, 0 30px 60px -20px rgba(10,23,48,.45), 0 6px 16px rgba(10,23,48,.12);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1400px 700px at 105% -15%, rgba(31,215,200,.16), transparent 55%),
    radial-gradient(1000px 650px at -15% 0%, rgba(124,108,255,.14), transparent 55%),
    radial-gradient(900px 500px at 50% 120%, rgba(242,181,68,.08), transparent 60%),
    var(--bg);
}
h1, h2, h3, .pagetitle, .brand-name, .group-name, .section-title, .uploader-cta {
  font-family: "Sora", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Floating ambient orbs behind everything (purely decorative, inert) */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.bg-orbs span {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55;
  animation: pc-float 18s ease-in-out infinite;
}
.bg-orbs span:nth-child(1) { width: 420px; height: 420px; top: -140px; right: -100px; background: radial-gradient(circle, rgba(31,215,200,.45), transparent 70%); animation-duration: 22s; }
.bg-orbs span:nth-child(2) { width: 360px; height: 360px; bottom: -120px; left: -80px; background: radial-gradient(circle, rgba(124,108,255,.4), transparent 70%); animation-duration: 26s; animation-delay: -6s; }
.bg-orbs span:nth-child(3) { width: 260px; height: 260px; top: 40%; left: 60%; background: radial-gradient(circle, rgba(242,181,68,.28), transparent 70%); animation-duration: 20s; animation-delay: -3s; }
@keyframes pc-float {
  0%, 100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(20px,-30px,0) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { .bg-orbs span { animation: none; } }

/* ---- Brand identity ---- */
.topbar {
  background: linear-gradient(120deg, rgba(8,17,36,.97), rgba(16,33,63,.94));
  border-bottom: 1px solid rgba(31,215,200,.18);
}
.brand-mark {
  background: var(--grad-brand); color: #08132a; font-family: "Sora", sans-serif;
  box-shadow: 0 4px 14px -2px rgba(31,215,200,.55), inset 0 1px 0 rgba(255,255,255,.5);
}
.brand-name { display: flex; flex-direction: column; line-height: 1.1; font-weight: 700; }
.brand-name em { font-style: normal; font-weight: 500; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--pc-teal); }

/* ---- Glass cards with real depth ---- */
.card {
  background: var(--pc-glass);
  border: 1px solid var(--pc-glass-line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-3d);
  transition: box-shadow .25s ease, transform .25s ease;
}

/* ---- Buttons: brand gradient, tactile press ---- */
.btn {
  background: var(--grad-brand); color: #08132a;
  box-shadow: 0 2px 0 var(--pc-teal-d), 0 10px 22px -8px rgba(31,215,200,.5), inset 0 1px 0 rgba(255,255,255,.5);
  font-family: "Sora", sans-serif; font-weight: 700;
}
.btn:hover { box-shadow: 0 3px 0 var(--pc-teal-d), 0 14px 28px -8px rgba(31,215,200,.55), inset 0 1px 0 rgba(255,255,255,.55); }
.btn.ok { background: linear-gradient(135deg,#2fe08a,#17c46e); color: #06301c;
  box-shadow: 0 2px 0 #0f9c58, 0 10px 22px -8px rgba(23,196,110,.5), inset 0 1px 0 rgba(255,255,255,.5); }

/* ---- Group cards: perspective-ready 3D tilt targets ---- */
.group-grid { perspective: 1400px; }
.group-card {
  background: var(--pc-glass);
  border: 1px solid var(--pc-glass-line);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  box-shadow: var(--shadow-3d);
  transform-style: preserve-3d;
  will-change: transform;
}
.group-card:hover { box-shadow: var(--shadow-3d-hover); }

/* Photo now genuinely fills the icon slot instead of overflowing/breaking */
.group-ico { overflow: hidden; background: var(--grad-brand); position: relative; }
.group-ico-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.group-card:hover .group-ico-img { transform: scale(1.06); }
.group-ico-img { transition: transform .3s ease; }

/* ---- Group header card (group.php banner) ---- */
.group-header-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--grad-brand-soft);
}
.group-header-img {
  flex: 0 0 84px; width: 84px; height: 84px; border-radius: 18px; overflow: hidden;
  background: var(--grad-brand); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -10px rgba(31,215,200,.55), inset 0 1px 0 rgba(255,255,255,.4);
}
.group-header-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.group-header-placeholder { font-family: "Sora", sans-serif; font-size: 30px; font-weight: 800; color: #08132a; }
.group-header-info { min-width: 0; }
.group-header-info .pagetitle { margin: 0; }

/* ---- Badges: brand-consistent depth ---- */
.badge.open { background: linear-gradient(135deg,#2fe08a,#17c46e); }
.badge.completed { background: linear-gradient(135deg, var(--pc-navy), var(--pc-navy-deep)); }

/* ---- Login: glass hero panel ---- */
.login-card { box-shadow: var(--shadow-3d-hover); }

/* ---- Reduced motion & small screens: never force 3D transforms ---- */
@media (prefers-reduced-motion: reduce) {
  .group-card, .group-ico-img { transition: none !important; transform: none !important; }
}
@media (max-width: 480px) {
  .group-header-card { flex-direction: column; text-align: center; }
}

/* ============================================================= */
/*  CLIENT GROUP CARDS — RESPONSIVE: DESKTOP / TABLET / PHONE /   */
/*  IPHONE (safe-area aware)                                     */
/*  These rules are intentionally last in the file so they win    */
/*  the cascade over the earlier .group-grid / .group-card rules. */
/* ============================================================= */

.group-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.group-card {
  padding: 14px 16px;
  min-height: 64px;
  gap: 14px;
}
.group-ico { width: 48px; height: 48px; border-radius: 14px; font-size: 18px; }

/* ---- Large / ultra-wide desktops: cap card width so rows don't
        stretch into unreadably wide tiles ---- */
@media (min-width: 1400px) {
  .group-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 340px)); }
}

/* ---- Tablets: iPad portrait, Android tablets ---- */
@media (min-width: 768px) and (max-width: 1023px) {
  .group-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .group-header-img { width: 76px; height: 76px; }
}

/* ---- Large phones / small tablets in landscape ---- */
@media (min-width: 481px) and (max-width: 767px) {
  .group-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
  .group-header-img { width: 72px; height: 72px; }
}

/* ---- Phones, including iPhone SE / mini / standard widths, portrait ---- */
@media (max-width: 480px) {
  .group-grid { grid-template-columns: 1fr; gap: 10px; }
  .group-card { padding: 12px 14px; min-height: 60px; gap: 12px; }
  .group-ico { width: 42px; height: 42px; font-size: 16px; border-radius: 12px; }
  .group-name { font-size: 15px; }
  .group-meta { font-size: 12px; }
  .group-chevron { font-size: 22px; }
  .group-header-img { width: 96px; height: 96px; border-radius: 16px; }
}

/* ---- iPhone notch / Dynamic Island / home-indicator safe areas:
        keep page content clear of the curved edges in both orientations ---- */
.wrap {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
@media (min-width: 1200px) {
  .wrap {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
}

/* ---- Touch devices (all phones/tablets, not just small screens):
        comfortable tap targets, no hover-only affordances ---- */
@media (hover: none) and (pointer: coarse) {
  .group-card { min-height: 68px; }
  .group-chevron { display: none; }
  .group-card:active { transform: scale(.98); box-shadow: var(--shadow-3d); }
}

/* ============================================================= */
/*  CLIENT GROUP CARDS — FACEBOOK-PAGE STYLE                     */
/*  Cover photo + overlapping avatar circle, no like/comment/     */
/*  share row (the whole card is the single click target).        */
/*  Placed last so it overrides the earlier row-layout rules.     */
/* ============================================================= */
.group-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
  overflow: hidden;
  position: relative;
  text-decoration: none;
}

.group-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  background: var(--grad-brand);
  overflow: hidden;
}
.group-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.group-card:hover .group-cover img { transform: scale(1.05); }
.group-cover img { transition: transform .35s ease; }

.group-avatar {
  width: 58px; height: 58px; margin: -29px 0 0 16px;
  border-radius: 50%; border: 3px solid var(--card);
  background: var(--grad-brand); color: #08132a;
  display: grid; place-items: center;
  font-family: "Sora", sans-serif; font-weight: 800; font-size: 20px;
  box-shadow: 0 8px 16px -6px rgba(16,32,60,.4);
  position: relative; z-index: 2; overflow: hidden; flex: none;
}
.group-avatar img { width: 100%; height: 100%; object-fit: cover; }

.group-content { padding: 8px 16px 16px; }
.group-content .group-name { font-size: 16px; }
.group-content .group-meta { margin-top: 3px; }

/* ---- Responsive: keep the cover/avatar proportions sane across
        desktop, tablet, phone and iPhone widths ---- */
@media (min-width: 768px) and (max-width: 1023px) {
  .group-cover { aspect-ratio: 16 / 7; }
}
@media (max-width: 480px) {
  .group-cover { aspect-ratio: 16 / 8; }
  .group-avatar { width: 50px; height: 50px; margin: -25px 0 0 14px; font-size: 17px; }
  .group-content { padding: 6px 14px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .group-cover img { transition: none; }
}

/* ============================================================= */
/*  CLIENT GROUP CARDS — EDITORIAL POSTER DESIGN (final)          */
/*  Full-bleed cover photo, gradient scrim, name + stats overlaid */
/*  at the bottom. One clean click target, no avatar/action row.  */
/*  Placed last so it wins the cascade over earlier card layers.  */
/* ============================================================= */
.group-grid { gap: 20px; }

.group-card {
  display: block;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  transition: transform .25s ease, box-shadow .25s ease;
}
.group-card:hover { text-decoration: none; }

.group-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--pc-navy) 0%, var(--pc-navy-deep) 100%);
  overflow: hidden;
}
.group-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
.group-card:hover .group-cover img { transform: scale(1.08); }

.group-cover-letter {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: "Sora", sans-serif; font-weight: 800; font-size: 108px; line-height: 1;
  color: rgba(255,255,255,.16); letter-spacing: -2px; user-select: none;
}

/* Scrim so white text stays legible over any photo, always */
.group-cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,19,42,0) 38%, rgba(8,19,42,.55) 72%, rgba(8,19,42,.9) 100%);
}

.group-cover-text {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 18px;
  color: #fff;
}
.group-cover-text .group-name {
  color: #fff; font-size: 17px; text-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.group-cover-text .group-meta {
  color: rgba(255,255,255,.82); font-size: 13px; margin-top: 3px;
}
.group-cover-text .text-open { color: #6df2c4; font-weight: 700; }

/* Small circular affordance, fades in on hover/focus — replaces the old chevron */
.group-cover-cta {
  position: absolute; right: 14px; bottom: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #fff; font-size: 18px; font-weight: 700; line-height: 1;
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s ease, transform .25s ease, background .2s ease;
}
.group-card:hover .group-cover-cta,
.group-card:focus-visible .group-cover-cta { opacity: 1; transform: translateY(0); }
.group-card:hover .group-cover-cta { background: rgba(255,255,255,.28); }

.group-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-3d-hover);
}
.group-card:focus-visible {
  outline: 2px solid var(--pc-teal); outline-offset: 3px;
}

/* ---- Responsive proportions: desktop / tablet / phone / iPhone ---- */
@media (min-width: 1400px) {
  .group-cover { aspect-ratio: 16 / 11; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .group-cover { aspect-ratio: 16 / 10; }
  .group-cover-letter { font-size: 88px; }
}
@media (min-width: 481px) and (max-width: 767px) {
  .group-cover { aspect-ratio: 16 / 10; }
}
@media (max-width: 480px) {
  .group-grid { gap: 14px; }
  .group-card { border-radius: 16px; }
  .group-cover { aspect-ratio: 16 / 11; }
  .group-cover-letter { font-size: 72px; }
  .group-cover-text { padding: 14px; }
  .group-cover-text .group-name { font-size: 16px; }
  .group-cover-cta { display: none; } /* whole card is already the tap target */
}
@media (hover: none) and (pointer: coarse) {
  .group-card:active { transform: scale(.98); }
}
@media (prefers-reduced-motion: reduce) {
  .group-card, .group-cover img, .group-cover-cta { transition: none !important; transform: none !important; }
}

/* ============================================================= */
/*  CLIENT GROUP CARDS — SIMPLE STACKED DESIGN (final, no overlap) */
/*  Image block, then a separate text block directly below it.    */
/*  Nothing absolutely positioned, nothing overlapping — this is   */
/*  intentionally the most robust layout: plain document flow.     */
/*  Placed last so it wins over every earlier card layer.          */
/* ============================================================= */
.group-grid { gap: 18px; }

.group-card {
  display: block;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.group-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-3d-hover); }
.group-card:focus-visible { outline: 2px solid var(--pc-teal); outline-offset: 3px; }

/* Image sits in its own block, full width, fixed ratio — never overlaid with text */
.group-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--grad-brand);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.group-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.group-card:hover .group-cover img { transform: scale(1.04); }
.group-cover-letter {
  font-family: "Sora", sans-serif; font-weight: 800; font-size: 40px;
  color: #08132a;
}

/* Text sits in a completely separate block underneath, normal padding */
.group-content {
  padding: 14px 16px 16px;
  background: var(--card);
}
.group-content .group-name { font-size: 16px; }
.group-content .group-meta { margin-top: 3px; font-size: 13px; }

/* ---- Responsive: desktop / tablet / phone / iPhone ---- */
@media (min-width: 768px) and (max-width: 1023px) {
  .group-cover { aspect-ratio: 16 / 9; }
}
@media (max-width: 480px) {
  .group-grid { gap: 12px; }
  .group-card { border-radius: 14px; }
  .group-cover-letter { font-size: 32px; }
  .group-content { padding: 12px 14px 14px; }
  .group-content .group-name { font-size: 15px; }
}
@media (hover: none) and (pointer: coarse) {
  .group-card:active { transform: scale(.98); }
}
@media (prefers-reduced-motion: reduce) {
  .group-card, .group-cover img { transition: none !important; transform: none !important; }
}

/* ============================================================= */
/*  LOGO, OTP LOGIN, CLIENT PORTAL & ADMIN ACCESS (v3)           */
/* ============================================================= */

/* ---- Brand logo image in the top bar ---- */
.brand-logo {
  height: 34px; width: auto; display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
@media (max-width: 560px) { .brand-logo { height: 28px; } }

/* ---- Login: logo + one-time-code ---- */
.login-logo { display:block; width: 100%; max-width: 260px; height:auto; margin: 0 auto 14px; }
.login-sub { margin: -6px 0 16px; font-size: 14px; }
.otp-input {
  letter-spacing: .5em; text-align: center; font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums; padding-left: .5em;
}
.login-links { margin-top: 14px; display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 14px; }
.linklike { background: none; border: 0; padding: 0; color: var(--pc-teal-d, #0fb6a8); font-weight: 600; cursor: pointer; }
.linklike:hover { text-decoration: underline; }

/* ---- Setup log ---- */
.setup-log { margin: 6px 0 0; padding-left: 18px; }
.setup-log li { margin: 4px 0; }

/* ---- Small buttons / row actions (users list) ---- */
.btn-sm { padding: 5px 10px; font-size: 13px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.ghost.danger { color: #c0392b; border-color: #e6b0aa; }
.btn.ghost.danger:hover { background: #fdecea; }

/* ---- Admin: assign groups ---- */
.access-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
.access-group {
  position: relative; display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  border: 2px solid var(--line, #dbe3ee); border-radius: 14px; padding: 8px; background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.access-group.is-on, .access-group:has(input:checked) {
  border-color: var(--pc-teal, #1fd7c8);
  box-shadow: 0 6px 16px -8px rgba(31,215,200,.6);
}
.access-group input { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; }
.access-group-cover {
  aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--grad-brand, #10213f);
  display: flex; align-items: center; justify-content: center;
}
.access-group-cover img { width: 100%; height: 100%; object-fit: cover; }
.access-group-letter { font-family: "Sora", sans-serif; font-size: 26px; font-weight: 800; color: #08132a; }
.access-group-name { font-size: 13px; font-weight: 700; line-height: 1.2; }

/* ---- Admin: assign matters ---- */
.access-matter-group { margin-bottom: 14px; }
.access-matter-grouphead { padding: 6px 0; border-bottom: 1px solid var(--line, #dbe3ee); margin-bottom: 6px; }
.access-matter {
  display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer;
}
.access-matter:hover { background: rgba(31,215,200,.08); }
.access-matter input { width: 18px; height: 18px; }
.access-matter-id { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.access-matter-name { flex: 1; min-width: 0; }

/* ---- Client portal ---- */
.group-card.static { cursor: default; }
.group-card.static:hover { transform: none; }
.client-group-block { margin-bottom: 18px; }
.client-group-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px; font-weight: 800;
  color: var(--navy); margin: 4px 2px 8px;
}
.client-matter { display: block; text-decoration: none; color: inherit; margin-bottom: 10px; }
.client-matter:hover { text-decoration: none; transform: translateY(-2px); }
.client-matter-group { font-size: 12px; margin-top: 4px; }

/* ---- Edit group image ---- */
.group-header-info .btn-sm { margin-top: 8px; }
.edit-image-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.edit-image-preview {
  width: 160px; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden;
  background: var(--grad-brand, #10213f); display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.edit-image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-image-remove { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.edit-image-remove input { width: 16px; height: 16px; }
