:root {
  --bg: #0b1220;
  --panel: #111827;
  --panel2: #1a2332;
  --line: #243044;
  --text: #e5eefb;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0f172a, #0b1220);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  position: sticky; top: 0; height: 100vh; overflow: auto;
}
.brand {
  font-weight: 800; letter-spacing: 0.08em; font-size: 0.85rem;
  color: var(--accent2); margin-bottom: 1.5rem; padding: 0.5rem 0.75rem;
}
.nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav button {
  text-align: left; background: transparent; border: 0; color: var(--muted);
  padding: 0.65rem 0.85rem; border-radius: 10px; cursor: pointer; font-size: 0.9rem;
}
.nav button:hover { background: var(--panel2); color: var(--text); }
.nav button.active { background: rgba(59,130,246,0.15); color: var(--accent2); font-weight: 600; }
.main { padding: 1.5rem 1.75rem 3rem; max-width: 1200px; }
h1 { font-size: 1.6rem; margin: 0 0 0.35rem; }
.sub, .muted { color: var(--muted); font-size: 0.9rem; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem; margin: 1rem 0 1.25rem;
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 0.85rem;
}
.card .label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.card .value { font-size: 1.6rem; font-weight: 700; margin-top: 0.35rem; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.form-row { margin-bottom: 0.65rem; }
input, select, textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 0.65rem 0.8rem; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(59,130,246,0.35); border-color: var(--accent); }
.primary, .ghost {
  border: 0; border-radius: 999px; padding: 0.55rem 1rem; cursor: pointer; font: inherit; font-size: 0.85rem;
}
.primary { background: var(--accent); color: white; font-weight: 600; }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost { background: transparent; color: var(--accent2); border: 1px solid var(--line); margin-right: 0.35rem; }
.badge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
  background: #334155; color: #e2e8f0;
}
.badge.paid, .badge.active, .badge.completed { background: rgba(52,211,153,0.15); color: var(--ok); }
.badge.unpaid, .badge.inactive { background: rgba(248,113,113,0.12); color: var(--bad); }
.badge.pending { background: rgba(251,191,36,0.12); color: var(--warn); }
.error { color: var(--bad); }
.login {
  max-width: 400px; margin: 10vh auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 2rem;
}
.login h1 { margin-bottom: 0.5rem; }
code { background: var(--panel2); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
pre { background: var(--panel2); padding: 0.75rem; border-radius: 10px; overflow: auto; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
}

/* ===================================================================
   Admin shell — Cloudflare-style layout (round redesign)
   Top bar + full-height grouped sidebar + icon rail + phone drawer.
   Panels keep their existing classes, so their content is unchanged.
   =================================================================== */
:root {
  --accent: #f38020;
  --accent2: #fb923c;
  --shell-top: 56px;
  --shell-side: 248px;
  --shell-rail: 72px;
}
html { -webkit-text-size-adjust: 100%; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

.app {
  display: grid;
  grid-template-columns: var(--shell-side) minmax(0, 1fr);
  grid-template-rows: var(--shell-top) auto;
  min-height: 100vh;
}
.app.rail { grid-template-columns: var(--shell-rail) minmax(0, 1fr); }

/* top bar */
.app .topbar {
  grid-column: 1 / -1; grid-row: 1;
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 0.6rem;
  height: var(--shell-top); padding: 0 1rem;
  background: rgba(11,18,32,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.app .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  background: transparent; border: 1px solid var(--line); color: var(--text); cursor: pointer;
}
.app .icon-btn:hover { background: var(--panel2); }
.app .crumbs { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; min-width: 0; white-space: nowrap; overflow: hidden; }
.app .crumbs .sep { color: var(--line); }
.app .crumbs strong { overflow: hidden; text-overflow: ellipsis; }
.app .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.app .topbar-right .small { padding: 0.45rem 0.8rem; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.35rem; }
.app .user-email { font-size: 0.82rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sidebar */
.app .sidebar {
  grid-column: 1; grid-row: 2;
  position: sticky; top: var(--shell-top);
  height: calc(100vh - var(--shell-top)); overflow-y: auto;
  padding: 1rem 0.75rem 1.25rem;
  background: var(--bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.75rem;
}
.app .brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0.5rem; font-weight: 700; font-size: 0.95rem; }
.app .brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #111; display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.app .search-wrap {
  display: flex; align-items: center; gap: 0.5rem; padding: 0 0.7rem;
  height: 36px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.app .search-wrap input { border: 0; background: transparent; padding: 0; height: 100%; font-size: 0.88rem; color: var(--text); }
.app .search-wrap input:focus { outline: none; }
.app .search-wrap:focus-within { border-color: var(--accent); }
.app .nav { display: flex; flex-direction: column; gap: 0.9rem; }
.app .nav-group { display: flex; flex-direction: column; gap: 0.1rem; }
.app .nav-title {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.4rem 0.6rem; border-radius: 8px; text-align: left;
}
.app .nav-title:hover { color: var(--text); }
.app .nav-title-icon { display: none; }
.app .nav-item {
  display: flex; align-items: center; width: 100%; min-height: 36px;
  background: transparent; border: 0; border-left: 2px solid transparent; color: var(--text);
  padding: 0.5rem 0.75rem 0.5rem 0.9rem; border-radius: 0 8px 8px 0; cursor: pointer;
  font-size: 0.9rem; text-align: left;
}
.app .nav-item:hover { background: var(--panel2); }
.app .nav-item.active { background: rgba(243,128,32,0.12); border-left-color: var(--accent); color: var(--accent2); font-weight: 600; }
.app .sidebar-foot { margin-top: auto; font-size: 0.75rem; padding: 0 0.6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* main content */
.app .main { grid-column: 2; grid-row: 2; padding: 1.5rem 1.75rem 3rem; max-width: 1240px; width: 100%; min-width: 0; }
.app .page-head { margin-bottom: 1.1rem; }
.app .page-kicker { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.2rem; }
.app h1 { font-size: 1.5rem; letter-spacing: -0.01em; }
.app .card { border-radius: 12px; }
.app .scrim { display: none; }

/* icon rail (collapsed sidebar, desktop) */
.app.rail .sidebar { padding: 1rem 0.5rem; align-items: stretch; }
.app.rail .brand { justify-content: center; padding: 0.25rem 0; }
.app.rail .brand-text, .app.rail .search-wrap, .app.rail .nav-item, .app.rail .nav-title-text, .app.rail .sidebar-foot { display: none; }
.app.rail .nav { gap: 0.4rem; align-items: center; }
.app.rail .nav-title { justify-content: center; padding: 0.55rem; width: 44px; height: 44px; border-radius: 12px; }
.app.rail .nav-title-icon { display: inline-flex; }
.app.rail .nav-title:hover { background: var(--panel2); }

/* phones and small tablets: sidebar becomes a drawer */
@media (max-width: 959px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app.rail { grid-template-columns: minmax(0, 1fr); }
  .app .rail-btn { display: none; }
  .app .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: 100vh;
    z-index: 60; transform: translateX(-102%); transition: transform 0.25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.5); padding-top: 1.1rem;
  }
  .app.drawer-open .sidebar { transform: translateX(0); }
  .app .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,0.55); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .app .main { grid-column: 1; padding: 1.2rem 1rem 3rem; }
  .app .crumbs .crumb-group, .app .crumbs .sep:nth-of-type(2) { display: none; }
  .app .user-email { display: none; }
  .app .nav-item { min-height: 44px; font-size: 0.95rem; }
  .app .nav-title { min-height: 40px; }
}
@media (max-width: 560px) {
  .app .topbar { padding: 0 0.75rem; gap: 0.5rem; }
  .app .btn-text { display: none; }
  .app .topbar-right .small { padding: 0.5rem; }
  .app h1 { font-size: 1.3rem; }
  .app .main { padding: 1rem 0.75rem 2.5rem; }
  .app .card { padding: 0.85rem; }
}
@media (max-width: 360px) {
  .app h1 { font-size: 1.2rem; }
  .app .crumbs { font-size: 0.82rem; }
}

/* ===================================================================
   Shell v2 — light, Cloudflare-style (mobile drawer as in the reference)
   =================================================================== */
:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --panel2: #f5f5f5;
  --line: #e5e5e5;
  --text: #1d1d1d;
  --muted: #6b6b6b;
  --ink: #1d1d1d;
  --accent: #f38020;
  --accent2: #c2410c;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #dc2626;
}
body { background: var(--bg); color: var(--text); }
.card { box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.primary:hover { background: #3d3d3d; }

.app .topbar { background: #ffffff; border-bottom: 1px solid var(--line); backdrop-filter: none; }
.app .icon-btn { border: 0; color: var(--text); }
.app .icon-btn:hover { background: #f3f3f3; }
.app .user-email { color: var(--muted); }
.app .crumbs strong { font-weight: 600; }
.app .main { background: var(--bg); }
.app .page-kicker { color: var(--muted); text-transform: none; letter-spacing: 0; font-size: 0.85rem; margin-bottom: 0.1rem; }
.app h1 { font-size: 1.75rem; font-weight: 600; color: var(--text); }

/* drawer / sidebar */
.app .sidebar { background: #ffffff; border-right: 1px solid var(--line); padding: 0 0.75rem 1rem; gap: 0.6rem; }
.app .drawer-head { display: flex; align-items: center; gap: 0.25rem; height: 56px; margin: 0 -0.25rem; border-bottom: 1px solid var(--line); }
.app .account-switch {
  flex: 1; display: flex; align-items: center; gap: 0.6rem; min-width: 0;
  background: transparent; border: 0; padding: 0.35rem 0.5rem; border-radius: 8px; cursor: pointer; color: var(--text);
}
.app .account-switch:hover { background: #f3f3f3; }
.app .account-switch .brand-text { font-weight: 600; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app .updown { margin-left: auto; color: var(--muted); display: inline-flex; }
.app .close-btn { display: none; }
.app .brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; }
.app .search-wrap {
  background: #ffffff; border: 1px solid #d4d4d4; height: 42px; border-radius: 10px; color: var(--muted);
  padding: 0 0.8rem; gap: 0.6rem;
}
.app .search-wrap input { color: var(--text); }
.app .search-wrap input::placeholder { color: #8a8a8a; }
.app .search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(243,128,32,0.15); }
.app .search-wrap kbd { margin-left: auto; font-family: inherit; font-size: 0.78rem; color: var(--muted); }

.app .nav { gap: 0.1rem; }
.app .nav-group { display: flex; flex-direction: column; }
.app .nav-title {
  display: flex; align-items: center; gap: 0.7rem; width: 100%; min-height: 42px;
  padding: 0.45rem 0.65rem; background: transparent; border: 0; border-radius: 8px;
  color: var(--text); font-size: 0.96rem; font-weight: 500; text-align: left; cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.app .nav-title:hover { background: #f3f3f3; }
.app .nav-title-icon { display: inline-flex; color: var(--muted); }
.app .nav-title-text { flex: 1; }
.app .nav-chev { display: inline-flex; color: var(--muted); transition: transform 0.2s ease; }
.app .nav-title[aria-expanded="true"] .nav-chev { transform: rotate(90deg); }
.app .nav-children {
  margin: 0.1rem 0 0.35rem 1.35rem; padding-left: 0.85rem; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.1rem;
}
.app .nav-item {
  display: flex; align-items: center; width: 100%; min-height: 38px;
  padding: 0.45rem 0.6rem; background: transparent; border: 0; border-radius: 8px;
  color: #3d3d3d; font-size: 0.93rem; text-align: left; cursor: pointer;
}
.app .nav-item:hover { background: #f3f3f3; color: var(--text); }
.app .nav-item.active { background: #fff1e6; color: #9a3412; font-weight: 600; }
.app .sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 0.6rem; }
.app .sidebar-foot p { font-size: 0.78rem; margin: 0 0.6rem 0.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* rail (desktop, collapsed) */
.app.rail .nav-title { justify-content: center; padding: 0.55rem; width: 44px; height: 44px; }
.app.rail .nav-chev, .app.rail .nav-title-text { display: none; }
.app.rail .account-switch .brand-text, .app.rail .account-switch .updown { display: none; }

/* phones and small tablets: drawer, with a close button */
@media (max-width: 959px) {
  .app .close-btn { display: inline-flex; }
  .app .sidebar { padding-top: 0; }
  .app .nav-item { min-height: 44px; font-size: 0.98rem; }
  .app .nav-title { min-height: 46px; font-size: 1rem; }
  .app .drawer-head { padding-left: 0.25rem; }
}

/* ===================================================================
   v3 — Cloudflare blue for actions (no orange), skeletons, boot loader
   =================================================================== */
:root { --accent: #0051c3; --accent2: #003d91; }
.primary { background: #0051c3; color: #fff; border-color: #0051c3; }
.primary:hover { background: #003d91; }
.ghost { color: #0051c3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #0051c3; box-shadow: 0 0 0 3px rgba(0,81,195,0.15); }
.app .brand-mark { background: #1d1d1d; color: #fff; }
.app .search-wrap:focus-within { border-color: #0051c3; box-shadow: 0 0 0 3px rgba(0,81,195,0.15); }
.app .nav-item.active { background: #eef4ff; color: #0051c3; box-shadow: inset 2px 0 0 #0051c3; }
.app .crumbs { gap: 0.5rem; font-size: 0.95rem; }
.app .crumb-icon, .app .crumb-chev { display: inline-flex; color: var(--muted); }
.app .crumbs strong { font-weight: 600; }
.app h1 { margin-bottom: 0.25rem; }
.app .page-head { margin-bottom: 1rem; }

/* skeleton placeholders with shimmer */
.skel-wrap { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.6rem 0.25rem; }
.skel-row {
  height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, #ededed 25%, #f8f8f8 37%, #ededed 63%);
  background-size: 400% 100%;
  animation: cgtia-shimmer 1.4s ease infinite;
}
@keyframes cgtia-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* full-page loading (start-up) */
.boot { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--muted); }
.boot-spin { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #e5e5e5; border-top-color: #1d1d1d; animation: cgtia-spin 0.9s linear infinite; }
@keyframes cgtia-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .skel-row { animation-duration: 3s; }
  .boot-spin { animation-duration: 2.4s; }
}

/* ===================================================================
   v4 — plain, compact, phone-first (Samsung A51 is ~412px wide)
   =================================================================== */
@media (max-width: 600px) {
  body { font-size: 14px; }
  .app .topbar { height: 52px; padding: 0 0.6rem; }
  .app .main { padding: 0.75rem 0.6rem 2.5rem; }
  .app h1 { font-size: 1.22rem; margin-bottom: 0.15rem; }
  .app .page-head { margin-bottom: 0.7rem; }
  .card { padding: 0.75rem; margin-bottom: 0.6rem; border-radius: 12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; margin: 0.6rem 0 0.9rem; }
  .card .value { font-size: 1.25rem; }
  input, select, textarea { font-size: 15px; padding: 0.55rem 0.7rem; min-height: 40px; border-radius: 9px; }
  textarea { min-height: 72px; }
  .form-row { margin-bottom: 0.5rem; }
  button, .primary, .ghost { min-height: 36px; padding: 0.45rem 0.8rem; font-size: 0.86rem; border-radius: 9px; }
  .ghost { margin-right: 0.25rem; margin-bottom: 0.25rem; }
  .sub, .muted { font-size: 0.84rem; }
  .app .crumbs { font-size: 0.9rem; }
  .app .search-wrap { height: 40px; }

  /* tables become a stack of cards, each field labelled */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 0.35rem 0.65rem; margin-bottom: 0.55rem;
  }
  .table-wrap td { border: 0; padding: 0.3rem 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; font-size: 0.86rem; }
  .table-wrap td[data-label]::before {
    content: attr(data-label); color: var(--muted); font-size: 0.74rem; flex: 0 0 38%; max-width: 38%;
  }
  .table-wrap td[colspan] { display: block; }
  .table-wrap td[colspan]::before { content: none; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
  .app h1 { font-size: 1.1rem; }
  .app .main { padding-left: 0.5rem; padding-right: 0.5rem; }
}

/* ===================================================================
   v5 — grey active menu item, sign-in card, sheets, dropdowns, skeletons
   =================================================================== */
.app .nav-item.active { background: #f1f1f1; color: #1d1d1d; font-weight: 600; box-shadow: none; }

/* sign-in */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: linear-gradient(180deg, #f1f4f9 0%, #fafafa 60%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid #e5e5e5; border-radius: 20px; padding: 2rem 1.75rem; box-shadow: 0 18px 50px rgba(15,23,42,0.08); box-sizing: border-box; }
.login-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; margin-bottom: 1.4rem; }
.login-title { font-size: 1.6rem; margin: 0 0 0.3rem; font-weight: 700; }
.login-sub { color: var(--muted); margin: 0 0 1.4rem; font-size: 0.95rem; line-height: 1.5; }
.login-form { display: flex; flex-direction: column; gap: 0.9rem; }
.login-form .field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.86rem; color: #3d3d3d; font-weight: 500; }
.login-form .field input { min-height: 46px; font-size: 16px; border: 1px solid #d4d4d4; border-radius: 12px; padding: 0.6rem 0.85rem; background: #fff; color: var(--text); }
.login-form .field input:focus { border-color: #0051c3; box-shadow: 0 0 0 3px rgba(0,81,195,0.15); outline: none; }
.login-btn { min-height: 48px; border: 0; border-radius: 12px; background: #0051c3; color: #fff; font-size: 0.98rem; font-weight: 600; cursor: pointer; margin-top: 0.3rem; }
.login-btn:hover { background: #003d91; }
.login-btn:disabled { opacity: 0.6; cursor: default; }
.login-err { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 0.55rem 0.7rem; margin: 0; font-size: 0.88rem; }
.login-foot { color: var(--muted); font-size: 0.82rem; margin: 1.2rem 0 0; text-align: center; }

/* sheets and confirmations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,0.42); display: flex; align-items: center; justify-content: center; z-index: 300; padding: 1rem; animation: fadeIn 0.18s ease; }
.modal { background: #fff; border-radius: 18px; padding: 1.25rem; max-width: 380px; width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,0.25); box-sizing: border-box; }
.sheet-up { animation: sheetUp 0.22s ease; }
.modal-title { font-size: 1.05rem; margin: 0 0 0.4rem; font-weight: 700; }
.modal-text { margin: 0 0 1rem; color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }
.danger { background: #dc2626; color: #fff; border: 1px solid #dc2626; border-radius: 9px; padding: 0.5rem 1rem; min-height: 38px; cursor: pointer; }
.note-list { display: flex; flex-direction: column; gap: 0.65rem; max-height: 60vh; overflow: auto; margin-bottom: 0.75rem; -webkit-overflow-scrolling: touch; }
.note-row { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.85rem 1rem; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; }
.note-row small { color: #94a3b8; font-size: 0.75rem; }
.card-title { font-size: 1rem; margin: 0 0 0.6rem; }
@media (max-width: 600px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 18px 18px 0 0; padding: 1.1rem 1rem calc(1.1rem + env(safe-area-inset-bottom, 0px)); }
}

/* notification bell */
.bell-wrap { position: relative; }
.bell-badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-sizing: border-box; }

/* dropdowns */
.sel-wrap { position: relative; width: 100%; }
.sel-btn {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 42px;
  padding: 0.5rem 2.2rem 0.5rem 0.8rem; border: 1px solid #d4d4d4; border-radius: 10px; background: #fff;
  color: var(--text); font: inherit; text-align: left; cursor: pointer; box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
}
.sel-btn:disabled { opacity: 0.6; cursor: default; }
.sel-list {
  position: absolute; z-index: 90; left: 0; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid #e5e5e5; border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,0.14);
  padding: 6px; max-height: 300px; overflow: auto;
}
.sel-list[hidden] { display: none; }
.sel-opt { display: block; width: 100%; min-height: 40px; text-align: left; padding: 0.6rem 0.7rem; border: 0; background: transparent; border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; box-sizing: border-box; }
.sel-opt:hover { background: #f3f3f3; }
.sel-opt.on { background: #ececec; font-weight: 600; }

/* shimmer skeletons (whole page) */
.skel-block, .skel-inline {
  background: linear-gradient(90deg, #ededed 25%, #f8f8f8 37%, #ededed 63%);
  background-size: 400% 100%; animation: cgtia-shimmer 1.4s ease infinite; border-radius: 8px;
}
.skel-inline { display: inline-block; width: 180px; height: 16px; vertical-align: middle; }
.page-skel { display: flex; flex-direction: column; }
.skel-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin-top: 14px; }

/* ===================================================================
   v6 — sub-page tabs with a "..." menu
   =================================================================== */
.subtabs { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 1.1rem; }
.subtabs-row { display: inline-flex; gap: 2px; padding: 3px; background: #efefef; border-radius: 12px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.subtabs-row::-webkit-scrollbar { display: none; }
.subtab { flex: 0 0 auto; padding: 0.45rem 0.9rem; border: 0; background: transparent; border-radius: 9px; color: #3d3d3d; font: inherit; font-size: 0.9rem; white-space: nowrap; cursor: pointer; min-height: 36px; }
.subtab:hover { color: var(--text); }
.subtab.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.subtabs-more { position: relative; flex: 0 0 auto; }
.subtabs-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 180px;
  background: #fff; border: 1px solid #e5e5e5; border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,0.14); padding: 6px;
}
.subtabs-menu button { display: block; width: 100%; text-align: left; padding: 0.6rem 0.75rem; border: 0; background: transparent; border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; min-height: 40px; }
.subtabs-menu button:hover { background: #f3f3f3; }
.subtabs-menu button.on { font-weight: 600; color: var(--text); }



.note-row strong { display: block; font-size: 0.95rem; font-weight: 700; color: #0f172a; line-height: 1.35; }
.note-row span { display: block; font-size: 0.875rem; color: #475569; line-height: 1.4; }
.note-row-link { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.note-row-link:hover { background: #f8fafc; border-color: #cbd5e1; }
.note-row-link:active { background: #f1f5f9; }
.note-row-link:focus { outline: 2px solid rgba(59,130,246,0.35); outline-offset: 1px; }

.row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; justify-content: flex-start; }
.row-actions button { pointer-events: auto; margin: 0; }
.badge.paused { background: rgba(248,113,113,0.12); color: var(--bad); }
/* mobile card actions: one clean button row, no split Delete */
@media (max-width: 860px) {
  .table-wrap td.row-actions,
  .table-wrap tr td.row-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 0.4rem !important;
    width: 100% !important;
    padding: 0.65rem 0 0.25rem !important;
    margin-top: 0.35rem;
    border-top: 1px solid var(--line);
  }
  .table-wrap td.row-actions::before { content: none !important; display: none !important; }
  .table-wrap td.row-actions button {
    flex: 0 0 auto !important;
    margin: 0 !important;
  }
}

/* Toggle switch */
.toggle {
  position: relative; display: inline-flex; align-items: center; gap: 0.55rem;
  cursor: pointer; user-select: none; font-size: 0.88rem; color: var(--muted);
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 40px; height: 22px; border-radius: 999px; background: #cbd5e1;
  position: relative; flex-shrink: 0; transition: background .2s ease;
}
.toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.2);
  transition: transform .2s cubic-bezier(.16,1,.3,1);
}
.toggle input:checked + .toggle-track { background: #2563eb; }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid rgba(37,99,235,.35); outline-offset: 2px; }



/* MCQ editor (modules quick check, module quiz, assessments) */
.mcq-block {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}
.mcq-prompt {
  width: 100%;
  display: block;
  margin-top: 0.25rem;
  box-sizing: border-box;
}
.mcq-option {
  display: grid;
  grid-template-columns: 22px 28px 1fr auto;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
  cursor: pointer;
}
.mcq-option input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #2563eb;
}
.mcq-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.mcq-option-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.mcq-correct-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: #15803d;
  background: #dcfce7;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.mcq-option:has(input:checked) .mcq-letter {
  background: #dbeafe;
  color: #1d4ed8;
}

@media print {
  .sidebar, .topbar, .nav, .no-print, button, .subtabs, input, select { display: none !important; }
  .transcript-sheet, .card { box-shadow: none !important; border: 1px solid #ccc; }
}

/* Transcript: student photo + print sheet */
.tx-admin-photo { width: 92px; height: 112px; object-fit: cover; border-radius: 10px; border: 1px solid #dfe6f3; background: #f5f7fb; flex: 0 0 auto; }
.tx-admin-photo.is-empty { display: grid; place-items: center; font-size: 12px; color: #64748b; }
@media print {
  body * { visibility: hidden; }
  .transcript-sheet, .transcript-sheet * { visibility: visible; }
  .transcript-sheet { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 0; }
  .no-print { display: none !important; }
}

/* Results summary: print only the summary sheet */
@media print {
  body * { visibility: hidden; }
  .summary-print, .summary-print * { visibility: visible; }
  .summary-print { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 0; }
  .no-print { display: none !important; }
}

/* Sized design uploads: each shows its exact frame so the designer knows the size */
.media-field { border: 1px dashed #cbd5e1; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.media-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.media-preview { background: #f1f5f9; border-radius: 10px; overflow: hidden; display: grid; place-items: center; }
.media-preview.is-portrait { aspect-ratio: 4 / 5; max-width: 220px; }
.media-preview.is-landscape { aspect-ratio: 16 / 9; max-width: 100%; }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-actions, .media-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.media-link input { flex: 1; min-width: 180px; }

/* Results: programme filter chips */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chips .chip { border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.filter-chips .chip.on { background: #0f126c; border-color: #0f126c; color: #fff; }
.media-preview.is-free { aspect-ratio: 1 / 1; max-width: 180px; background: repeating-conic-gradient(#e2e8f0 0 25%, #f8fafc 0 50%) 0 0 / 16px 16px; }

/* Crop tool */
.crop-scrim { position: fixed; inset: 0; background: rgba(8,12,40,0.6); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.crop-box { background: #fff; border-radius: 16px; padding: 1.25rem; width: min(440px, 100%); box-sizing: border-box; max-height: 92vh; overflow: auto; }
.crop-box h3 { margin: 0 0 0.25rem; }
.crop-stage { position: relative; overflow: hidden; background: #0f172a; border-radius: 10px; margin: 0 auto; cursor: grab; touch-action: none; user-select: none; }
.crop-stage img { position: absolute; max-width: none; pointer-events: none; }

/* Crop tool: locked-ratio frame */
.crop-stage { position: relative; overflow: hidden; background: #0f172a; border-radius: 10px; margin: 0 auto; touch-action: none; user-select: none; }
.crop-stage img { position: absolute; left: 0; top: 0; max-width: none; pointer-events: none; }
.crop-frame { position: absolute; border: 2px solid #fff; box-sizing: border-box; box-shadow: 0 0 0 9999px rgba(8,12,40,0.55); cursor: move; }
.crop-handle { position: absolute; width: 22px; height: 22px; background: #fff; border-radius: 6px; box-shadow: 0 0 0 2px rgba(9,72,230,0.9); transform: translate(-50%, -50%); }
.crop-handle.h-nw { left: 0; top: 0; cursor: nwse-resize; }
.crop-handle.h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.crop-handle.h-sw { left: 0; top: 100%; cursor: nesw-resize; }
.crop-handle.h-se { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-readout { margin: 0.5rem 0 0; font-weight: 700; font-size: 0.9rem; }
.crop-scrim { overscroll-behavior: contain; touch-action: none; }

/* Card style: controls and live preview */
.card-style { border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.75rem; margin-top: 0.5rem; }
.card-style-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-top: 0.5rem; }
@media (min-width: 720px) { .card-style-grid { grid-template-columns: 1fr 1fr; } }
.card-style-controls { display: flex; flex-direction: column; gap: 0.5rem; }
.card-style-row { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; color: #475569; }
.card-style-row input[type="range"] { width: 100%; }
.card-preview { position: relative; width: 100%; max-width: 360px; height: 230px; }
.card-preview.is-protrude { margin-top: 44px; }
.card-preview-card { position: absolute; inset: 0; border-radius: 26px; overflow: hidden; background: linear-gradient(135deg, #0a0e4a 0%, #0948e6 100%); color: #fff; }
.card-preview-text { position: relative; z-index: 1; padding: 24px 22px 72px; }
.card-preview-text h3 { margin: 0 0 8px; font-family: Montserrat, Inter, sans-serif; line-height: 1.15; }
.card-preview-text p { margin: 0; font-size: 13px; line-height: 1.5; opacity: 0.9; }
.card-preview-ph { position: absolute; right: 0; bottom: 0; height: 94%; width: auto; max-width: 58%; object-fit: contain; object-position: right bottom; transform-origin: right bottom; z-index: 1; pointer-events: none; }
.card-preview-clip { position: absolute; left: 0; right: 0; top: -44px; bottom: 0; overflow: hidden; border-radius: 26px; pointer-events: none; }
.card-preview-clip .card-preview-ph { height: 100%; max-width: 56%; right: 8px; }
.card-preview-cta { position: absolute; left: 18px; bottom: 18px; z-index: 6; font-weight: 800; font-size: 14px; color: #fff; text-decoration: underline; text-underline-offset: 6px; }

/* Attendance and other records: real table form, scrolls sideways instead of stacking into long cards */
.table-wrap { overflow-x: auto; }
.table-wrap table { display: table !important; width: 100%; }
.table-wrap thead { display: table-header-group !important; }
.table-wrap tbody { display: table-row-group !important; }
.table-wrap tr { display: table-row !important; }
.table-wrap th, .table-wrap td { display: table-cell !important; padding: 0.5rem 0.6rem; vertical-align: top; }
/* Card preview uses the same 5:3 shape as the phone card */
.card-preview { height: auto; aspect-ratio: 5 / 3; }
.card-preview.is-protrude { margin-top: 44px; }

/* Stories: preview of the 9:16 frame */
.story-preview { background: #0f172a; border-radius: 12px; overflow: hidden; width: 180px; aspect-ratio: 9 / 16; display: grid; place-items: center; }
.story-preview img, .story-preview video { width: 100%; height: 100%; object-fit: cover; }

/* Text style controls */
.ts-panel { margin: 0.4rem 0 0.75rem; }
.ts-panel > summary { cursor: pointer; font-size: 0.8rem; }
.ts-grid { display: grid; grid-template-columns: 1fr; gap: 0.6rem; margin-top: 0.5rem; }
@media (min-width: 720px) { .ts-grid { grid-template-columns: 1fr 1fr; } }
.ts-row { display: flex; flex-direction: column; gap: 0.25rem; }
.ts-pair { display: flex; gap: 0.5rem; align-items: center; }
.ts-pair input[type="range"] { flex: 1; min-width: 0; }
.ts-pair input[type="number"] { width: 5.5rem; }
.ts-row input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
textarea { white-space: pre-wrap; }

/* Text style controls */
.ts-panel { margin: 0.4rem 0 0.75rem; }
.ts-panel > summary { cursor: pointer; font-size: 0.8rem; }
.ts-grid { display: grid; grid-template-columns: 1fr; gap: 0.6rem; margin-top: 0.5rem; }
@media (min-width: 720px) { .ts-grid { grid-template-columns: 1fr 1fr; } }
.ts-row { display: flex; flex-direction: column; gap: 0.25rem; }
.ts-pair { display: flex; gap: 0.5rem; align-items: center; }
.ts-pair input[type="range"] { flex: 1; min-width: 0; }
.ts-pair input[type="number"] { width: 5.5rem; }
.ts-row input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
textarea { white-space: pre-wrap; }

/* Apply form tabs */
.tab-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0 0 0.75rem; border-bottom: 1px solid #e2e8f0; padding-bottom: 0.4rem; }
.tab-bar.sub { border-bottom: 0; margin-bottom: 0.5rem; }
.tab-btn { border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.tab-btn.on { background: #0f126c; border-color: #0f126c; color: #fff; }

/* Segmented tabs, as on the invites page */
.seg { display: inline-flex; background: #f1f5f9; border-radius: 999px; padding: 4px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 9px 16px; border-radius: 999px; font-weight: 600; color: #475569; cursor: pointer; white-space: nowrap; font-size: 0.9rem; }
.seg button.on { background: #ffffff; color: #0f172a; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }

/* Form placement: switches in rows and columns */
.place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.5rem; margin: 0.4rem 0 0.25rem; }
.place-cell { border: 1px solid #e2e8f0; border-radius: 14px; padding: 0.6rem 0.75rem; display: flex; flex-direction: column; gap: 0.2rem; background: #fff; }
.place-cell small { font-size: 0.72rem; }
/* Steps in the form editor */
.stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; }
.stage-cell { display: flex; flex-direction: column; gap: 0.25rem; }
/* Button position preview: a strip the size of the bottom of a phone screen */
.pos-preview { margin-top: 0.6rem; height: 56px; border: 1px dashed #cbd5e1; border-radius: 14px; background: #f8fafc; padding: 0 10px; display: flex; align-items: center; }
.pos-btn { background: #0f126c; color: #fff; border-radius: 999px; padding: 8px 16px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.pos-left { margin-right: auto; }
.pos-centre { margin: 0 auto; }
.pos-right { margin-left: auto; }

/* Drag-and-drop button position */
.placer-track { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); height: 74px; border: 1px dashed #cbd5e1; border-radius: 16px; background: #f8fafc; overflow: hidden; }
.placer-zone { display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 0.7rem; font-weight: 600; color: #94a3b8; }
.placer-zone.is-here span { color: #0f126c; }
.placer-btn { position: absolute; top: 50%; margin-top: -18px; height: 36px; border: 0; border-radius: 999px; background: #0f126c; color: #fff; font-weight: 700; font-size: 0.8rem; padding: 0 16px; white-space: nowrap; cursor: grab; touch-action: none; user-select: none; transition: left 0.15s ease, right 0.15s ease; }
.placer-btn.pos-left { left: 8px; }
.placer-btn.pos-centre { left: 50%; transform: translateX(-50%); }
.placer-btn.pos-right { left: auto; right: 8px; }
.placer-btn.is-drag { cursor: grabbing; transition: none; z-index: 2; box-shadow: 0 10px 20px -8px rgba(15, 18, 108, 0.6); }
.placer-btn:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

/* Full-screen form preview */
.preview-screen { position: fixed; inset: 0; z-index: 300; background: #eef4ff; overflow: auto; }
.preview-bar { display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; flex-wrap: wrap; }
.preview-stage { display: flex; justify-content: center; padding: 24px 12px 48px; }
.preview-phone { width: min(100%, 420px); background: #fff; border-radius: 28px; box-shadow: 0 24px 48px -30px rgba(15, 18, 108, 0.45); overflow: hidden; position: relative; padding-bottom: 84px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.preview-brand { font-weight: 800; color: #0f126c; letter-spacing: 0.02em; }
.preview-card { padding: 12px 20px 20px; }
.preview-card h2 { font-size: 22px; font-weight: 800; color: #0f126c; margin: 6px 0 14px; line-height: 1.2; }
.preview-steps { margin: 4px 0 18px; }
.pv-dots { display: flex; gap: 6px; margin-bottom: 10px; }
.pv-dot { flex: 1; height: 6px; border-radius: 999px; background: #dfe6f3; }
.pv-dot.on { background: #0948e6; }
.pv-stepname { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #0f172a; font-size: 14px; }
.pv-num { width: 26px; height: 26px; border-radius: 50%; background: #0f126c; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.pv-field { margin-bottom: 14px; }
.pv-field label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; margin-bottom: 6px; }
.pv-field input, .pv-field select, .pv-field textarea { width: 100%; border: 1px solid #dfe6f3; border-radius: 14px; padding: 11px 13px; background: #f8fafc; box-sizing: border-box; font: inherit; }
.pv-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-pill { display: inline-block; border: 1px solid #dfe6f3; border-radius: 999px; padding: 7px 12px; font-size: 13px; background: #f8fafc; }
.pv-actions { display: flex; gap: 8px; margin-top: 16px; }
.pv-main { flex: 1; background: #0f126c; color: #fff; border: 0; border-radius: 999px; height: 48px; font-weight: 700; }
.pv-draft { background: #fff; border: 1px solid #dfe6f3; border-radius: 999px; height: 48px; padding: 0 16px; color: #0f126c; font-weight: 700; }
.pv-back { background: #fff; border: 1px solid #dfe6f3; border-radius: 999px; height: 48px; padding: 0 16px; color: #0f126c; font-weight: 700; }
.preview-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 72px; border-top: 1px dashed #cbd5e1; display: flex; align-items: center; padding: 0 12px; background: #f8fafc; }
.pv-launch { background: #0f126c; color: #fff; border-radius: 999px; padding: 10px 18px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.pv-launch.pos-left { margin-right: auto; }
.pv-launch.pos-centre { margin: 0 auto; }
.pv-launch.pos-right { margin-left: auto; }

.pv-heading { font-size: 18px; font-weight: 800; color: #0f126c; margin: 6px 0 14px; line-height: 1.25; }

/* Compact preview buttons and the top of the form */
.pv-main, .pv-draft, .pv-back { height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 15px; width: auto; flex: none; }
.pv-main { background: #0f126c; color: #fff; border: 0; }
.pv-draft { background: #fff; border: 1px solid #dfe6f3; color: #0f126c; }
.pv-back { background: #fff; border: 1px solid #dfe6f3; color: #0f126c; margin-right: auto; }
.pv-actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; }
.pv-at-left { justify-content: flex-start; }
.pv-at-centre { justify-content: center; }
.pv-at-right { justify-content: flex-end; }
.pv-logo-row { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.pv-logo-row.at-left { justify-content: flex-start; }
.pv-logo-row.at-centre { justify-content: center; }
.pv-logo-row.at-right { justify-content: flex-end; }
.pv-logo { height: 40px; width: auto; }
.pv-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #0948e6; margin: 0 0 4px; }

/* Preview: desktop width, and half-width questions side by side */
.preview-phone.is-desktop { width: min(100%, 860px); }
.pv-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.preview-phone.is-desktop .pv-grid { grid-template-columns: 1fr 1fr; }
.preview-phone.is-desktop .pv-full { grid-column: 1 / -1; }

/* Exams: live, alerts and results */
.live-wrap { display: flex; flex-direction: column; gap: 22px; }
.live-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.live-title h3 { margin: 0; font-size: 1rem; font-weight: 800; color: #0f172a; }
.live-pill { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; background: #dcfce7; color: #166534; border-radius: 999px; padding: 4px 10px; }
.live-pill-soft { background: #eef2ff; color: #1e3a8a; }
.live-empty { color: #64748b; font-size: 0.9rem; padding: 14px 16px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 16px; }
.live-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .live-grid { grid-template-columns: 1fr 1fr; } }
.live-card, .result-card, .alert-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 20px; padding: 14px 16px; box-shadow: 0 10px 24px -22px rgba(15, 18, 108, 0.5); }
.live-who, .result-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.live-who strong, .result-who strong, .alert-text strong { display: block; color: #0f172a; font-size: 0.95rem; }
.live-who small, .result-who small, .alert-text small { display: block; color: #64748b; font-size: 0.8rem; margin-top: 2px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #0948e6, #0f126c); color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: 0.8rem; flex: 0 0 auto; }
.live-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.live-stats > div { background: #f8fafc; border-radius: 14px; padding: 10px 12px; }
.live-stats small { display: block; color: #64748b; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.live-stats b { display: block; font-size: 1.15rem; color: #0f172a; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-timer.is-danger { background: #fef2f2 !important; }
.stat-timer.is-danger b { color: #b91c1c; animation: adminShake 0.6s ease-in-out infinite; display: inline-block; }
.stat-leave.is-danger b { color: #b91c1c; }
@keyframes adminShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.alert-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; }
.alert-dot { width: 9px; height: 9px; border-radius: 50%; background: #2563eb; flex: 0 0 auto; box-shadow: 0 0 0 4px #dbeafe; }
.alert-text { flex: 1; min-width: 0; }
.chip-btn { border: 1px solid #e2e8f0; background: #fff; color: #334155; border-radius: 999px; padding: 6px 12px; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.result-card { margin-bottom: 10px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.score { text-align: right; flex: 0 0 auto; }
.score b { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.score small { display: block; color: #64748b; font-size: 0.75rem; margin-top: 4px; }
.score-good b { color: #15803d; } .score-mid b { color: #b45309; } .score-low b { color: #b91c1c; }
.result-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.meta { background: #f1f5f9; color: #475569; border-radius: 999px; padding: 5px 10px; font-size: 0.78rem; }
.meta b { color: #0f172a; font-weight: 700; }
.review-btn { margin-top: 12px; width: 100%; border: 0; background: #eef2ff; color: #1e3a8a; border-radius: 14px; padding: 10px; font-weight: 800; font-size: 0.85rem; cursor: pointer; }
.review { margin-top: 10px; display: grid; gap: 8px; }
.qa { border: 1px solid #e2e8f0; border-radius: 16px; padding: 12px; }
.qa-right { border-color: #bbf7d0; background: #f0fdf4; }
.qa-wrong { border-color: #fecaca; background: #fef2f2; }
.qa-skip { border-color: #e2e8f0; background: #f8fafc; }
.qa-top { display: flex; align-items: flex-start; gap: 10px; }
.qa-num { width: 24px; height: 24px; border-radius: 50%; background: #0f126c; color: #fff; display: inline-grid; place-items: center; font-size: 0.75rem; font-weight: 800; flex: 0 0 auto; }
.qa-prompt { flex: 1; font-weight: 700; color: #0f172a; font-size: 0.9rem; line-height: 1.35; }
.qa-badge { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 999px; padding: 4px 9px; background: #fff; border: 1px solid #e2e8f0; color: #475569; flex: 0 0 auto; }
.qa-right .qa-badge { color: #15803d; border-color: #86efac; }
.qa-wrong .qa-badge { color: #b91c1c; border-color: #fca5a5; }
.qa-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; padding-left: 34px; }
.qa-lines small { display: block; color: #64748b; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.qa-lines b { color: #0f172a; font-size: 0.88rem; font-weight: 700; }

/* Exam links: people lists and places */
.time-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.time-presets .chip-btn.on { background: #0f126c; color: #fff; border-color: #0f126c; }
.link-list { display: grid; gap: 10px; }
.link-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 20px; padding: 14px 16px; box-shadow: 0 10px 24px -22px rgba(15, 18, 108, 0.5); }
.link-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.link-top strong { display: block; color: #0f172a; font-size: 0.95rem; }
.link-top small { display: block; color: #64748b; font-size: 0.8rem; margin-top: 2px; }
.status-pill { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 999px; padding: 4px 10px; background: #f1f5f9; color: #475569; flex: 0 0 auto; }
.status-pill.s-active { background: #dcfce7; color: #166534; }
.status-pill.s-used-up { background: #fef3c7; color: #92400e; }
.status-pill.s-expired, .status-pill.s-revoked { background: #fee2e2; color: #991b1b; }
.link-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.link-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip-btn.danger { color: #b91c1c; border-color: #fecaca; }
.people { margin-top: 12px; display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 10px; background: #f8fafc; border-radius: 14px; padding: 9px 12px; }
.person strong { display: block; font-size: 0.88rem; color: #0f172a; }
.person small { display: block; font-size: 0.75rem; color: #64748b; }
.person-state { margin-left: auto; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: #1d4ed8; }
.person.is-used { opacity: 0.6; }
.person.is-used .person-state { color: #15803d; }
.avatar.sm { width: 30px; height: 30px; font-size: 0.7rem; }

/* Student picker for exam links */
.picker { border: 1px solid #e2e8f0; border-radius: 18px; padding: 12px; margin: 0.4rem 0 0.8rem; background: #fafbff; }
.picker-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.picker-body { margin-top: 10px; display: grid; gap: 8px; }
.picker-filters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
@media (max-width: 640px) { .picker-filters { grid-template-columns: 1fr; } }
.picker-search { width: 100%; }
.picker-list { max-height: 260px; overflow: auto; display: grid; gap: 6px; }
.pick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 8px 10px; }
.pick-row strong { display: block; font-size: 0.88rem; color: #0f172a; }
.pick-row small { display: block; font-size: 0.74rem; color: #64748b; }
.pick-row.is-added { opacity: 0.55; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.picked-chip { background: #eef2ff; color: #1e3a8a; border-radius: 999px; padding: 5px 6px 5px 11px; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 6px; }
.picked-chip small { color: #475569; }
.picked-chip button { border: 0; background: #fff; border-radius: 999px; width: 22px; height: 22px; cursor: pointer; }

/* Live: identity photo and flags */
.id-photo { width: 52px; height: 52px; border-radius: 16px; object-fit: cover; flex: 0 0 auto; border: 2px solid #fff; box-shadow: 0 6px 14px -8px rgba(15,18,108,.6); }
.live-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.flag { font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 4px 10px; }
.flag.ok { background: #dcfce7; color: #166534; }
.flag.warn { background: #fef3c7; color: #92400e; }

/* Exam links: table with used details */
.table-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; overflow-x: auto; }
table.lk { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }
table.lk th { text-align: left; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; padding: 12px 14px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
table.lk td { padding: 12px 14px; border-bottom: 1px solid #eef2f7; vertical-align: middle; color: #0f172a; }
table.lk td strong { display: block; }
table.lk td small { display: block; color: #64748b; font-size: 0.74rem; margin-top: 2px; }
.used-btn { border: 1px solid #e2e8f0; background: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 0.82rem; cursor: pointer; color: #0f172a; }
.used-btn span { color: #64748b; margin-left: 4px; }
td.acts { white-space: nowrap; }
tr.sub-row > td { background: #fafbff; padding: 12px 14px 16px; }
table.inner { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.inner th { text-align: left; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: #64748b; padding: 8px 10px; border-bottom: 1px solid #e2e8f0; }
table.inner td { padding: 9px 10px; border-bottom: 1px solid #eef2f7; color: #0f172a; }

.lock-box { border: 1px solid #e2e8f0; border-radius: 16px; padding: 12px; margin: 0.4rem 0 0.8rem; background: #fafbff; }
.lock-fields { margin-top: 8px; display: grid; gap: 4px; }

.trash-bar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
