/* The Tax Pro Portal — one stylesheet for the whole portal. Tokens follow the Base44 prototype. */
:root {
  --bg: #f4f6f9;
  --fg: hsl(220 35% 9%);
  --card: #fff;
  --primary: hsl(221 83% 48%);
  --brand: var(--primary);
  --accent: hsl(174 72% 36%);
  --muted: hsl(214 20% 95%);
  --muted-fg: hsl(220 12% 46%);
  --soft: #94a3b8;
  --border: hsl(214 20% 88%);
  --line: #e2e8f0;
  --danger: hsl(0 72% 51%);
  --success: hsl(142 71% 42%);
  --warning: hsl(38 92% 50%);
  --radius: .625rem;
  --side: #0d1525;
  --side-w: 248px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-card: 0 1px 3px 0 rgba(0,0,0,.05), 0 1px 2px -1px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 20px -4px rgba(0,0,0,.08), 0 2px 8px -2px rgba(0,0,0,.05);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "cv02","cv03","cv04","cv11"; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
[hidden] { display: none !important; }
.ic { width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted-fg); }
.center { text-align: center; }
.grow { flex: 1; }

/* ---------- Frame ---------- */
.app { display: flex; min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--side-w); background: var(--side); border-right: 1px solid rgba(255,255,255,.04); display: flex; flex-direction: column; user-select: none; transition: transform .3s ease; }
.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; min-height: 100vh; }
.scrim { display: none; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); }

.side-brand { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 16px; flex: none; text-decoration: none !important; }
.side-logo { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; color: #fff; background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 10px 15px -3px rgba(30,58,138,.4); }
.side-logo .ic { width: 18px; height: 18px; }
/* A brand's logo sits on a white tile, so one made for a white page still shows on the navy menu. */
.side-logo.is-img { width: auto; min-width: 36px; max-width: 96px; padding: 4px 6px; background: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.side-logo.is-img img { display: block; max-width: 100%; max-height: 28px; object-fit: contain; }
.side-brand-text, .side-chip-text, .side-user-text { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.side-brand-text strong { color: #fff; font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-brand-text small { color: rgba(255,255,255,.35); font-size: 10.5px; font-weight: 500; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-chip { margin: 0 12px 12px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; border-radius: 8px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); flex: none; }
.side-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 1px 2px rgba(52,211,153,.5); flex: none; }
.side-chip-text strong { color: rgba(255,255,255,.8); font-size: 11.5px; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-chip-text small { color: rgba(255,255,255,.3); font-size: 10px; font-weight: 500; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-rule { height: 1px; margin: 0 12px 8px; background: rgba(255,255,255,.06); flex: none; }

.side-nav { flex: 1; overflow-y: auto; padding: 4px 8px; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-label { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; margin-bottom: 6px; background: none; border: 0; cursor: pointer; color: rgba(255,255,255,.2); }
.nav-label span { font-size: 9px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.nav-label .ic { width: 12px; height: 12px; color: rgba(255,255,255,.15); transition: transform .2s; }
.nav-label:hover .ic { color: rgba(255,255,255,.3); }
.nav-group.is-collapsed .nav-label .ic { transform: rotate(-90deg); }
.nav-group.is-collapsed .nav-items { display: none; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500; color: rgba(255,255,255,.4); text-decoration: none !important; transition: all .15s; }
.nav-item .ic { width: 14px; height: 14px; color: rgba(255,255,255,.25); transition: color .15s; }
.nav-item span { flex: 1; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.05); }
.nav-badge { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; }
.nav-item:hover .ic { color: rgba(255,255,255,.6); }
.nav-item.is-on { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.nav-item.is-on .ic { color: #60a5fa; color: color-mix(in srgb, var(--brand) 45%, #fff); }
.nav-item.is-on::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 99px 99px 0; background: #60a5fa; background: color-mix(in srgb, var(--brand) 55%, #fff); }

.side-user { padding: 8px 8px 12px; flex: none; }
.side-user .side-rule { margin: 0 4px 12px; }
.side-user-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; transition: background .15s; }
.side-user-row:hover { background: rgba(255,255,255,.06); }
.side-user-text strong { color: #fff; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: rgba(255,255,255,.35); font-size: 10px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-out { margin: 0; display: flex; }
.side-out button { background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 6px; color: rgba(255,255,255,.3); display: flex; }
.side-out button:hover { color: #f87171; background: rgba(248,113,113,.1); }
.side-out .ic { width: 13px; height: 13px; }

.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 700; background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.avatar-sm { width: 24px; height: 24px; font-size: 9px; }

.top { height: 58px; flex: none; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 0 24px; background: rgba(255,255,255,.9); backdrop-filter: blur(4px); border-bottom: 1px solid rgba(226,232,240,.7); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.top-menu { display: none; width: 32px; height: 32px; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: none; color: #64748b; cursor: pointer; }
.top-menu:hover { background: #f1f5f9; }
.top-title { font-size: 15px; font-weight: 700; color: #0f172a; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-user { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 4px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: #334155; text-decoration: none !important; }
.top-user:hover { background: #f1f5f9; }

.content { flex: 1; }
.wrap { max-width: 1400px; margin: 0 auto; padding: 24px; }
@media (min-width: 1024px) { .wrap { padding: 32px; } }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-enter { animation: page-in .22s ease-out; }
@media (prefers-reduced-motion: reduce) { .page-enter { animation: none; } * { transition: none !important; } }

/* ---------- Page pieces ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: #0f172a; }
.page-desc { color: var(--muted-fg); font-size: 13.5px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stack > * + * { margin-top: 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: calc(var(--radius) - 2px); border: 1px solid transparent; font-size: 13.5px; font-weight: 500; line-height: 1; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, box-shadow .15s, border-color .15s, opacity .15s; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: #fff; color: var(--fg); border-color: var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn-outline:hover { background: var(--muted); }
.btn-ghost { background: none; color: var(--muted-fg); }
.btn-ghost:hover { background: var(--muted); color: var(--fg); }
.btn-danger { background: #fff; color: var(--danger); border-color: hsl(0 72% 51% / .35); }
.btn-danger:hover { background: hsl(0 72% 51% / .06); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-card); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; }
.card-head h3 { font-size: 14px; font-weight: 700; color: #0f172a; letter-spacing: -.01em; }
.card-actions { display: flex; gap: 8px; }
.card-body { padding: 20px; }
.card-flush .card-body { padding: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.stat { position: relative; display: block; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; color: inherit; text-decoration: none !important; transition: all .2s; }
.stat-link:hover { border-color: #cbd5e1; box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat-link::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; opacity: 0; transition: opacity .2s; background: var(--brand); }
.stat-link:hover::before { opacity: 1; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.stat-ic { width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px rgba(0,0,0,.05); flex: none; }
.stat-go { width: 14px; height: 14px; color: #cbd5e1; opacity: 0; transition: opacity .2s; }
.stat-link:hover .stat-go { opacity: 1; }
.stat-pill { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid #fef3c7; background: #fffbeb; color: #b45309; }
.stat-title { font-size: 11.5px; font-weight: 600; color: var(--soft); letter-spacing: -.01em; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; color: #0f172a; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11px; font-weight: 500; color: var(--soft); margin-top: 6px; }
.tone-blue { background: #eff6ff; color: #2563eb; } .tone-violet { background: #f5f3ff; color: #7c3aed; } .tone-emerald { background: #ecfdf5; color: #059669; }
.tone-amber { background: #fffbeb; color: #d97706; } .tone-rose { background: #fff1f2; color: #e11d48; } .tone-slate { background: #f8fafc; color: #475569; } .tone-teal { background: #f0fdfa; color: #0d9488; }
.tone-line-violet::before { background: #8b5cf6; } .tone-line-emerald::before { background: #10b981; } .tone-line-amber::before { background: #f59e0b; } .tone-line-rose::before { background: #f43f5e; } .tone-line-teal::before { background: #14b8a6; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; border: 1px solid; font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; }
.badge-emerald { background: #ecfdf5; color: #047857; border-color: #d1fae5; } .badge-amber { background: #fffbeb; color: #b45309; border-color: #fef3c7; }
.badge-rose { background: #fff1f2; color: #be123c; border-color: #ffe4e6; } .badge-slate { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.badge-blue { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; } .badge-violet { background: #f5f3ff; color: #6d28d9; border-color: #ede9fe; }

.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 20px; border-radius: 10px; border: 1px solid #d1fae5; background: #ecfdf5; color: #065f46; font-size: 13.5px; font-weight: 500; }
.flash-err { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

.empty { text-align: center; padding: 56px 16px; color: var(--muted-fg); }
.empty-ic { width: 48px; height: 48px; opacity: .2; margin-bottom: 12px; }
.empty-title { font-weight: 600; color: #334155; }
.empty-text { font-size: 13.5px; margin-top: 4px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-fg); pointer-events: none; }
.search .input { padding-left: 36px; }
.filters .filter-select { width: 170px; flex: none; }
.filters .btn { flex: none; }

.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.org-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; color: inherit; text-decoration: none !important; box-shadow: var(--shadow-card); transition: all .2s; }
.org-card:hover { border-color: #cbd5e1; box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.org-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.org-name { font-size: 15px; font-weight: 700; color: #0f172a; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-type { font-size: 12px; color: var(--soft); font-weight: 500; margin-top: 2px; }
.org-meta { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #f1f5f9; font-size: 12.5px; color: var(--muted-fg); }
.org-meta span { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-meta .ic { width: 13px; height: 13px; color: var(--soft); }

.split { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 1024px) { .split { grid-template-columns: 2fr 1fr; } }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; box-shadow: var(--shadow-card); }
.hero h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: #0f172a; }
.hero p { color: var(--muted-fg); font-size: 13.5px; margin-top: 4px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.list li:last-child { border-bottom: 0; }
.list .li-main { flex: 1; min-width: 0; }
.list .li-main strong { display: block; font-weight: 600; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .li-main small { color: var(--soft); font-size: 11.5px; }
.list .li-side { color: var(--soft); font-size: 11.5px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.quick { display: flex; flex-direction: column; gap: 8px; }
.quick .btn { justify-content: flex-start; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; }
.tab { padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--muted-fg); border-bottom: 2px solid transparent; text-decoration: none !important; white-space: nowrap; }
.tab:hover { color: var(--fg); }
.tab.is-on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 20px; font-size: 11px; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .05em; background: hsl(214 20% 95% / .4); white-space: nowrap; }
.data-table td { padding: 12px 20px; border-top: 1px solid hsl(214 20% 88% / .5); vertical-align: middle; }
.data-table tbody tr:hover { background: hsl(214 20% 95% / .3); }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-person strong { display: block; font-weight: 600; color: #0f172a; }
.cell-person small { color: var(--soft); font-size: 11.5px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.details { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 24px; }
.details dt { font-size: 11px; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.details dd { margin: 0; font-size: 13.5px; font-weight: 500; color: #0f172a; word-break: break-word; }

.org-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.org-head .stat-ic { width: 48px; height: 48px; border-radius: 14px; }
.org-head .stat-ic .ic { width: 22px; height: 22px; }
.org-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: #0f172a; }
.org-head .crumbs { font-size: 12.5px; color: var(--muted-fg); margin-top: 2px; }
.org-head .badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.org-head form { margin: 0; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 13px; font-weight: 500; color: #0f172a; margin-bottom: 6px; }
.req { color: var(--danger); }
.input { display: block; width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: #fff; color: var(--fg); font: inherit; font-size: 13.5px; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 8px 12px; resize: vertical; }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.input::placeholder { color: #94a3b8; }
.input[readonly] { background: var(--muted); color: var(--muted-fg); }
.hint { font-size: 12px; color: var(--muted-fg); margin-top: 6px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; flex: none; accent-color: var(--brand); }   /* flex: none: a long label must not squeeze the box */
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.dlg { width: min(32rem, calc(100vw - 32px)); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--fg); box-shadow: 0 24px 64px -12px rgba(0,0,0,.18), 0 8px 24px -8px rgba(0,0,0,.1); overflow: hidden; }
.dlg[open] { display: flex; flex-direction: column; }
.dlg::backdrop { background: rgba(15,23,42,.6); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 8px; }
.dlg-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.dlg-x { border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--muted-fg); display: flex; }
.dlg-x:hover { background: var(--muted); color: var(--fg); }
.dlg-body { padding: 8px 24px 24px; overflow-y: auto; }
.dlg-note { font-size: 13px; color: var(--muted-fg); margin-bottom: 16px; }

.copy-row { display: flex; gap: 8px; }
.copy-row .input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.input[type=file] { height: auto; padding: 7px 10px; font-size: 13px; }

/* ---------- Tickets ---------- */
.tk-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tk-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-top: 3px solid #cbd5e1; border-radius: 12px; color: inherit; text-decoration: none !important; box-shadow: var(--shadow-card); transition: all .2s; }
.tk-tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.tk-tile.is-on { border-color: var(--brand); border-top-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.tk-tile strong { font-size: 24px; font-weight: 800; line-height: 1.1; color: #0f172a; font-variant-numeric: tabular-nums; }
.tk-tile span { font-size: 12.5px; font-weight: 600; color: #334155; }
.tk-tile small { font-size: 11px; color: var(--soft); }
.tone-edge-blue { border-top-color: #3b82f6; } .tone-edge-violet { border-top-color: #8b5cf6; } .tone-edge-amber { border-top-color: #f59e0b; } .tone-edge-slate { border-top-color: #cbd5e1; }
.tk-title { color: #0f172a; text-decoration: none; }
.tk-title:hover strong { color: var(--brand); }
.tk-age { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--soft); }
.tk-age.is-amber { color: #b45309; } .tk-age.is-red { color: #b91c1c; }
.tk-narrow { max-width: 760px; }
.tk-body { font-size: 14px; line-height: 1.7; color: #0f172a; word-break: break-word; }
.tk-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tk-file { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 12.5px; font-weight: 500; color: #0f172a; text-decoration: none !important; }
a.tk-file:hover { border-color: var(--brand); color: var(--brand); }
.tk-file.is-off { background: var(--muted); color: var(--muted-fg); }
.tk-file .ic { width: 13px; height: 13px; }
.tk-msg { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid #f1f5f9; }
.tk-msg:first-child { border-top: 0; padding-top: 0; }
.tk-msg:last-child { padding-bottom: 0; }
.tk-msg-main { flex: 1; min-width: 0; }
.tk-msg-who { font-size: 13px; margin-bottom: 4px; }
.tk-msg-who .muted { font-size: 11.5px; margin-left: 6px; }
.tk-msg-text { font-size: 14px; line-height: 1.65; word-break: break-word; }
.tk-msg.is-team .avatar { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.tk-msg.is-note { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 12px; margin: 10px 0; }
.tk-msg.is-note .avatar { background: #94a3b8; }
.tk-event { padding: 8px 0; border-top: 1px solid #f1f5f9; font-size: 12px; color: var(--soft); text-align: center; }
.tk-event:first-child { border-top: 0; }

/* ---------- EFIN branches ---------- */
.efin { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; border: 1px solid var(--line); font: 600 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; color: #0f172a; white-space: nowrap; }
.efin.is-master { background: #eff6ff; border-color: #dbeafe; color: #1d4ed8; }
.efin.is-none { background: #fff; border-style: dashed; color: var(--soft); font-weight: 500; letter-spacing: 0; font-family: inherit; }
.branch { list-style: none; margin: 0; padding: 0; }
.branch .branch { margin-left: 18px; padding-left: 14px; border-left: 2px solid #e2e8f0; }
.branch-row { display: flex; align-items: center; gap: 10px; padding: 9px 20px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.branch .branch .branch-row { padding-left: 6px; }
.branch-row .stat-ic { width: 28px; height: 28px; border-radius: 8px; }
.branch-row .stat-ic .ic { width: 14px; height: 14px; }
.branch-name { flex: 1; min-width: 0; }
.branch-name a { color: #0f172a; font-weight: 600; text-decoration: none; }
.branch-name a:hover { color: var(--brand); }
.branch-name small { display: block; color: var(--soft); font-size: 11.5px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); background: #fff; color: #334155; font-size: 12.5px; font-weight: 500; text-decoration: none !important; }
.pill b { font-weight: 700; color: #0f172a; }
.pill.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill.is-on b { color: #fff; }
.result-list { margin: 0; padding-left: 18px; font-size: 13px; }
.result-list li { margin-bottom: 4px; }
.result-list code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: #f8fafc; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.list .li-side form { margin: 0; }
.list .li-side .efin { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---------- Onboarding ---------- */
.tk-tiles.onb-tiles { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.onb-steps { list-style: none; margin: 0 0 20px; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.onb-step { flex: 1; min-width: 190px; }
.onb-step-in { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; color: var(--muted-fg); text-decoration: none !important; box-shadow: var(--shadow-card); }
a.onb-step-in:hover { border-color: #cbd5e1; }
.onb-step .num { width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; background: #f1f5f9; font-weight: 700; font-size: 12px; color: #475569; flex: none; }
.onb-step .num .ic { width: 15px; height: 15px; }
.onb-step strong { display: block; color: #0f172a; font-weight: 600; }
.onb-step small { font-size: 11.5px; }
.onb-step.is-done .num { background: #ecfdf5; color: #059669; }
.onb-step.is-back .num { background: #fff1f2; color: #e11d48; }
.onb-step.is-on .onb-step-in { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.onb-step.is-on .num { background: var(--brand); color: #fff; }
.onb-note { display: flex; gap: 10px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; border-radius: 10px; font-size: 13.5px; }
.onb-note .ic { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.onb-info { padding: 12px 14px; margin-bottom: 16px; border: 1px solid #dbeafe; background: #eff6ff; color: #1e3a8a; border-radius: 10px; font-size: 13.5px; line-height: 1.7; }
.onb-block + .onb-block { margin-top: 18px; padding-top: 18px; border-top: 1px solid #f1f5f9; }
.onb-block-head { margin-bottom: 10px; font-size: 14px; }
.onb-block-head .muted { font-size: 12px; }

/* ---------- Agreements ---------- */
/* What a signature also covers (fees, a split), above the wording. */
.agr-sum { margin: 0 0 14px; padding: 14px 18px 6px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.agr-sum h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: #0f172a; }
.agr-sum .details { margin: 0; }
.agr-doc { max-height: 440px; overflow-y: auto; padding: 18px 20px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13.5px; line-height: 1.7; color: #1e293b; }
.agr-doc.is-raw { max-height: 560px; }
.agr-doc h4 { margin: 16px 0 6px; font-size: 13.5px; font-weight: 700; color: #0f172a; }
.agr-doc h4:first-child { margin-top: 0; }
.agr-doc p { margin: 0 0 10px; }
.agr-sign { margin-top: 18px; display: grid; gap: 14px; }
.agr-sig-pad { position: relative; border: 1px dashed #94a3b8; border-radius: 10px; background: #fff; overflow: hidden; }
.agr-sig-pad.is-error { border-color: #e11d48; border-style: solid; }
.agr-sig-canvas { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; }
.agr-sig-clear { position: absolute; top: 8px; right: 8px; }
.agr-editor textarea.input { font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 420px; }
.agr-fields { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.agr-fields li { padding: 7px 0; border-bottom: 1px solid #f1f5f9; }
.agr-fields li:last-child { border-bottom: 0; }
.agr-fields code, .dlg-note code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: #f8fafc; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
/* Rows that carry an EFIN and buttons: on a narrow screen the buttons drop under the text instead of squeezing it. */
.efin-rows li { flex-wrap: wrap; }
.efin-rows .li-main { min-width: 200px; }
.efin-rows .li-main strong { white-space: normal; }
.efin-rows .li-side { flex-wrap: wrap; margin-left: auto; }
@media (max-width: 560px) {
  .efin-rows .li-side { margin-left: 48px; }
  .branch .branch { margin-left: 8px; padding-left: 8px; }
  .branch-row { padding: 9px 12px; gap: 8px; flex-wrap: wrap; }
  .branch-row .branch-name { min-width: 150px; }
}
.pills + .pills { margin-top: -4px; }
.pills:last-of-type { margin-bottom: 16px; }

/* ---------- Gravity Forms inside the portal (its own stylesheet is switched off here) ---------- */
.tpp-gf .gform_heading, .tpp-gf .gform_validation_container, .tpp-gf .gform_hidden, .tpp-gf .gf_invisible, .tpp-gf .screen-reader-text { display: none !important; }
.tpp-gf fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.tpp-gf .gfield { margin: 0 0 18px; }
.tpp-gf .gfield_label, .tpp-gf legend.gfield_label { display: block; font-size: 13px; font-weight: 500; color: #0f172a; margin-bottom: 6px; padding: 0; }
.tpp-gf .gfield_required { color: var(--danger); margin-left: 4px; font-size: 11.5px; font-weight: 500; }
.tpp-gf .gfield_required .gfield_required { margin-left: 0; }
.tpp-gf input[type=text], .tpp-gf input[type=email], .tpp-gf input[type=tel], .tpp-gf input[type=number], .tpp-gf input[type=url], .tpp-gf input[type=file], .tpp-gf select, .tpp-gf textarea {
  display: block; width: 100%; min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: #fff; color: var(--fg); font: inherit; font-size: 13.5px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.tpp-gf textarea { padding: 8px 12px; min-height: 130px; resize: vertical; }
.tpp-gf input[type=file] { padding: 7px 10px; font-size: 13px; }
.tpp-gf select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.tpp-gf input:focus, .tpp-gf select:focus, .tpp-gf textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.tpp-gf .gfield_description, .tpp-gf .gform_fileupload_rules, .tpp-gf .charleft { display: block; font-size: 12px; color: var(--muted-fg); margin-top: 6px; }
.tpp-gf .gfield_error input, .tpp-gf .gfield_error select, .tpp-gf .gfield_error textarea { border-color: var(--danger); }
.tpp-gf .validation_message { font-size: 12px; font-weight: 500; color: #b91c1c; margin-top: 6px; }
.tpp-gf .gform_validation_errors { padding: 12px 16px; margin-bottom: 20px; border-radius: 10px; border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; }
.tpp-gf .gform_validation_errors h2 { font-size: 13.5px; font-weight: 600; margin: 0; }
.tpp-gf .gform_validation_errors ol { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
.tpp-gf .gform_validation_errors a { color: inherit; }
.tpp-gf .gform_footer, .tpp-gf .gform_page_footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.tpp-gf .gform_button, .tpp-gf .gform_next_button, .tpp-gf .gform_previous_button { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px; border: 1px solid transparent; border-radius: calc(var(--radius) - 2px); background: var(--brand); color: #fff; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tpp-gf .gform_button:hover, .tpp-gf .gform_next_button:hover { opacity: .9; }
.tpp-gf .gform_previous_button { background: #fff; color: var(--fg); border-color: var(--border); }
.tpp-gf .gform_ajax_spinner { margin-left: 8px; }
.tpp-gf .gchoice { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13.5px; }
.tpp-gf .gform_confirmation_message { padding: 12px 16px; border-radius: 10px; border: 1px solid #d1fae5; background: #ecfdf5; color: #065f46; font-weight: 500; }

/* ---------- Signed-out screens ---------- */
body.auth { background: hsl(225 35% 8%); color: #fff; }
.auth-wrap { min-height: 100vh; display: flex; }
.auth-left { display: none; position: relative; overflow: hidden; width: 52%; padding: 56px; flex-direction: column; justify-content: space-between; }
@media (min-width: 1024px) { .auth-left { display: flex; } }
.glow { position: absolute; border-radius: 50%; pointer-events: none; }
.g1 { top: 40px; left: 40px; width: 384px; height: 384px; background: rgba(37,99,235,.1); filter: blur(64px); }
.g2 { bottom: 80px; right: 0; width: 288px; height: 288px; background: rgba(6,182,212,.08); filter: blur(64px); }
.g3 { top: 50%; left: 33%; width: 192px; height: 192px; background: rgba(30,64,175,.1); filter: blur(40px); }
.auth-brand { position: relative; display: flex; align-items: center; gap: 12px; color: #fff; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.auth-logo { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(59,130,246,.2); border: 1px solid rgba(96,165,250,.3); color: #60a5fa; flex: none; }
.auth-logo .ic { width: 24px; height: 24px; }
.auth-logo.is-img { width: auto; height: 48px; max-width: 220px; padding: 6px 10px; background: #fff; border: 1px solid rgba(15,23,42,.08); }
.auth-logo.is-img img { display: block; max-width: 100%; max-height: 36px; object-fit: contain; }
.auth-help { margin-top: 18px; }
.auth-powered { margin-top: 10px; text-align: center; font-size: 11.5px; color: #94a3b8; }
.auth-hero { position: relative; }
.auth-hero h1 { font-size: 48px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; color: #fff; }
.auth-hero h1 span { color: #60a5fa; }
.auth-hero p { margin-top: 20px; max-width: 24rem; font-size: 18px; line-height: 1.6; color: rgba(191,219,254,.6); }
.auth-points { list-style: none; margin: 40px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; color: rgba(219,234,254,.8); }
.auth-points li span { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: rgba(59,130,246,.15); border: 1px solid rgba(96,165,250,.2); color: #60a5fa; flex: none; }
.auth-points .ic { width: 20px; height: 20px; }
.auth-copy { position: relative; font-size: 12px; color: rgba(147,197,253,.25); }
.auth-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
@media (min-width: 1024px) { .auth-right { padding: 48px; } }
.auth-box { width: 100%; max-width: 28rem; }
.auth-brand-m { justify-content: center; font-size: 18px; margin-bottom: 32px; }
.auth-brand-m .auth-logo { width: 36px; height: 36px; }
.auth-brand-m .auth-logo .ic { width: 20px; height: 20px; }
@media (min-width: 1024px) { .auth-brand-m { display: none; } }
.auth-box h2 { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; color: #fff; }
.auth-sub { margin-top: 8px; font-size: 14px; line-height: 1.6; color: rgba(191,219,254,.5); }
.auth-form { margin-top: 32px; display: flex; flex-direction: column; gap: 20px; }
.auth-field label { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 500; color: rgba(219,234,254,.7); margin-bottom: 6px; }
.auth-field label a { font-size: 12px; font-weight: 400; color: rgba(96,165,250,.7); }
.auth-field label a:hover { color: #60a5fa; text-decoration: none; }
.auth-input-wrap { position: relative; }
.auth-input { display: block; width: 100%; height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05); color: #fff; font: inherit; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.auth-input::placeholder { color: rgba(255,255,255,.25); }
.auth-input:focus { outline: none; border-color: rgba(59,130,246,.5); box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.auth-input[readonly] { color: rgba(255,255,255,.5); }
.auth-input-wrap .auth-input { padding-right: 48px; }
.auth-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 8px; cursor: pointer; color: rgba(255,255,255,.3); display: flex; }
.auth-eye:hover { color: rgba(255,255,255,.6); }
.auth-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: 0 10px 15px -3px rgba(30,58,138,.4); transition: background .15s; text-decoration: none !important; }
.auth-btn:hover { filter: brightness(1.12); }
.auth-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; padding: 12px 16px; border-radius: 12px; font-size: 14px; background: rgba(16,185,129,.1); border: 1px solid rgba(52,211,153,.2); color: #6ee7b7; }
.auth-note.is-err { background: rgba(239,68,68,.1); border-color: rgba(248,113,113,.2); color: #fca5a5; }
.auth-note .ic { margin-top: 2px; }
.auth-foot { margin-top: 20px; text-align: center; font-size: 14px; color: rgba(191,219,254,.4); }
.auth-foot a { color: rgba(96,165,250,.8); }
.auth-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .auth-two { grid-template-columns: 1fr; } .auth-box h2 { font-size: 26px; } }

/* ---------- Small screens ---------- */
@media (max-width: 1023px) {
  .side { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .top-menu { display: flex; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; }
  .top { padding: 0 16px; }
  .wrap { padding: 16px; }
  .top-user span:not(.avatar) { display: none; }
}

/* Fees */
.fee-form td { vertical-align: middle; }
.fee-in { position: relative; max-width: 132px; }
.fee-in > span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--soft); pointer-events: none; }
.fee-in .input { padding-left: 24px; }
.fee-confirm .card { border-color: #fcd34d; background: #fffbeb; }
.fee-change { margin: 0 0 16px; padding-left: 18px; font-size: 13.5px; line-height: 1.8; }
.fee-sub { margin: 0; padding: 14px 20px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--soft); }
.split-form { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin: 0; }
.split-form select.input { width: 150px; }
.split-form input.input { width: 84px; }
@media (max-width: 640px) {
  .split-form { flex-wrap: wrap; justify-content: flex-start; }
  /* On a phone the fee boxes stack under each software, each with its name, instead of scrolling sideways. */
  .fee-form thead { display: none; }
  .fee-form, .fee-form tbody, .fee-form tr, .fee-form td { display: block; width: 100%; }
  .fee-form tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .fee-form tr:last-child { border-bottom: 0; }
  .fee-form td { padding: 6px 0; border: 0; }
  .fee-form td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--soft); }
  .fee-in { max-width: none; }
}

/* Branding */
.brand-color { display: flex; gap: 8px; align-items: center; }
.brand-color input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; flex: none; }
.brand-color .input { max-width: 130px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.brand-slug { display: flex; align-items: center; gap: 6px; }
.brand-slug > span { font-size: 13px; color: var(--muted-fg); white-space: nowrap; }
.brand-slug .input { max-width: 240px; }
@media (max-width: 560px) { .brand-slug { flex-wrap: wrap; } .brand-slug .input { max-width: none; } }
.brand-logo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.brand-logo-now { display: inline-flex; align-items: center; justify-content: center; height: 52px; min-width: 52px; max-width: 220px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.brand-logo-now img { display: block; max-width: 100%; max-height: 40px; object-fit: contain; }
.brand-swatch { display: inline-block; width: 14px; height: 14px; margin-right: 8px; border-radius: 4px; vertical-align: -2px; box-shadow: inset 0 0 0 1px rgba(15,23,42,.15); }
.brand-preview { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.brand-pv-side { display: flex; align-items: center; gap: 12px; width: 240px; padding: 14px 16px; background: #0d1525; }
.brand-pv-main { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 220px; padding: 14px 18px; background: #f4f6f9; font-size: 13.5px; }
.form-sub { margin: 8px 0 -4px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 700; color: #0f172a; }

/* Messages */
.msg-row { display: flex; align-items: flex-start; gap: 10px; color: inherit; text-decoration: none !important; min-width: 220px; }
.msg-row > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.msg-row strong { font-weight: 500; color: #334155; }
.msg-row.is-new strong { font-weight: 700; color: #0f172a; }
.msg-row small { font-size: 12.5px; color: var(--muted-fg); }
.msg-row:hover strong { color: var(--brand); }
.msg-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 99px; background: var(--brand); }
.msg-meta { margin: 0 0 14px; font-size: 13px; color: var(--muted-fg); line-height: 1.6; }
.msg-meta strong { color: #0f172a; }
.msg-subject { margin: 0 0 12px; font-size: 17px; font-weight: 700; color: #0f172a; }
.msg-body { font-size: 14.5px; line-height: 1.7; color: #1e293b; word-break: break-word; }
.msg-body p { margin: 0 0 12px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-ask { margin-top: 20px; padding: 16px 18px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; }
.msg-ask p { margin: 0 0 12px; font-size: 13.5px; color: #78350f; }
.msg-done { display: flex; align-items: center; gap: 8px; margin: 20px 0 0; padding: 12px 16px; border: 1px solid #d1fae5; border-radius: 10px; background: #ecfdf5; color: #065f46; font-size: 13.5px; }
.msg-done .ic { width: 16px; height: 16px; flex: none; }
.msg-count { padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.msg-count > strong { display: block; font-size: 16px; color: #0f172a; }
.msg-count p { margin: 6px 0 0; font-size: 13.5px; color: #475569; }
.msg-count.is-none { border-color: #fecaca; background: #fef2f2; }
.msg-accounts { margin: 12px 0 0; padding: 0; list-style: none; max-height: 220px; overflow-y: auto; font-size: 13px; }
.msg-accounts li { padding: 6px 0; border-top: 1px solid var(--line); }
.msg-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; max-height: 260px; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.msg-pick .check { font-weight: 400; align-items: flex-start; }
.msg-pick .check input { margin-top: 2px; }
.msg-pick small { display: block; font-size: 11.5px; }
.msg-m { display: none; }
@media (max-width: 640px) {
  /* The notice board and Sent on a phone: the message column only, with what the other columns say under the subject. */
  .msg-list .data-table thead, .msg-list .data-table td:not(:first-child) { display: none; }
  .msg-list .data-table td { padding: 14px 16px; }
  .msg-list small.msg-m { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted-fg); }
  .msg-row { min-width: 0; }
}

/* Training */
.trn-sec + .trn-sec { margin-top: 28px; }
.trn-h { margin: 0 0 12px; font-size: 14px; font-weight: 700; color: #0f172a; }
.trn-h .muted { font-weight: 500; margin-left: 4px; }
.trn-card { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow-card); }
.trn-card-title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.35; color: #0f172a; }
.trn-card-title a { color: #0f172a; text-decoration: none; }
.trn-card-title a:hover { color: var(--brand); }
.trn-card-sum { margin: 0; font-size: 13px; color: #475569; line-height: 1.55; }
.trn-card-meta { margin: 0; font-size: 12px; color: var(--muted-fg); display: flex; align-items: center; gap: 6px; }
.trn-card-meta .ic { width: 14px; height: 14px; color: #059669; }
.trn-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; }
.trn-bar { height: 6px; border-radius: 99px; background: #e2e8f0; overflow: hidden; }
.trn-bar span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.trn-bar-note { margin: 4px 0 0; font-size: 12px; color: var(--muted-fg); }
.trn-sum { margin: 0 0 10px; font-size: 14.5px; line-height: 1.65; color: #1e293b; }
.trn-look { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; color: #1e3a8a; font-size: 13.5px; }
.trn-look .ic { width: 16px; height: 16px; flex: none; }
.trn-outline { list-style: none; margin: 0; padding: 0; }
.trn-outline > li + li { border-top: 1px solid var(--line); }
.trn-step-sec { padding: 10px 20px; background: #f8fafc; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-fg); }
.trn-step { display: flex; align-items: center; gap: 12px; padding: 13px 20px; color: inherit; text-decoration: none !important; font-size: 14px; }
a.trn-step:hover { background: #f8fafc; }
.trn-step-ic { flex: none; display: inline-flex; color: #64748b; }
.trn-step-ic .ic { width: 18px; height: 18px; }
.trn-step.is-done .trn-step-ic { color: #059669; }
.trn-step.is-locked { color: #94a3b8; }
.trn-step-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.trn-step-t small { font-weight: 400; font-size: 12px; }
.trn-step-k { flex: none; font-size: 12px; color: var(--muted-fg); }
.trn-edit-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.trn-edit-acts { display: flex; align-items: center; gap: 4px; flex: none; }
.trn-edit-acts form { display: inline-flex; }
.trn-edit-acts button[disabled] { opacity: .3; cursor: default; }
.trn-video { position: relative; padding-top: 56.25%; margin-bottom: 18px; border-radius: 10px; overflow: hidden; background: #0f172a; }
.trn-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.trn-text { font-size: 15px; line-height: 1.75; color: #1e293b; word-break: break-word; }
.trn-text h3 { margin: 22px 0 8px; font-size: 17px; font-weight: 700; color: #0f172a; }
.trn-text h4 { margin: 18px 0 6px; font-size: 15px; font-weight: 700; color: #0f172a; }
.trn-text > :first-child { margin-top: 0; }
.trn-text p { margin: 0 0 14px; }
.trn-text ul, .trn-text ol { margin: 0 0 14px; padding-left: 22px; }
.trn-text li { margin-bottom: 4px; }
.trn-pic { display: block; max-width: 100%; height: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 10px; }
.trn-files { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.trn-files-h { flex-basis: 100%; margin: 0 0 2px; font-size: 12px; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .05em; }
.trn-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.trn-foot form { margin-left: auto; }
.trn-done-note { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; font-weight: 600; color: #059669; }
.trn-done-note .ic { width: 16px; height: 16px; }
.trn-q { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.trn-q.is-missed { border-color: #fecaca; background: #fef2f2; }
.trn-q-t { margin: 0 0 10px; padding: 0; font-size: 14.5px; font-weight: 600; color: #0f172a; line-height: 1.5; }
/* A legend sits on the border by default, and a long question then wraps across it: float it so it reads as the first line inside the box. */
fieldset.trn-q > legend.trn-q-t { float: left; width: 100%; }
fieldset.trn-q > legend.trn-q-t + * { clear: both; }
.msg-done + .trn-q { margin-top: 16px; }
.trn-choice { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 7px 0; font-size: 14px; cursor: pointer; }
.trn-choice input { margin-top: 3px; width: 16px; height: 16px; flex: none; accent-color: var(--brand); }
p.trn-choice { cursor: default; color: #475569; }
.trn-choice.is-right { color: #065f46; font-weight: 600; }
.trn-choice .ic { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.trn-dot { width: 16px; height: 16px; flex: none; margin-top: 3px; border: 1.5px solid #cbd5e1; border-radius: 99px; }
.trn-result { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 12px 16px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #78350f; font-size: 13.5px; }
.trn-result .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.trn-ticks { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 4px 0; }
.trn-assigns { list-style: none; margin: 0; padding: 0; }
.trn-assigns li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 20px; font-size: 13.5px; }
.trn-assigns li + li { border-top: 1px solid var(--line); }
.trn-status { margin: 0; font-size: 13px; }
.trn-qedit { margin: 0 0 14px; padding: 14px 16px 4px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.trn-qedit legend { padding: 0 6px; font-size: 12.5px; font-weight: 700; color: #0f172a; }
.trn-filelist { list-style: none; margin: 0 0 16px; padding: 0; }
.trn-filelist li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.trn-filelist .ic { width: 14px; height: 14px; vertical-align: -2px; color: #64748b; }
.trn-more { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) {
  .trn-edit-row { flex-wrap: wrap; }
  .trn-edit-row .trn-step-t { flex-basis: calc(100% - 30px); }
  .trn-edit-acts { margin-left: 30px; }
  .card-head, .card-actions { flex-wrap: wrap; }
  .trn-tbl td:first-child { min-width: 170px; }
  .trn-assigns li { flex-direction: column; align-items: flex-start; }
  .trn-step-k { display: none; }
}
