/* RP2 shared interface polish.
   Loaded last so staff, leader and admin use the same compact operational UI. */

:root {
  --bg-0: #111921;
  --bg-1: #071016;
  --bg-glow: rgba(68, 178, 218, 0.1);
  --glass-bg: rgba(17, 29, 37, 0.48);
  --glass-bg-2: rgba(30, 45, 55, 0.58);
  --glass-border: rgba(211, 232, 241, 0.28);
  --glass-hi: rgba(245, 251, 255, 0.5);
  --glass-blur: 30px;
  --glass-sat: 170%;
  --content-max: clamp(1180px, 82vw, 1460px);
  --text: #f4f7f9;
  --text-2: #b7c0c8;
  --text-3: #828d97;
  --accent: #4d9de0;
  --accent-2: #79b8ee;
  --accent-soft: rgba(77, 157, 224, 0.16);
  --success: #39b980;
  --success-soft: rgba(57, 185, 128, 0.15);
  --danger: #ef6a6a;
  --danger-soft: rgba(239, 106, 106, 0.15);
  --warn: #e9bd5b;
  --warn-soft: rgba(233, 189, 91, 0.15);
  --amber: #e59b4a;
  --unknown: #9099a1;
  --unknown-soft: rgba(144, 153, 161, 0.16);
  --app-gutter: clamp(12px, 1.8vw, 28px);
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-pill: 8px;
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.24);
  --shadow-deep: 0 14px 36px rgba(0, 0, 0, 0.38);
  --shadow-lift: 0 18px 44px rgba(0, 0, 0, 0.44);
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg-1);
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  background-color: #081117;
  background-image: url(assets/main_bg.png);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  background-blend-mode: soft-light;
  letter-spacing: 0;
}

body[data-app="staff"],
body[data-app="leader"],
body[data-app="admin"] {
  background-color: #081117;
  background-image: url(assets/main_bg.png);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  background-blend-mode: soft-light;
}

.app-header {
  width: 100%;
  max-width: none;
  margin: 0;
  padding-inline: clamp(14px, 2.2vw, 32px);
  background: rgba(10, 21, 29, 0.54);
  border-bottom-color: rgba(220, 238, 246, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22), inset 0 1px rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(28px) saturate(165%);
  -webkit-backdrop-filter: blur(28px) saturate(165%);
}

.app-main {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}

.container {
  width: 100%;
  max-width: var(--content-max) !important;
  min-width: 0;
  margin-inline: auto;
}

#app,
.app-shell,
.shell,
.shell > .main,
.main,
.view,
.stack {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.shell > .main {
  flex: 1 1 0;
}

body[data-app="staff"] .app-main,
body[data-app="leader"] .app-main,
body[data-app="admin"] .app-main,
.shell > .main > .app-main {
  padding-inline: var(--app-gutter) !important;
}

.app-header__inner {
  width: 100%;
  max-width: var(--content-max) !important;
  margin-inline: auto;
  padding-inline: var(--app-gutter);
}

.glass,
.card,
.section,
.brand-card {
  border-radius: var(--r-lg);
  border-color: var(--glass-border);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.11), transparent 28%),
    linear-gradient(165deg, rgba(24, 43, 54, 0.56), rgba(9, 19, 27, 0.38));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 1px 0 0 rgba(255, 255, 255, 0.07),
    0 12px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
}

body[data-app="staff"] #brand-grid .brand-card,
body[data-app="staff"] #brand-grid .brand-card__logo,
.brand-card__logo,
.check__box,
.check-search,
.serp-row,
.serp-warn,
.hd-cta,
.guide-toc__link,
.guide-body blockquote,
.kpi-bar,
.kpi-bar__fill,
.kpi-brand,
.tier-group,
.attend-chip,
.rank-input,
.rank-row,
.res-table-wrap,
.task-item,
.tpl-pick .tpl-btn,
.admin-card {
  border-radius: var(--r-lg);
}

.glass::before,
.card::before,
.section::before {
  opacity: 0.62;
}

.card:hover,
.glass--raised:hover,
.brand-card:hover {
  border-color: rgba(121, 184, 238, 0.4);
  transform: translateY(-1px);
}

.glass--raised {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), transparent 24%),
    linear-gradient(165deg, rgba(28, 48, 60, 0.64), rgba(10, 20, 29, 0.44));
}

.glass--flat {
  background: rgba(19, 34, 44, 0.34);
}

.schedule-card {
  display: grid;
  gap: 18px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  align-items: start;
}

.schedule-grid .input[type="time"] {
  min-height: 46px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.manual-channel {
  margin-top: 10px;
  border: 1px solid rgba(211, 232, 241, 0.2);
  border-radius: var(--r-lg);
  padding: 10px 12px;
}

.manual-channel > summary {
  cursor: pointer;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 600;
}

.manual-channel__form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  padding-top: 12px;
}

.task-status--cancelled {
  color: var(--text-3);
  border-color: rgba(144, 153, 161, 0.32);
  background: rgba(144, 153, 161, 0.12);
}

.task-item--cancelled {
  opacity: 0.72;
}

.roster-run-row {
  cursor: pointer;
}

.roster-run-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.roster-run-detail > td {
  padding: 0 12px 14px;
}

.roster-run-detail__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(211, 232, 241, 0.18);
  border-radius: var(--r-lg);
  background: rgba(12, 24, 32, 0.32);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.roster-run-detail__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.btn {
  min-height: 40px;
  border-radius: var(--r-md);
  padding-inline: 16px;
  font-size: 14px;
}

.btn:hover {
  transform: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.btn:active {
  transform: translateY(1px);
}

.btn--icon {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.input,
.textarea,
select.input {
  width: 100%;
  min-width: 0;
  border-radius: var(--r-md);
}

.brand-grid,
.brandsum-grid,
.admin-grid,
.ops-form,
.grid-2col,
.grid-3col {
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

.brand-grid,
.brandsum-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)) !important;
}

.grid-2col,
.grid-3col {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

.brand-card,
.domain-row,
.channel-item,
.task-item,
.res-item,
.fraud-item {
  min-width: 0;
}

.brand-card:hover,
.brandsum:hover,
.domain-row:hover,
.fraud-item:hover,
.channel-item:hover,
.check-row:hover {
  transform: translateY(-1px);
}

.brand-card,
.brandsum,
.domain-row,
.fraud-item,
.channel-item,
.check-row,
.kpi,
.stat-chip {
  will-change: auto;
}

.table-wrap,
.matrix-wrap,
.scroll-x {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.app-header .who {
  min-width: 0;
  max-width: min(48vw, 420px);
}

.app-header .who > .truncate {
  min-width: 0;
  max-width: 180px;
}

#app-footer,
.app-bar {
  width: calc(100% - (var(--app-gutter) * 2)) !important;
  max-width: var(--content-max) !important;
  margin-inline: auto !important;
  border-radius: var(--r-lg) !important;
  border-color: rgba(183, 198, 212, 0.14);
  background: rgba(13, 25, 33, 0.55);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
}

.sidebar {
  background: rgba(14, 18, 22, 0.98);
  border-right-color: rgba(183, 198, 212, 0.14);
}

.sidebar-item {
  border-radius: var(--r-md);
}

.sidebar-item .icon-tile {
  border-radius: var(--r-sm);
}

.sidebar-item-active {
  background: rgba(77, 157, 224, 0.15);
  border-color: rgba(121, 184, 238, 0.3);
}

/* Login: Camell Liquid Glass 6.3. Layered, translucent and deliberately compact. */
.login-wrap {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100dvh;
  width: 100%;
  box-sizing: border-box;
  padding: clamp(10px, 1.5vw, 22px);
  color: #f2f8f6;
  background: #111719;
}

.login-wrap::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: -3%;
  display: block;
  background: url(assets/login_bg.png) center / cover no-repeat;
  filter: saturate(0.58) brightness(1.16) contrast(0.88);
  opacity: 0.76;
  pointer-events: none;
}

.login-wrap::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: 44%;
  display: block;
  border-right: 1px solid rgba(224, 240, 235, 0.1);
  background: rgba(9, 14, 15, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow:
    inset -1px 0 0 rgba(255, 255, 255, 0.04),
    18px 0 52px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.login-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  align-items: stretch;
  gap: 14px;
  border: 1px solid rgba(226, 241, 237, 0.22);
  border-radius: var(--r-lg);
  background: rgba(218, 235, 230, 0.08);
  backdrop-filter: blur(9px) saturate(112%);
  -webkit-backdrop-filter: blur(9px) saturate(112%);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.login-layout::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-top: 1px solid rgba(235, 250, 246, 0.13);
  border-left: 1px solid rgba(235, 250, 246, 0.07);
  border-radius: var(--r-md);
  pointer-events: none;
}

.login-intro {
  position: relative;
  min-width: 0;
  box-sizing: border-box;
  padding: clamp(28px, 5vw, 58px);
  overflow: hidden;
  border: 1px solid rgba(213, 235, 228, 0.24);
  border-radius: var(--r-md);
  background: rgba(23, 31, 31, 0.52);
  backdrop-filter: blur(22px) saturate(108%);
  -webkit-backdrop-filter: blur(22px) saturate(108%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -20px 48px rgba(0, 0, 0, 0.12),
    0 18px 40px rgba(0, 0, 0, 0.2);
}

.login-intro::before {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 0;
  width: 3px;
  background: #63d7df;
  box-shadow:
    0 0 18px rgba(99, 215, 223, 0.45),
    0 94px 0 #68c899,
    0 188px 0 #e7b75e;
  pointer-events: none;
}

.login-intro::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-top: 1px solid rgba(240, 252, 249, 0.08);
  border-right: 1px solid rgba(240, 252, 249, 0.05);
  border-radius: var(--r-sm);
  pointer-events: none;
}

.login-kicker {
  margin: 0 0 12px;
  color: #78e0e5;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: uppercase;
}

.login-intro h1 {
  max-width: 660px;
  margin: 0;
  color: #f5faf8;
  font-size: clamp(34px, 4.3vw, 52px);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.32);
}

.login-subtitle {
  margin: 13px 0 30px;
  color: #b7c6c2;
  font-size: 15px;
  line-height: 1.5;
}

.login-signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.login-signal {
  position: relative;
  min-width: 0;
  min-height: 84px;
  box-sizing: border-box;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  overflow: hidden;
  border: 1px solid rgba(220, 239, 233, 0.22);
  border-top-color: rgba(99, 215, 223, 0.48);
  border-radius: var(--r-md);
  background: rgba(224, 242, 236, 0.105);
  backdrop-filter: blur(17px) saturate(118%);
  -webkit-backdrop-filter: blur(17px) saturate(118%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 22px rgba(0, 0, 0, 0.18);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.login-signal:nth-child(1) {
  border-top-color: rgba(104, 200, 153, 0.58);
}

.login-signal:nth-child(3) {
  border-top-color: rgba(231, 183, 94, 0.62);
}

.login-signal div {
  min-width: 0;
}

.login-signal b,
.login-signal small {
  display: block;
  overflow-wrap: anywhere;
}

.login-signal b {
  color: #edf6f3;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.3;
}

.login-signal small {
  margin-top: 4px;
  color: #9caca8;
  font-size: 10px;
  line-height: 1.4;
}

.signal-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: #63d7df;
  box-shadow:
    0 0 0 3px rgba(99, 215, 223, 0.12),
    0 0 13px rgba(99, 215, 223, 0.55);
}

.signal-dot--ready {
  background: #68c899;
  box-shadow:
    0 0 0 3px rgba(104, 200, 153, 0.12),
    0 0 13px rgba(104, 200, 153, 0.5);
}

/* The Telegram-SSO row carries --sync; without this rule it fell back to the base dot
   while the two rows around it were colour-coded. */
.signal-dot--sync {
  background: #63b0e7;
  box-shadow:
    0 0 0 3px rgba(99, 176, 231, 0.12),
    0 0 13px rgba(99, 176, 231, 0.48);
}

.signal-dot--role {
  background: #e7b75e;
  box-shadow:
    0 0 0 3px rgba(231, 183, 94, 0.12),
    0 0 13px rgba(231, 183, 94, 0.48);
}

.roster-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.roster-summary .card {
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.roster-summary strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.roster-change {
  display: grid;
  gap: 14px;
  border-left: 3px solid var(--accent);
}

.roster-change--deactivate {
  border-left-color: var(--danger);
}

.roster-change--reactivate {
  border-left-color: var(--success);
}

.roster-change__head,
.roster-change__actions,
.roster-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.roster-change__head h3 {
  margin: 6px 0 3px;
}

.roster-change__form {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(190px, 1.4fr) minmax(120px, .6fr);
  gap: 10px;
}

.roster-empty {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  align-self: center;
  padding: clamp(26px, 4vw, 36px) clamp(22px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  overflow: visible;
  text-align: center;
  border: 1px solid rgba(230, 246, 241, 0.32);
  border-radius: var(--r-lg);
  background: rgba(30, 40, 40, 0.62);
  backdrop-filter: blur(30px) saturate(118%);
  -webkit-backdrop-filter: blur(30px) saturate(118%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -32px 52px rgba(0, 0, 0, 0.12),
    0 24px 58px rgba(0, 0, 0, 0.38);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-top: 1px solid rgba(243, 255, 252, 0.14);
  border-left: 1px solid rgba(243, 255, 252, 0.08);
  border-radius: var(--r-md);
  background: none;
  opacity: 1;
  pointer-events: none;
}

.login-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -9px;
  display: block;
  border: 1px solid rgba(220, 240, 234, 0.11);
  border-radius: var(--r-lg);
  background: rgba(207, 231, 223, 0.035);
  box-shadow:
    0 0 0 1px rgba(5, 8, 9, 0.18),
    0 20px 46px rgba(0, 0, 0, 0.26);
  pointer-events: none;
}

.login-card .logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 4px;
  border: 1px solid rgba(99, 215, 223, 0.72);
  border-right-color: rgba(104, 200, 153, 0.78);
  border-bottom-color: rgba(231, 183, 94, 0.8);
  border-radius: var(--r-lg);
  color: #effaf7;
  background: rgba(8, 13, 14, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 0 5px rgba(99, 215, 223, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.28);
  font-size: 16px;
  font-weight: 760;
  letter-spacing: 0;
}

.login-card .h1 {
  margin: 0;
  color: #f6fbf9;
  font-size: clamp(20px, 4vw, 23px);
  font-weight: 660;
  line-height: 1.3;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.login-card p {
  margin: 0;
  color: #adbbb7;
  line-height: 1.5;
}

.login-card .tg-slot {
  width: 100%;
  min-width: 0;
  min-height: 62px;
  box-sizing: border-box;
  margin: 6px 0 0;
  padding: 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(219, 238, 232, 0.12);
  border-radius: var(--r-md);
  background: rgba(5, 10, 11, 0.18);
  box-shadow:
    inset 0 1px 8px rgba(0, 0, 0, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.04);
}

.login-card .tg-slot iframe {
  width: min(100%, 260px);
  max-width: 100%;
}

.login-card #login-hint:empty {
  display: none;
}

.tg-retry {
  width: 100%;
}

.login-card .tg-retry:focus-visible {
  outline: 2px solid #63d7df;
  outline-offset: 2px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .login-layout,
  .login-intro,
  .login-card,
  .login-signal {
    background-color: rgba(18, 25, 26, 0.94);
  }
}

.kpi-grid {
  min-width: 0;
}

.toast-wrap {
  max-width: min(420px, calc(100vw - 24px));
}

@media (max-width: 719.98px) {
  .app-main,
  body[data-app="staff"] .app-main {
    padding: 16px 14px calc(28px + env(safe-area-inset-bottom));
  }

  .app-header {
    gap: 8px;
    padding-inline: 12px;
  }

  .app-header .who {
    max-width: calc(100vw - 112px);
  }

  .app-header .who > .truncate {
    max-width: 108px;
  }

  .brand-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-2col,
  .grid-3col,
  .roster-summary,
  .roster-change__form {
    grid-template-columns: minmax(0, 1fr);
  }

  .roster-run-table thead {
    display: none;
  }

  .roster-run-table,
  .roster-run-table tbody,
  .roster-run-table tr {
    display: block;
    width: 100%;
  }

  .roster-run-table {
    min-width: 0 !important;
  }

  .roster-run-table tr {
    padding: 6px 0;
  }

  .roster-run-table td {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    text-align: right;
  }

  .roster-run-table td::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    text-align: left;
  }

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

  .card,
  .section {
    padding: 16px;
  }

  .submit-bar {
    position: static;
    margin: 20px 0 0;
    padding: 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
    background: rgba(17, 21, 25, 0.96);
  }

  .login-wrap {
    place-items: center;
    min-height: 100svh;
    padding: 12px;
  }

  .login-wrap::before {
    background-position: 62% center;
  }

  .login-wrap::after {
    width: 100%;
    border-right: 0;
    background: rgba(9, 14, 15, 0.32);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
  }

  .login-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 8px;
  }

  .login-intro {
    padding: 22px 20px 20px;
  }

  .login-intro h1 {
    font-size: 28px;
  }

  .login-subtitle {
    margin: 8px 0 16px;
    font-size: 13px;
  }

  .login-signal-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .login-signal {
    min-height: 72px;
    padding: 10px 8px;
    gap: 7px;
  }

  .login-card {
    width: 100%;
    max-width: none;
    padding: 24px 20px;
  }

  .row--between {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .schedule-grid {
    grid-template-columns: 1fr;
  }

  .manual-channel__form,
  .roster-run-detail__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 399.98px) {
  .app-header .who > .truncate {
    display: none;
  }

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

  .login-card {
    padding-inline: 16px;
  }

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

  .login-signal {
    min-height: 82px;
    flex-direction: column;
    gap: 6px;
  }

  .login-signal b {
    font-size: 11px;
  }

  .login-signal small {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .login-wrap::before {
    animation: login-scene-drift 16s ease-in-out infinite alternate;
  }

  .login-intro,
  .login-card {
    animation: login-glass-enter 480ms cubic-bezier(0.2, 0.72, 0.22, 1) both;
  }

  .login-card {
    animation-delay: 70ms;
  }

  .login-signal:hover {
    transform: translateY(-2px);
    border-color: rgba(226, 244, 238, 0.28);
    background-color: rgba(224, 242, 236, 0.105);
  }

  .signal-dot {
    animation: login-signal-breathe 2.8s ease-in-out infinite;
  }

  .login-signal:nth-child(2) .signal-dot {
    animation-delay: 320ms;
  }

  .login-signal:nth-child(3) .signal-dot {
    animation-delay: 640ms;
  }
}

@keyframes login-scene-drift {
  from {
    transform: scale(1.025) translate3d(-0.3%, 0, 0);
  }
  to {
    transform: scale(1.055) translate3d(0.35%, -0.35%, 0);
  }
}

@keyframes login-glass-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes login-signal-breathe {
  0%,
  100% {
    opacity: 0.82;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-card:hover,
  .card:hover,
  .btn:hover {
    transform: none;
  }

  .login-wrap::before,
  .login-intro,
  .login-card,
  .login-signal,
  .signal-dot {
    animation: none;
    transition: none;
  }
}

/* Current macOS-style login shell. The template keeps an inline fallback, so
   these selectors intentionally carry enough specificity to remain canonical. */
body .login-layout.login-window {
  width: min(1280px, 100%);
  max-width: 1280px;
  min-height: min(820px, calc(100svh - clamp(20px, 3vw, 44px)));
  margin: auto;
  padding: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
  border-color: rgba(226, 241, 237, 0.24);
  border-radius: var(--r-lg);
  background: rgba(23, 31, 31, 0.69);
  backdrop-filter: blur(26px) saturate(116%);
  -webkit-backdrop-filter: blur(26px) saturate(116%);
  box-shadow:
    0 30px 76px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

body .login-layout.login-window::before {
  z-index: 2;
  inset: 1px;
  border-radius: var(--r-md);
}

body .login-window .login-chrome {
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(224, 240, 235, 0.14);
  background: rgba(227, 243, 238, 0.065);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 24px rgba(0, 0, 0, 0.09);
}

body .login-window .login-window-controls {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

body .login-window .login-window-control {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border: 1px solid rgba(4, 8, 9, 0.28);
  border-radius: 50%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 2px 5px rgba(0, 0, 0, 0.2);
}

body .login-window .login-window-control--close {
  background: #63d7df;
}

body .login-window .login-window-control--minimize {
  background: #e7b75e;
}

body .login-window .login-window-control--zoom {
  background: #68c899;
}

body .login-window .login-window-title {
  min-width: 0;
  justify-self: center;
  color: #c1ceca;
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0;
  text-align: center;
}

body .login-window .login-window-security {
  min-width: 0;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #9dacaa;
  font-size: 10px;
  white-space: nowrap;
}

body .login-window .login-window-security .signal-dot,
body .login-window .login-window-footer .signal-dot {
  width: 7px;
  height: 7px;
  flex-basis: 7px;
  margin: 0;
}

body .login-window .login-workspace {
  min-width: 0;
  box-sizing: border-box;
  padding: clamp(18px, 2vw, 30px);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.75fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "intro card"
    "signals card";
  align-items: stretch;
  gap: 14px 22px;
  background: rgba(4, 9, 10, 0.13);
  box-shadow: inset 0 1px 32px rgba(255, 255, 255, 0.025);
}

body .login-window .login-intro {
  grid-area: intro;
  align-self: stretch;
  padding: clamp(22px, 3vw, 30px);
}

body .login-window .login-kicker {
  margin-bottom: 8px;
  color: #78e0e5;
  font-size: 10px;
}

body .login-window .login-intro h1 {
  max-width: none;
  font-size: clamp(34px, 4vw, 44px);
  line-height: 1.08;
}

body .login-window .login-subtitle {
  margin: 9px 0 0;
  font-size: 13px;
}

body .login-window .login-signal-grid {
  grid-area: signals;
  align-self: start;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

body .login-window .login-signal {
  min-height: 76px;
  padding: 12px 10px;
  align-items: flex-start;
  border-radius: var(--r-md);
  background: rgba(224, 242, 236, 0.105);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 22px rgba(0, 0, 0, 0.18);
}

body .login-window .login-signal .signal-dot {
  margin-top: 4px;
}

body .login-window .login-card {
  grid-area: card;
  align-self: stretch;
  max-width: none;
  min-height: 100%;
  justify-content: center;
  padding: 30px 28px;
  border-radius: var(--r-lg);
  background: rgba(30, 40, 40, 0.62);
}

body .login-window .login-card .logo {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
}

body .login-window .login-panel-label {
  margin: 0 0 -4px;
  color: #78e0e5;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

body .login-window .local-auth-notice {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 12px;
  display: grid;
  gap: 9px;
  border: 1px solid rgba(231, 183, 94, 0.24);
  border-radius: var(--r-md);
  background: rgba(231, 183, 94, 0.065);
  text-align: left;
}

body .login-window .local-auth-notice__status {
  color: #e7c476;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

body .login-window .local-auth-notice strong {
  color: #edf5f2;
  font-size: 12px;
  line-height: 1.45;
}

body .login-window .local-auth-notice .btn {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  box-sizing: border-box;
  padding-inline: 12px;
  font-size: 12px;
}

body .login-window .login-window-footer {
  min-width: 0;
  min-height: 38px;
  box-sizing: border-box;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid rgba(224, 240, 235, 0.12);
  color: #93a39f;
  background: rgba(227, 243, 238, 0.035);
  font-size: 10px;
}

body .login-window .login-window-footer__meta {
  min-width: 0;
  margin-left: auto;
  color: #a9b8b4;
}

@media (max-width: 760px) {
  body .login-layout.login-window {
    min-height: calc(100svh - 24px);
    border-radius: var(--r-lg);
  }

  body .login-window .login-workspace {
    padding: 14px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "intro"
      "signals"
      "card";
    gap: 10px;
  }

  body .login-window .login-intro {
    align-self: auto;
    padding: 20px;
  }

  body .login-window .login-intro h1 {
    font-size: 28px;
  }

  body .login-window .login-card {
    min-height: 0;
    padding: 24px 20px;
  }
}

@media (max-width: 420px) {
  body .login-window .login-chrome {
    padding-inline: 12px;
    gap: 8px;
  }

  body .login-window .login-window-security {
    font-size: 0;
  }

  body .login-window .login-workspace {
    padding: 10px;
  }

  body .login-window .login-card {
    padding-inline: 16px;
  }

  body .login-window .login-window-footer {
    padding-inline: 12px;
  }
}

/* ==========================================================================
   RP2 MOTION SYSTEM
   Subtle, GPU-friendly motion shared by staff, leader and admin surfaces.
   ========================================================================== */
:root {
  --motion-instant: 120ms;
  --motion-fast: 180ms;
  --motion-base: 260ms;
  --motion-slow: 360ms;
  --motion-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-exit: cubic-bezier(0.4, 0, 1, 1);
}

/* Header glass and page-title frame */
.app-header {
  isolation: isolate;
  transition:
    transform var(--motion-base) var(--motion-enter),
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-base) ease;
}

.app-header::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(108, 185, 236, 0.18) 24%,
    rgba(217, 255, 244, 0.74) 50%,
    rgba(108, 185, 236, 0.18) 76%,
    transparent 100%
  );
  background-size: 220% 100%;
  opacity: 0.72;
}

.view > .row:first-child {
  position: relative;
  min-height: 62px;
  padding: 12px 14px;
  overflow: hidden;
  border: 1px solid rgba(201, 235, 230, 0.16);
  border-radius: var(--r-md, 8px);
  background:
    linear-gradient(130deg, rgba(239, 255, 250, 0.095), transparent 48%),
    rgba(17, 35, 43, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 10px 26px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(20px) saturate(128%);
  -webkit-backdrop-filter: blur(20px) saturate(128%);
}

.view > .row:first-child::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--accent, #60afff), var(--lg-cyan, #00e8ff));
  box-shadow: 0 0 14px rgba(66, 205, 224, 0.5);
}

.view > .row:first-child .h1,
.view > .row:first-child .h2 {
  text-wrap: balance;
}

.title-swap {
  animation: rp2-title-swap var(--motion-base) var(--motion-enter) backwards;
}

/* One canonical page/panel transition instead of competing animations. */
.view {
  animation: rp2-view-enter var(--motion-slow) var(--motion-enter) backwards;
}

[data-panel]:not(.hidden),
[role="tabpanel"]:not(.hidden) {
  animation: rp2-panel-enter var(--motion-base) var(--motion-enter) backwards;
}

/* Data cards enter after their skeleton is replaced. Delays stay below 160 ms. */
:is(.brand-grid, .kpi-grid, .brandsum-grid, .admin-grid, .roster-summary) > *,
.view .stack > .card,
.view .stack > .glass {
  animation: rp2-card-enter var(--motion-slow) var(--motion-enter) backwards;
}

:is(.brand-grid, .kpi-grid, .brandsum-grid, .admin-grid, .roster-summary) > :nth-child(2),
.view .stack > :is(.card, .glass):nth-child(2) { animation-delay: 30ms; }
:is(.brand-grid, .kpi-grid, .brandsum-grid, .admin-grid, .roster-summary) > :nth-child(3),
.view .stack > :is(.card, .glass):nth-child(3) { animation-delay: 60ms; }
:is(.brand-grid, .kpi-grid, .brandsum-grid, .admin-grid, .roster-summary) > :nth-child(4),
.view .stack > :is(.card, .glass):nth-child(4) { animation-delay: 90ms; }
:is(.brand-grid, .kpi-grid, .brandsum-grid, .admin-grid, .roster-summary) > :nth-child(n + 5),
.view .stack > :is(.card, .glass):nth-child(n + 5) { animation-delay: 120ms; }

.card,
.glass--raised,
.brand-card,
.kpi,
.tk-card {
  transition:
    transform var(--motion-fast) var(--motion-enter),
    border-color var(--motion-base) ease,
    background-color var(--motion-base) ease,
    box-shadow var(--motion-base) ease;
}

.card::before,
.glass--raised::before,
.brand-card::before {
  transition: opacity var(--motion-base) ease;
}

/* Hover transforms only run on devices that actually have a hover pointer. */
@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .glass--raised:hover {
    transform: translateY(-2px) scale(1.003);
  }

  .brand-card:hover,
  .kpi:hover,
  .tk-card:hover {
    transform: translateY(-3px) scale(1.008);
  }

  .card:hover::before,
  .glass--raised:hover::before,
  .brand-card:hover::before {
    opacity: 0.82;
  }
}

/* Sidebar: moving active rail, icon settle and non-popping collapsed labels. */
.sidebar-item {
  position: relative;
  transition:
    gap var(--motion-base) var(--motion-enter),
    background var(--motion-fast) ease,
    color var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-base) ease,
    transform var(--motion-fast) var(--motion-enter);
}

.sidebar-item::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: -3px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent, #60afff), var(--lg-cyan, #00e8ff));
  box-shadow: 0 0 12px rgba(66, 205, 224, 0.65);
  opacity: 0;
  transform: scaleY(0.35);
  transition:
    opacity var(--motion-fast) ease,
    transform var(--motion-base) var(--motion-enter);
}

.sidebar-item-active::before {
  opacity: 1;
  transform: scaleY(1);
}

.sidebar-item-active .icon-tile {
  animation: rp2-icon-settle var(--motion-base) var(--motion-enter) both;
}

.sidebar__title,
.sidebar-section,
.sidebar-item__label,
.sidebar-item__metric {
  transition:
    max-width var(--motion-base) var(--motion-enter),
    max-height var(--motion-base) var(--motion-enter),
    padding var(--motion-base) var(--motion-enter),
    opacity var(--motion-fast) ease,
    transform var(--motion-base) var(--motion-enter);
}

@media (hover: hover) and (min-width: 900px) {
  .sidebar.is-collapsed:not(:hover) .sidebar__title,
  .sidebar.is-collapsed:not(:hover) .sidebar-item__label,
  .sidebar.is-collapsed:not(:hover) .sidebar-item__metric {
    display: block;
    max-width: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
  }

  .sidebar.is-collapsed:not(:hover) .sidebar-section {
    display: block;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
  }

  .sidebar.is-collapsed:not(:hover) .sidebar-item {
    gap: 0;
  }

  .sidebar.is-collapsed:hover .sidebar__title,
  .sidebar.is-collapsed:hover .sidebar-item__label,
  .sidebar.is-collapsed:hover .sidebar-item__metric {
    max-width: 180px;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .sidebar.is-collapsed:hover .sidebar-section {
    max-height: 30px;
    opacity: 0.8;
    visibility: visible;
    transform: none;
  }
}

@media (max-width: 899.98px) {
  .sidebar {
    transform: translateX(-105%) scale(0.985);
    transform-origin: left center;
  }

  .shell.side-open .sidebar {
    transform: translateX(0) scale(1);
  }
}

/* Account menu and dialogs share the same open/close language. */
.account-menu {
  transform-origin: top right;
}

.account-menu:not(.hidden) {
  animation: rp2-menu-in var(--motion-fast) var(--motion-enter) both;
}

.account-menu.is-closing {
  animation: rp2-menu-out var(--motion-instant) var(--motion-exit) both;
  pointer-events: none;
}

.rp2-dialog-backdrop,
.modal-wrap,
.modal-mask {
  animation: rp2-backdrop-in var(--motion-fast) ease both;
}

.rp2-dialog,
.modal-wrap > .modal,
.modal-mask > .modal-panel {
  transform-origin: center;
  animation: rp2-dialog-in var(--motion-base) var(--motion-enter) both;
}

.rp2-dialog-backdrop.is-closing,
.modal-wrap.is-closing,
.modal-mask.is-closing {
  animation: rp2-backdrop-out var(--motion-fast) var(--motion-exit) both;
  pointer-events: none;
}

.rp2-dialog-backdrop.is-closing > .rp2-dialog,
.modal-wrap.is-closing > .modal,
.modal-mask.is-closing > .modal-panel {
  animation: rp2-dialog-out var(--motion-fast) var(--motion-exit) both;
}

@media (prefers-reduced-motion: no-preference) {
  .app-header::after {
    animation: rp2-header-glint 9s linear infinite;
  }
}

@keyframes rp2-view-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rp2-panel-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rp2-card-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rp2-title-swap {
  from { opacity: 0.45; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rp2-icon-settle {
  0% { transform: scale(0.9); }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes rp2-menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rp2-menu-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-4px) scale(0.98); }
}

@keyframes rp2-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rp2-backdrop-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes rp2-dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rp2-dialog-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(7px) scale(0.985); }
}

@keyframes rp2-header-glint {
  from { background-position: 110% 0; }
  to { background-position: -110% 0; }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .app-header::after {
    animation: none !important;
  }

  .card:hover,
  .glass--raised:hover,
  .brand-card:hover,
  .kpi:hover,
  .tk-card:hover,
  .sidebar-item:hover,
  .sidebar-item:active {
    transform: none !important;
  }
}
