:root,
html[data-theme="dark"] {
  --black: #000000;
  --ink: #f2f1ef;
  --muted: #85868b;
  --line: #3a3c42;
  --paper: #1b1c20;
  --page: #0d0e10;
  --card: #16171a;
  --red: #e8112d;
  --red-dark: #9e0000;
  --red-soft: #fff1f1;
  --ok: #1f7a45;
  --ok-soft: #e8f6ee;
  --warn: #9a6b1f;
  --warn-soft: #fff6e5;
  --bad: #9e0000;
  --bad-soft: #fff1f1;
  --font-display: "Archivo Narrow", Archivo, sans-serif;
  --font-body: Archivo, Helvetica, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --touch: 44px;
  --radius-chip: 0;
  --radius-card: 0;
  --radius-panel: 0;
  --card-shadow: 0 6px 20px rgba(0, 0, 0, 0.65);
  color-scheme: dark;
}

html[data-theme="light"] {
  --ink: #111;
  --muted: #6b6b6b;
  --line: #eae8e4;
  --paper: #fafaf8;
  --page: #fafaf8;
  --card: #ffffff;
  --card-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  color-scheme: light;
}

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, var(--safe-top)) max(24px, var(--safe-right)) max(24px, var(--safe-bottom)) max(24px, var(--safe-left));
  background:
    radial-gradient(700px 280px at 50% 0%, rgba(227, 0, 0, 0.18), transparent 60%),
    #000;
}

.gate-card {
  width: min(100%, 380px);
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 4px solid var(--red);
  padding: 28px 24px 24px;
  text-align: center;
  color: #fff;
  animation: brand-in 420ms ease-out both;
}

.performance-unlock {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}

.performance-unlock.hidden,
.performance-unlock[hidden] {
  display: none;
}

.performance-unlock-card {
  width: min(100%, 380px);
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 4px solid var(--red);
  padding: 24px;
  color: #fff;
  text-align: left;
}

.performance-unlock-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.performance-unlock-card .sub {
  color: #bdbdbd;
  margin: 0 0 14px;
}

.performance-unlock-card input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  margin: 6px 0 14px;
  padding: 10px 12px;
  border: 1px solid #333;
  background: #000;
  color: #fff;
  font: inherit;
}

.performance-unlock-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.cash-unlock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.32;
  cursor: pointer;
}

.cash-unlock-btn:hover,
.cash-unlock-btn:focus-visible {
  opacity: 0.85;
}

.cash-unlock-btn.is-unlocked {
  opacity: 0.55;
}

.cash-heading {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-metric.cash-locked .value,
.stat.cash-locked .value {
  color: var(--muted);
  letter-spacing: 0.18em;
}

.clubhouse-dialog {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 280px at 50% 0%, rgba(227, 0, 0, 0.18), transparent 60%),
    rgba(0, 0, 0, 0.72);
}

.clubhouse-dialog.hidden,
.clubhouse-dialog[hidden] {
  display: none !important;
}

.clubhouse-dialog-card {
  width: min(100%, 400px);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  padding: 24px 24px 20px;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.clubhouse-dialog-logo {
  width: 72px;
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.clubhouse-dialog-kicker {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

.clubhouse-dialog-card h2 {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
}

.clubhouse-dialog-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.clubhouse-dialog-card .gate-label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clubhouse-dialog-card input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 16px;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.clubhouse-dialog-card input[type="text"]:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.clubhouse-dialog-card textarea {
  width: 100%;
  min-height: 120px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.clubhouse-dialog-card textarea:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.clubhouse-dialog-card-wide {
  width: min(100%, 480px);
}

.clubhouse-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.clubhouse-dialog-card .btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.clubhouse-dialog-card .btn-secondary:hover:not(:disabled),
.clubhouse-dialog-card .btn-secondary:focus-visible {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}

.clubhouse-dialog-card .btn-danger {
  background: #9e0000;
  color: #fff;
  border: 0;
}

.about-dialog-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}

.about-dialog-title .brand-line:first-child {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
}

.about-dialog-meta {
  margin: 4px 0 20px;
  display: grid;
  gap: 12px;
}

.about-dialog-meta > div {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.about-dialog-meta dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-dialog-meta dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-all;
}

.about-dialog-actions {
  justify-content: center;
}

.gate-logo {
  width: 140px;
  height: auto;
  margin: 0 auto 10px;
  display: block;
}

.gate-kicker {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #bdbdbd;
}

.gate-card h1 {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: clamp(1.45rem, 5.2vw, 2rem);
  line-height: 0.95;
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
}

.gate-card h1 .brand-line:first-child {
  color: #bdbdbd;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.gate-card h1 .brand-line:last-child {
  color: #fff;
}

.gate-card h1 .accent {
  color: var(--red);
}

.gate-sub {
  margin: 0 0 18px;
  color: #b5b5b5;
  font-size: 0.95rem;
}

.gate-label {
  display: block;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cfcfcf;
  margin-bottom: 6px;
}

.gate-card input[type="password"] {
  width: 100%;
  border: 1px solid #3a3a3a;
  background: #000;
  color: #fff;
  border-radius: var(--radius-card);
  padding: 14px 12px;
  font: inherit;
  font-size: 16px;
  margin-bottom: 12px;
  min-height: var(--touch);
}

.gate-card input[type="password"]:focus {
  outline: 2px solid rgba(227, 0, 0, 0.45);
  border-color: var(--red);
}

.gate-submit {
  width: 100%;
}

.google-signin-button {
  display: grid;
  place-items: center;
  margin: 16px 0 4px;
  min-height: 44px;
}

.gate-google-hint {
  margin: 8px 0 0;
  color: #9a9a9a;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
}

.gate-or {
  margin: 14px 0 10px;
  color: #888;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.gate-password-block {
  text-align: left;
}

.gate-password-block[hidden] {
  display: none !important;
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  margin-top: 0;
}

.session-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  cursor: pointer;
  text-align: right;
}

button.session-user:hover .session-name,
button.session-user:focus-visible .session-name {
  color: #fff;
}

.session-avatar-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  padding: 0;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #c2185b;
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}

.session-avatar-btn:hover,
.session-avatar-btn:focus-visible {
  border-color: #fff;
  outline: none;
}

.session-avatar-initials {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.session-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.session-avatar-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  padding: 8px 10px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.session-avatar-btn:hover .session-avatar-tip,
.session-avatar-btn:focus-visible .session-avatar-tip {
  opacity: 1;
  visibility: visible;
}

.session-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
}

.session-avatar-wrap.is-open .session-avatar-tip {
  opacity: 0;
  visibility: hidden;
}

.session-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  min-width: 180px;
  padding: 6px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 3px solid var(--red);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.session-user-menu.hidden,
.session-user-menu[hidden] {
  display: none !important;
}

.session-user-menu-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

.session-user-menu-item:hover,
.session-user-menu-item:focus-visible {
  background: #1d1d1d;
  outline: none;
}

.session-user-menu-item.hidden {
  display: none !important;
}

.session-user-menu-heading {
  margin: 8px 8px 2px;
  padding: 6px 4px 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8f8f8f;
}

.session-user-menu-theme {
  display: flex;
  flex-direction: column;
}

.session-user-menu-theme-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.session-user-menu-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
  flex: 0 0 auto;
}

.session-user-menu-theme-trigger.is-open .session-user-menu-caret {
  transform: rotate(180deg);
}

.session-user-menu-theme-choices {
  display: flex;
  flex-direction: column;
  padding: 0 0 4px;
}

.session-user-menu-theme-choices.hidden,
.session-user-menu-theme-choices[hidden] {
  display: none !important;
}

.session-user-menu-item[data-theme-choice] {
  padding-left: 20px;
}

.session-user-menu-item[data-theme-choice][aria-checked="true"] {
  color: #fff;
}

.session-user-menu-item[data-theme-choice][aria-checked="true"]::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  margin-left: -14px;
  background: var(--red);
}

.user-profile {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.user-profile.hidden,
.user-profile[hidden] {
  display: none !important;
}

.profile-page {
  display: grid;
  gap: 16px;
  max-width: 920px;
}

.profile-page-head h2 {
  margin: 0;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  font-size: 1.35rem;
}

.profile-card {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 22px;
  color: #fff;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #c2185b;
  color: #fff;
  flex: 0 0 auto;
}

.profile-avatar-initials {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-hero-main {
  min-width: 0;
}

.profile-hero-main h3 {
  margin: 0 0 10px;
  font-size: 1.85rem;
  line-height: 1.1;
  font-weight: 800;
  color: #fff;
}

.profile-role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--radius-card);
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-hero-account {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cfcfcf;
  font-size: 0.92rem;
  min-width: 0;
}

.profile-hero-account span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.profile-account-icon {
  color: #8f8f8f;
  font-size: 1rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.profile-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 1rem;
  color: #fff;
}

.profile-card-sub {
  margin: 0 0 14px;
  color: #bdbdbd;
  font-size: 0.88rem;
}

.profile-card .gate-label {
  display: block;
  margin: 0 0 6px;
  color: #d8d8d8;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-card input[type="text"],
.profile-card input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 16px;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #000;
  color: #fff;
  font: inherit;
}

.profile-card input[type="text"]:focus,
.profile-card input[type="email"]:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.profile-card input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.profile-card .gate-label + input + .gate-label {
  margin-top: 12px;
}

.profile-page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-page-actions .btn-secondary {
  background: transparent;
  color: #ddd;
  border-color: #444;
}

.profile-card .btn-secondary {
  background: transparent;
  color: #ddd;
  border-color: #444;
}

.profile-danger {
  border-color: #3a1515;
}

.profile-status {
  margin: 0;
  color: #d8d8d8;
  font-size: 0.9rem;
}

.profile-status.is-error {
  color: #ff8a80;
}

@media (max-width: 760px) {
  .profile-hero {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-hero-account span:last-child {
    max-width: 100%;
  }
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.users-table th,
.users-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.users-table select {
  min-height: 36px;
}

.session-name {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #e8e8e8;
  line-height: 1.2;
}

.session-email {
  display: none;
}

.brand-bar .logout-btn,
.brand-bar .theme-toggle {
  padding: 4px 10px;
  font-size: 0.75rem;
  min-height: 32px;
  background: transparent;
  color: #ddd;
  border: 1px solid #444;
  border-radius: var(--radius-chip);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.gate-error {
  margin: 12px 0 0;
  color: #ff8f8f;
  font-size: 0.9rem;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--page);
}

body {
  padding: 0 0 calc(56px + var(--safe-bottom));
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(227, 0, 0, 0.12);
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 max(18px, var(--safe-right)) 0 max(18px, var(--safe-left));
}

.brand-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0 0 10px;
  overflow: visible;
  --brand-logo: 52px;
  --brand-pad-y: 12px;
  --brand-chip-pad: 8px 14px;
  --brand-chip-min: 40px;
}

.brand-bar-slot {
  position: relative;
  background: var(--black);
  color: #fff;
  border-bottom: 2px solid var(--red);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
}

.brand-bar-inner {
  max-width: none;
  margin: 0 auto;
  padding: calc(var(--brand-pad-y) + var(--safe-top)) max(14px, var(--safe-right)) 0 max(14px, var(--safe-left));
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: transparent;
  color: inherit;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 0 auto;
}

.brand-logo {
  width: var(--brand-logo);
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.brand-copy {
  min-width: 0;
}

.brand-kicker {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: #bdbdbd;
}

.brand-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: nowrap;
}

.brand-line {
  display: block;
}

.brand-copy h1 .brand-line:first-child {
  color: #bdbdbd;
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  line-height: 1.2;
  margin-bottom: 2px;
}

.brand-copy h1 .brand-line:last-child {
  color: #fff;
  font-size: 1.05rem;
}

.brand-copy h1 .accent {
  color: var(--red);
}

.brand-motto {
  margin: 4px 0 0;
  color: #cfcfcf;
  font-size: 0.78rem;
  font-weight: 500;
}

.brand-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.app-nav {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  max-width: none;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  gap: clamp(3px, 0.8cqi, 6px);
  container-type: inline-size;
  container-name: app-nav;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 13rem;
  white-space: normal;
  overflow: hidden;
  background: transparent;
  color: #cfcfcf;
  border: 1px solid #333;
  border-radius: var(--radius-chip);
  padding: var(--brand-chip-pad);
  min-height: var(--brand-chip-min);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.nav-tab:hover:not(:disabled) {
  color: #fff;
  border-color: #666;
  transform: none;
}

.nav-tab.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.nav-tab-icon {
  display: none;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.brand-status-slot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 1.125rem;
  padding: 0 max(14px, var(--safe-right)) 6px max(14px, var(--safe-left));
  margin: 0;
}

#status-line {
  margin: 0;
  color: #b5b5b5;
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: right;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.auto-sync-line {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.btn-sync-sm {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--black);
  border-radius: var(--radius-card);
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn-sync-sm:hover:not(:disabled) {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.panel h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  color: var(--black);
  font-size: 1.45rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sub { margin: 0 0 12px; color: var(--muted); font-size: 0.95rem; }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar-actions .btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.filter-block {
  margin: 0 0 10px;
}

.filter-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.perf-section {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.perf-section:first-of-type {
  border-top: 0;
  margin-top: 16px;
  padding-top: 0;
}

.perf-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.perf-section-head .history-section-title {
  margin-bottom: 4px;
}

.perf-section-head .toolbar-actions {
  flex-shrink: 0;
}

.perf-subsection-title {
  margin: 20px 0 6px;
  font-size: 1rem;
}

.filter-block .type-filters {
  margin-bottom: 0;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.results-bar-count {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 0.9rem;
}

.sort-control-label {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.sort-control-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #bbb;
  border-radius: 8px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 10px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 6px 28px 6px 10px;
  min-height: 34px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.sort-control-select:hover {
  background-color: #d0d0d0;
}

.sort-control-select:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.table-section {
  margin-top: 4px;
}

@media (max-width: 640px) {
  .results-bar {
    align-items: flex-start;
  }

  .sort-control {
    width: 100%;
    justify-content: flex-end;
  }
}

.type-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--black);
  border-radius: var(--radius-chip);
  padding: 10px 12px;
  min-height: var(--touch);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.type-chip .type-count {
  min-width: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  background: #c8c8c8;
  padding: 2px 6px;
  border-radius: var(--radius-chip);
}

.type-chip.active {
  background: var(--black);
  border-color: var(--black);
  color: #fff;
}

.type-chip.active .type-count {
  background: var(--red);
  color: #fff;
}

.search-row {
  margin: 0 0 12px;
}

input[type="search"] {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 12px;
  font: inherit;
  font-size: 16px;
  background: var(--card);
  min-height: var(--touch);
}

.type-group {
  margin-bottom: 14px;
}

.type-group-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--black);
}

.type-group-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.type-group-header span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.type-group-list {
  display: grid;
  gap: 8px;
}

.item-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.badge.type {
  background: #111;
  color: #fff;
}

input[type="search"]:focus {
  outline: 2px solid rgba(227, 0, 0, 0.35);
  border-color: var(--red);
}

button, .btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-card);
  padding: 12px 14px;
  min-height: var(--touch);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
  touch-action: manipulation;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled) { transform: translateY(-1px); }
}

.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-secondary { background: var(--card); color: var(--black); border: 1px solid var(--line); }
.btn-secondary:hover:not(:disabled) { background: var(--paper); }
.btn-ghost { background: transparent; color: var(--black); border: 1px solid var(--line); }
.btn-danger { background: #9e0000; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #7a0000; }

.list {
  display: grid;
  gap: 8px;
  max-height: min(62vh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px;
  min-height: var(--touch);
  background: var(--card);
  cursor: pointer;
  font: inherit;
}

.item:hover {
  border-color: var(--black);
  background: var(--paper);
  box-shadow: inset 3px 0 0 var(--red);
}

.item .name {
  font-weight: 700;
  color: var(--black);
  font-family: var(--font-body);
}

.item .meta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-card);
  padding: 4px 9px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.live { background: var(--ok-soft); color: var(--ok); }
.badge.upcoming { background: var(--warn-soft); color: var(--warn); }
.badge.unset { background: #c8c8c8; color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 12px 0; }

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 12px;
  background: var(--card);
}

.stat .value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--ink);
  line-height: 1;
}

.stat .label { margin-top: 5px; color: var(--muted); font-size: 0.82rem; }
.stat.bad .value { color: var(--bad); }
.stat.warn .value { color: var(--warn); }
.stat.ok .value { color: var(--ok); }

.team-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px;
  background: var(--card);
  border-top: 3px solid var(--black);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.team-card:hover {
  border-color: var(--black);
  box-shadow: inset 3px 0 0 var(--red);
}

.team-card h3 {
  margin: 0 0 8px;
  color: var(--black);
  font-size: 1.05rem;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.gap-mini-note {
  min-height: 2.4em;
  margin: 0;
}

.gap-mini-wrap {
  margin: 0;
  overflow-x: auto;
}

.gap-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  line-height: 1.25;
}

.gap-mini-table th,
.gap-mini-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.gap-mini-table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gap-mini-table td:nth-child(2),
.gap-mini-table td:nth-child(3),
.gap-mini-table td:nth-child(4),
.gap-mini-table th:nth-child(2),
.gap-mini-table th:nth-child(3),
.gap-mini-table th:nth-child(4) {
  text-align: right;
}

.gap-mini-table tr.bad td:nth-child(4) {
  color: var(--bad);
  font-weight: 700;
}

.gap-mini-table tr.ok td:nth-child(4) {
  color: var(--muted);
}

.gap-mini-table tbody tr:last-child td {
  border-bottom: 0;
}

.roster-count-wrap {
  max-width: 22rem;
  margin: 0 0 12px;
}

.roster-count-box {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}

.roster-count-heading {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--ink);
}

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.format-toolbar {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.format-toolbar .sub { display: block; margin: 0 0 6px; }
.format-toolbar .pill-row { margin: 8px 0 0; }
.tb-picker-add {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.tb-picker-add .sub { margin: 0; }
.tb-picker-add .tb-name-input {
  display: block;
  width: 100%;
  max-width: none;
}
.tb-setup {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.tb-setup-field { min-width: min(22rem, 100%); flex: 1 1 16rem; }
.tb-setup-field .tb-name-input { width: 100%; max-width: none; }
.tb-setup-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}
.tb-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tb-count {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--card);
  line-height: 1.2;
}
.tb-count .value {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--black);
}
.tb-count .label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tb-count.ok .value { color: var(--ok); }
.tb-count.bad .value { color: var(--bad); }
.tb-mins {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.tb-mins-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.tb-mins-head .sub {
  margin: 0;
}
.tb-min-row {
  align-items: center;
  margin: 0 0 0 auto;
  flex: 0 1 auto;
  justify-content: flex-end;
}
.tb-min-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tb-min-label input {
  width: 3.5rem;
}
.tb-gap-table { width: 100%; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--black);
  border-radius: var(--radius-chip);
  padding: 10px 12px;
  min-height: var(--touch);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.pill.active {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}

.callout {
  border-radius: var(--radius-card);
  padding: 12px 14px;
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-left: 3px solid var(--black);
}

.callout.warn,
html[data-theme="dark"] .callout.warn,
html[data-theme="light"] .callout.warn {
  background: var(--red);
  border-color: var(--red);
  border-left-color: var(--red);
  color: #fff;
}
.callout.warn strong { color: #fff; }
.callout.ok { background: var(--ok-soft); border-color: #b7d7c4; border-left-color: var(--ok); }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
tr.bad td { background: var(--bad-soft); }
tr.ok td { background: var(--ok-soft); }

.error {
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid #efc4c4;
  border-radius: var(--radius-card);
  padding: 12px 14px;
  margin: 0 0 12px;
}

.durable-fail-banner {
  color: #5c1a1a;
  background: var(--bad-soft);
  border: 1px solid #efc4c4;
  border-left: 4px solid var(--red);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  margin: 0 0 12px;
  font-weight: 600;
}

.hidden { display: none !important; }
.loading { color: var(--muted); font-style: italic; }
.breadcrumb { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; color: var(--muted); }
.breadcrumb strong { color: var(--black); }

/* Team drill-down (IQ-211, IQ-212). Text colors use --ink/--muted, never --black (#000 in both themes). */
.team-h3 { margin: 0 0 8px; color: var(--ink); }
.team-h3-gap { margin: 16px 0 8px; }
.team-format-label { margin-bottom: 6px; color: var(--muted); font-size: 0.85rem; }
html[data-theme="dark"] .callout.ok {
  background: #1a3d2a;
  border-color: #2f6b49;
  border-left-color: #5fd18a;
  color: #d7f5e3;
}
html[data-theme="dark"] .stat.ok .value { color: #5fd18a; }
html[data-theme="dark"] .stat.bad .value { color: #ff8a8a; }

.roster-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.roster-search { flex: 1 1 220px; max-width: 420px; }
/* IQ-233: the dropdowns sit in the toolbar's own row; the house .home-mosaic-filter-* look does the rest. */
.roster-filters { display: contents; }
#roster-pane { overflow-x: auto; } /* the 7-column table scrolls inside the pane, not the page */
.roster-filter-field .home-mosaic-filter-menu { max-width: min(320px, calc(100vw - 32px)); }
@media (max-width: 640px) {
  .roster-tools { position: relative; }
  .roster-tools .roster-filter-field { position: static; }
  .roster-tools .roster-filter-field .home-mosaic-filter-menu { right: 0; max-width: none; }
}
.roster-search::placeholder { color: #6b6b6b; }
html[data-theme="dark"] .roster-search::placeholder { color: #d6d7da; }
html[data-theme="dark"] #view-team .roster-search { border-color: #8a8b90; }
html[data-theme="dark"] #view-team th { color: #c9cacd; }
.th-sort {
  background: none;
  border: 0;
  padding: 6px 0;
  min-height: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.th-sort:hover:not(:disabled) { transform: none; }
.th-sort.active { color: var(--ink); }
.th-sort:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.roster-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--muted);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@keyframes brand-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.dash-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  border: 1px solid var(--line);
  border-top: 3px solid var(--black);
  border-radius: var(--radius-card);
  padding: 14px;
  background: var(--card);
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.dash-card:hover {
  border-color: var(--black);
  box-shadow: inset 3px 0 0 var(--red);
  transform: none;
}

.dash-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  min-height: calc(1.25em * 2);
}

.dash-card .dash-meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 10px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-card .dash-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 10px;
  min-width: 0;
}

.dash-card .dash-metric {
  min-width: 0;
  overflow: hidden;
}

.dash-card .dash-metric .value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-card .dash-metric .value.money {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.dash-card .dash-metric .label {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-card .dash-metric.bad .value { color: var(--bad); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.history-stat-row {
  margin: 14px 0 10px;
}

.history-latest {
  margin: 0 0 12px;
}

.history-warn {
  color: #8a4b00;
  margin: 6px 0 0;
}

.tb-source-error {
  color: var(--red);
  margin: 6px 0 0;
  font-weight: 700;
}

.history-section-title {
  margin: 22px 0 6px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-year-hint {
  margin: 6px 0 0;
}

.history-program-card {
  cursor: default;
}

.history-program-card.is-clickable {
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.history-program-card.is-clickable:focus-visible {
  outline: 2px solid var(--accent, #1f4b7a);
  outline-offset: 2px;
}

.history-card-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.history-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0 18px;
}

.history-compare-side {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 14px;
}

.history-compare-side h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.history-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.history-field select {
  width: 100%;
  min-height: var(--touch);
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.history-compare-table-wrap {
  margin-top: 8px;
}

.history-compare-table th[scope="col"] {
  vertical-align: top;
  min-width: 9rem;
}

.history-compare-col-title {
  font-weight: 650;
  color: var(--ink);
}

.history-compare-col-sub {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 450;
  color: var(--muted);
  line-height: 1.35;
  max-width: 16rem;
}

.history-compare-table th[scope="row"] {
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.history-compare-delta {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.ask-reso {
  position: fixed;
  right: max(16px, var(--safe-right));
  bottom: max(16px, var(--safe-bottom));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.ask-reso[hidden] {
  display: none !important;
}

.ask-reso-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--black);
  color: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 10px 28px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.ask-reso-launcher:hover {
  background: #1a1a1a;
}

.ask-reso-logo {
  width: 44px;
  height: auto;
  display: block;
}

.ask-reso-panel {
  width: min(calc(100vw - 32px), 380px);
  height: min(70vh, 560px);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  transition: width 160ms ease, height 160ms ease, max-height 160ms ease;
}

.ask-reso-panel.is-expanded {
  width: min(calc(100vw - 32px), 720px);
  height: min(88vh, 820px);
  max-height: min(88vh, 820px);
}

.ask-reso-panel[hidden] {
  display: none !important;
}

.ask-reso-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 10px;
  background: var(--black);
  color: #fff;
}

.ask-reso-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ask-reso-header-mark {
  width: 40px;
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.ask-reso-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #fff;
}

.ask-reso-status {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
}

.ask-reso-status.history-warn {
  color: #ffb4b4;
}

.ask-reso-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.ask-reso-icon-btn {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.9;
}

.ask-reso-icon-btn:hover {
  opacity: 1;
}

.ask-reso-close {
  font-size: 1.5rem;
}

.ask-reso .history-ask-thread {
  flex: 1;
  min-height: 160px;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--paper);
}

.history-ask-empty {
  margin: 0;
}

.history-ask-msg {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--card);
}

.history-ask-msg.user {
  border-left: 3px solid var(--ink);
}

.history-ask-msg.assistant {
  border-left: 3px solid var(--red);
}

.history-ask-msg-role {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-ask-msg-body {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink);
  white-space: normal;
}

.ask-reso-download {
  display: inline-block;
  margin: 6px 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}

.ask-reso-download:hover {
  border-color: var(--red);
  color: var(--red);
}

.ask-reso .history-ask-form {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.history-ask-field textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.history-ask-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 520px) {
  .ask-reso-panel,
  .ask-reso-panel.is-expanded {
    width: min(calc(100vw - 24px), 720px);
    height: min(80vh, 820px);
    max-height: min(80vh, 820px);
  }
}

.history-monthly-pivot th,
.history-monthly-pivot td {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.history-monthly-pivot .history-month-total-row th,
.history-monthly-pivot .history-month-total-row td {
  font-weight: 650;
  border-top: 1px solid var(--line);
}

.history-cohort-panel {
  margin: 0 0 22px;
}

.history-cohort-season-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-end;
  margin: 0 0 12px;
}

.history-cohort-season-controls .sub {
  flex: 1 1 100%;
  margin: 0;
}

.history-cohort-yoy-table td,
.history-cohort-yoy-table th[scope="row"] {
  white-space: nowrap;
}

.history-cohort-table td,
.history-cohort-table th[scope="row"] {
  font-variant-numeric: tabular-nums;
}

.history-cohort-delta-row th,
.history-cohort-delta-row td {
  color: var(--muted);
  font-size: 0.92em;
}

@media (max-width: 720px) {
  .history-compare-grid {
    grid-template-columns: 1fr;
  }
}

.menu {
  position: relative;
  display: inline-block;
}

.menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.menu-caret {
  font-size: 0.75em;
  opacity: 0.75;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: min(320px, 86vw);
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--paper);
  outline: none;
}

.menu-item-title {
  font-weight: 600;
}

.menu-item-sub {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.3;
}

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

.table-wrap {
  overflow: auto;
  max-height: min(52vh, 640px);
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.late-select-th,
.late-select-td {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  text-align: center;
  vertical-align: middle;
}

.late-select-box {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--red);
  cursor: pointer;
}

tr.late-row-selected td.late-select-td {
  box-shadow: inset 3px 0 0 var(--red);
}

body.late-invoices-open .shell {
  max-width: none;
  width: 100%;
  padding-left: max(24px, var(--safe-left));
  padding-right: max(24px, var(--safe-right));
}

body.late-invoices-open .brand-bar-inner {
  max-width: none;
}

/* IQ-262: only the page scrolls vertically; a wide table may still scroll sideways inside the wrap. */
body.late-invoices-open #view-late-invoices .late-invoices-table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

body.late-invoices-open #view-late-invoices .late-invoices-table {
  width: 100%;
}

/* IQ-264: a known "no parent" reads as a note, not as missing data; --muted is set per theme. */
.late-invoices-table .late-no-parent {
  color: var(--muted);
  font-style: italic;
}

/* IQ-261: History day rows counted under the earlier late rule; --muted is set per theme. */
td.muted,
.history-late-divider td {
  color: var(--muted);
}

.history-late-divider td {
  font-style: italic;
}

body.team-builder-open .shell {
  max-width: none;
  width: 100%;
  padding-left: max(24px, var(--safe-left));
  padding-right: max(24px, var(--safe-right));
}

body.team-builder-open .brand-bar-inner {
  max-width: none;
}

body.team-builder-open #view-team-builder:not(.hidden),
body.team-builder-open #tb-main,
body.team-builder-open .tb-page {
  width: 100%;
  max-width: none;
}

#view-team-builder {
  position: relative;
}

.tb-saved-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  min-height: 480px;
}
.tb-saved-overlay.hidden {
  display: none;
}
.tb-saved-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.tb-saved-overlay-bar h2 {
  margin: 0;
  font-size: 1.05rem;
}
.tb-saved-overlay iframe {
  flex: 1;
  width: 100%;
  border: 0;
  min-height: 420px;
  background: var(--paper);
}
.tb-view-saved {
  font-weight: 600;
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.tb-view-saved:hover {
  color: var(--red);
}
.built-team-owner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.built-team-owner select {
  min-width: 10rem;
}
html.saved-teams-embed .brand-bar {
  display: none;
}
html.saved-teams-embed .shell {
  padding: 12px 16px;
  max-width: none;
}
html.saved-teams-embed body,
html.saved-teams-embed {
  background: var(--paper);
}

.section-title {
  margin: 18px 0 8px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--black);
  font-size: 1.05rem;
}

@media (max-width: 1280px) {
  .brand-bar-inner {
    flex-wrap: wrap;
  }

  .brand-motto {
    display: none;
  }

  .brand-lockup {
    order: 1;
  }

  .brand-actions {
    margin-left: auto;
    order: 2;
  }

  .app-nav {
    width: 100%;
    order: 3;
  }

}

@media (max-width: 820px) {
  .brand-bar-inner {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px max(12px, var(--safe-right)) 8px max(12px, var(--safe-left));
  }

  .brand-lockup {
    gap: 8px;
    order: 1;
  }

  .brand-logo {
    width: 32px;
  }

  .brand-actions {
    align-items: center;
    width: auto;
    margin-left: auto;
    order: 2;
  }

  .brand-actions .btn-secondary {
    width: auto;
  }

  .app-nav {
    width: 100%;
    order: 3;
    padding-bottom: 0;
  }

  .nav-tab {
    flex: 1 1 0;
    text-align: center;
    justify-content: center;
  }

  .shell {
    padding-left: max(12px, var(--safe-left));
    padding-right: max(12px, var(--safe-right));
  }

  .panel {
    padding: 14px;
    border-radius: 6px;
  }

  .panel h2 {
    font-size: 1.25rem;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > * {
    width: 100%;
  }

  .type-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin: 0 -4px 0;
    padding: 2px 4px 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .type-filters::-webkit-scrollbar {
    display: none;
  }

  input[type="search"] {
    max-width: none;
  }

  .list {
    max-height: none;
  }

  .item {
    align-items: start;
    gap: 8px;
  }

  .item-badges {
    align-items: flex-end;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .stat .value {
    font-size: 1.45rem;
  }

  .breadcrumb {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .table-wrap {
    max-height: none;
    margin: 0 -14px;
    border-left: 0;
    border-right: 0;
  }

  table {
    min-width: 640px;
    font-size: 0.88rem;
  }

  .row .btn-primary,
  .row .btn-sync-sm,
  .row .btn-secondary {
    flex: 1 1 auto;
  }
}

@media (max-width: 520px) {
  .brand-copy h1 {
    font-size: 1.35rem;
  }

  .brand-motto {
    display: none;
  }

  .item {
    grid-template-columns: 1fr;
  }

  .item-badges {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }

  .gate-card {
    padding: 22px 18px 18px;
  }

  .gate-logo {
    width: 112px;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-card .dash-metric .value {
    font-size: 1.05rem;
  }

  .dash-card .dash-metric .value.money {
    font-size: 1rem;
  }
}

.badge.field-only { background: #c8c8c8; color: var(--muted); }
.badge.field-box { background: var(--ok-soft); color: var(--ok); }
.badge.box-reg { background: var(--warn-soft); color: var(--warn); }

.built-teams {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.built-teams h2,
.built-teams h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--black);
}
.built-teams .sub { margin: 0 0 10px; }
.built-team-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.built-team-row:last-child { border-bottom: 0; }
.built-team-row .name { font-weight: 700; }
.built-team-row .btn-ghost { cursor: pointer; }

.tb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.tb-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(12px, 1.5vw, 24px);
  align-items: start;
  width: 100%;
}
.tb-page {
  width: 100%;
  max-width: none;
  container-type: inline-size;
  container-name: tb-page;
}
#tb-pool,
#tb-built {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}
#tb-pool .tb-picker-add {
  flex: 0 0 auto;
  min-height: 0;
}
#tb-pool #tb-program-picker.list {
  flex: 0 1 auto;
  max-height: min(40vh, 24rem);
  overflow: auto;
}
#tb-program-picker .item {
  align-items: start;
  overflow: hidden;
  min-width: 0;
}
#tb-program-picker .item > span:first-child {
  min-width: 0;
}
#tb-program-picker .item .name,
#tb-program-picker .item .meta {
  overflow-wrap: anywhere;
}
#tb-program-picker .item-badges {
  flex: 0 0 auto;
}
.tb-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.tb-sources-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 8px;
  row-gap: 10px;
  align-items: center;
  margin: 0 0 12px;
}
.tb-sources-row > .sub {
  flex: 1 0 100%;
  margin: 0;
}
.tb-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  min-height: var(--touch);
  box-sizing: border-box;
  padding: 6px 8px 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
  font-size: 0.85rem;
  line-height: 1.2;
}
.tb-source-chip-name {
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tb-source-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  color: inherit;
  line-height: 0;
}
.tb-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink);
  transition: transform 0.12s ease;
}
.tb-source-chip.is-collapsed .tb-caret {
  transform: rotate(-90deg);
}
.tb-source-chip .badge {
  flex: 0 0 auto;
  line-height: 1;
}
.tb-add-chip {
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  flex: 0 0 auto;
}
.tb-outline-program {
  margin: 0 0 12px;
}
.tb-outline-program > .tb-source-chip {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
}
.tb-outline-program-body {
  margin: 8px 0 0 14px;
  padding: 0 0 2px 12px;
  border-left: 2px solid var(--line);
}
.tb-outline-program-players {
  margin: 8px 0 0;
}
.tb-chip-x {
  flex: 0 0 auto;
  margin-left: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}
.tb-block {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  padding: 12px 14px;
  min-height: min(70vh, 52rem);
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}
#tb-pool-block.tb-block {
  min-height: 0;
  flex: 0 0 auto;
}
#tb-pool-block .tb-add-chip {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  margin: 0 0 10px;
  border-radius: 8px;
}
.tb-block-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 10px;
}
.tb-block-head h3 { margin: 0; }
.tb-pool-filters .pill-row { margin: 4px 0 8px; }
.tb-pool-filters {
  position: relative;
  z-index: 2;
  overflow: visible;
}
.tb-checklist-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin: 8px 0 4px;
}
.tb-checklist {
  position: relative;
  min-width: 0;
}
.tb-checklist-toggle {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--paper);
  font: inherit;
  padding: 8px 10px;
  cursor: pointer;
}
.tb-checklist-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 8;
  max-height: 16rem;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}
.tb-checklist-search {
  width: 100%;
  margin: 0 0 8px;
  font: inherit;
  padding: 6px 8px;
}
.tb-checklist-option {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 2px;
  font-size: 0.9rem;
}
.tb-group { margin: 0 0 12px; }
.tb-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--black);
  color: #fff;
}
.tb-group-head h4 {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tb-group-need {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tb-group-head.is-short .tb-group-need { color: #f3c4c4; }
.tb-built-gap {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.tb-built-gap h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.tb-source {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 0 0 12px;
  background: var(--card);
}
.tb-source h3 {
  margin: 0;
  font-size: 1rem;
}
.tb-source-head {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 8px;
}
.tb-source-head-copy {
  min-width: 0;
  flex: 1 1 auto;
}
.tb-source-head .tb-caret {
  border-left-width: 5px;
  border-right-width: 5px;
  border-top-width: 7px;
  border-top-color: var(--ink);
}
.tb-source-head strong {
  overflow-wrap: anywhere;
}
.tb-source-head .sub {
  display: block;
  margin: 0;
}
.tb-source-section {
  margin: 0 0 10px;
}
.tb-source-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
}
.tb-source-fold {
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 6px 10px;
  cursor: pointer;
  min-height: var(--touch);
}
.tb-source-body {
  margin-top: 8px;
}
.tb-source-subfilters {
  margin: 0 0 10px;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
}
.tb-source-subfilters .sub { display: block; margin: 0 0 4px; }
.tb-source-subfilters .pill-row { margin: 4px 0 8px; }
.tb-player-list {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.tb-player-row,
.tb-team-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.tb-player-row:last-child,
.tb-team-row:last-child { border-bottom: 0; }
.tb-player-row .meta,
.tb-team-row .meta { color: var(--muted); font-size: 0.8rem; }
.tb-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
}
.tb-name-input {
  width: min(100%, 28rem);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font: inherit;
}
.tb-preview-table .meta { color: var(--muted); font-size: 0.8rem; }

body.board-open {
  height: 100dvh;
  overflow: hidden;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
}

body.board-open #app-root:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

body.board-open .brand-bar {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

body.board-open .shell,
body.board-open .brand-bar-inner,
body.board-open .app-nav {
  width: 100%;
  max-width: none;
}

body.board-open .shell {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: max(24px, var(--safe-left));
  padding-right: max(24px, var(--safe-right));
  padding-bottom: 8px;
}

body.board-open #view-board:not(.hidden),
body.board-open #board-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.board-app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--page);
}

.board-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--black);
  color: #d8d8d8;
  padding: 14px 10px 18px;
  overflow: hidden;
}

.board-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 1px solid #444;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
}

.board-sidebar-toggle[aria-expanded="true"] {
  border-color: var(--red);
  color: var(--red);
}

.board-sidebar-backdrop {
  display: none;
}

.board-ws-kicker,
.board-ws-section {
  margin: 0 8px 8px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8f8f8f;
}

.board-ws-section { margin-top: 16px; }

.board-ws-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 4px;
  padding: 8px 8px 8px 10px;
  border: 1px solid #333;
  background: #141414;
}

.board-ws-mark {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background: var(--red);
}

.board-ws-name {
  flex: 1;
  min-width: 0;
  color: #fff;
  font-weight: 700;
}

.board-plus-wrap {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
}

.board-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #444;
  background: #1a1a1a;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
}

.board-plus:hover,
.board-plus[aria-expanded="true"] {
  border-color: var(--red);
  color: var(--red);
  transform: none;
}

.board-plus-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 4;
  min-width: 168px;
  padding: 6px 0;
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 3px solid var(--red);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.board-plus-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #eee;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.board-plus-menu button:hover {
  background: #1c1c1c;
  color: #fff;
}

.board-tree-folder { margin: 2px 0; }
.board-tree-folder.collapsed .board-tree-children { display: none; }
.board-tree-folder.collapsed .board-chevron { transform: rotate(-90deg); }

.board-tree-folder-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.board-tree-folder-btn,
.board-tree-board,
.board-side-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #d0d0d0;
  padding: 8px 8px;
  min-height: 36px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.board-tree-folder-btn:hover,
.board-tree-board:hover,
.board-side-link:hover { color: #fff; background: #1c1c1c; }

.board-tree-board { padding-left: 28px; font-weight: 500; cursor: grab; }
.board-tree-board:active { cursor: grabbing; }
.board-tree-board.dragging { opacity: 0.45; }
.board-tree-board.active {
  background: var(--red);
  color: #fff;
}

.board-side-link.active {
  background: var(--red);
  color: #fff;
}

.board-tree-folder.drop-target {
  outline: 1px dashed var(--red);
  outline-offset: -1px;
  background: rgba(227, 0, 0, 0.12);
}

.board-nav-menu {
  position: fixed;
  z-index: 92;
  min-width: 188px;
  max-width: 240px;
  overflow: visible;
  padding: 6px 0;
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 3px solid var(--red);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.board-nav-move {
  position: relative;
  margin: 0 0 4px;
  padding: 0 0 4px;
  border-bottom: 1px solid #2a2a2a;
}

.board-nav-move-trigger,
.board-nav-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.board-nav-action {
  justify-content: flex-start;
}

.board-nav-move-trigger:hover,
.board-nav-action:hover:not(:disabled) {
  background: #1c1c1c;
}

.board-nav-caret {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  flex: 0 0 auto;
}

.board-nav-move-tree {
  position: absolute;
  left: calc(100% - 2px);
  top: -3px;
  z-index: 93;
  min-width: 196px;
  max-height: min(60vh, 360px);
  overflow: auto;
  padding: 6px 0;
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 3px solid var(--red);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.board-nav-move-tree.flip {
  left: auto;
  right: calc(100% - 2px);
}

.board-nav-move-tree.hidden {
  display: none;
}

.board-nav-folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #c4c4c4;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.board-nav-folder-item .board-chevron {
  transform: rotate(-90deg);
}

.board-nav-folder-item:hover:not(:disabled) {
  background: #1c1c1c;
  color: #fff;
}

.board-nav-folder-item:disabled {
  color: #6a6a6a;
  cursor: default;
}

.board-nav-menu-danger {
  color: var(--red);
}

.board-tree-archive .board-tree-folder-btn {
  color: #a8a8a8;
}

.board-history-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  max-height: 50vh;
  overflow: auto;
}

.board-history-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid #2a2a2a;
}

.board-history-list li:last-child { border-bottom: 0; }

.board-history-text {
  color: #eee;
  font-weight: 600;
}

.board-history-list time {
  color: #8f8f8f;
  font-size: 0.78rem;
}

.board-tree-x,
.board-row-x {
  border: 0;
  background: transparent;
  color: #8f8f8f;
  min-width: 32px;
  min-height: 32px;
  cursor: pointer;
  font-size: 1.1rem;
}

.board-tree-x:hover,
.board-row-x:hover { color: var(--red); }

.board-chevron {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  flex: 0 0 auto;
  transition: transform 0.12s ease;
}

.board-group-fold .board-chevron {
  border-left-width: 5px;
  border-right-width: 5px;
  border-top-width: 6px;
}

.board-board-icon {
  width: 12px;
  height: 10px;
  border: 1px solid #d0d0d0;
  flex: 0 0 auto;
}

.board-tree-board.active .board-board-icon,
.board-tree-board:hover .board-board-icon {
  border-color: #fff;
}

.board-tree-empty {
  margin: 0 0 0 28px;
  color: #6a6a6a;
  font-size: 0.8rem;
}

.board-tree {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.board-side-link { padding-left: 8px; color: #d0d0d0; font-weight: 700; }

.team-works-dashboard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
  padding: 0 0 16px;
  overflow: auto;
  color: #eee;
}

.team-works-overview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.team-works-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.team-works-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 5.25rem;
  margin: 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
  color: var(--ink);
  text-align: center;
  font: inherit;
  cursor: pointer;
}

.team-works-kpi-static {
  cursor: default;
}

.team-works-kpi-n {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.team-works-kpi-n.ok { color: var(--ok); }
.team-works-kpi-n.bad { color: var(--red); }

html[data-theme="dark"] .team-works-kpi-n.ok {
  color: color-mix(in srgb, var(--ok) 42%, var(--ink));
}

.team-works-kpi-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  line-height: 1.25;
}

.team-works-charts {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}

.team-works-chart {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 10px 12px 12px;
  color: var(--ink);
}

.team-works-chart h3 {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 800;
}

.team-works-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 0 0 12px;
}

.team-works-legend-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-card);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

.team-works-legend-pill.ok { background: var(--ok); color: #fff; }
.team-works-legend-pill.progress { background: #6fbf7c; color: #163d24; }
.team-works-legend-pill.bad { background: var(--red); color: #fff; }

.team-works-bar-row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.team-works-bar-name {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.team-works-bar-track {
  height: 28px;
  background: var(--line);
}

.team-works-bar-stack {
  display: flex;
  height: 100%;
  min-width: 0;
}

.team-works-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 0 10px;
  border: 0;
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.team-works-seg.ok { background: var(--ok); }
.team-works-seg.progress { background: #6fbf7c; color: #163d24; }
.team-works-seg.bad { background: var(--red); }

@media (max-width: 900px) {
  .team-works-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-works-charts { grid-template-columns: 1fr; }
}

.team-works-chip-n {
  margin-left: 6px;
  font-weight: 800;
}

.team-works-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.team-works-filters select {
  min-width: 8.5rem;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #333;
  border-radius: var(--radius-chip);
  background: #1a1a1a;
  color: #eee;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
}

.team-works-people {
  position: relative;
}

.team-works-people-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
  min-width: 8.5rem;
  max-width: 14rem;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #333;
  border-radius: var(--radius-chip);
  background: #1a1a1a;
  color: #eee;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.team-works-people-trigger::after {
  content: "";
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
}

.team-works-people-trigger.active,
.team-works-people-trigger[aria-expanded="true"] {
  border-color: var(--red);
}

.team-works-people-menu {
  left: 0;
  right: auto;
}

.team-works-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.team-works-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 32px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #333;
  background: transparent;
  color: #d4d4d4;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  border-radius: var(--radius-chip);
}

.team-works-chip.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.team-works-chip:hover:not(.active) {
  background: #2a2a2a;
  border-color: #666;
}

.team-works-table-wrap {
  min-height: 16rem;
  flex: 1 1 16rem;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
}

.team-works-list-head {
  padding: 10px 12px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.team-works-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.team-works-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.team-works-table .board-sort-th {
  justify-content: flex-start;
  text-align: left;
  min-height: 0;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.team-works-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.team-works-row { cursor: pointer; }
.team-works-row:hover td { background: var(--paper); }
.team-works-row-past td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.team-works-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.team-works-empty { color: var(--muted); text-align: center; padding: 24px 12px; }

.team-works-events-wrap {
  overflow: auto;
  border: 1px solid #c5c7d0;
  background: var(--card);
  color: var(--ink);
}

.team-works-events-wrap .team-works-list-head {
  color: #222;
}

.team-works-events-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  color: var(--ink);
}

.team-works-events-wrap th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #b0b0b0;
  background: #c8c8c8;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #222;
}

.team-works-events-wrap td {
  padding: 4px 10px;
  border-bottom: 1px solid #b8b8b8;
  vertical-align: middle;
  color: var(--ink);
  white-space: nowrap;
  line-height: 1.25;
}

.team-works-events-wrap .team-works-name {
  display: table-cell;
  white-space: nowrap;
}

.team-works-events-wrap tbody tr:nth-child(odd) td {
  background: var(--card);
}

.team-works-events-wrap tbody tr:nth-child(even) td {
  background: #c4c4c4;
}

html[data-theme="dark"] .team-works-events-wrap tbody tr:nth-child(even) td {
  background: #2a2c31;
  color: var(--ink);
}

.team-works-events-wrap tbody tr:hover td,
.team-works-events-wrap .team-works-row:hover td {
  background: var(--paper);
  color: var(--ink);
}

.team-works-events-wrap .team-works-row {
  cursor: default;
}

.team-works-events-wrap .team-works-empty {
  color: #222;
}

.team-works-expand-col,
.team-works-expand-cell {
  width: 3.5rem;
  padding-left: 8px;
  padding-right: 0;
  white-space: nowrap;
}

.team-works-events-wrap .team-works-expand-cell .board-drag-handle,
.team-works-events-wrap .team-works-expand-cell .team-works-expand {
  display: inline-flex;
  vertical-align: middle;
}

.team-works-events-wrap .team-works-expand {
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
}

.team-works-events-wrap .team-works-goal-input {
  min-height: 0;
  height: 1.6rem;
  padding: 2px 6px;
  line-height: 1.2;
}

.team-works-remove-col,
.team-works-remove-cell {
  width: 2rem;
  text-align: right;
  padding-right: 8px;
}

.team-works-events-wrap .team-works-row-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
  transform: none;
}

.team-works-events-wrap .team-works-row-remove:hover {
  color: var(--red);
  transform: none;
}

.team-works-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.team-works-expand.collapsed .board-chevron {
  transform: rotate(-90deg);
}

.team-works-nested-row td {
  color: var(--ink);
  font-weight: 500;
}

.team-works-nested-name {
  padding-left: 12px;
  font-weight: 600;
}

.team-works-nested-meta td {
  font-size: 0.9rem;
  color: var(--ink);
}

.team-works-nested-kicker {
  margin-right: 12px;
  font-weight: 700;
  color: #111;
}

.team-works-nested-goal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
}

.team-works-goal-input {
  width: 4.75rem;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid #888;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

.team-works-focus td {
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

.board-canvas {
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 0;
  background: var(--page);
  overflow: hidden;
}

.board-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.board-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  width: 100%;
  position: relative;
  z-index: 20;
  padding-bottom: 8px;
}

.board-chrome-start {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.board-chrome-end {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.board-chrome h2 {
  margin: 0;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 1.12rem;
  color: #fff;
}

.board-chrome-count {
  margin: 0;
  color: #a8a8a8;
  font-size: 0.78rem;
}

.board-save-status {
  margin: 0;
  color: #a8a8a8;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.board-completed-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.board-completed-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #2a2a2a;
  background: #1a1a1a;
  color: #eee;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
}

.board-completed-chip.open,
.board-completed-chip:hover {
  border-color: var(--red);
}

.board-completed-count {
  min-width: 1.1em;
  color: #a8a8a8;
  font-weight: 600;
}

.board-completed-empty-btn {
  border: 0;
  background: transparent;
  color: var(--red);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  cursor: pointer;
}

.board-completed-empty-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.board-completed-empty-btn:disabled {
  color: #6a6a6a;
  cursor: default;
}

.board-fold-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #a8a8a8;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.board-presence {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  flex: 0 0 auto;
  align-self: center;
}

.board-presence[hidden] {
  display: none;
}

.board-presence-kicker {
  color: #8a8a8a;
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.board-presence-faces {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
}

.board-presence-avatar {
  position: relative;
  width: 26px;
  height: 26px;
  margin-left: -8px;
  border: 2px solid var(--page);
  border-radius: 50%;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-transform: uppercase;
  overflow: visible;
  background: #222;
}

.board-presence-avatar:last-child {
  margin-left: 0;
}

.board-presence-avatar.self {
  box-shadow: 0 0 0 1px #fff;
}

.board-presence-avatar:hover,
.board-presence-avatar:focus-visible {
  z-index: 6;
  outline: none;
}

.board-presence-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.board-presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  background: #3dcc6d;
  border: 2px solid var(--page);
  border-radius: 50%;
  box-sizing: border-box;
}

.board-presence-tip {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 80;
  padding: 6px 8px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0s linear, visibility 0s linear;
}

.board-presence-avatar:hover .board-presence-tip,
.board-presence-avatar:focus-visible .board-presence-tip {
  opacity: 1;
  visibility: visible;
  transition-delay: 1s;
}

.board-presence-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  overflow: hidden;
}

.board-remote-caret {
  position: absolute;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
}

.board-remote-caret-label {
  position: absolute;
  top: -15px;
  left: 0;
  padding: 1px 5px;
  border-radius: 3px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}

.board-remote-sel {
  position: absolute;
  border-radius: 2px;
}

.board-fold-all:hover:not(:disabled) {
  color: #fff;
  background: #2a2a2a;
}

.board-fold-all:disabled {
  opacity: 0.4;
  cursor: default;
}

.board-fold-all.collapsed .board-chevron {
  transform: rotate(-90deg);
}

.board-toolbar {
  position: relative;
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.board-toolbar .board-plus-menu,
.board-chip-menu {
  left: 0;
  right: auto;
}

.board-chip-wrap {
  position: relative;
  flex: 0 0 auto;
}

.board-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #333;
  background: transparent;
  color: #d4d4d4;
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: var(--radius-chip);
}

.board-chip svg {
  flex: 0 0 auto;
}

.board-chip span {
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-chip-icon {
  width: 32px;
  padding: 0;
  justify-content: center;
}

.board-chip-hover-label {
  display: none;
}

.board-chip-undo:hover,
.board-chip-undo:focus-visible {
  width: auto;
  padding: 0 10px;
}

.board-chip-undo:hover .board-chip-hover-label,
.board-chip-undo:focus-visible .board-chip-hover-label {
  display: inline;
}

.board-chip:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: #666;
}

.board-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.board-chip.active,
.board-chip[aria-expanded="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.board-chip-menu {
  position: absolute;
  top: calc(100% + 4px);
  z-index: 12;
  min-width: 240px;
  max-width: min(340px, 86vw);
  max-height: min(420px, 70vh);
  overflow: auto;
  padding: 6px 0 10px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 3px solid var(--red);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.board-chip-menu-title {
  margin: 0;
  padding: 8px 14px 6px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8f8f8f;
}

.board-chip-menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-chip-menu-head .board-chip-menu-title {
  flex: 1;
  min-width: 0;
}

.board-chip-menu .board-filter-clear {
  width: auto;
  flex: 0 0 auto;
  padding: 4px 10px;
  margin-right: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #b5b5b5;
}

.board-filter-col {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-filter-col .board-chevron {
  margin-left: auto;
  transform: rotate(-90deg);
}

.board-filter-col.open .board-chevron {
  transform: none;
}

.board-filter-col-value {
  color: #8f8f8f;
  font-weight: 500;
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-filter-col.has-filter .board-filter-col-value {
  color: #fff;
}

.board-chip-menu button:has(.board-filter-check) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-filter-values button {
  padding-left: 14px;
}

.board-filter-check {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 1px solid #666;
  border-radius: 2px;
  background: transparent;
}

.board-chip-menu button.selected .board-filter-check {
  background: var(--red);
  border-color: var(--red);
}

.board-chip-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #eee;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.board-chip-menu button:hover,
.board-chip-menu button.selected {
  background: #1c1c1c;
  color: #fff;
}

.board-chip-menu button.selected {
  box-shadow: inset 3px 0 0 var(--red);
}

.board-chip-menu button:disabled {
  opacity: 0.45;
  cursor: default;
}

.board-chip-menu input,
.board-chip-menu select {
  display: block;
  width: calc(100% - 20px);
  margin: 4px 10px 6px;
  box-sizing: border-box;
  min-height: 36px;
  border: 1px solid #444;
  background: #1a1a1a;
  color: #fff;
  padding: 0 10px;
  font: inherit;
  border-radius: 6px;
}

.board-chip-menu input:focus,
.board-chip-menu select:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.board-sort-th {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 0 18px 0 8px;
  cursor: pointer;
  text-align: center;
  position: relative;
  z-index: 1;
}

.board-col-th.pinned .board-sort-th {
  justify-content: flex-start;
  text-align: left;
  padding-left: 12px;
}

.board-sort-th.active {
  color: var(--red);
}

.board-col-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  font-weight: 600;
  padding: 0 18px 0 8px;
  text-align: center;
}

.board-col-th.pinned .board-col-label {
  justify-content: flex-start;
  text-align: left;
  padding-left: 12px;
}

.board-groups {
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-bottom: 28px;
}

.board-group {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--card);
  border: 1px solid #c8c8c8;
  border-radius: 8px;
  overflow: visible;
  box-sizing: border-box;
}

.board-group:nth-child(even) {
  background: #c4c4c4;
}

.board-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: transparent;
}

.board-drag-handle {
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 22px;
  touch-action: none;
  cursor: grab;
  background-image: radial-gradient(circle, #767676 1.15px, transparent 1.2px);
  background-size: 5px 5px;
  background-position: 2px 1px;
  opacity: 0.4;
}

.board-drag-handle:active {
  cursor: grabbing;
}

.board-group-head:hover .board-drag-handle,
tr:hover .board-drag-handle,
.board-drag-handle:hover {
  opacity: 0.9;
}

.board-group.dragging,
tr.dragging {
  opacity: 0.45;
}

.board-group.drop-before {
  box-shadow: inset 0 3px 0 var(--red);
}

.board-group.drop-after {
  box-shadow: inset 0 -3px 0 var(--red);
}

tr.drop-before td {
  box-shadow: inset 0 3px 0 var(--red);
}

tr.drop-after td {
  box-shadow: inset 0 -3px 0 var(--red);
}

body.board-row-dragging {
  cursor: grabbing;
  user-select: none;
}

.board-select-th,
.board-select-td {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  text-align: center;
  vertical-align: middle;
  overflow: visible;
}

.board-select-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.board-select-box {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--red);
  cursor: pointer;
}

.board-group-head .board-select-box {
  flex: 0 0 auto;
}

@media (hover: hover) and (pointer: fine) {
  .board-select-box {
    opacity: 0;
  }

  .board-group-head:hover .board-select-box,
  .board-table tbody tr:hover .board-select-box,
  .board-select-box:focus-visible,
  .board-has-selection .board-select-box {
    opacity: 1;
  }
}

.board-group.is-selected {
  box-shadow: inset 3px 0 0 var(--red);
}

.board-table tbody tr.is-selected td {
  background: #f3d0d0;
}

.board-group:nth-child(even) .board-table tbody tr.is-selected td {
  background: #e8c4c4;
}

.board-table tbody tr.is-selected td.board-select-td {
  box-shadow: inset 3px 0 0 var(--red);
}

.board-bulk-bar {
  position: fixed;
  left: 50%;
  bottom: max(20px, calc(16px + var(--safe-bottom)));
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: min(960px, calc(100vw - 32px));
  padding: 10px 12px 10px 14px;
  background: #111;
  color: #fff;
  border: 1px solid #333;
  border-radius: var(--radius-card);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.board-bulk-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-card);
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
}

.board-bulk-label {
  font-weight: 650;
  font-size: 0.88rem;
  white-space: nowrap;
  margin-right: 4px;
}

.board-bulk-btn {
  border: 1px solid #333;
  background: transparent;
  color: #eee;
  border-radius: var(--radius-card);
  min-height: 32px;
  padding: 0 12px;
  font: inherit;
  font-weight: 650;
  font-size: 0.82rem;
  cursor: pointer;
}

.board-bulk-btn:hover,
.board-bulk-btn.is-open {
  border-color: #666;
  background: #1c1c1c;
  color: #fff;
}

.board-bulk-delete:hover {
  border-color: var(--red);
  color: #fff;
}

.board-bulk-x {
  width: 32px;
  height: 32px;
  margin-left: 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #bbb;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.board-bulk-x:hover {
  color: #fff;
  background: #2a2a2a;
}

.board-bulk-menu {
  position: absolute;
  left: 14px;
  bottom: calc(100% + 8px);
  z-index: 71;
  min-width: 220px;
  max-width: min(360px, 86vw);
  max-height: min(360px, 50vh);
  overflow: auto;
  padding: 8px 0 10px;
  background: #111;
  color: #eee;
  border: 1px solid #2a2a2a;
  border-top: 3px solid var(--red);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.board-bulk-menu-title {
  margin: 0;
  padding: 6px 14px 8px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8f8f8f;
}

.board-bulk-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #eee;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.board-bulk-menu button:hover {
  background: #1c1c1c;
  color: #fff;
}

.board-bulk-person-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.board-bulk-person-row button:first-child {
  flex: 1;
}

.board-bulk-remove {
  width: 36px;
  flex: 0 0 auto;
  text-align: center;
  color: #aaa;
}

.board-bulk-menu input {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 8px;
  padding: 8px 10px;
  border: 1px solid #333;
  background: #000;
  color: #fff;
  font: inherit;
}

.board-bulk-empty {
  margin: 0;
  padding: 8px 14px;
  color: #8f8f8f;
  font-size: 0.85rem;
}

.board-group-label,
.board-group-color {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.board-group-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.board-group-color::-webkit-color-swatch {
  border: 0;
  border-radius: 3px;
}

.board-group-color::-moz-color-swatch {
  border: 0;
  border-radius: 3px;
}

.board-group.tone-red .board-group-label { background: var(--red); }
.board-group.tone-red .board-group-fold { color: var(--red); }
.board-group.tone-ink .board-group-label { background: var(--black); }
.board-group.tone-ink .board-group-fold { color: var(--black); }
.board-group.tone-warn .board-group-label { background: var(--warn); }
.board-group.tone-warn .board-group-fold { color: var(--warn); }
.board-group.tone-ok .board-group-label { background: var(--ok); }
.board-group.tone-ok .board-group-fold { color: var(--ok); }
.board-group.tone-mute .board-group-label { background: #7a7a7a; }
.board-group.tone-mute .board-group-fold { color: #5a5a5a; }

.board-group-head .board-row-x,
.board-table .board-row-x {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .board-group-head .board-row-x,
  .board-table .board-row-x {
    opacity: 0;
  }

  .board-group:hover .board-group-head .board-row-x,
  .board-table tbody tr:hover .board-row-x,
  .board-table tbody tr.board-draft-row .board-row-x {
    opacity: 1;
  }
}

.board-group-fold {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  font: inherit;
  position: relative;
  z-index: 1;
}

.board-group-fold:hover .board-chevron {
  opacity: 1;
}

.board-group.collapsed .board-group-body { display: none; }
.board-group.collapsed .board-group-fold .board-chevron { transform: rotate(-90deg); }

.board-group-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: text;
  font: inherit;
  color: inherit;
  position: relative;
  z-index: 2;
}

.board-group-name {
  display: inline;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: text;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--group-color, inherit);
}

.board-group-name-input {
  width: min(100%, 22rem);
  border: 0;
  border-bottom: 2px solid currentColor;
  background: transparent;
  padding: 0 0 2px;
  margin: 0;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: inherit;
  outline: none;
}

.board-group-count {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.board-table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: none;
  overflow: visible;
  border: 0;
}

.board-table {
  table-layout: fixed;
  border-collapse: collapse;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-size: 0.86rem;
  border: 1px solid var(--line);
  --board-cell-gap: 4px;
}

.board-table th,
.board-table td {
  border: 1px solid var(--line);
  padding: 0;
  vertical-align: middle;
  overflow: hidden;
}

.board-table tbody td {
  padding: var(--board-cell-gap);
  height: auto;
}

.board-table tbody td.board-select-td,
.board-table tbody td.board-row-actions {
  padding: var(--board-cell-gap) 0;
}

.board-table th.board-select-th,
.board-table td.board-select-td {
  overflow: visible;
}

.board-table .board-person-td,
.board-table .board-scope-td {
  overflow: visible;
}

.board-table th {
  background: var(--card);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  height: 38px;
  padding: 0 10px;
}

.board-group:nth-child(even) .board-table th {
  background: #c4c4c4;
}

.board-table td {
  background: var(--card);
  height: 38px;
}

.board-group:nth-child(even) .board-table td {
  background: #c4c4c4;
}

.board-table tbody tr:hover td {
  background: var(--paper);
}

.board-group:nth-child(even) .board-table tbody tr:hover td {
  background: #d0d0d0;
}

.board-table tbody tr:has(:focus-within),
.board-table tbody tr:has(.board-cell-active) {
  position: relative;
  z-index: 5;
}

.board-table td:focus-within,
.board-table td.board-cell-active {
  position: relative;
  z-index: 6;
  box-shadow: 0 0 0 2px #0073ea;
  background: var(--card);
}

.board-table .board-name-td { min-width: 0; }
.board-table .board-person-td { min-width: 0; }
.board-table .board-status-td { min-width: 0; }
.board-table .board-date-td { min-width: 0; }
.board-table .board-scope-td { min-width: 0; }
.board-table .board-init-td { min-width: 0; }
.board-row-actions { width: 36px; text-align: center; }
.board-actions-th {
  position: relative;
  width: 36px;
}

.board-col-th {
  position: relative;
  cursor: grab;
  user-select: none;
}

.board-col-th.pinned {
  cursor: default;
}

.board-col-th.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.board-col-th.drop-left::before,
.board-col-th.drop-right::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--red);
  z-index: 3;
}

.board-col-th.drop-left::before { left: 0; }
.board-col-th.drop-right::after { right: 0; }

.board-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 100%;
  cursor: col-resize;
  z-index: 8;
  touch-action: none;
  pointer-events: auto;
}

.board-table td[data-col-key],
.board-row-actions {
  position: relative;
}

.board-table td .board-col-resizer {
  z-index: 9;
}

.board-col-th:has(.board-col-resizer:hover),
.board-table td:has(.board-col-resizer:hover),
.board-actions-th:has(.board-col-resizer:hover),
.board-row-actions:has(.board-col-resizer:hover),
.board-col-resize-line {
  box-shadow: inset -3px 0 0 0 var(--red);
}

body.board-col-resizing,
body.board-col-dragging {
  cursor: col-resize;
  user-select: none;
}

body.board-col-dragging { cursor: grabbing; }

.board-cell-input,
.board-status,
.board-initiative {
  width: 100%;
  height: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 3px;
  padding: 0 8px;
  font: inherit;
  background: transparent;
  outline: none;
  box-shadow: none;
}

.board-cell-input:focus,
.board-status:focus,
.board-initiative:focus {
  outline: none;
}

.board-status {
  font-weight: 700;
  text-align: center;
  appearance: none;
  color: #fff;
  cursor: pointer;
}

.board-status option {
  color: #111;
  background: #fff;
  font-weight: 600;
}

.board-status:not(.ok):not(.warn):not(.bad):not(.idle):not(.progress) {
  background: #c4c4c4;
  color: #fff;
}

.board-status.ok { background: var(--ok); color: #fff; }
.board-status.progress { background: #b5e0bd; color: #163d24; }
.board-status.warn { background: var(--warn); color: #fff; }
.board-status.bad { background: var(--red); color: #fff; }
.board-status.idle { background: #c4c4c4; color: #fff; }

.board-name-input {
  text-align: left;
}

/* IQ-248: long task names wrap instead of clipping. */
.board-table textarea.board-name-input {
  display: block;
  height: auto;
  resize: none;
  overflow: hidden;
  padding: 5px 8px;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  field-sizing: content;
}

.board-table .board-date-td .board-cell-input,
.board-table .board-init-td .board-cell-input,
.board-table .board-init-td .board-initiative {
  text-align: center;
}

.board-initiative {
  appearance: none;
  cursor: pointer;
  font-weight: 600;
}

.board-table .board-date-td .board-cell-input::-webkit-datetime-edit {
  width: 100%;
  text-align: center;
}

.board-table .board-person-trigger {
  justify-content: center;
  text-align: center;
}

.board-table .board-person-stack {
  justify-content: center;
}

.board-person-cell {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 28px;
  padding: 0;
}

.board-person-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 28px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  outline: none;
  box-shadow: none;
}

.board-person-trigger:focus {
  outline: none;
}

.board-person-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
}

.board-person-placeholder {
  display: block;
  min-height: 22px;
}

.board-person-chip {
  display: inline-flex;
  align-items: center;
}

.board-person-chip.initials {
  padding: 0;
  background: transparent;
  margin-left: -6px;
}

.board-person-chip.initials:first-child {
  margin-left: 0;
}

.board-person-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.5rem;
}

.board-person-picker {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: min(280px, 72vw);
  padding: 10px;
  background: #2b2b2b;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.board-person-picker-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 8px;
  background: #1f1f1f;
  border: 2px solid #0073ea;
  border-radius: 8px;
}

.board-person-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 6px 2px 2px;
  border-radius: var(--radius-card);
  background: #3a3a3a;
  color: #fff;
}

.board-person-pill-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.board-person-pill-x,
.board-person-picker-clear {
  border: 0;
  background: transparent;
  color: #bbb;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.board-person-pill-x:hover,
.board-person-picker-clear:hover {
  color: #fff;
}

.board-person-picker-search {
  flex: 1 1 72px;
  min-width: 48px;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  padding: 4px 0;
  outline: none;
}

.board-person-picker-label {
  margin: 10px 2px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #9a9a9a;
}

.board-person-picker-list {
  max-height: 220px;
  overflow: auto;
}

.board-person-suggest {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #eee;
  text-align: left;
  padding: 7px 6px;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
}

.board-person-suggest:hover {
  background: #3a3a3a;
  color: #fff;
}

.board-person-picker-empty {
  margin: 0;
  padding: 8px 6px;
  color: #8f8f8f;
  font-size: 0.8rem;
}

.board-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--black);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  box-shadow: 0 0 0 2px var(--card);
}

.board-avatar-photo {
  overflow: hidden;
  padding: 0;
  background: #222;
}

.board-avatar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.board-group:nth-child(even) .board-avatar {
  box-shadow: 0 0 0 2px #c4c4c4;
}

.board-table td:focus-within .board-avatar,
.board-table td.board-cell-active .board-avatar {
  box-shadow: 0 0 0 2px var(--paper);
}

.board-person-picker .board-avatar,
.board-person-pill .board-avatar {
  box-shadow: none;
}

.board-subitems,
.board-empty-row {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 8px;
}

.board-add-task {
  display: block;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.board-add-task:hover {
  background: var(--paper);
  color: var(--black);
}

.board-group:nth-child(even) .board-add-task:hover {
  background: #d0d0d0;
}

.board-draft-row td {
  background: #fff7f7;
}

.board-group:nth-child(even) .board-draft-row td {
  background: #f3eaea;
}

.board-group:nth-child(even) .board-draft-row {
  background: #f3eaea;
}

.board-draft-row .board-row-actions {
  width: 36px;
  white-space: nowrap;
}

.board-scope-cell {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0;
}

.board-scope-btn {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 4px;
  position: relative;
  width: 100%;
  min-height: 28px;
  height: auto;
  border: 0;
  background: transparent;
  border-radius: 3px;
  text-align: left;
  padding: 2px 28px 2px 10px;
  font: inherit;
  cursor: pointer;
  outline: none;
}

.board-scope-btn:focus,
.board-scope-btn.open {
  outline: none;
}

.board-scope-caret {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #666;
}

.board-scope-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-card);
  background: #c8c8c8;
  font-size: 0.72rem;
  font-weight: 600;
}

.board-scope-placeholder {
  color: #9a9a9a;
  font-size: 0.78rem;
}

.board-scope-pop {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  display: flex;
  flex-direction: column;
  width: min(320px, 75vw);
  max-height: 320px;
  overflow: hidden;
  padding: 0;
  background: var(--card);
  border: 1px solid #c8c8c8;
  border-radius: 8px;
}

.board-scope-search {
  flex: 0 0 auto;
  padding: 8px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.board-scope-search-input {
  width: 100%;
  height: 32px;
  border: 1px solid #c8c8c8;
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  font-size: 0.82rem;
  background: #f4f4f4;
  outline: none;
}

.board-scope-search-input:focus {
  border-color: #0073ea;
  background: #fff;
}

.board-scope-outline {
  flex: 1 1 auto;
  overflow: auto;
  padding: 4px 0 8px;
}

.board-scope-outline > .board-scope-empty {
  margin: 8px 12px;
}

.board-scope-region {
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--line);
}

.board-scope-region:last-child {
  border-bottom: 0;
}

.board-scope-hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.board-scope-empty {
  margin: 0 0 0 24px;
  color: #9a9a9a;
  font-size: 0.72rem;
}

.board-scope-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.board-scope-option.nested {
  padding-left: 8px;
  font-weight: 500;
  color: var(--ink);
}

.board-scope-programs {
  padding-left: 16px;
}

.board-scope-option input {
  margin-top: 3px;
}

@media (max-width: 820px) {
  body.board-open .brand-bar {
    margin-bottom: 0;
  }
  body.board-open .shell {
    padding-left: max(8px, var(--safe-left));
    padding-right: max(8px, var(--safe-right));
    padding-bottom: 4px;
  }
  .board-app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    position: relative;
  }
  .board-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 32;
    width: min(86vw, 300px);
    max-height: none;
    height: 100%;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
  }
  .board-app.board-sidebar-open .board-sidebar {
    transform: translateX(0);
    box-shadow: 12px 0 28px rgba(0, 0, 0, 0.45);
  }
  .board-app.board-sidebar-open .board-sidebar-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 31;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
  }
  .board-sidebar-toggle {
    display: inline-flex;
  }
  .board-canvas {
    padding: 8px 10px 0;
  }
  .board-chrome {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
  .board-chrome-end {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
}

.tb-drop,
.tb-pool-drop {
  min-height: 72px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  background: var(--paper);
}
#tb-pool-list {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}
#tb-built-groups {
  flex: 1 1 auto;
  min-height: 12rem;
  overflow: auto;
}
.tb-drop.over,
.tb-pool-drop.over {
  border-color: var(--black);
  background: var(--card);
}
.tb-player-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  margin: 0 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
  cursor: grab;
}
.tb-player-card:last-child { margin-bottom: 0; }
.tb-player-card.dragging { opacity: 0.5; }
.tb-player-card .meta { color: var(--muted); font-size: 0.8rem; }

@media (max-width: 900px) {
  .tb-grid,
  .tb-board { grid-template-columns: 1fr; }
  .tb-block { min-height: 20rem; }
  #tb-pool-block.tb-block { min-height: 0; }
}

@container tb-page (max-width: 900px) {
  .tb-board { grid-template-columns: 1fr; }
  .tb-block { min-height: 20rem; }
  #tb-pool-block.tb-block { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html.ui-preview,
html.ui-preview body {
  background: var(--page);
}

@media (min-width: 821px) {
  html.ui-preview .brand-bar-inner {
    flex-wrap: nowrap;
    align-items: center;
  }

  html.ui-preview .brand-lockup {
    flex: 0 0 auto;
    order: unset;
  }

  html.ui-preview .app-nav {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    order: unset;
  }

  html.ui-preview .brand-actions {
    flex: 0 0 auto;
    margin-left: 0;
    order: unset;
  }
}

html.ui-preview .nav-tab {
  display: inline-flex;
  flex: 1 1 0;
  min-width: 0;
  max-width: 13rem;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.2cqi, 8px);
  border-radius: var(--radius-chip);
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 600;
  line-height: 1;
  padding: 8px clamp(6px, 2.2cqi, 16px);
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

html.ui-preview .nav-tab-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  overflow: visible;
}

html.ui-preview .nav-tab-label {
  display: block;
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: 100%;
  line-height: 1;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  font-size: clamp(10px, 0.95vw, 13px);
}

html.ui-preview .app-nav--compact .nav-tab-icon {
  display: none !important;
}

html.ui-preview .app-nav--compact .nav-tab {
  gap: 0;
  padding-inline: clamp(4px, 1.4cqi, 10px);
}

@container app-nav (max-width: 780px) {
  html.ui-preview .nav-tab-icon {
    display: none;
  }

  html.ui-preview .nav-tab {
    gap: 0;
    padding-inline: clamp(4px, 1.6cqi, 10px);
  }
}

html.ui-preview .nav-tab:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: var(--ink);
}

html.ui-preview .nav-tab.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 8px 18px rgba(232, 17, 45, 0.28);
}

html.ui-preview .brand-bar .logout-btn,
html.ui-preview .brand-bar .theme-toggle {
  border-radius: var(--radius-chip);
  background: transparent;
  color: #fff;
  border: 1px solid #444;
}

html.ui-preview .brand-bar .logout-btn:hover:not(:disabled),
html.ui-preview .brand-bar .theme-toggle:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

html.ui-preview .panel {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  color: var(--ink);
}

html.ui-preview .panel h2 {
  letter-spacing: 0.02em;
}

html.ui-preview .filter-label {
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 600;
  font-size: 0.78rem;
}

html.ui-preview .type-chip,
html.ui-preview .pill {
  border-radius: var(--radius-chip);
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 600;
}

html.ui-preview .type-chip.active,
html.ui-preview .pill.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

html.ui-preview .type-chip .type-count {
  border-radius: var(--radius-chip);
  background: var(--paper);
  color: var(--muted);
}

html.ui-preview .type-chip.active .type-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

html.ui-preview .item {
  border-radius: var(--radius-card);
  background: var(--card);
  border-color: var(--line);
}

html.ui-preview .item:hover {
  box-shadow: inset 3px 0 0 var(--red), 0 8px 20px rgba(0, 0, 0, 0.06);
}

html.ui-preview .badge {
  border-radius: var(--radius-card);
}

html.ui-preview input[type="search"] {
  border-radius: 12px;
  background: #fff;
}

html.ui-preview .stat {
  border-radius: 12px;
  background: var(--card);
}

html.ui-preview .sort-control-select {
  border-radius: var(--radius-chip);
}

html.ui-preview .board-chip {
  border-radius: var(--radius-chip);
}

html.ui-preview .btn-primary,
html.ui-preview .btn-secondary,
html.ui-preview .btn-ghost,
html.ui-preview .btn-danger,
html.ui-preview .btn-sync-sm {
  border-radius: var(--radius-card);
}

.members-geo-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.members-geo-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: end;
  margin: 0 0 12px;
}

.members-geo-controls {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) auto;
  gap: 12px 16px;
  align-items: end;
  margin: 0 0 16px;
}

.members-geo-search-wrap {
  position: relative;
  min-width: 0;
}

.members-geo-search-wrap input[type="search"] {
  max-width: none;
}

.members-geo-location {
  max-width: 560px;
  margin: 0 0 16px;
}

.members-geo-suggest {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  max-height: 240px;
  overflow: auto;
}

.members-geo-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
}

.members-geo-suggest button:hover,
.members-geo-suggest button:focus {
  background: var(--red-soft);
}

.members-geo-suggest-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--red);
}

.members-geo-label {
  display: block;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 6px;
}

.members-geo-field .members-geo-label {
  display: block;
  margin-bottom: 6px;
}

.members-geo-field-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.members-geo-field-head .members-geo-label {
  margin-bottom: 0;
}

.members-geo-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: var(--ink);
}

.members-geo-all input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--red);
}

.members-geo-range {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
}

.members-geo-range input[type="range"] {
  flex: 1;
  min-width: 0;
}

.members-geo-grad {
  display: flex;
  align-items: center;
  gap: 8px;
}

.members-geo-grad input[type="number"],
#members-geo-miles {
  width: 5.5rem;
  min-height: var(--touch);
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.members-geo-grad select {
  width: 6.5rem;
  min-height: var(--touch);
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.members-geo-grad select:disabled {
  opacity: 0.55;
}

.members-geo-gender {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.members-geo-gender-btn {
  min-height: var(--touch);
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--black);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.members-geo-gender-btn.is-on,
.members-geo-gender-btn[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.members-geo-actions {
  padding-bottom: 2px;
}

.members-geo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 16px;
  min-height: 480px;
}

.members-geo-map {
  min-height: 480px;
  height: 62vh;
  border: 1px solid var(--line);
  background: #d7dde2;
  z-index: 1;
}

.members-geo-results {
  min-height: 480px;
  max-height: 62vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px 14px;
}

.members-geo-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 10px;
  font-weight: 600;
}

.members-geo-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.members-geo-family {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.members-geo-family h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.members-geo-family p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.92rem;
}

.leaflet-container {
  font: inherit;
  background: #d7dde2;
}

.pac-container {
  z-index: 12000;
  font-family: var(--font-body);
}

@media (max-width: 960px) {
  .members-geo-controls {
    grid-template-columns: 1fr 1fr;
  }

  .members-geo-search-wrap,
  .members-geo-actions {
    grid-column: 1 / -1;
  }

  .members-geo-layout {
    grid-template-columns: 1fr;
  }

  .members-geo-map,
  .members-geo-results {
    height: 360px;
    min-height: 360px;
    max-height: none;
  }
}

.home-mosaic-shell {
  max-width: 1280px;
  padding-bottom: 48px;
}

body:has(#view-home-mosaic:not(.hidden)) .shell {
  max-width: none;
  width: 100%;
}

@media (min-width: 1025px) {
  #view-home-mosaic {
    width: 75%;
    max-width: 75%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }
}

.home-mosaic-banner {
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.home-mosaic-title {
  margin: 0 0 16px;
  color: var(--black);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-mosaic {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 92px;
  gap: 16px;
  align-items: stretch;
  align-content: start;
  grid-auto-flow: row;
}

.home-mosaic-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 0 auto;
  flex: 0 0 auto;
}

.home-mosaic-region-filters {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.home-mosaic-region-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  margin: 0;
  padding: 16px 32px;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.home-mosaic-region-bar[hidden] {
  display: none;
}

.home-mosaic-filter-field {
  position: relative;
  flex: 0 1 auto;
}

.home-mosaic-filter-trigger,
.home-mosaic-filter-query {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 9px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.home-mosaic-filter-trigger {
  min-width: 0;
  flex: 0 1 auto;
}

.home-mosaic-filter-kicker {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-mosaic-filter-value {
  color: var(--ink);
  font-weight: 700;
}

.home-mosaic-filter-value.is-all {
  font-weight: 600;
  color: var(--muted);
}

.home-mosaic-filter-caret {
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
}

.home-mosaic-filter-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 100%;
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--line);
}

.home-mosaic-filter-menu .home-mosaic-regions,
.home-mosaic-filter-menu .home-mosaic-types {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.home-mosaic-filter-query {
  flex: 1 1 220px;
  width: auto;
  min-width: 140px;
  max-width: 320px;
  font-weight: 500;
  cursor: text;
}

.home-mosaic-filter-query::placeholder {
  color: var(--muted);
}

.home-mosaic-filter-count {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* IQ-233: at phone width the master filter bar wraps and the query takes a full row. */
@media (max-width: 640px) {
  .home-mosaic-region-bar {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .home-mosaic-region-filters {
    flex-wrap: wrap;
    flex-basis: 100%;
  }

  .home-mosaic-filter-query {
    flex: 1 1 100%;
    max-width: none;
  }
}

.home-mosaic.is-rail {
  display: block;
}

.home-mosaic.is-rail.is-editing {
  display: block;
}

.home-mosaic.is-rail::after {
  content: "";
  display: block;
  clear: both;
}

.home-mosaic.is-rail .home-mosaic-card,
.home-mosaic.is-rail .home-mosaic-card[data-x],
.home-mosaic.is-rail .home-mosaic-card[data-col],
.home-mosaic.is-rail .home-mosaic-card[data-row],
.home-mosaic.is-rail .home-mosaic-card[data-size="sm"],
.home-mosaic.is-rail .home-mosaic-card[data-size="md"],
.home-mosaic.is-rail .home-mosaic-card[data-size="lg"],
.home-mosaic.is-rail .home-mosaic-card.is-expanded {
  grid-column: auto;
  grid-row: auto;
}

.home-mosaic.is-rail .home-mosaic-card:not([data-card="team-works"]) {
  width: calc(64% - 16px);
  margin-bottom: 32px;
  height: auto;
}

.home-mosaic.is-rail .home-mosaic-card[data-card="team-works"] {
  float: right;
  width: calc(36% - 16px);
  height: auto;
  max-height: calc(100dvh - 188px);
  overflow: hidden;
  margin: 0 12px 32px 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

.home-mosaic.is-rail .home-mosaic-events-block,
.home-mosaic.is-rail .home-mosaic-surface,
.home-mosaic.is-rail .home-mosaic-late-wrap,
.home-mosaic.is-rail .home-mosaic-peek {
  flex: none;
  min-height: unset;
  height: auto;
  overflow: visible;
}

.home-mosaic.is-rail [data-card="members"] .home-mosaic-map {
  flex: none;
  height: 220px;
  min-height: 220px;
}

.home-mosaic-team-chip .gap-mini-table {
  margin-top: 14px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.home-mosaic-team-chip .gap-mini-table th {
  padding: 0 0 7px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.13em;
  font-size: 10.5px;
}

.home-mosaic-team-chip .gap-mini-table td {
  padding: 8px 0;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.home-mosaic-team-chip .gap-mini-table tr.bad td,
.home-mosaic-team-chip .gap-mini-table tr.ok td {
  background: transparent;
}

.home-mosaic-team-chip .gap-mini-table td:nth-child(3) {
  color: var(--muted);
}

.home-mosaic-team-chip .gap-mini-table tr.bad td:nth-child(4) {
  color: var(--bad);
  font-weight: 700;
}

.home-mosaic-team-chip .gap-mini-table tr.ok td:nth-child(4) {
  color: var(--muted);
  font-weight: 700;
}

.home-mosaic-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  background: var(--line);
  border: 2px solid var(--line);
}

.home-mosaic-stat {
  background: var(--card);
  padding: 18px 16px;
  text-align: center;
}

.home-mosaic-stat-kicker,
.home-mosaic-task-stat-k {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-mosaic-stat-n {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.home-mosaic-stat-n.bad,
.home-mosaic-task-stat-n.bad {
  color: var(--red);
}

.home-mosaic-stat-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.home-mosaic-stat-bar {
  height: 4px;
  margin-top: 12px;
  background: var(--line);
}

.home-mosaic-stat-bar > span {
  display: block;
  height: 4px;
  background: var(--ink);
}

.home-mosaic-task-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.home-mosaic-task-stat-n {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.home-mosaic-task-stat-k {
  display: block;
  margin-top: 6px;
}

.home-mosaic-task-list {
  display: flex;
  flex-direction: column;
}

.home-mosaic-task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  box-sizing: border-box;
}

.home-mosaic-task-main {
  flex: 1 1 auto;
  min-width: 0;
  --home-task-mark: 15px;
  --home-task-mark-gap: 12px;
}

.home-mosaic-task-name {
  display: flex;
  align-items: center;
  gap: var(--home-task-mark-gap);
}

.home-mosaic-task-box {
  width: var(--home-task-mark);
  height: var(--home-task-mark);
  margin-top: 0;
  border: 1.5px solid var(--red);
  background: var(--red);
  flex: 0 0 auto;
}

.home-mosaic-task-name,
.home-mosaic-task-name .board-name-input {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.home-mosaic-task-group-title {
  margin: 16px 0 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-mosaic-task-group:first-child .home-mosaic-task-group-title {
  margin-top: 4px;
}

.home-mosaic-task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  margin-left: calc(var(--home-task-mark) + var(--home-task-mark-gap));
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.home-mosaic-task-meta.is-past,
.home-mosaic-task-meta.is-past .board-status {
  color: var(--red);
}

.home-mosaic-task-board {
  margin-left: 8px;
}

.home-mosaic-card {
  order: 1;
  position: relative;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 16px 16px 18px;
  color: var(--ink);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  grid-column: var(--mosaic-x, 1) / span var(--mosaic-col, 2);
  grid-row: var(--mosaic-y, 1) / span var(--mosaic-row, 2);
}

.home-mosaic-card[data-size="sm"] {
  --mosaic-col: 2;
  --mosaic-row: 2;
}

.home-mosaic-card[data-size="md"] {
  --mosaic-col: 4;
  --mosaic-row: 2;
}

.home-mosaic-card[data-size="lg"],
.home-mosaic-card.is-expanded {
  --mosaic-col: 4;
  --mosaic-row: 4;
}

.home-mosaic-card[data-col] {
  grid-column: var(--mosaic-x, 1) / span var(--mosaic-col, 2);
}

.home-mosaic-card[data-row] {
  grid-row: var(--mosaic-y, 1) / span var(--mosaic-row, 2);
}

.home-mosaic-card:not(.is-expanded) {
  cursor: pointer;
}

.home-mosaic-card.is-expanded {
  cursor: pointer;
}

.home-mosaic.is-editing .home-mosaic-card {
  cursor: grab;
  touch-action: none;
  will-change: transform;
  transition:
    transform 480ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms ease;
  box-shadow: 0 0 0 2px #111, 0 18px 40px rgba(0, 0, 0, 0.28);
}

.home-mosaic.is-editing .home-mosaic-card.is-tile-dragging {
  cursor: grabbing;
  z-index: 9;
  transition: none;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.4);
}

.home-mosaic.is-editing .home-mosaic-card.is-collision-preview {
  z-index: 7;
}

.home-mosaic.is-rail.is-editing .home-mosaic-card:not([data-card="team-works"]) {
  cursor: grab;
  grid-column: auto;
  grid-row: auto;
}

.home-mosaic.is-rail.is-editing .home-mosaic-card[data-card="team-works"] {
  float: none;
  position: fixed;
  top: 188px;
  right: 12px;
  width: calc(36% - 16px);
  height: auto;
  max-height: calc(100dvh - 204px);
  overflow: hidden;
  margin: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  grid-column: auto;
  grid-row: auto;
  will-change: auto;
  transform: none;
  cursor: default;
}

.home-mosaic.is-editing {
  min-height: 1120px;
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.045) 1px, transparent 1px);
  background-size:
    calc((100% - 48px) / 4 + 16px) 108px,
    calc((100% - 48px) / 4 + 16px) 108px;
}

.home-mosaic.is-editing .home-mosaic-card.is-resizing {
  cursor: nwse-resize;
  justify-self: start;
  align-self: start;
  width: var(--mosaic-resize-w);
  height: var(--mosaic-resize-h);
  max-width: none;
  z-index: 8;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  transition: none;
}

.home-mosaic-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-mosaic-card[data-card="rosters"] .home-mosaic-card-body {
  overflow: hidden;
}

.home-mosaic-resize {
  display: none;
}

.home-mosaic.is-editing .home-mosaic-resize {
  display: block;
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  z-index: 5;
  touch-action: none;
}

.home-mosaic.is-editing [data-card="team-works"] .home-mosaic-resize {
  display: none;
}

.home-mosaic.is-editing .home-mosaic-resize::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-right: 2px solid #111;
  border-bottom: 2px solid #111;
}

.home-mosaic-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-mosaic-card h3 {
  position: relative;
  margin: 0;
  padding-left: 14px;
  font-size: 1.2rem;
}

.home-mosaic-card h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  background: var(--red);
}

.home-mosaic-summary {
  margin: 0;
  color: var(--muted);
}

.home-mosaic-as-of {
  margin: 0 0 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.waitlist-note {
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

.home-mosaic-late-label {
  margin: 0 0 2px;
  font-size: 0.9rem;
}

.home-mosaic-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.home-mosaic-card[data-col="4"] .home-mosaic-kpis,
.home-mosaic-card.is-expanded > .home-mosaic-kpis,
.home-mosaic-card.is-expanded .home-mosaic-kpis {
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
}

.home-mosaic-events-block,
.home-mosaic-tasks-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.home-mosaic-events-block .home-mosaic-kicker,
.home-mosaic-tasks-block .home-mosaic-kicker {
  margin-top: 4px;
}

.home-mosaic-card .team-works-kpi {
  min-height: 4.5rem;
  padding: 12px 8px;
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}

.home-mosaic-card .team-works-kpi-n {
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
}

.home-mosaic-card .team-works-chip {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}

.home-mosaic-card .team-works-chip.active {
  background: #111;
  border-color: #111;
  color: #fff;
}

.home-mosaic-card .team-works-chip:hover:not(.active) {
  background: #eceae6;
  border-color: #cfc9c2;
}

.home-mosaic-program-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.home-mosaic-program-query {
  flex: 1 1 12rem;
  min-width: 10rem;
  box-sizing: border-box;
  padding: 6px 12px;
  border: 1px solid #cfc8bc;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: text;
}

.home-mosaic-card .team-works-programs {
  position: relative;
}

.home-mosaic-card .team-works-programs .board-chip-menu {
  z-index: 4;
}

.home-mosaic-card .home-mosaic-events-block {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.home-mosaic-card .home-mosaic-surface,
.home-mosaic-card .home-mosaic-late-wrap {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  flex: 1 1 0;
  overflow: auto;
}

.home-mosaic-card .team-works-table-wrap,
.home-mosaic-card .team-works-events-wrap,
.home-mosaic-late-wrap,
.home-mosaic-team-chips,
.home-mosaic-peek {
  min-height: 0;
}

.home-mosaic-card .team-works-table,
.home-mosaic-card .events-fill-table,
.home-mosaic-card .home-mosaic-late {
  width: 100%;
  min-width: 100%;
  table-layout: auto;
}

.home-mosaic-card .team-works-table th,
.home-mosaic-card .team-works-table td,
.home-mosaic-card .events-fill-table th,
.home-mosaic-card .events-fill-table td,
.home-mosaic-card .home-mosaic-late th,
.home-mosaic-card .home-mosaic-late td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.home-mosaic-card .events-fill-table th,
.home-mosaic-card .events-fill-table td {
  width: 1%;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.home-mosaic-card .events-fill-table th:first-child,
.home-mosaic-card .events-fill-table td:first-child {
  width: auto;
  white-space: normal;
  overflow-wrap: break-word;
  text-align: left;
}

.home-mosaic-card .events-fill-table th:nth-child(n + 2):not(:last-child),
.home-mosaic-card .events-fill-table td:nth-child(n + 2):not(:last-child) {
  text-align: center;
}

.home-mosaic-card .events-fill-table .team-works-goal-input {
  width: 4.75rem;
  min-width: 4.75rem;
  max-width: 4.75rem;
  margin: 0 auto;
  text-align: center;
}

.home-mosaic-card .events-fill-table .home-mosaic-fill {
  justify-content: center;
  margin: 0 auto;
}

.home-mosaic-card .team-works-table .team-works-name {
  display: table-cell;
}

.home-mosaic-card .team-works-table td:last-child,
.home-mosaic-card .events-fill-table td:last-child {
  white-space: nowrap;
}

.home-mosaic-card .team-works-events-wrap {
  overflow-x: auto;
}

.home-mosaic-card .board-cell-input,
.home-mosaic-card .team-works-goal-input {
  width: 100%;
  max-width: 12rem;
  box-sizing: border-box;
  padding: 4px 8px;
  border: 1px solid #cfc8bc;
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: text;
}

html[data-theme="dark"] .home-mosaic-card .board-cell-input,
html[data-theme="dark"] .home-mosaic-card .team-works-goal-input {
  background: #3a3c42;
  color: #fff;
  border-color: #4a4b50;
  color-scheme: dark;
}

.home-mosaic-card .board-name-input {
  max-width: none;
}

.home-mosaic-card select.board-status {
  width: auto;
  max-width: 11rem;
  min-width: 0;
  padding: 4px 10px;
  border: 0;
  border-radius: var(--radius-card);
}

.home-mosaic-card .home-mosaic-task-name .board-name-input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink);
}

.home-mosaic-card .home-mosaic-task-date {
  width: auto;
  max-width: 9.5rem;
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.home-mosaic-fill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 7rem;
  color: var(--ink);
}

.home-mosaic-fill-track {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 0;
  overflow: hidden;
}

.home-mosaic-fill-bar {
  display: block;
  height: 100%;
  background: var(--ok);
}

.home-mosaic-fill-bar.is-low { background: var(--red); }
.home-mosaic-fill-bar.is-mid,
.home-mosaic-fill-bar.is-ok { background: var(--ink); }

.home-mosaic-fill-na {
  color: var(--muted);
}

.home-mosaic-support {
  display: flex;
  gap: 8px;
}

.home-mosaic-items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.home-mosaic-items li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.home-mosaic-items span {
  color: var(--muted);
}

.home-mosaic-card .team-works-events-wrap,
.home-mosaic-card .team-works-table-wrap,
.home-mosaic-card .home-mosaic-late-wrap,
.home-mosaic-late-wrap {
  background: transparent;
  border: 0;
  color: var(--ink);
}

.home-mosaic-card .events-fill-table th,
.home-mosaic-card .home-mosaic-late th,
.home-mosaic-card .team-works-table th,
.home-mosaic-card .gap-mini-table th {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
}

.home-mosaic-card .events-fill-table td,
.home-mosaic-card .home-mosaic-late td,
.home-mosaic-card .team-works-table td {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}

.home-mosaic-card .team-works-list-head {
  padding: 0 0 8px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10.5px;
}

.home-mosaic-fill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.home-mosaic-team-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding: 0;
  margin: 0;
  cursor: grab;
}

.home-mosaic-team-chips.is-drag-scrolling,
.home-mosaic-team-chips.is-drag-scrolling .home-mosaic-team-chip {
  cursor: grabbing;
  user-select: none;
}

.home-mosaic-team-chip {
  width: auto;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 18px;
  cursor: grab;
  color: var(--ink);
  font: inherit;
}

.home-mosaic-team-chip-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.home-mosaic-team-chip-top .home-mosaic-team-chip-state {
  margin-left: auto;
  margin-bottom: 0;
}

.home-mosaic-team-chip-state {
  display: block;
  margin-bottom: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-mosaic-team-chip-state.is-short {
  color: var(--bad);
}

/* IQ-261: brand red text is under 4.5:1 on the dark card; same red text as .stat.bad. */
html[data-theme="dark"] .home-mosaic-team-chip-state.is-short,
html[data-theme="dark"] .home-mosaic-team-chip .gap-mini-table tr.bad td:nth-child(4) {
  color: #ff8a8a;
}

.home-mosaic-team-chip-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.home-mosaic-team-chip strong {
  display: block;
  margin-bottom: 8px;
}

.home-mosaic-team-chip .gap-mini-table {
  font-size: 12px;
}

.home-mosaic-late-wrap {
  overflow: visible;
  max-height: none;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.home-mosaic-late {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.home-mosaic-late th,
.home-mosaic-late td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #ece8e4;
  white-space: nowrap;
}

.home-mosaic-late th {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-mosaic-map {
  min-height: 8rem;
  height: 100%;
  flex: 1 1 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e8e4dc;
}

.home-mosaic-card[data-card="members"] .home-mosaic-card-body {
  overflow: hidden;
}

.home-mosaic-card[data-card="members"] .home-mosaic-peek {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.home-mosaic-card[data-card="members"] .home-mosaic-map {
  height: auto;
  flex: 1 1 0;
}

.home-mosaic-peek {
  min-width: 0;
}

.home-mosaic-denied {
  padding: 24px 0;
  color: var(--black);
}

.home-mosaic-denied a {
  color: var(--red);
}

.mosaic-more-wrap {
  position: relative;
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  max-width: 13rem;
}

.mosaic-more-wrap .nav-tab {
  width: 100%;
  max-width: none;
}

.mosaic-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  min-width: 200px;
  padding: 6px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-top: 3px solid var(--red);
  border-radius: 8px;
}

.mosaic-more-menu.hidden,
.mosaic-more-menu[hidden] {
  display: none !important;
}

.mosaic-more-menu button,
.mosaic-more-menu a {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

.mosaic-more-menu button:hover,
.mosaic-more-menu a:hover,
.mosaic-more-menu button:focus-visible,
.mosaic-more-menu a:focus-visible {
  background: #1d1d1d;
  outline: none;
}

@media (max-width: 1024px) {
  .home-mosaic {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    min-height: 0;
  }

  .home-mosaic.is-editing {
    min-height: 0;
    background-image: none;
  }

  .home-mosaic .home-mosaic-card,
  .home-mosaic .home-mosaic-card[data-x],
  .home-mosaic .home-mosaic-card[data-col],
  .home-mosaic .home-mosaic-card[data-row],
  .home-mosaic .home-mosaic-card[data-size="sm"],
  .home-mosaic .home-mosaic-card[data-size="md"],
  .home-mosaic .home-mosaic-card[data-size="lg"],
  .home-mosaic .home-mosaic-card.is-expanded {
    grid-column: 1 / -1;
    grid-row: auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .home-mosaic-card-body,
  .home-mosaic-card[data-card="rosters"] .home-mosaic-card-body,
  .home-mosaic-card .home-mosaic-events-block {
    overflow: visible;
    flex: 1 1 auto;
  }

  .home-mosaic .home-mosaic-card[data-card="members"] {
    overflow: hidden;
  }

  .home-mosaic-card[data-card="members"] .home-mosaic-card-body {
    overflow: hidden;
    flex: 0 0 auto;
    min-height: 0;
  }

  .home-mosaic-card[data-card="members"] .home-mosaic-peek {
    overflow: hidden;
    flex: 0 0 auto;
    min-height: 0;
  }

  .home-mosaic-card[data-card="members"] .home-mosaic-summary {
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
  }

  .home-mosaic-card[data-card="members"] .home-mosaic-map {
    flex: none;
    height: 16rem;
    min-height: 16rem;
    max-height: 16rem;
    width: 100%;
    overflow: hidden;
    position: relative;
    isolation: isolate;
    z-index: 0;
  }

  .home-mosaic-kpis,
  .home-mosaic-card[data-col="4"] .home-mosaic-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-mosaic-regions,
  .home-mosaic-types {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .home-mosaic-regions .team-works-chip:first-child {
    grid-column: 1 / -1;
  }

  .home-mosaic-regions .team-works-chip,
  .home-mosaic-types .team-works-chip {
    width: 100%;
    min-height: var(--touch);
    height: auto;
    padding: 10px 12px;
    white-space: normal;
    line-height: 1.2;
  }

  .home-mosaic-card .home-mosaic-surface,
  .home-mosaic-card .home-mosaic-late-wrap,
  .home-mosaic-card .team-works-table-wrap,
  .home-mosaic-card .team-works-events-wrap {
    flex: 1 1 auto;
    min-height: 12rem;
    overflow: auto;
  }

  .home-mosaic-toolbar {
    display: none;
  }

  .home-mosaic-card .team-works-events-wrap,
  .home-mosaic-card .team-works-table-wrap,
  .home-mosaic-card .home-mosaic-late-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .home-mosaic-card .team-works-table,
  .home-mosaic-card .events-fill-table,
  .home-mosaic-card .home-mosaic-late {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }

  .home-mosaic-card .team-works-table th,
  .home-mosaic-card .team-works-table td,
  .home-mosaic-card .events-fill-table th,
  .home-mosaic-card .events-fill-table td,
  .home-mosaic-card .home-mosaic-late th,
  .home-mosaic-card .home-mosaic-late td {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }

  .home-mosaic-card .team-works-name,
  .home-mosaic-card .board-name-input {
    white-space: normal;
    overflow-wrap: break-word;
    min-width: 8rem;
  }

  .home-mosaic-card .board-cell-input,
  .home-mosaic-card .team-works-goal-input,
  .home-mosaic-card select.board-status {
    width: auto;
    max-width: none;
    min-width: 4.5rem;
  }

  .home-mosaic.is-editing .home-mosaic-card {
    touch-action: pan-y;
  }

  .home-mosaic.is-editing .home-mosaic-resize {
    display: none;
  }
}

.home-mosaic.is-rail .home-mosaic-card-body,
.home-mosaic.is-rail [data-card="rosters"] .home-mosaic-card-body,
.home-mosaic.is-rail [data-card="members"] .home-mosaic-peek,
.home-mosaic.is-rail [data-card="team-works"] .home-mosaic-task-list {
  flex: none;
  min-height: unset;
  height: auto;
  overflow: visible;
  max-height: none;
}

.home-mosaic.is-rail [data-card="team-works"] > .home-mosaic-card-body,
.home-mosaic.is-editing [data-card="team-works"] > .home-mosaic-card-body {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0;
  scrollbar-gutter: stable;
}

html[data-theme="dark"] :is(
  h1,
  h2,
  h3,
  h4,
  .panel h2,
  .section-title,
  .type-group-header h3,
  .team-card h3,
  .dash-card h3,
  .dash-card .dash-metric .value,
  .built-teams h2,
  .built-teams h3,
  .roster-count-heading,
  .tb-source h3,
  .tb-built-gap h4,
  .tb-mins-head h3,
  .tb-block-head h3,
  .breadcrumb strong,
  .members-geo-family h3,
  .history-compare-side h3,
  .home-mosaic-title,
  .home-mosaic-card h3,
  .home-mosaic-denied
) {
  color: #f2f1ef;
}

html[data-theme="dark"] .team-works-chart h3,
html[data-theme="dark"] .team-works-kpi,
html[data-theme="dark"] .team-works-bar-name {
  color: var(--ink);
}

html[data-theme="dark"] .team-works-events-wrap th,
html[data-theme="dark"] .home-mosaic-card .events-fill-table th,
html[data-theme="dark"] .home-mosaic-card .home-mosaic-late th {
  background: #2a2c31;
  color: #f2f1ef;
  border-bottom-color: #3a3c42;
}

html[data-theme="dark"] .team-works-events-wrap .team-works-list-head {
  color: #c9cacd;
}

html[data-theme="dark"].ui-preview :is(
  .type-chip,
  .pill,
  .tb-source-chip,
  .tb-add-chip,
  .team-works-chip,
  .board-chip,
  .board-completed-chip
) {
  color: #f2f1ef;
  background: #16171a;
  border-color: #3a3c42;
}

html[data-theme="dark"].ui-preview :is(
  .type-chip,
  .pill,
  .team-works-chip,
  .board-chip
):hover:not(.active):not(:disabled) {
  background: #2a2c31;
  border-color: #4a4b50;
  color: #fff;
}

html[data-theme="dark"].ui-preview :is(
  .type-chip.active,
  .pill.active,
  .team-works-chip.active,
  .board-chip.active,
  .board-chip[aria-expanded="true"]
) {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

html[data-theme="dark"].ui-preview .type-chip .type-count,
html[data-theme="dark"].ui-preview :is(.badge.unset, .badge.field-only) {
  background: #3a3c42;
  color: #f2f1ef;
}

html[data-theme="dark"].ui-preview .type-chip.active .type-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

html[data-theme="dark"].ui-preview :is(.badge.live, .badge.ok, .badge.field-box) {
  background: #1a3d2a;
  color: #d7f5e3;
}

html[data-theme="dark"].ui-preview :is(.badge.upcoming, .badge.warn, .badge.box-reg) {
  background: #3d3018;
  color: #ffe7c2;
}

html[data-theme="dark"].ui-preview .badge.bad {
  background: #3d1518;
  color: #ffd0d0;
}

html[data-theme="dark"].ui-preview .home-mosaic-card .team-works-chip:hover:not(.active) {
  background: #2a2c31;
  border-color: #4a4b50;
  color: #fff;
}

html[data-theme="dark"].ui-preview .home-mosaic-card .team-works-chip.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

html[data-theme="dark"] .item,
html[data-theme="dark"] .item .name,
html[data-theme="dark"] #tb-program-picker .item .name {
  color: #f2f1ef;
}

html[data-theme="dark"] :is(
  .btn-secondary,
  .btn-ghost,
  .btn-sync-sm,
  .tb-view-saved,
  .members-geo-gender-btn
) {
  color: #f2f1ef;
}

html[data-theme="dark"] .members-geo-gender-btn.is-on,
html[data-theme="dark"] .members-geo-gender-btn[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-danger {
  color: #fff;
}

html[data-theme="dark"].ui-preview :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not(.board-status) {
  color: #f2f1ef;
  background-color: #3a3c42;
  border-color: #4a4b50;
  color-scheme: dark;
}

html[data-theme="dark"] tr.bad td,
html[data-theme="dark"] tr.ok td,
html[data-theme="dark"] .late-invoices-table td {
  background: #1b1c20;
  color: #f2f1ef;
}

html[data-theme="dark"] .late-invoices-table th {
  background: #16171a;
  color: #c9cacd;
}

html[data-theme="dark"] .board-group:nth-child(even) {
  background: #2a2c31;
}

html[data-theme="dark"] .board-table th {
  background: var(--card);
  color: var(--ink);
}

html[data-theme="dark"] .board-group:nth-child(even) .board-table th {
  background: #2a2c31;
  color: var(--ink);
}

html[data-theme="dark"] .board-group:nth-child(even) .board-table td {
  background: #2a2c31;
  color: #f2f1ef;
}

html[data-theme="dark"] .board-group:nth-child(even) .board-table tbody tr:hover td,
html[data-theme="dark"] .board-group:nth-child(even) .board-add-task:hover {
  background: #3a3c42;
  color: #fff;
}

/* IQ-248: AA text contrast on Clubhouse task rows and dark placeholders. */
html[data-theme="dark"] .board-scope-chip {
  background: #3a3c42;
  color: var(--ink);
}

html[data-theme="dark"] .board-scope-search-input {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] :is(.board-scope-placeholder, .board-scope-empty, .board-tree-empty, .board-group-count, .board-add-task) {
  color: #b4b5b9;
}

html[data-theme="dark"] :is(.board-scope-search-input, .tb-name-input, .board-chip-menu input)::placeholder {
  color: #b4b5b9;
  opacity: 1;
}

/* IQ-261: Filter programs sits on a lighter box; match the Rosters search placeholder. */
html[data-theme="dark"] .home-mosaic-filter-query::placeholder {
  color: #d6d7da;
  opacity: 1;
}

/* A chosen group color keeps its hue but is lifted toward white to stay readable. */
html[data-theme="dark"] .board-group-name[style*="--group-color"] {
  color: color-mix(in srgb, var(--group-color) 35%, #fff);
}

html[data-theme="dark"] .board-group:nth-child(even) .board-avatar {
  box-shadow: 0 0 0 2px #2a2c31;
}

html[data-theme="dark"] .board-status.idle,
html[data-theme="dark"] .board-status:not(.ok):not(.warn):not(.bad):not(.idle):not(.progress) {
  background: #3a3c42;
  color: #fff;
}

html[data-theme="dark"].ui-preview .board-status.bad {
  background: var(--red);
  color: #fff;
}

html[data-theme="dark"].ui-preview .board-status.progress {
  background: #1f7a45;
  color: #fff;
}

html[data-theme="dark"].ui-preview .board-status.ok {
  background: var(--ok);
  color: #fff;
}

html[data-theme="dark"].ui-preview .board-status.warn {
  background: var(--warn);
  color: #fff;
}

html[data-theme="light"] .brand-bar-slot {
  background: #fff;
  color: #111;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .brand-bar-inner {
  background: transparent;
  box-shadow: none;
}

html[data-theme="light"] .brand-logo,
html[data-theme="light"] .clubhouse-dialog-logo {
  filter: brightness(0);
}

html[data-theme="light"] .brand-copy h1 .brand-line:first-child,
html[data-theme="light"] .brand-motto,
html[data-theme="light"] #status-line,
html[data-theme="light"] .session-name {
  color: #6b6b6b;
}

html[data-theme="light"] .brand-copy h1 .brand-line:last-child {
  color: #111;
}

html[data-theme="light"].ui-preview .nav-tab {
  color: #111;
  border-color: #d9d6d0;
  background: transparent;
}

html[data-theme="light"].ui-preview .nav-tab:hover:not(:disabled) {
  color: #111;
  border-color: #111;
  background: #f3f1ed;
}

html[data-theme="light"].ui-preview .nav-tab.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

html[data-theme="light"] .brand-bar .logout-btn,
html[data-theme="light"] .brand-bar .theme-toggle {
  color: #111;
  border-color: #d9d6d0;
  background: #fff;
}

html[data-theme="light"] .session-user-menu {
  background: var(--card);
  border-color: var(--line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .session-user-menu-item {
  color: var(--ink);
}

html[data-theme="light"] .session-user-menu-heading {
  color: var(--muted);
}

html[data-theme="light"] .session-user-menu-item:hover,
html[data-theme="light"] .session-user-menu-item:focus-visible {
  background: #f3f1ed;
}

html[data-theme="light"] .session-user-menu-item[data-theme-choice][aria-checked="true"] {
  color: var(--ink);
}

/* IQ-253 / IQ-257: every picker and popover (Home, Team Works, board toolbar, menus) follows the light theme. */
html[data-theme="light"] :is(.board-chip-menu, .board-plus-menu, .board-nav-menu, .board-bulk-menu, .mosaic-more-menu, .home-mosaic-filter-menu) {
  background: var(--card);
  border-color: var(--line);
  border-top-color: var(--red);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  color: var(--ink);
  color-scheme: light;
  scrollbar-color: #b8b4ac var(--paper);
}

html[data-theme="light"] :is(.board-chip-menu, .board-plus-menu, .board-nav-menu, .board-bulk-menu, .mosaic-more-menu) :is(button, a, .board-chip-menu-title, .board-bulk-menu-title, .team-works-empty) {
  color: var(--ink);
}

html[data-theme="light"] :is(.board-chip-menu, .board-plus-menu, .board-nav-menu, .board-bulk-menu, .mosaic-more-menu) :is(button, a):is(:hover, :focus-visible, .selected) {
  background: #f3f1ed;
  color: var(--ink);
}

/* IQ-261: Region/Type chips in the Home filter menu: same hover as the other menus; the selected chip stays red. */
html[data-theme="light"] .home-mosaic-filter-menu .team-works-chip:not(.active):is(:hover, :focus-visible) {
  background: #f3f1ed;
  color: var(--ink);
}

html[data-theme="light"] .board-nav-menu .board-nav-menu-danger {
  color: var(--red);
}

html[data-theme="light"] .board-filter-check {
  border-color: #8a8a8a;
}

html[data-theme="light"] :is(.board-chip-menu :is(input, select), .board-bulk-menu input) {
  background: #fff;
  border-color: #d9d6d0;
  color: var(--ink);
}

html[data-theme="light"] :is(.board-chip-menu, .board-bulk-menu) input::placeholder {
  color: var(--muted);
  opacity: 1;
}

html[data-theme="light"] .board-chip-menu .board-filter-clear,
html[data-theme="light"] .board-filter-col-value {
  color: var(--muted);
}

html[data-theme="light"] .board-filter-col.has-filter .board-filter-col-value {
  color: var(--ink);
}

html[data-theme="light"] .board-person-picker {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .board-person-picker-field {
  background: #fff;
}

html[data-theme="light"] .board-person-pill {
  background: #e7e4de;
  color: var(--ink);
}

html[data-theme="light"] :is(.board-person-picker-clear, .board-person-picker-label, .board-person-picker-empty) {
  color: var(--muted);
}

html[data-theme="light"] .board-person-pill-x,
html[data-theme="light"] .board-person-picker-clear:hover {
  color: var(--ink);
}

html[data-theme="light"] :is(.board-person-picker-search, .board-person-suggest) {
  color: var(--ink);
}

html[data-theme="light"] .board-person-picker-search::placeholder {
  color: var(--muted);
}

html[data-theme="light"] .board-person-suggest:hover {
  background: #f3f1ed;
  color: var(--ink);
}

html[data-theme="light"] :is(.team-works-people-trigger, .team-works-filters select) {
  background: var(--card);
  border-color: #d9d6d0;
  color: var(--ink);
}

html[data-theme="light"] .team-works-people-trigger:is(.active, [aria-expanded="true"]) {
  border-color: var(--red);
}

html[data-theme="light"] .team-works-chip:not(.active) {
  color: var(--ink);
  border-color: #d9d6d0;
}

html[data-theme="light"] .board-sidebar {
  background: var(--card);
  color: var(--ink);
  border-right: 1px solid var(--line);
  color-scheme: light;
  scrollbar-color: #b8b4ac var(--paper);
}

html[data-theme="light"] .board-app,
html[data-theme="light"] .board-tree,
html[data-theme="light"] .board-groups,
html[data-theme="light"] .team-works-dashboard {
  color-scheme: light;
  scrollbar-color: #b8b4ac var(--paper);
}

html[data-theme="light"] .board-tree::-webkit-scrollbar,
html[data-theme="light"] .board-groups::-webkit-scrollbar,
html[data-theme="light"] .team-works-dashboard::-webkit-scrollbar,
html[data-theme="light"] .board-sidebar::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html[data-theme="light"] .board-tree::-webkit-scrollbar-track,
html[data-theme="light"] .board-groups::-webkit-scrollbar-track,
html[data-theme="light"] .team-works-dashboard::-webkit-scrollbar-track,
html[data-theme="light"] .board-sidebar::-webkit-scrollbar-track {
  background: var(--paper);
}

html[data-theme="light"] .board-tree::-webkit-scrollbar-thumb,
html[data-theme="light"] .board-groups::-webkit-scrollbar-thumb,
html[data-theme="light"] .team-works-dashboard::-webkit-scrollbar-thumb,
html[data-theme="light"] .board-sidebar::-webkit-scrollbar-thumb {
  background: #b8b4ac;
  border: 2px solid var(--paper);
}

html[data-theme="light"] .board-sidebar .board-ws-kicker,
html[data-theme="light"] .board-sidebar .board-ws-section,
html[data-theme="light"] .board-sidebar .board-tree-empty,
html[data-theme="light"] .board-sidebar .board-tree-x,
html[data-theme="light"] .board-sidebar .board-history-list time {
  color: var(--muted);
}

html[data-theme="light"] .board-sidebar .board-ws-select {
  border-color: var(--line);
  background: var(--paper);
}

html[data-theme="light"] .board-sidebar .board-ws-name,
html[data-theme="light"] .board-sidebar .board-history-text {
  color: var(--ink);
}

html[data-theme="light"] .board-sidebar .board-plus,
html[data-theme="light"] .board-sidebar-toggle {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="light"] .board-sidebar .board-tree-folder-btn,
html[data-theme="light"] .board-sidebar .board-tree-board,
html[data-theme="light"] .board-sidebar .board-side-link {
  color: var(--ink);
}

html[data-theme="light"] .board-sidebar .board-tree-folder-btn:hover,
html[data-theme="light"] .board-sidebar .board-tree-board:hover,
html[data-theme="light"] .board-sidebar .board-side-link:hover {
  color: var(--ink);
  background: var(--paper);
}

html[data-theme="light"] .board-sidebar .board-tree-board.active,
html[data-theme="light"] .board-sidebar .board-side-link.active {
  background: var(--red);
  color: #fff;
}

html[data-theme="light"] .board-sidebar .board-board-icon {
  border-color: var(--ink);
}

html[data-theme="light"] .board-sidebar .board-tree-board.active .board-board-icon,
html[data-theme="light"] .board-sidebar .board-tree-board:hover .board-board-icon {
  border-color: #fff;
}

html[data-theme="light"] .board-sidebar .board-tree-archive .board-tree-folder-btn {
  color: var(--muted);
}

html[data-theme="light"] .board-sidebar .board-history-list li {
  border-bottom-color: var(--line);
}

html[data-theme="light"] .board-chrome h2 {
  color: var(--red);
}

html[data-theme="light"] .board-chrome-count,
html[data-theme="light"] .board-save-status {
  color: var(--muted);
}

html[data-theme="light"].ui-preview :is(
  .type-chip,
  .pill,
  .tb-source-chip,
  .tb-add-chip,
  .team-works-chip,
  .board-chip,
  .board-completed-chip,
  .members-geo-gender-btn
) {
  color: #111;
  background: #fff;
  border-color: #d9d6d0;
}

html[data-theme="light"].ui-preview :is(
  .type-chip,
  .pill,
  .team-works-chip,
  .board-chip,
  .members-geo-gender-btn
):hover:not(.active):not(.is-on):not([aria-pressed="true"]):not(:disabled) {
  background: #f3f1ed;
  border-color: #111;
  color: #111;
}

html[data-theme="light"].ui-preview :is(
  .type-chip.active,
  .pill.active,
  .team-works-chip.active,
  .board-chip.active,
  .board-chip[aria-expanded="true"]
),
html[data-theme="light"] .members-geo-gender-btn.is-on,
html[data-theme="light"] .members-geo-gender-btn[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

html[data-theme="light"] .type-chip .type-count {
  background: #f3f1ed;
  color: #6b6b6b;
}

html[data-theme="light"] .team-works-events-wrap tbody tr:nth-child(even) td,
html[data-theme="light"] .board-group:nth-child(even),
html[data-theme="light"] .board-group:nth-child(even) .board-table td {
  background: #f3f1ed;
  color: #111;
}

html[data-theme="light"] .board-table th {
  background: var(--card);
  color: var(--ink);
}

html[data-theme="light"] .board-group:nth-child(even) .board-table th {
  background: #f3f1ed;
  color: var(--ink);
}

html[data-theme="light"] .team-works-events-wrap th {
  background: #e0dbd3;
  color: var(--ink);
}

html[data-theme="light"] .board-status.idle,
html[data-theme="light"] .board-status:not(.ok):not(.warn):not(.bad):not(.idle):not(.progress) {
  background: #e7e4de;
  color: #111;
}

html[data-theme="light"].ui-preview :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not(.board-status) {
  color: #111;
  background-color: #fff;
  border-color: #d9d6d0;
  color-scheme: light;
}

.tb-built-gap .callout.tb-need,
html[data-theme="dark"] .tb-built-gap .callout.tb-need,
html[data-theme="light"] .tb-built-gap .callout.tb-need {
  background: var(--red);
  border-color: var(--red);
  border-left-color: var(--red);
  color: #fff;
}

.tb-built-gap .callout.tb-need strong,
html[data-theme="dark"] .tb-built-gap .callout.tb-need strong,
html[data-theme="light"] .tb-built-gap .callout.tb-need strong,
html[data-theme="dark"] .callout.warn,
html[data-theme="light"] .callout.warn,
html[data-theme="dark"] .callout.warn strong,
html[data-theme="light"] .callout.warn strong {
  color: #fff;
}

html[data-theme="dark"] #members-geo-search::placeholder {
  color: #b4b5b9;
  opacity: 1;
}
