:root {
  --pink: #cb217f;
  --pink-hot: #f04aa0;
  --green: #209747;
  --green-hot: #39c76d;
  --blue: #2868b8;
  --gold: #c28a16;
  --ink: #151923;
  --ink-2: #202737;
  --muted: #697386;
  --muted-2: #8a96a8;
  --line: rgba(30, 39, 54, 0.12);
  --line-strong: rgba(30, 39, 54, 0.2);
  --paper: #ffffff;
  --paper-soft: #f7f9fc;
  --canvas: #edf1f5;
  --danger: #b42318;
  --radius: 8px;
  --shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 20px 48px rgba(15, 23, 42, 0.14);
  --shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Ubuntu, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(203, 33, 127, 0.1), transparent 26%),
    linear-gradient(45deg, transparent 0, rgba(32, 151, 71, 0.08) 46%, transparent 76%),
    repeating-linear-gradient(90deg, rgba(21, 25, 35, 0.04) 0 1px, transparent 1px 86px),
    repeating-linear-gradient(0deg, rgba(21, 25, 35, 0.035) 0 1px, transparent 1px 86px),
    var(--canvas);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
select {
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(203, 33, 127, 0.22);
  outline-offset: 2px;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(460px, 1.06fr) minmax(380px, 0.72fr);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.84)),
    transparent;
}

.brand-panel {
  position: relative;
  min-height: 100vh;
  padding: 58px;
  display: grid;
  align-content: center;
  gap: 30px;
  overflow: hidden;
  color: white;
  background:
    linear-gradient(135deg, rgba(12, 16, 24, 0.2), rgba(12, 16, 24, 0.86)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 800'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1' y1='0' y2='1'%3E%3Cstop stop-color='%23209747'/%3E%3Cstop offset='.48' stop-color='%232868B8'/%3E%3Cstop offset='1' stop-color='%23CB217F'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='1200' height='800' fill='url(%23g)'/%3E%3Cpath d='M0 625 C260 510 390 630 600 500 C800 374 948 344 1200 402 L1200 800 L0 800 Z' fill='%23151923' opacity='.55'/%3E%3Cpath d='M0 138 C190 74 352 126 560 86 C780 44 958 30 1200 88 L1200 0 L0 0 Z' fill='%23ffffff' opacity='.15'/%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.34' stroke-width='3'%3E%3Cpath d='M268 365 L600 170 L932 365 L600 560 Z'/%3E%3Cpath d='M600 170 L600 560'/%3E%3Cpath d='M268 365 L932 365'/%3E%3Cpath d='M414 282 L786 448'/%3E%3Cpath d='M786 282 L414 448'/%3E%3C/g%3E%3Cg fill='%23ffffff' opacity='.12'%3E%3Crect x='128' y='132' width='180' height='2'/%3E%3Crect x='128' y='160' width='118' height='2'/%3E%3Crect x='900' y='616' width='190' height='2'/%3E%3Crect x='974' y='646' width='118' height='2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 96px);
  pointer-events: none;
}

.brand-panel > * {
  position: relative;
}

.brand-mark {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius);
  color: white;
  font-size: 34px;
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.02)),
    linear-gradient(135deg, var(--pink), var(--green));
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.28);
}

.brand-mark.small {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-color: rgba(255, 255, 255, 0.22);
  font-size: 23px;
  box-shadow: 0 16px 34px rgba(203, 33, 127, 0.26);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
}

.brand-wordmark {
  width: min(430px, 82%);
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.28));
}

.header-wordmark {
  width: 150px;
  height: 48px;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.sidebar-brand > #connectionState {
  align-self: flex-end;
  margin: 0 0 7px -4px;
}

.header-language-select {
  width: 68px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
  font-weight: 800;
}

@media (max-width: 860px) {
  .header-language-select {
    width: 58px;
    height: 38px;
    padding: 0 7px;
  }
}

.maintenance-screen {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(10, 14, 21, 0.78), rgba(10, 14, 21, 0.9)),
    url("/assets/ubuntu-unity-board-v2.webp") center / cover fixed;
}

.maintenance-card {
  width: min(520px, 100%);
  padding: 36px;
  display: grid;
  justify-items: start;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: #f7f9fb;
  background: rgba(18, 23, 31, 0.86);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.maintenance-card h1,
.maintenance-card p { margin: 0; }
.maintenance-card h1 { font-size: clamp(30px, 5vw, 46px); letter-spacing: 0; }
.maintenance-card > p:not(.eyebrow) { color: #b9c2ce; line-height: 1.6; }
.maintenance-card .brand-mark { width: 58px; height: 58px; }

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--pink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.brand-panel .eyebrow {
  color: #ffe4f2;
}

.brand-panel h1 {
  max-width: 820px;
  margin: 0;
  font-size: 52px;
  line-height: 1.02;
  letter-spacing: 0;
}

.brand-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 12px;
  max-width: 600px;
}

.brand-metrics div {
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius);
  color: white;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset;
  backdrop-filter: blur(18px);
}

.brand-metrics span {
  display: block;
  font-size: 29px;
  font-weight: 900;
}

.brand-metrics small {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.auth-panel {
  width: min(100% - 48px, 500px);
  align-self: center;
  justify-self: center;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 252, 0.88)),
    linear-gradient(135deg, rgba(203, 33, 127, 0.08), rgba(32, 151, 71, 0.06));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.auth-heading {
  margin-bottom: 18px;
}

.auth-heading h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #e9eef5, #f7f9fc);
}

.segment {
  min-height: 43px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.segment.is-active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.form-stack {
  display: grid;
  gap: 14px;
}

.auth-notice-host:empty { display: none; }
.referral-preview {
  padding: 11px 13px;
  border: 1px solid rgba(32, 151, 71, 0.28);
  border-radius: 7px;
  color: #12642e;
  background: rgba(230, 245, 236, 0.82);
  font-size: 13px;
  font-weight: 800;
}

.registration-fields {
  min-width: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  border: 0;
}

.registration-required-notice {
  min-height: 132px;
  padding: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(203, 33, 127, 0.34);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(203, 33, 127, 0.08);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #526072;
  font-size: 13px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 45px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 13px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.92) inset;
}

input:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus {
  border-color: rgba(203, 33, 127, 0.72);
  outline: 3px solid rgba(203, 33, 127, 0.14);
  box-shadow: 0 0 0 1px rgba(203, 33, 127, 0.1);
}

.primary-action,
.secondary-action,
.ghost-action,
.danger-action,
.table-action {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 15px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.primary-action {
  color: white;
  background: linear-gradient(135deg, var(--pink-hot), var(--pink) 52%, #7c154f);
  box-shadow: 0 16px 32px rgba(203, 33, 127, 0.26);
}

.primary-action:hover,
.secondary-action:hover,
.ghost-action:hover,
.table-action:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  box-shadow: 0 22px 42px rgba(203, 33, 127, 0.32);
}

.secondary-action {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.76);
  background: linear-gradient(180deg, #ffffff, #edf2f7);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, var(--shadow-sm);
}

.ghost-action {
  color: #edf3fb;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
}

.panel .ghost-action,
.position-card .ghost-action {
  color: #596577;
  border-color: var(--line);
  background: linear-gradient(180deg, #ffffff, #f2f5f9);
}

.danger-action {
  color: white;
  background: var(--danger);
}

.table-action {
  min-height: 34px;
  color: var(--pink);
  border-color: rgba(203, 33, 127, 0.2);
  background: linear-gradient(180deg, #fff6fb, #f7e3ef);
}

.primary-action:disabled,
.secondary-action:disabled,
.ghost-action:disabled,
.danger-action:disabled,
.table-action:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 306px;
  padding: 22px 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  color: white;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 26%),
    linear-gradient(135deg, rgba(203, 33, 127, 0.13), transparent 36%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 54px),
    #0d131d;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 24px 0 50px rgba(13, 19, 29, 0.18);
}

.sidebar-brand {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand strong,
.session-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.sidebar-brand strong {
  font-size: 17px;
}

.sidebar-brand span,
.session-card span {
  display: block;
  margin-top: 2px;
  color: #9daabc;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 9px;
}

.nav-item {
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 13px;
  color: #cad5e3;
  background: transparent;
  text-align: left;
  font-weight: 900;
}

.nav-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #202228;
  border-radius: 999px;
  color: white;
  background: #d92d20;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(217, 45, 32, 0.35);
}

.nav-icon {
  position: relative;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 2px solid currentColor;
  border-radius: 6px;
  opacity: 0.76;
}

.overview-icon::after,
.board-icon::after,
.referrals-icon::after,
.gifts-icon::after,
.stats-icon::after,
.admin-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
  opacity: 0.9;
}

.overview-icon::after {
  inset: 5px;
  border-radius: 2px;
}

.board-icon::after {
  left: 50%;
  top: 3px;
  width: 2px;
  height: 10px;
  transform: translateX(-50%);
}

.referrals-icon::after {
  left: 4px;
  right: 4px;
  top: 8px;
  height: 2px;
}

.gifts-icon::after {
  left: 8px;
  top: -2px;
  width: 2px;
  height: 20px;
}

.stats-icon::after {
  left: 4px;
  bottom: 4px;
  width: 3px;
  height: 10px;
  box-shadow: 5px -5px 0 currentColor, 10px -2px 0 currentColor;
}

.admin-icon::after {
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.nav-item:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.065);
}

.nav-item.is-active {
  color: white;
  border-color: rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(240, 74, 160, 0.94), rgba(40, 104, 184, 0.8) 56%, rgba(32, 151, 71, 0.7)),
    var(--pink);
  box-shadow: 0 18px 34px rgba(203, 33, 127, 0.28);
}

.session-card {
  padding: 14px;
  display: grid;
  gap: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset;
}

.session-main {
  display: flex;
  align-items: center;
  gap: 11px;
}

.profile-avatar,
.overview-avatar,
.avatar-mini {
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background:
    linear-gradient(135deg, var(--pink), var(--blue) 56%, var(--green));
}

.profile-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
}

.session-card .ghost-action {
  width: 100%;
}

.workspace {
  min-height: 100vh;
  margin-left: 306px;
  padding: 26px;
}

.topbar {
  min-height: 118px;
  margin-bottom: 18px;
  padding: 24px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  color: white;
  background:
    linear-gradient(135deg, rgba(240, 74, 160, 0.3), transparent 34%),
    linear-gradient(45deg, transparent 0, rgba(32, 151, 71, 0.2) 58%, rgba(40, 104, 184, 0.2)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 74px),
    #111722;
  box-shadow: var(--shadow-md);
}

.topbar .eyebrow {
  color: #ff9bcf;
}

.topbar h2 {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  color: white;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.live-chip {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #d9f8e5;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.live-chip span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-hot);
  box-shadow: 0 0 0 4px rgba(57, 199, 109, 0.14);
}

.refresh-action {
  min-height: 46px;
}

.refresh-symbol {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.notice-host {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.notice {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  box-shadow: var(--shadow-sm);
}

.notice.error {
  border-color: #f0b7b2;
  color: var(--danger);
  background: #fff0ef;
}

.notice.success {
  border-color: #b9e2c6;
  color: #12642e;
  background: #e6f5ec;
}

.view-root {
  display: grid;
  gap: 18px;
}

.overview-hero {
  min-height: 150px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  color: white;
  background:
    linear-gradient(135deg, rgba(203, 33, 127, 0.35), transparent 44%),
    linear-gradient(45deg, transparent 0, rgba(32, 151, 71, 0.25) 58%, rgba(40, 104, 184, 0.22)),
    #151923;
  box-shadow: var(--shadow-md);
}

.overview-profile {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
}

.overview-avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: var(--radius);
  font-size: 22px;
}

.overview-profile span {
  color: #ff9bcf;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overview-profile h3 {
  margin: 4px 0;
  font-size: 26px;
  line-height: 1.1;
}

.overview-profile p,
.overview-status {
  color: #bcc7d5;
}

.overview-status {
  display: grid;
  justify-items: end;
  gap: 8px;
  text-align: right;
}

.overview-status strong {
  color: white;
  font-size: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.position-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.metric-card::before,
.panel::before,
.position-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--pink), var(--green), var(--blue));
  opacity: 0.9;
}

.metric-card {
  min-height: 136px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 252, 0.9)),
    repeating-linear-gradient(135deg, rgba(21, 25, 35, 0.035) 0 1px, transparent 1px 18px);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 29px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.metric-mark {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(21, 25, 35, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(203, 33, 127, 0.16), rgba(32, 151, 71, 0.12));
}

.metric-card.pink {
  border-color: rgba(203, 33, 127, 0.22);
  background: linear-gradient(145deg, #ffffff, #fdeaf4);
}

.metric-card.green {
  border-color: rgba(32, 151, 71, 0.24);
  background: linear-gradient(145deg, #ffffff, #e7f7ed);
}

.metric-card.gold {
  border-color: rgba(194, 138, 22, 0.28);
  background: linear-gradient(145deg, #ffffff, #fff3cf);
}

.panel {
  padding: 21px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 252, 0.92)),
    repeating-linear-gradient(135deg, rgba(21, 25, 35, 0.03) 0 1px, transparent 1px 18px);
  box-shadow: var(--shadow-md);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.18;
}

.panel-header p {
  margin: 6px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.board-panel {
  padding: 0;
  background: #ffffff;
}

.board-panel > .panel-header,
.board-panel > .board-meta {
  margin-left: 22px;
  margin-right: 22px;
}

.board-panel > .panel-header {
  margin-top: 22px;
}

.board-panel > .board-layout {
  margin: 18px 22px 22px;
}

.board-layout {
  display: grid;
  gap: 14px;
}

.board-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.two-column .board-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.board-meta div {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, #ffffff, #f2f6fb);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.92) inset;
}

.board-meta small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.board-meta strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.board-tree {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(142px, 1fr));
  grid-template-areas:
    ". legend legend ."
    "leftBuilder leftBuilder rightBuilder rightBuilder"
    "leftDonor1 leftDonor2 rightDonor1 rightDonor2";
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(203, 33, 127, 0.22), transparent 36%),
    linear-gradient(45deg, transparent 0, rgba(32, 151, 71, 0.17) 56%, rgba(40, 104, 184, 0.18)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 72px),
    #111722;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dual-legend-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(203, 33, 127, 0.24);
  border-left: 3px solid var(--pink);
  background: #fff6fb;
  color: var(--ink);
}

.dual-legend-note span {
  color: var(--muted);
  text-align: right;
}

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

.notification-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #fff8fc;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.notification-row.is-read {
  background: var(--surface);
  color: var(--muted);
}

.notification-row span {
  display: grid;
  gap: 4px;
}

.notification-row small,
.notification-row time {
  color: var(--muted);
}

.captcha-container {
  min-height: 65px;
  overflow: hidden;
}

.language-control,
.language-select {
  width: 100%;
}

.language-control {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted-2);
  font-size: 12px;
}

.position-card {
  min-height: 148px;
  padding: 15px;
  display: grid;
  align-content: space-between;
  gap: 13px;
  border-color: rgba(255, 255, 255, 0.22);
  color: white;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045)),
    rgba(255, 255, 255, 0.035);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
}

.position-card.legend {
  grid-area: legend;
  border-color: rgba(240, 74, 160, 0.62);
  background:
    linear-gradient(145deg, rgba(240, 74, 160, 0.32), rgba(255, 255, 255, 0.06));
}

.position-card.left_builder {
  grid-area: leftBuilder;
  border-color: rgba(57, 199, 109, 0.52);
  background:
    linear-gradient(145deg, rgba(57, 199, 109, 0.26), rgba(255, 255, 255, 0.06));
}

.position-card.right_builder {
  grid-area: rightBuilder;
  border-color: rgba(40, 104, 184, 0.58);
  background:
    linear-gradient(145deg, rgba(40, 104, 184, 0.3), rgba(255, 255, 255, 0.06));
}

.position-card.left_donor_1 {
  grid-area: leftDonor1;
}

.position-card.left_donor_2 {
  grid-area: leftDonor2;
}

.position-card.right_donor_1 {
  grid-area: rightDonor1;
}

.position-card.right_donor_2 {
  grid-area: rightDonor2;
}

.position-card.empty {
  border-style: dashed;
  border-color: rgba(203, 213, 225, 0.26);
  color: #c8d2df;
  background: rgba(255, 255, 255, 0.04);
}

.position-card.empty::before {
  opacity: 0.28;
}

.position-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.slot-label {
  color: #b8c4d3;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.position-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.position-user div {
  min-width: 0;
}

.position-user strong {
  display: block;
  color: white;
  overflow-wrap: anywhere;
}

.position-user small {
  display: block;
  margin-top: 3px;
  color: #b8c4d3;
  overflow-wrap: anywhere;
}

.avatar-mini {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.18);
}

.empty-avatar {
  color: #a7b3c3;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.position-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  min-height: 25px;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #596577;
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.status-pill.ok {
  color: #12642e;
  border-color: #b9e2c6;
  background: #e6f5ec;
}

.status-pill.warn {
  color: #7a4d00;
  border-color: #ead29a;
  background: #fff8e6;
}

.status-pill.danger {
  color: var(--danger);
  border-color: #f0b7b2;
  background: #fff0ef;
}

.status-pill.muted-pill {
  color: #6f7b8d;
  border-color: #d8dee8;
  background: #f1f4f8;
}

.form-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 11px;
  align-items: end;
}

.form-inline button {
  min-width: 138px;
}

.referral-result {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid rgba(203, 33, 127, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(253, 234, 244, 0.96), rgba(255, 255, 255, 0.92));
}

.referral-link-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.referral-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.referral-link-main {
  min-width: 0;
}

.referral-link-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
}

.referral-link-meta strong {
  color: var(--ink);
}

@media (max-width: 700px) {
  .referral-link-row {
    grid-template-columns: 1fr;
  }

  .referral-link-row .secondary-action {
    width: 100%;
  }
}

.token-box {
  display: block;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #526072;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.table-shell {
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  box-shadow: var(--shadow-sm);
}

.gift-attention {
  margin-bottom: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #f1b4ac;
  border-radius: 8px;
  color: #7a271a;
  background: #fff4f2;
}

.gift-attention-count {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #d92d20;
  font-weight: 900;
}

.gift-attention strong,
.gift-attention span,
.party-name strong,
.party-name small {
  display: block;
}

.gift-attention div > span,
.party-name small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.gift-action-row {
  background: #fff8f7;
}

.gift-focused-row {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  animation: gift-focus-pulse 1.8s ease-out 1;
}

@keyframes gift-focus-pulse {
  0% { box-shadow: inset 0 0 0 999px rgba(203, 33, 127, 0.18); }
  100% { box-shadow: inset 0 0 0 999px rgba(203, 33, 127, 0); }
}

.gift-actions {
  min-width: 220px;
  white-space: nowrap;
}

.gift-actions .ghost-action {
  margin-left: 6px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  background: rgba(238, 242, 247, 0.74);
}

td {
  color: var(--ink-2);
  font-size: 14px;
}

tbody tr:hover td {
  background: rgba(203, 33, 127, 0.04);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  min-height: 140px;
  padding: 30px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px dashed rgba(105, 115, 134, 0.34);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(244, 247, 251, 0.78));
}

.empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

.empty-state span {
  display: block;
  max-width: 560px;
}

.muted {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .auth-screen,
  .two-column {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 430px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .board-meta {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    min-height: auto;
    grid-template-rows: auto auto auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(116px, 1fr));
  }

  .workspace {
    margin-left: 0;
    padding: 18px;
  }

  .topbar,
  .overview-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-status {
    justify-items: start;
    text-align: left;
  }

  .board-tree {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "legend legend"
      "leftBuilder rightBuilder"
      "leftDonor1 leftDonor2"
      "rightDonor1 rightDonor2";
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding: 14px;
    gap: 12px;
  }

  .sidebar-brand {
    min-height: 46px;
  }

  .nav-item {
    min-height: 42px;
    padding: 0 8px;
    gap: 7px;
    font-size: 12px;
  }

  .nav-icon {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }

  .session-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 10px;
  }

  .session-card .ghost-action {
    min-height: 42px;
  }

  .language-control {
    grid-column: 1 / -1;
    margin-top: 0;
  }
  .auth-panel {
    width: calc(100% - 28px);
    padding: 18px;
  }

  .brand-panel {
    min-height: 370px;
    padding: 30px 18px;
  }

  .brand-panel h1 {
    font-size: 34px;
  }

  .brand-metrics,
  .field-grid,
  .metric-grid,
  .board-meta,
  .form-inline {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar {
    min-height: 0;
    padding: 20px;
  }

  .topbar h2 {
    font-size: 30px;
  }

  .panel,
  .metric-card {
    padding: 16px;
  }

  .panel-header {
    flex-direction: column;
  }

  .board-panel > .panel-header,
  .board-panel > .board-meta {
    margin-left: 16px;
    margin-right: 16px;
  }

  .board-panel > .board-layout {
    margin: 16px;
  }

  .board-tree {
    padding: 12px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "legend"
      "leftBuilder"
      "leftDonor1"
      "leftDonor2"
      "rightBuilder"
      "rightDonor1"
      "rightDonor2";
  }

  .position-card {
    min-height: 130px;
  }
}

.incoming-gift-queue {
  position: relative;
  overflow: hidden;
}

.incoming-gift-queue::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--pink), var(--green), var(--blue));
}

.queue-total {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--danger);
  font-weight: 900;
}

.incoming-gift-list {
  display: grid;
  gap: 10px;
}

.incoming-gift-card {
  min-height: 104px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(320px, 1.4fr) auto;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}

.incoming-gift-card.requires-action {
  border-color: rgba(203, 33, 127, 0.3);
  box-shadow: 0 10px 28px rgba(203, 33, 127, 0.08);
}

.incoming-gift-sender,
.incoming-gift-context,
.incoming-gift-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.incoming-gift-sender > div,
.incoming-gift-context > div {
  min-width: 0;
}

.incoming-gift-sender small,
.incoming-gift-context small,
.incoming-gift-sender span,
.incoming-gift-context span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.incoming-gift-sender strong,
.incoming-gift-context strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incoming-gift-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.incoming-gift-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.incoming-gift-history {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.incoming-gift-history > summary {
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

[data-theme="dark"] .incoming-gift-card,
[data-resolved-theme="dark"] .incoming-gift-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045) !important;
}

[data-theme="dark"] .incoming-gift-card.requires-action,
[data-resolved-theme="dark"] .incoming-gift-card.requires-action {
  border-color: rgba(240, 74, 160, 0.35);
  background: rgba(203, 33, 127, 0.065) !important;
}

[data-theme="dark"] .incoming-gift-sender strong,
[data-theme="dark"] .incoming-gift-context strong,
[data-resolved-theme="dark"] .incoming-gift-sender strong,
[data-resolved-theme="dark"] .incoming-gift-context strong {
  color: #f4f7f6;
}

[data-theme="dark"] .incoming-gift-sender small,
[data-theme="dark"] .incoming-gift-context small,
[data-theme="dark"] .incoming-gift-sender span,
[data-theme="dark"] .incoming-gift-context span,
[data-resolved-theme="dark"] .incoming-gift-sender small,
[data-resolved-theme="dark"] .incoming-gift-context small,
[data-resolved-theme="dark"] .incoming-gift-sender span,
[data-resolved-theme="dark"] .incoming-gift-context span {
  color: #98a7a4;
}

@media (max-width: 900px) {
  .incoming-gift-card {
    grid-template-columns: 1fr;
  }

  .incoming-gift-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .incoming-gift-context {
    grid-template-columns: 1fr;
  }

  .incoming-gift-actions > button {
    flex: 1 1 140px;
  }
}

/* Statistics icon: contained three-bar chart. */
.stats-icon {
  border: 0;
  border-radius: 0;
}

.stats-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.stats-icon::after {
  left: 3px;
  bottom: 4px;
  width: 3px;
  height: 6px;
  border-radius: 2px 2px 0 0;
  box-shadow: 5px -4px 0 currentColor, 10px -8px 0 currentColor;
}

/* Official Lucide navigation icons, vendored locally. */
.nav-icon {
  width: 19px;
  height: 19px;
  flex-basis: 19px;
  border: 0;
  border-radius: 0;
  background: currentColor;
  opacity: 0.78;
  -webkit-mask: var(--nav-icon-url) center / contain no-repeat;
  mask: var(--nav-icon-url) center / contain no-repeat;
}

.nav-icon::before,
.nav-icon::after {
  display: none;
}

.overview-icon { --nav-icon-url: url("/assets/icons/layout-dashboard.svg"); }
.board-icon { --nav-icon-url: url("/assets/icons/panel-top.svg"); }
.referrals-icon { --nav-icon-url: url("/assets/icons/network.svg"); }
.gifts-icon { --nav-icon-url: url("/assets/icons/gift.svg"); }
.stats-icon { --nav-icon-url: url("/assets/icons/chart-no-axes-column-increasing.svg"); }
.admin-icon { --nav-icon-url: url("/assets/icons/shield-check.svg"); }

.nav-item:hover .nav-icon,
.nav-item.is-active .nav-icon {
  opacity: 1;
}

.refresh-symbol {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 0;
  background: currentColor;
  -webkit-mask: url("/assets/icons/refresh-cw.svg") center / contain no-repeat;
  mask: url("/assets/icons/refresh-cw.svg") center / contain no-repeat;
}

@media (max-width: 620px) {
  .nav-icon {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }
}

/* Compact shared page command bar */
.workspace {
  padding-top: 16px;
}

.topbar {
  min-height: 56px;
  margin-bottom: 10px;
  padding: 7px 9px 7px 17px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: white;
  background:
    linear-gradient(110deg, rgba(203, 33, 127, 0.16), transparent 34%),
    linear-gradient(180deg, #20242b, #171a20);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 14px 32px rgba(17, 24, 39, 0.15);
}

.topbar > div:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.topbar h2 {
  order: 1;
  margin: 0;
  color: white;
  font-size: 21px;
  line-height: 1;
  white-space: nowrap;
}

.topbar .eyebrow {
  order: 2;
  margin: 0;
  padding-left: 11px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
  line-height: 18px;
  white-space: nowrap;
}

.topbar-actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.topbar .live-chip {
  min-height: 30px;
  padding: 0 10px;
  border-color: rgba(99, 217, 140, 0.18);
  color: #8ee8ae;
  background: rgba(72, 201, 120, 0.08);
  font-size: 9px;
}

.topbar .live-chip span {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 0 3px rgba(57, 199, 109, 0.12);
}

.topbar .refresh-action {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.topbar .refresh-action:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.11);
  transform: translateY(-1px);
}

.topbar .refresh-label {
  display: none;
}

.topbar + .notice-host:empty {
  display: none;
}

@media (max-width: 620px) {
  .workspace {
    padding-top: 10px;
  }

  .topbar {
    min-height: 50px;
    margin-bottom: 8px;
    padding: 6px 7px 6px 13px;
  }

  .topbar h2 {
    font-size: 18px;
  }

  .topbar .eyebrow {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar .live-chip {
    display: inline-flex;
    min-height: 28px;
    padding: 0 8px;
  }

  .topbar .refresh-action {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
  }
}

/* Closed board branches */
.unity-tree {
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.62fr) minmax(0, 1fr);
  grid-template-rows: 1fr;
  grid-template-areas: "leftTeam legend rightTeam";
  gap: 18px;
}

.unity-tree > .position-card.legend {
  grid-area: legend;
}

.team-branch {
  position: relative;
  min-width: 0;
  padding-top: 38px;
  display: grid;
  align-items: center;
  gap: 12px;
}

.left-team {
  grid-area: leftTeam;
  grid-template-columns: minmax(105px, 0.82fr) minmax(145px, 1fr);
  grid-template-areas: "donors builder";
}

.right-team {
  grid-area: rightTeam;
  grid-template-columns: minmax(145px, 1fr) minmax(105px, 0.82fr);
  grid-template-areas: "builder donors";
}

.team-branch > .position-card {
  grid-area: builder;
  min-height: 276px;
  align-self: center;
}

.branch-donors {
  grid-area: donors;
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 10px;
}

.branch-donors .position-card,
.branch-donors .position-card.empty {
  width: 100%;
  min-height: 142px;
  grid-area: auto;
}

.team-branch-title {
  position: absolute;
  inset: 4px 10px auto;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #42665e;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.right-team .team-branch-title {
  justify-content: flex-end;
}

.team-branch-title i {
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(40, 127, 181, 0.08);
}

.left-team .team-branch-title { color: #27865e; }
.right-team .team-branch-title { color: #287fb5; }

.team-branch.is-separated {
  padding-top: 86px;
  opacity: 1;
  filter: none;
}

.team-branch.is-separated .team-branch-title::after {
  display: none;
}

.team-branch.is-separated > .position-card,
.team-branch.is-separated > .branch-donors {
  opacity: 0.43;
  filter: grayscale(0.72) saturate(0.35);
}

.branch-closed-banner {
  position: absolute;
  inset: 29px 8px auto;
  z-index: 4;
  min-height: 48px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(34, 125, 88, 0.28);
  border-radius: 10px;
  color: #164f39;
  background: rgba(228, 247, 237, 0.88);
  box-shadow: 0 12px 28px rgba(26, 71, 55, 0.12);
  backdrop-filter: blur(14px);
}

.branch-closed-banner > span {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #27865e;
  font-weight: 900;
}

.branch-closed-banner div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.branch-closed-banner strong {
  font-size: 11px;
}

.branch-closed-banner small {
  color: #53786a;
  font-size: 9px;
}

.has-left-closed .edge-core-left,
.has-left-closed .edge-left,
.has-right-closed .edge-core-right,
.has-right-closed .edge-right {
  opacity: 0.2;
  filter: grayscale(1);
}

.has-left-closed .edge-core-left .edge-flow,
.has-left-closed .edge-left .edge-flow,
.has-right-closed .edge-core-right .edge-flow,
.has-right-closed .edge-right .edge-flow {
  animation: none;
}

html[data-resolved-theme="dark"] .team-branch-title {
  color: #9db4ae;
}

html[data-resolved-theme="dark"] .left-team .team-branch-title { color: #79c9a6; }
html[data-resolved-theme="dark"] .right-team .team-branch-title { color: #7fc7e8; }

html[data-resolved-theme="dark"] .branch-closed-banner {
  border-color: rgba(99, 217, 140, 0.26);
  color: #d9f5e4;
  background: rgba(18, 48, 37, 0.9);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
}

html[data-resolved-theme="dark"] .branch-closed-banner small {
  color: #91b7a5;
}

@media (max-width: 980px) {
  .unity-tree {
    grid-template-columns: minmax(0, 1fr) minmax(165px, 0.75fr) minmax(0, 1fr);
    grid-template-areas: "leftTeam legend rightTeam";
    gap: 10px;
  }

  .left-team,
  .right-team {
    grid-template-columns: 1fr;
    grid-template-areas:
      "builder"
      "donors";
  }

  .team-branch > .position-card {
    min-height: 205px;
  }
}

@media (max-width: 620px) {
  .unity-tree {
    grid-template-columns: 1fr;
    grid-template-areas:
      "legend"
      "leftTeam"
      "rightTeam";
    gap: 12px;
  }

  .team-branch,
  .left-team,
  .right-team {
    grid-template-columns: 1fr;
    grid-template-areas:
      "builder"
      "donors";
    padding: 42px 8px 10px;
    border: 1px solid rgba(49, 102, 91, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
  }

  .team-branch.is-separated {
    padding-top: 96px;
  }

  .team-branch-title,
  .right-team .team-branch-title {
    inset: 14px 14px auto;
    justify-content: flex-start;
  }

  .branch-closed-banner {
    inset: 39px 10px auto;
  }

  .branch-donors {
    grid-template-columns: 1fr;
  }

  .team-branch > .position-card,
  .branch-donors .position-card,
  .branch-donors .position-card.empty {
    min-height: 170px;
  }

  html[data-resolved-theme="dark"] .team-branch {
    border-color: rgba(180, 205, 213, 0.14);
    background: rgba(7, 17, 21, 0.24);
  }
}

/* Keep long board roles readable after all responsive cascades. */
body .board-tree .slot-label {
  max-width: 100%;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  font-size: 10px;
  line-height: 1.25;
}

body .board-tree .status-pill,
body .board-tree .position-circle {
  font-size: 9px;
}

/* Board information hierarchy and durable state markers. */
.board-system-hud .board-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.level-pass-code {
  position: absolute;
  inset: 0 0 auto;
  min-height: 30px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(9, 16, 21, 0.82);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.level-pass-code:hover,
.level-pass-code.is-copied {
  color: white;
  background: rgba(9, 16, 21, 0.94);
}

.position-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
}

.position-circle {
  min-height: 20px;
  padding: 3px 7px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(57, 102, 92, 0.16);
  border-radius: 999px;
  color: #42665e;
  background: rgba(255, 255, 255, 0.48);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.team-branch {
  transition: opacity 180ms ease, filter 180ms ease;
}

.team-branch.is-separated {
  opacity: 0.46;
  filter: grayscale(0.62) saturate(0.45);
}

.team-branch.is-separated .team-branch-title::after {
  content: "Отделена";
  margin-left: 8px;
  padding: 3px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 8px;
  opacity: 0.82;
}

.board-is-closed .board-tree {
  opacity: 0.58;
  filter: grayscale(0.56) saturate(0.5);
}

@media (max-width: 620px) {
  .board-system-hud .board-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

[data-theme="dark"] .position-circle {
  border-color: rgba(133, 218, 194, 0.2);
  color: #b7d9d0;
  background: rgba(10, 20, 24, 0.5);
}

.stats-icon {
  border: 0;
  border-radius: 0;
}

.stats-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.stats-icon::after {
  left: 3px;
  bottom: 4px;
  width: 3px;
  height: 6px;
  border-radius: 2px 2px 0 0;
  box-shadow: 5px -4px 0 currentColor, 10px -8px 0 currentColor;
}

/* Board composition refinement */
.board-panel > .board-layout {
  min-height: 690px;
  background:
    linear-gradient(180deg, rgba(250, 255, 253, 0.12), rgba(196, 241, 226, 0.38)),
    linear-gradient(90deg, rgba(221, 246, 239, 0.18), transparent 42%, rgba(239, 220, 235, 0.14)),
    url("/assets/ubuntu-sky-board-v1.webp") center / cover no-repeat;
}

.board-layout > .board-meta {
  width: min(790px, calc(100% - 32px));
  min-height: 58px;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: 0 20px 50px rgba(29, 76, 68, 0.09), inset 0 1px rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(14px);
}

.board-layout > .board-meta div {
  min-height: 46px;
  padding: 8px 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.board-layout > .board-meta div + div {
  border-left: 1px solid rgba(44, 84, 77, 0.11);
}

.board-tree {
  position: relative;
  min-height: 360px;
  padding-top: 20px;
  grid-template-columns: minmax(125px, 0.78fr) minmax(150px, 1fr) minmax(210px, 1.28fr) minmax(150px, 1fr) minmax(125px, 0.78fr);
  grid-template-rows: 1fr;
  grid-template-areas: "leftDonors leftBuilder legend rightBuilder rightDonors";
  gap: 20px;
}

.board-tree::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 53%;
  z-index: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159, 53, 107, 0.24) 14%, rgba(51, 123, 107, 0.28) 50%, rgba(159, 53, 107, 0.24) 86%, transparent);
  box-shadow: 0 1px rgba(255, 255, 255, 0.72);
}

.board-tree > * {
  position: relative;
  z-index: 1;
}

.left-donors {
  grid-area: leftDonors;
}

.right-donors {
  grid-area: rightDonors;
}

.donor-stack {
  min-width: 0;
  padding: 12px 8px 8px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(232, 250, 243, 0.2));
  box-shadow: 0 24px 50px rgba(33, 87, 77, 0.09), inset 0 1px rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(10px);
}

.donor-stack-title {
  display: block;
  margin-bottom: 1px;
  color: #7f3b61;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.donor-stack .position-card,
.donor-stack .position-card.empty {
  min-height: 142px;
  width: 100%;
  grid-area: auto;
}

.donor-stack .position-head {
  min-height: 34px;
}

.donor-stack .slot-label {
  font-size: 8px;
}

.donor-stack .avatar-mini {
  width: 60px;
  height: 60px;
  flex-basis: 60px;
}

.board-tree > .position-card.left_builder,
.board-tree > .position-card.right_builder {
  min-height: 276px;
  align-self: center;
}

.board-tree > .position-card.legend {
  min-height: 310px;
  align-self: center;
}

.board-tree > .position-card.legend .avatar-mini {
  width: 116px;
  height: 116px;
  flex-basis: 116px;
}

.board-tree > .position-card.legend .position-user strong {
  font-size: 16px;
}

.board-tree > .position-card.left_builder .position-user,
.board-tree > .position-card.right_builder .position-user,
.board-tree > .position-card.legend .position-user {
  padding: 14px 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 22px 48px rgba(30, 82, 72, 0.07);
  backdrop-filter: blur(5px);
}

.board-tree > .position-card.legend .position-user {
  border-color: rgba(215, 61, 137, 0.2);
  background: linear-gradient(180deg, rgba(255, 238, 248, 0.28), rgba(255, 255, 255, 0.13));
}

.board-scene-progress {
  margin-top: 10px;
}

@media (max-width: 980px) {
  .board-panel > .board-layout {
    min-height: 820px;
  }

  .board-tree {
    min-height: 520px;
    grid-template-columns: minmax(125px, 1fr) minmax(170px, 1.2fr) minmax(125px, 1fr);
    grid-template-rows: 1fr 1fr;
    grid-template-areas:
      "leftBuilder legend rightBuilder"
      "leftDonors legend rightDonors";
    gap: 10px 14px;
  }

  .board-tree::before {
    top: 29%;
  }

  .board-tree > .position-card.legend {
    min-height: 430px;
    align-self: stretch;
  }

  .donor-stack {
    align-self: start;
  }
}

@media (max-width: 620px) {
  .board-panel > .board-layout {
    min-height: 0;
  }

  .board-layout > .board-meta {
    width: 100%;
    padding: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
  }

  .board-layout > .board-meta div + div {
    border-left: 0;
  }

  .board-layout > .board-meta div:nth-child(even) {
    border-left: 1px solid rgba(44, 84, 77, 0.11);
  }

  .board-layout > .board-meta div:nth-child(n + 3) {
    border-top: 1px solid rgba(44, 84, 77, 0.11);
  }

  .board-tree {
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    grid-template-areas:
      "legend legend"
      "leftBuilder rightBuilder"
      "leftDonors rightDonors";
    gap: 8px;
  }

  .board-tree::before {
    display: none;
  }

  .board-tree > .position-card.legend {
    min-height: 220px;
  }

  .board-tree > .position-card.left_builder,
  .board-tree > .position-card.right_builder {
    min-height: 204px;
  }

  .board-tree > .position-card.left_builder .position-user,
  .board-tree > .position-card.right_builder .position-user,
  .board-tree > .position-card.legend .position-user {
    padding-left: 3px;
    padding-right: 3px;
  }

  .donor-stack {
    padding: 9px 3px 6px;
  }

  .donor-stack .position-card,
  .donor-stack .position-card.empty {
    min-height: 140px;
    padding-left: 2px;
    padding-right: 2px;
  }
}

/* Immersive board scene */
.board-panel {
  padding-bottom: 0;
  overflow: hidden;
  border-color: rgba(30, 54, 52, 0.12);
}

.board-panel > .panel-header {
  margin-bottom: 18px;
}

.board-panel > .dual-legend-note {
  margin: 0 24px 18px;
}

.board-panel > .board-layout {
  position: relative;
  min-height: 660px;
  margin: 0;
  padding: 28px 30px 22px;
  isolation: isolate;
  overflow: hidden;
  border: 0;
  border-top: 1px solid rgba(35, 91, 82, 0.14);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(249, 255, 253, 0.2), rgba(211, 247, 235, 0.48)),
    url("/assets/ubuntu-sky-board-v1.webp") center / cover no-repeat;
}

.board-panel > .board-layout::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.26), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.26)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 36%, rgba(231, 255, 246, 0.18));
  pointer-events: none;
}

.level-pass {
  position: relative;
  width: min(350px, calc(100% - 24px));
  min-height: 134px;
  margin: 0 auto 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(118deg, rgba(16, 28, 31, 0.9) 0 28%, transparent 28%),
    linear-gradient(135deg, #d62984, #645bd0 54%, #168c65);
  box-shadow: 0 24px 48px rgba(28, 75, 70, 0.24), inset 0 1px rgba(255, 255, 255, 0.3);
  transform: rotate(-1deg);
}

.level-pass-serial {
  position: absolute;
  inset: 0 0 auto;
  min-height: 27px;
  padding: 7px 12px 6px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(9, 16, 21, 0.82);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-pass-body {
  min-width: 0;
  padding: 46px 0 17px 18px;
  display: grid;
  gap: 3px;
}

.level-pass-kicker,
.level-pass-body small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.level-pass-body > strong {
  font-size: 25px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.level-pass-value {
  padding: 0 18px 18px 0;
  display: grid;
  justify-items: end;
  line-height: 1;
}

.level-pass-value strong {
  font-size: 24px;
}

.level-pass-value span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 9px;
  font-weight: 900;
}

.level-pass-mark {
  position: absolute;
  right: 18px;
  top: 39px;
  display: flex;
  gap: 3px;
  transform: skew(-18deg);
}

.level-pass-mark i {
  width: 25px;
  height: 9px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.2);
}

.board-layout > .board-meta {
  width: min(780px, 100%);
  margin: 0 auto 12px;
  gap: 6px;
}

.board-layout > .board-meta div {
  min-height: 54px;
  padding: 9px 11px;
  border-color: rgba(39, 98, 84, 0.12);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 30px rgba(37, 94, 84, 0.06);
  backdrop-filter: blur(10px);
}

.board-layout > .board-meta small {
  margin-bottom: 4px;
  color: #6c7d7a;
  font-size: 9px;
}

.board-layout > .board-meta strong {
  color: #18312f;
  font-size: 13px;
}

.board-tree {
  width: min(1160px, 100%);
  min-height: 330px;
  margin: 0 auto;
  padding: 12px 0 0;
  grid-template-columns: minmax(100px, 0.8fr) minmax(150px, 1.05fr) minmax(190px, 1.25fr) minmax(150px, 1.05fr) minmax(100px, 0.8fr);
  grid-template-rows: 1fr 1fr;
  grid-template-areas:
    "leftDonor1 leftBuilder legend rightBuilder rightDonor1"
    "leftDonor2 leftBuilder legend rightBuilder rightDonor2";
  align-items: center;
  gap: 12px 18px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.board-tree .position-card {
  min-height: 132px;
  padding: 8px 6px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  overflow: visible;
  border: 0;
  color: #173733;
  background: transparent;
  box-shadow: none;
}

.board-tree .position-card.legend,
.board-tree .position-card.left_builder,
.board-tree .position-card.right_builder {
  min-height: 244px;
  align-self: stretch;
  background: transparent;
}

.board-tree .position-head {
  width: 100%;
  min-height: 39px;
  display: grid;
  justify-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

.board-tree .slot-label {
  color: #9b2f69;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.board-tree .status-pill {
  min-height: 20px;
  padding: 0 7px;
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.62);
  color: #4c6a65;
  font-size: 8px;
  backdrop-filter: blur(8px);
}

.board-tree .position-user {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  color: #173733;
  text-align: center;
}

.board-tree .position-user-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.board-tree .position-user-button:hover {
  background: transparent;
}

.board-tree .position-user-button:hover .avatar-mini {
  transform: translateY(-3px);
  box-shadow: 0 20px 38px rgba(42, 91, 83, 0.24), inset 0 0 0 1px rgba(28, 33, 65, 0.12);
}

.board-tree .position-user strong {
  color: #173733;
  font-size: 13px;
}

.board-tree .position-user small {
  margin-top: 1px;
  color: #67807b;
  font-size: 10px;
}

.board-tree .avatar-mini {
  width: 66px;
  height: 66px;
  flex-basis: 66px;
  display: grid;
  place-items: center;
  border: 5px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  color: white;
  font-size: 17px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 45%),
    linear-gradient(145deg, #dd318d, #645bd0 52%, #208e68);
  box-shadow: 0 14px 30px rgba(42, 91, 83, 0.18), inset 0 0 0 1px rgba(28, 33, 65, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.board-tree .position-card.legend .avatar-mini {
  width: 106px;
  height: 106px;
  flex-basis: 106px;
  border-width: 7px;
  font-size: 24px;
  box-shadow: 0 22px 42px rgba(81, 54, 132, 0.24), inset 0 0 0 1px rgba(28, 33, 65, 0.14);
}

.board-tree .position-card.left_builder .avatar-mini,
.board-tree .position-card.right_builder .avatar-mini {
  width: 82px;
  height: 82px;
  flex-basis: 82px;
  font-size: 19px;
}

.board-tree .position-card.empty .avatar-mini {
  border-color: rgba(255, 255, 255, 0.56);
  color: #7b9992;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: 0 12px 28px rgba(42, 91, 83, 0.08);
}

.board-tree .position-state-icon {
  position: absolute;
  top: -4px;
  left: calc(50% + 18px);
  width: 23px;
  height: 23px;
  flex-basis: 23px;
  margin: 0;
  border: 2px solid white;
  font-size: 11px;
  box-shadow: 0 6px 14px rgba(35, 84, 74, 0.16);
}

.board-tree .legend-stars {
  display: inline-flex;
  margin-left: 4px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #bb7808;
  background: #fff3bc;
  letter-spacing: 0;
}

.board-tree .qualification-ring {
  margin-left: 4px;
}

.board-tree .position-actions {
  justify-content: center;
}

.board-tree .position-actions button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 10px;
  box-shadow: 0 8px 18px rgba(35, 84, 74, 0.09);
}

.board-scene-progress {
  width: 112px;
  margin: 2px auto 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.board-scene-progress > span {
  height: 4px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(49, 102, 91, 0.18);
}

.board-scene-progress > span::after {
  content: "";
  width: var(--board-progress);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #bd2a78;
}

.board-scene-progress small {
  color: #58746e;
  font-size: 10px;
  font-weight: 800;
}

@media (max-width: 980px) {
  .board-panel > .board-layout {
    min-height: 780px;
  }

  .board-tree {
    min-height: 470px;
    grid-template-columns: minmax(110px, 1fr) minmax(150px, 1.2fr) minmax(110px, 1fr);
    grid-template-rows: 1.15fr repeat(2, 0.8fr);
    grid-template-areas:
      "leftBuilder legend rightBuilder"
      "leftDonor1 legend rightDonor1"
      "leftDonor2 legend rightDonor2";
    gap: 8px 12px;
  }
}

@media (max-width: 620px) {
  .board-panel > .panel-header {
    margin-left: 18px;
    margin-right: 18px;
  }

  .board-header-actions,
  .board-switcher {
    width: 100%;
    min-width: 0;
  }

  .board-panel > .board-layout {
    min-height: 0;
    padding: 22px 14px 20px;
    background-position: center top;
  }

  .level-pass {
    min-height: 124px;
  }

  .level-pass-body > strong {
    font-size: 21px;
  }

  .board-layout > .board-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-layout > .board-meta div:last-child {
    grid-column: 1 / -1;
  }

  .board-tree {
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    grid-template-areas:
      "legend legend"
      "leftBuilder rightBuilder"
      "leftDonor1 rightDonor1"
      "leftDonor2 rightDonor2";
    gap: 10px 4px;
  }

  .board-tree .position-card.legend,
  .board-tree .position-card.left_builder,
  .board-tree .position-card.right_builder {
    min-height: 188px;
  }

  .board-tree .position-card.legend .avatar-mini {
    width: 90px;
    height: 90px;
    flex-basis: 90px;
  }

  .board-tree .position-card.left_builder .avatar-mini,
  .board-tree .position-card.right_builder .avatar-mini {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
  }

  .board-tree .slot-label {
    font-size: 9px;
  }
}

.board-header-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
}

.board-switcher {
  display: grid;
  gap: 5px;
  min-width: min(360px, 48vw);
}

.board-switcher > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.board-switcher select {
  min-height: 42px;
  width: 100%;
}

.selected-board-row {
  background: rgba(209, 35, 132, 0.06);
}

.position-user-button {
  appearance: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  width: 100%;
}

.position-user-button:hover strong,
.telegram-link:hover {
  color: var(--pink);
}

.legend-stars {
  color: #d49a14;
  font-size: 12px;
  margin-left: 7px;
}

.qualification-ring {
  border: 2px solid #cbd3de;
  border-radius: 50%;
  display: inline-block;
  height: 14px;
  margin-left: 7px;
  vertical-align: -2px;
  width: 14px;
}

.qualification-ring.half {
  background: linear-gradient(90deg, var(--green) 50%, transparent 50%);
  border-color: var(--green);
}

.qualification-ring.full {
  background: var(--green);
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px #fff;
}

.position-state-icon {
  align-items: center;
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 28px;
  font-size: 15px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  margin-left: auto;
}

.position-state-icon.confirmed { background: #dcf7e7; color: #16743b; }
.position-state-icon.sent { background: #e9efff; color: #315fbd; }
.position-state-icon.disputed { background: #ffe4e4; color: #a72828; }

.profile-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(12, 18, 29, 0.32);
  color: var(--ink);
  max-width: calc(100vw - 32px);
  padding: 22px;
  width: 420px;
}

.profile-dialog::backdrop { background: rgba(10, 14, 22, 0.62); }

.profile-dialog-head {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
}

.profile-dialog-head h3 { margin: 2px 0 0; }
.profile-dialog-head small { color: var(--muted); }

.icon-action {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 26px;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.profile-details {
  display: grid;
  gap: 0;
  margin: 20px 0;
}

.profile-details > div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  padding: 11px 0;
}

.profile-details dt { color: var(--muted); }
.profile-details dd { font-weight: 750; margin: 0; text-align: right; }
.telegram-link { color: #1877b7; font-weight: 800; text-decoration: none; }
.muted-text { color: var(--muted); }
.profile-dialog-actions { display: flex; justify-content: flex-end; }
.dialog-description { color: var(--muted); line-height: 1.5; margin: 6px 0; }
.dispute-dialog textarea { min-height: 120px; resize: vertical; }
.gift-recipient-inline { align-items: center; display: grid; gap: 2px 10px; grid-template-columns: 1fr auto; margin-bottom: 8px; width: 100%; }
.gift-recipient-inline small { color: var(--muted); grid-column: 1 / -1; }
.gift-recipient-inline .telegram-link { font-size: 12px; }
.referral-tree, .referral-tree ul { list-style: none; margin: 0; padding: 0; }
.referral-tree > ul { display: grid; gap: 12px; }
.referral-tree-node { position: relative; }
.referral-tree-node > details > summary { align-items: center; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; display: grid; gap: 10px; grid-template-columns: 16px 36px minmax(0, 1fr) auto; min-height: 56px; padding: 9px 12px; }
.referral-tree-node > details > summary::-webkit-details-marker { display: none; }
.referral-tree-node > details > summary::marker { content: ""; }
.referral-tree-chevron { border-bottom: 2px solid var(--muted); border-right: 2px solid var(--muted); height: 7px; transform: rotate(-45deg); transition: transform 160ms ease; width: 7px; }
.referral-tree-node > details[open] > summary .referral-tree-chevron { transform: rotate(45deg); }
.referral-tree-node .avatar-mini { height: 36px; width: 36px; }
.referral-tree-details { align-items: center; display: flex; gap: 8px; min-height: 38px; padding: 8px 14px 0 54px; }
.referral-telegram-icon { background: currentColor; color: #229ed9; height: 17px; -webkit-mask: url("/assets/icons/send.svg") center / contain no-repeat; mask: url("/assets/icons/send.svg") center / contain no-repeat; width: 17px; }
.referral-tree-node details > ul { border-left: 1px solid color-mix(in srgb, var(--pink) 45%, var(--line)); display: grid; gap: 8px; margin-left: 27px; padding-left: 22px; padding-top: 8px; }
.referral-tree-node details > ul > .referral-tree-node::before { background: color-mix(in srgb, var(--pink) 45%, var(--line)); content: ""; height: 1px; left: -22px; position: absolute; top: 28px; width: 22px; }

.audit-change summary {
  color: var(--pink);
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.audit-change > div {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  min-width: 280px;
}

.audit-change pre {
  background: #f3f5f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 0;
  max-width: 420px;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .board-panel > .panel-header,
  .gifts-panel > .panel-header,
  .board-header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .board-switcher {
    min-width: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
  }
}

/* Product shell */
:root {
  --ink: #15171c;
  --ink-2: #23262d;
  --muted: #6f7580;
  --muted-2: #969ca6;
  --line: #e4e6ea;
  --line-strong: #cfd3d9;
  --paper-soft: #f7f7f8;
  --canvas: #f2f3f5;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(18, 20, 24, 0.04), 0 8px 24px rgba(18, 20, 24, 0.04);
  --shadow-md: 0 16px 48px rgba(18, 20, 24, 0.08);
}

body {
  background: var(--canvas);
  overflow-x: clip;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 76px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  background: rgba(17, 19, 24, 0.96);
  box-shadow: 0 10px 30px rgba(18, 20, 24, 0.1);
  backdrop-filter: blur(18px);
}

.header-inner {
  width: min(100% - 40px, 1480px);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 210px;
  align-items: center;
  gap: 20px;
}

.sidebar-brand {
  min-height: 0;
}

.sidebar-brand .brand-mark.small {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-radius: 8px;
  font-size: 20px;
  box-shadow: none;
}

.sidebar-brand strong {
  font-size: 15px;
}

.sidebar-brand span {
  color: #7fe2a1;
  font-size: 10px;
}

.nav-list {
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.nav-item {
  min-height: 42px;
  gap: 8px;
  padding: 0 13px;
  border-radius: 7px;
  color: #aeb3bd;
  font-size: 13px;
}

.nav-item:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.is-active {
  border-color: rgba(255, 255, 255, 0.08);
  background: #292c33;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-basis: 17px;
  border-width: 1.5px;
  border-radius: 5px;
}

.account-menu {
  position: relative;
  justify-self: end;
}

.account-trigger {
  height: 48px;
  min-width: 176px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
  list-style: none;
}

.account-trigger::-webkit-details-marker {
  display: none;
}

.account-trigger:hover,
.account-menu[open] .account-trigger {
  background: rgba(255, 255, 255, 0.1);
}

.account-trigger .profile-avatar {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 7px;
  font-size: 13px;
}

.account-copy {
  min-width: 0;
  flex: 1;
}

.account-copy > span {
  display: block;
  color: #989faa;
  font-size: 9px;
  font-weight: 800;
}

.account-copy strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
}

.chevron {
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-right: 1.5px solid #9da3ad;
  border-bottom: 1.5px solid #9da3ad;
  transform: rotate(45deg) translateY(-2px);
}

.account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow-md);
}

.account-popover-head {
  padding: 4px 3px 10px;
  border-bottom: 1px solid var(--line);
}

.account-popover-head span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.account-popover-head strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.account-popover .ghost-action {
  width: 100%;
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper-soft);
}

.account-popover .logout-action {
  color: var(--danger);
}

.workspace {
  width: min(100% - 40px, 1480px);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 34px 0 60px;
}

.topbar {
  min-height: 74px;
  margin-bottom: 24px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.topbar .eyebrow {
  margin-bottom: 5px;
  color: var(--pink);
  font-size: 10px;
}

.topbar h2 {
  color: var(--ink);
  font-size: 32px;
}

.live-chip {
  min-height: 34px;
  border-color: #d9e8de;
  color: #217a42;
  background: #eaf6ee;
}

.refresh-action {
  min-height: 40px;
  border-color: var(--line);
  background: white;
  box-shadow: var(--shadow-sm);
}

.view-root {
  gap: 16px;
}

.overview-hero {
  position: relative;
  min-height: 164px;
  padding: 28px;
  border: 0;
  background: #181b21;
  box-shadow: var(--shadow-md);
}

.overview-hero::after {
  content: "UBUNTU";
  position: absolute;
  right: 24px;
  bottom: -20px;
  color: rgba(255, 255, 255, 0.035);
  font-size: 92px;
  font-weight: 900;
  pointer-events: none;
}

.overview-avatar,
.profile-avatar,
.avatar-mini {
  background: linear-gradient(135deg, #d72c87, #6858c9 52%, #279b65);
}

.metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.panel,
.position-card {
  border-color: var(--line);
  background: white;
  box-shadow: var(--shadow-sm);
}

.metric-card::before,
.panel::before,
.position-card::before {
  display: none;
}

.metric-card {
  min-height: 120px;
  padding: 18px;
  background: white;
}

.metric-card strong {
  font-size: 25px;
}

.panel {
  padding: 24px;
}

.panel-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.board-panel {
  padding-top: 24px;
}

.board-layout {
  border-color: var(--line);
  background: #f7f8fa;
}

.position-card {
  border-color: var(--line);
}

.table-shell {
  border-color: var(--line);
}

thead th {
  color: #737985;
  background: #f6f7f8;
}

tbody tr:hover {
  background: #fafafb;
}

@media (max-width: 1180px) {
  .header-inner {
    grid-template-columns: 180px minmax(0, 1fr) 54px;
  }

  .account-trigger {
    min-width: 48px;
    width: 48px;
  }

  .account-copy,
  .account-trigger .chevron {
    display: none;
  }

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

@media (max-width: 900px) {
  .app-header {
    height: 68px;
    backdrop-filter: none;
  }

  .header-inner {
    width: calc(100% - 28px);
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .app-header .nav-list {
    position: fixed;
    z-index: 40;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    height: 64px;
    padding: 7px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(20, 22, 27, 0.96);
    box-shadow: 0 20px 50px rgba(18, 20, 24, 0.28);
    backdrop-filter: blur(18px);
  }

  .nav-item {
    min-width: 0;
    min-height: 50px;
    padding: 4px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 9px;
  }

  .nav-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .workspace {
    width: calc(100% - 28px);
    min-height: calc(100vh - 68px);
    margin: 0 auto;
    padding: 24px 0 100px;
    overflow: clip;
  }

  .topbar,
  .overview-hero {
    flex-direction: row;
    align-items: center;
  }
}

@media (max-width: 620px) {
  .sidebar-brand > div:last-child span {
    display: none;
  }

  .sidebar-brand strong {
    font-size: 14px;
  }

  .account-popover {
    position: fixed;
    top: 76px;
    right: 14px;
    width: min(290px, calc(100vw - 28px));
  }

  .topbar {
    min-height: 62px;
    padding: 0;
  }

  .topbar h2 {
    font-size: 26px;
  }

  .refresh-label,
  .live-chip {
    display: none;
  }

  .refresh-action {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }

  .overview-hero {
    min-height: 190px;
    padding: 20px;
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-profile p {
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .overview-status {
    justify-items: start;
    text-align: left;
  }

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

  .metric-card {
    min-height: 112px;
  }

  .panel {
    padding: 18px;
  }

  .app-header .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow-x: auto;
  }

  .nav-item.admin-only:not(.is-hidden) {
    display: flex;
  }
}

/* Final board cascade: keep the immersive composition above legacy breakpoints. */
.board-panel > .board-layout {
  min-height: 690px;
  background:
    linear-gradient(180deg, rgba(250, 255, 253, 0.12), rgba(196, 241, 226, 0.38)),
    linear-gradient(90deg, rgba(221, 246, 239, 0.18), transparent 42%, rgba(239, 220, 235, 0.14)),
    url("/assets/ubuntu-sky-board-v1.webp") center / cover no-repeat;
}

.board-layout > .board-meta {
  width: min(790px, calc(100% - 32px));
  min-height: 58px;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: 0 20px 50px rgba(29, 76, 68, 0.09), inset 0 1px rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(14px);
}

.board-layout > .board-meta div {
  min-height: 46px;
  padding: 8px 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.board-layout > .board-meta div + div {
  border-left: 1px solid rgba(44, 84, 77, 0.11);
}

.board-tree {
  position: relative;
  min-height: 360px;
  padding: 20px 0 0;
  grid-template-columns: minmax(125px, 0.78fr) minmax(150px, 1fr) minmax(210px, 1.28fr) minmax(150px, 1fr) minmax(125px, 0.78fr);
  grid-template-rows: 1fr;
  grid-template-areas: "leftDonors leftBuilder legend rightBuilder rightDonors";
  align-items: center;
  gap: 20px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.left-donors { grid-area: leftDonors; }
.right-donors { grid-area: rightDonors; }

.donor-stack .position-card,
.donor-stack .position-card.empty {
  width: 100%;
  min-height: 142px;
  grid-area: auto;
}

.board-tree > .position-card.left_builder,
.board-tree > .position-card.right_builder {
  min-height: 276px;
  align-self: center;
}

.board-tree > .position-card.legend {
  min-height: 310px;
  align-self: center;
}

.board-tree > .position-card.legend .avatar-mini {
  width: 116px;
  height: 116px;
  flex-basis: 116px;
}

@media (max-width: 980px) {
  .board-panel > .board-layout {
    min-height: 820px;
  }

  .board-tree {
    min-height: 520px;
    grid-template-columns: minmax(125px, 1fr) minmax(170px, 1.2fr) minmax(125px, 1fr);
    grid-template-rows: 1fr 1fr;
    grid-template-areas:
      "leftBuilder legend rightBuilder"
      "leftDonors legend rightDonors";
    gap: 10px 14px;
  }

  .board-tree > .position-card.legend {
    min-height: 430px;
    align-self: stretch;
  }
}

@media (max-width: 620px) {
  .board-panel > .board-layout {
    min-height: 0;
  }

  .board-layout > .board-meta {
    width: 100%;
    padding: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-layout > .board-meta div + div { border-left: 0; }
  .board-layout > .board-meta div:nth-child(even) { border-left: 1px solid rgba(44, 84, 77, 0.11); }
  .board-layout > .board-meta div:nth-child(n + 3) { border-top: 1px solid rgba(44, 84, 77, 0.11); }

  .board-tree {
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    grid-template-areas:
      "legend legend"
      "leftBuilder rightBuilder"
      "leftDonors rightDonors";
    gap: 8px;
  }

  .board-tree > .position-card.legend { min-height: 220px; }
  .board-tree > .position-card.left_builder,
  .board-tree > .position-card.right_builder { min-height: 204px; }
}

/* Active board tabs */
.board-header-actions {
  max-width: min(720px, 64vw);
  align-items: center;
  flex-wrap: wrap;
}

.board-switcher {
  width: min(620px, 56vw);
  min-width: 360px;
  display: grid;
  gap: 7px;
}

.board-switcher-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.board-switcher-label small {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(203, 33, 127, 0.18);
  border-radius: 999px;
  color: var(--pink);
  background: #fff2f8;
  font-size: 9px;
}

.board-switcher-tabs {
  max-width: 100%;
  padding: 2px 2px 7px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(203, 33, 127, 0.28) transparent;
}

.board-switcher-tab {
  position: relative;
  min-width: 218px;
  min-height: 62px;
  padding: 8px 28px 8px 9px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(29, 39, 53, 0.12);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f5f7f9);
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.07);
  text-align: left;
}

.board-switcher-tab:hover {
  border-color: rgba(203, 33, 127, 0.3);
  background: #fff8fc;
  transform: translateY(-1px);
}

.board-switcher-tab.is-active {
  border-color: rgba(255, 255, 255, 0.12);
  color: white;
  background:
    linear-gradient(110deg, rgba(203, 33, 127, 0.24), transparent 42%),
    #181b21;
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.2);
}

.board-switcher-tab.is-active::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(90deg, var(--pink), var(--green), var(--blue));
}

.board-tab-level {
  width: 38px;
  height: 42px;
  display: grid;
  place-content: center;
  justify-items: center;
  border: 1px solid rgba(35, 47, 63, 0.1);
  border-radius: 6px;
  color: #75465f;
  background: linear-gradient(145deg, #ffe9f4, #e5f5ec);
  line-height: 1;
}

.board-tab-level small {
  font-size: 7px;
  font-weight: 900;
}

.board-tab-level strong {
  margin-top: 3px;
  font-size: 17px;
}

.board-switcher-tab.is-active .board-tab-level {
  border-color: rgba(255, 255, 255, 0.16);
  color: white;
  background: linear-gradient(145deg, #d83288, #4d68c4 54%, #218b61);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.board-tab-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.board-tab-copy > strong,
.board-tab-copy > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-tab-copy > strong {
  font-size: 13px;
}

.board-tab-copy > small {
  color: var(--muted);
  font-size: 9px;
}

.board-switcher-tab.is-active .board-tab-copy > small {
  color: rgba(255, 255, 255, 0.62);
}

.board-tab-state {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 7px;
  height: 7px;
  border: 1px solid #b6c0cc;
  border-radius: 50%;
  transform: translateY(-50%);
}

.board-switcher-tab.is-active .board-tab-state {
  border-color: #63d98c;
  background: #48c978;
  box-shadow: 0 0 0 4px rgba(72, 201, 120, 0.12);
}

@media (max-width: 760px) {
  .board-header-actions {
    width: 100%;
    max-width: none;
  }

  .board-switcher {
    width: 100%;
    min-width: 0;
  }

  .board-switcher-tab {
    min-width: min(240px, calc(100vw - 92px));
  }
}

/* Premium surface pass */
:root {
  --radius: 14px;
  --shadow-sm: 0 10px 30px rgba(17, 28, 40, 0.08);
  --shadow-md: 0 22px 58px rgba(17, 28, 40, 0.13);
}

.metric-card,
.panel,
.overview-hero,
.table-shell,
.notification-row,
.referral-result,
.gift-attention,
.account-popover,
.profile-dialog {
  border-radius: 14px;
}

.metric-card,
.panel {
  border-color: rgba(25, 40, 53, 0.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 18px 48px rgba(18, 32, 45, 0.08);
}

.board-panel {
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #f6f9f8);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 26px 70px rgba(20, 43, 39, 0.13);
}

.board-panel > .board-layout {
  margin: 0 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow:
    0 26px 56px rgba(31, 79, 70, 0.1) inset,
    0 14px 34px rgba(20, 52, 46, 0.08);
}

.board-panel > .board-layout::before {
  border-radius: inherit;
}

.level-pass {
  border-radius: 16px;
  box-shadow:
    0 30px 60px rgba(34, 63, 77, 0.25),
    0 1px 0 rgba(255, 255, 255, 0.44) inset;
}

.level-pass-serial {
  border-radius: 15px 15px 0 0;
}

.board-layout > .board-meta {
  border-radius: 14px;
  box-shadow:
    0 22px 52px rgba(29, 76, 68, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.donor-stack {
  border-radius: 18px;
  border-color: rgba(255, 255, 255, 0.76);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.48), rgba(226, 248, 241, 0.22));
  box-shadow:
    0 28px 64px rgba(30, 78, 69, 0.13),
    0 1px 0 rgba(255, 255, 255, 0.92) inset;
}

.board-tree > .position-card.left_builder .position-user,
.board-tree > .position-card.right_builder .position-user,
.board-tree > .position-card.legend .position-user {
  border-radius: 18px;
  border-color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.28);
  box-shadow:
    0 26px 58px rgba(31, 77, 69, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.board-tree > .position-card.legend .position-user {
  border-color: rgba(211, 48, 132, 0.2);
  background:
    linear-gradient(155deg, rgba(255, 237, 247, 0.48), rgba(255, 255, 255, 0.22));
  box-shadow:
    0 32px 70px rgba(105, 54, 102, 0.16),
    0 1px 0 rgba(255, 255, 255, 0.92) inset;
}

.board-tree .avatar-mini {
  border-radius: 16px;
  box-shadow:
    0 18px 38px rgba(47, 69, 102, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.34) inset;
}

.board-tree .position-card.empty .avatar-mini {
  border-radius: 14px;
  box-shadow:
    0 16px 34px rgba(42, 91, 83, 0.09),
    0 1px 0 rgba(255, 255, 255, 0.78) inset;
}

.board-switcher-tab {
  border-radius: 14px;
  border-color: rgba(31, 43, 56, 0.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92) inset,
    0 10px 26px rgba(16, 24, 40, 0.09);
}

.board-switcher-tab:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.94) inset,
    0 16px 34px rgba(91, 39, 72, 0.13);
}

.board-switcher-tab.is-active {
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(115deg, rgba(214, 47, 136, 0.32), transparent 46%),
    linear-gradient(180deg, #22262e, #15181e);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 18px 42px rgba(17, 24, 39, 0.24);
}

.board-tab-level {
  border-radius: 10px;
}

.board-switcher-label small {
  box-shadow: 0 7px 16px rgba(203, 33, 127, 0.09);
}

@media (max-width: 620px) {
  .board-panel {
    border-radius: 16px;
  }

  .board-panel > .board-layout {
    margin: 0 6px 6px;
    border-radius: 14px;
  }

  .level-pass,
  .donor-stack,
  .board-tree > .position-card.left_builder .position-user,
  .board-tree > .position-card.right_builder .position-user,
  .board-tree > .position-card.legend .position-user {
    border-radius: 14px;
  }
}

/* Final compact command-bar cascade. */
.workspace { padding-top: 16px; }

.topbar {
  min-height: 56px;
  margin-bottom: 10px;
  padding: 7px 9px 7px 17px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: white;
  background:
    linear-gradient(110deg, rgba(203, 33, 127, 0.16), transparent 34%),
    linear-gradient(180deg, #20242b, #171a20);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 14px 32px rgba(17, 24, 39, 0.15);
}

.topbar > div:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.topbar h2 {
  order: 1;
  margin: 0;
  color: white;
  font-size: 21px;
  line-height: 1;
  white-space: nowrap;
}

.topbar .eyebrow {
  order: 2;
  margin: 0;
  padding-left: 11px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
  line-height: 18px;
  white-space: nowrap;
}

.topbar-actions { flex-wrap: nowrap; gap: 6px; }

.topbar .live-chip {
  min-height: 30px;
  padding: 0 10px;
  border-color: rgba(99, 217, 140, 0.18);
  color: #8ee8ae;
  background: rgba(72, 201, 120, 0.08);
  font-size: 9px;
}

.topbar .live-chip span {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 0 3px rgba(57, 199, 109, 0.12);
}

.topbar .refresh-action {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.topbar .refresh-action:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.11);
  transform: translateY(-1px);
}

.topbar .refresh-label { display: none; }
.topbar + .notice-host:empty { display: none; }

@media (max-width: 620px) {
  .workspace { padding-top: 10px; }

  .topbar {
    min-height: 50px;
    margin-bottom: 8px;
    padding: 6px 7px 6px 13px;
  }

  .topbar h2 { font-size: 18px; }

  .topbar .eyebrow {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar .live-chip {
    display: inline-flex;
    min-height: 28px;
    padding: 0 8px;
  }

  .topbar .refresh-action {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
  }
}
