:root {
  color: #182433;
  background: #eef2f6;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
}

.boot-fallback {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.boot-fallback p {
  max-width: 520px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  align-content: start;
  background: #102331;
  color: #ffffff;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 18px;
  box-shadow: 8px 0 28px rgba(16, 35, 49, 0.16);
}

.sidebar-head {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.brand {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 9px 12px;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  border-radius: 8px;
  color: #c6d4df;
  font-size: 14px;
  font-weight: 900;
  padding: 11px 13px;
  text-decoration: none;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.admin-nav a.active,
.admin-nav a:hover {
  background: #1f7a8c;
  color: #ffffff;
  transform: translateX(2px);
}

.admin-nav a.active {
  box-shadow: inset 3px 0 0 #ffffff;
}

.content {
  display: grid;
  align-content: start;
  gap: 22px;
  height: 100vh;
  min-width: 0;
  overflow-y: auto;
  padding: clamp(22px, 4vw, 46px);
  scroll-padding-top: 24px;
  scroll-behavior: smooth;
}

[data-admin-section] {
  scroll-margin-top: 24px;
}

.section-anchor {
  display: block;
  height: 0;
  overflow: hidden;
  scroll-margin-top: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.header-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.language-select {
  display: grid;
  gap: 4px;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.language-select span {
  color: #667587;
  font-size: 12px;
  font-weight: 900;
}

.language-select select {
  min-width: 132px;
  border: 0;
  background: transparent;
  color: #152232;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 8px;
  color: #1f7a8c;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: #101820;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
}

h2 {
  color: #152232;
  font-size: 20px;
}

p {
  max-width: 760px;
  color: #5b6978;
}

.admin-status,
.mode-pill,
.alert-count {
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
}

.admin-status span,
.admin-status strong {
  display: block;
  white-space: nowrap;
}

.admin-status span {
  color: #667587;
  font-size: 13px;
  font-weight: 800;
}

.admin-status strong {
  color: #18a889;
  margin-top: 2px;
}

.metric-grid,
.status-grid,
.two-column {
  display: grid;
  gap: 14px;
}

.dashboard-compass {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.28fr);
  gap: 16px;
  align-items: stretch;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
  box-shadow: 0 14px 34px rgba(16, 35, 49, 0.08);
  padding: 18px;
}

.dashboard-compass-copy {
  display: grid;
  align-content: center;
  gap: 8px;
  border-right: 1px solid #d9e1ea;
  padding-right: 18px;
}

.dashboard-compass-copy h2 {
  margin: 0;
  color: #101820;
  font-size: 18px;
}

.dashboard-compass-copy strong {
  color: #1f7a8c;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
}

.dashboard-compass-copy p {
  margin: 0;
  color: #667587;
  font-size: 13px;
  line-height: 1.6;
}

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

.compass-node {
  display: grid;
  min-height: 132px;
  align-content: space-between;
  border: 1px solid rgba(16, 35, 49, 0.08);
  border-left: 4px solid var(--node-accent, #1f7a8c);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.compass-node span {
  color: #667587;
  font-size: 12px;
  font-weight: 900;
}

.compass-node strong {
  color: #101820;
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.1;
}

.compass-node small {
  color: #667587;
  font-size: 12px;
  line-height: 1.35;
}

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

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

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

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

.metric-card,
.status-card,
.panel {
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(16, 35, 49, 0.08);
}

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

.compass-card {
  position: relative;
  overflow: hidden;
  min-height: 222px;
  background:
    radial-gradient(circle at 18% 10%, rgba(31, 122, 140, 0.16), transparent 32%),
    linear-gradient(145deg, #ffffff 0%, #f8fbfd 100%);
}

.compass-card::after {
  position: absolute;
  right: -58px;
  bottom: -70px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(31, 122, 140, 0.1);
  border-radius: 50%;
  content: "";
}

.metric-head,
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.metric-head span,
.status-card span {
  color: #667587;
  font-size: 13px;
  font-weight: 900;
}

.metric-head b {
  color: #8a98a8;
  font-size: 12px;
}

.metric-values strong,
.metric-values small,
.status-card strong,
.status-card small {
  display: block;
}

.metric-values strong {
  margin-top: 14px;
  color: #101820;
  font-size: 26px;
}

.compass-card .metric-values strong {
  margin-top: 0;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1;
}

.metric-values small,
.status-card small {
  color: #667587;
}

.compass-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.compass-ring {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffffff 0 54%, transparent 55%),
    conic-gradient(var(--metric-accent, #1f7a8c) calc(var(--score) * 1%), #e6edf3 0);
  box-shadow: inset 0 0 0 1px rgba(16, 35, 49, 0.06);
}

.compass-ring span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--metric-accent, #1f7a8c);
  box-shadow: 0 0 0 8px rgba(31, 122, 140, 0.12);
}

.compass-card.green {
  --metric-accent: #18a889;
}

.compass-card.blue {
  --metric-accent: #2f6fed;
}

.compass-card.gold {
  --metric-accent: #d59b10;
}

.compass-card.red,
.metric-card.red {
  --metric-accent: #d65445;
}

.compass-node.green {
  --node-accent: #18a889;
}

.compass-node.blue {
  --node-accent: #2f6fed;
}

.compass-node.gold {
  --node-accent: #d59b10;
}

.compass-node.red {
  --node-accent: #d65445;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 7px;
  height: 92px;
  margin-top: 18px;
}

.bar-chart span {
  min-height: 12px;
  border-radius: 8px 8px 2px 2px;
  background: #1f7a8c;
}

.compact-chart {
  position: relative;
  z-index: 1;
  height: 54px;
  margin-top: 20px;
}

.compact-chart span {
  opacity: 0.86;
}

.metric-card.green .bar-chart span {
  background: #18a889;
}

.metric-card.blue .bar-chart span {
  background: #2f6fed;
}

.metric-card.gold .bar-chart span {
  background: #d59b10;
}

.metric-card.red .bar-chart span {
  background: #d65445;
}

.status-card {
  min-height: 132px;
}

.status-card strong {
  margin-top: 8px;
  color: #101820;
  font-size: 24px;
}

.status-card.normal {
  border-color: rgba(24, 168, 137, 0.38);
}

.status-card.warning {
  border-color: rgba(213, 155, 16, 0.45);
}

.status-card.pending {
  border-color: rgba(47, 111, 237, 0.35);
}

.panel-header {
  margin-bottom: 16px;
}

.panel-header p {
  margin-top: 4px;
  font-size: 13px;
}

.mode-pill,
.alert-count {
  color: #1f7a8c;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.mode-grid {
  display: grid;
  gap: 10px;
}

.mode-option {
  display: grid;
  gap: 5px;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #f7f9fb;
  color: #152232;
  padding: 13px;
}

.mode-option.active {
  border-color: rgba(31, 122, 140, 0.5);
  background: rgba(31, 122, 140, 0.08);
}

.mode-option input {
  display: none;
}

.mode-option span {
  font-weight: 900;
}

.mode-option small {
  color: #5b6978;
}

.secondary-action {
  margin-top: 14px;
  background: #eef2f6;
  color: #1f7a8c;
  padding: 10px 14px;
}

.danger-outline {
  border: 1px solid rgba(213, 155, 16, 0.5);
  background: #fff8e8;
  color: #9a6a00;
  padding: 10px 14px;
}

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

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-left: 4px solid #8a98a8;
  border-radius: 8px;
  background: #f7f9fb;
  padding: 12px;
}

.alert-item.warning {
  border-left-color: #d59b10;
}

.alert-item.pending {
  border-left-color: #2f6fed;
}

.alert-item.info {
  border-left-color: #1f7a8c;
}

.alert-item strong,
.alert-item span {
  display: block;
}

.alert-item span {
  color: #5b6978;
  font-size: 13px;
}

.alert-item time {
  color: #8a98a8;
  font-size: 12px;
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid #e4eaf0;
  padding: 13px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #667587;
  font-size: 12px;
  font-weight: 900;
}

td {
  color: #263445;
}

.user-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(160px, 0.8fr) minmax(180px, 0.8fr);
  gap: 12px;
  margin-bottom: 16px;
}

.user-filters label {
  display: grid;
  gap: 6px;
  color: #667587;
  font-size: 12px;
  font-weight: 900;
}

input,
select {
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  color: #152232;
  padding: 9px 10px;
}

.level-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-control button {
  background: #fff4d8;
  color: #9a6a00;
  padding: 8px 10px;
}

td small {
  display: block;
  color: #8a98a8;
  font-size: 11px;
  margin-top: 2px;
}

.level-badge,
.lp-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 9px;
}

.level-badge {
  background: #eef2ff;
  color: #2f52c7;
}

.level-badge.manual {
  background: #fff4d8;
  color: #9a6a00;
}

.row-actions {
  display: grid;
  gap: 8px;
  min-width: 110px;
}

.row-actions .secondary-action {
  margin-top: 0;
  padding: 8px 10px;
}

.lp-status {
  background: #eef2f6;
  color: #526173;
}

.lp-status.ok {
  background: rgba(24, 168, 137, 0.12);
  color: #08745d;
}

.lp-status.warning {
  background: #fff4d8;
  color: #9a6a00;
}

.lp-status.pending {
  background: #eef2f6;
  color: #667587;
}

.lp-status.exited {
  background: #f2e8e8;
  color: #9a3324;
}

.position-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.muted {
  color: #8a98a8;
  font-weight: 800;
}

.user-position-summary {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.user-position-summary strong {
  font-size: 12px;
}

.user-row:hover td {
  background: #f8fafc;
}

.user-detail-row td {
  background: #f7f9fc;
  white-space: normal;
}

.user-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 1fr) minmax(220px, 0.8fr);
  gap: 14px;
}

.user-detail-grid section {
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.user-detail-grid h4 {
  margin: 0 0 10px;
  color: #152232;
  font-size: 13px;
}

.user-detail-item {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid #edf2f7;
}

.user-detail-item:last-child {
  border-bottom: 0;
}

.user-detail-item span,
.user-detail-grid p {
  margin: 0;
  color: #667587;
  font-size: 12px;
  font-weight: 800;
}

.direct-member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.direct-member-list code {
  border: 1px solid #dfe7ef;
  border-radius: 6px;
  background: #f8fafc;
  padding: 5px 7px;
  color: #263445;
  font-size: 11px;
}

.empty-state {
  color: #8a98a8;
  font-weight: 900;
  text-align: center;
}

.data-note {
  margin-top: 12px;
  font-size: 13px;
}

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

.keeper-summary article,
.keeper-box {
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #f7f9fb;
}

.keeper-summary article {
  padding: 14px;
}

.keeper-summary span,
.keeper-summary strong,
.keeper-summary small {
  display: block;
}

.keeper-summary span {
  color: #667587;
  font-size: 12px;
  font-weight: 900;
}

.keeper-summary strong {
  color: #101820;
  font-size: 22px;
  margin-top: 6px;
}

.keeper-summary small {
  color: #667587;
}

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

.keeper-box {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

h3 {
  color: #152232;
  font-size: 16px;
  margin: 0;
}

.keeper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 8px;
  background: #ffffff;
  padding: 11px;
}

.keeper-row.stacked {
  display: grid;
  gap: 3px;
}

.keeper-row strong,
.keeper-row span,
.keeper-row small {
  display: block;
}

.keeper-row strong {
  color: #263445;
}

.keeper-row span,
.keeper-row small {
  color: #667587;
  font-size: 12px;
}

.keeper-row b {
  color: #526173;
  font-size: 12px;
  white-space: nowrap;
}

.keeper-row b.ok {
  color: #08745d;
}

.keeper-row b.paused {
  color: #9a6a00;
}

.keeper-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.keeper-actions .secondary-action {
  margin-top: 0;
  padding: 8px 10px;
}

.risk-box {
  border-color: rgba(213, 155, 16, 0.35);
}

.risk-box p {
  border-radius: 8px;
  background: #fff8e8;
  color: #7a5600;
  font-size: 13px;
  padding: 10px;
}

.keeper-message {
  border-radius: 8px;
  background: #eef2f6;
  color: #526173;
  font-size: 13px;
  font-weight: 800;
  margin-top: 14px;
  padding: 12px;
}

.platform-panel {
  display: grid;
  gap: 16px;
}

.platform-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.platform-actions small {
  color: #667587;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

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

.platform-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.platform-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-day {
  display: grid;
  min-height: 78px;
  align-content: space-between;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px;
}

.calendar-day span {
  color: #667587;
  font-size: 12px;
  font-weight: 900;
}

.calendar-day strong {
  color: #101820;
  font-size: 13px;
}

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

@media (max-width: 1120px) {
  .dashboard-compass,
  .metric-grid,
  .reward-grid,
  .status-grid,
  .platform-card-grid,
  .platform-board,
  .two-column {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-compass-copy {
    border-right: 0;
    border-bottom: 1px solid #d9e1ea;
    padding-right: 0;
    padding-bottom: 16px;
  }

  .dashboard-compass-orbit {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .content {
    min-width: 0;
    padding: 20px;
    scroll-padding-top: 20px;
  }

  .metric-grid,
  .reward-grid,
  .status-grid,
  .platform-card-grid,
  .keeper-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    height: auto;
    max-height: 100vh;
    padding: 18px;
  }

  .sidebar-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    margin-bottom: 0;
  }

  .brand {
    font-size: 18px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .admin-nav {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
  }

  .sidebar.open .admin-nav {
    display: grid;
  }

  .admin-nav a {
    min-height: 42px;
    justify-content: center;
    padding: 10px 8px;
    text-align: center;
    transform: none;
  }

  .admin-nav a.active,
  .admin-nav a:hover {
    transform: none;
  }

  .content {
    height: 100%;
    padding: 18px;
  }

  .page-header {
    display: grid;
  }

  .header-actions {
    display: grid;
  }

  .metric-grid,
  .reward-grid,
  .status-grid,
  .platform-card-grid,
  .dashboard-compass,
  .dashboard-compass-orbit,
  .platform-board,
  .two-column,
  .keeper-summary,
  .keeper-grid,
  .user-filters {
    grid-template-columns: 1fr;
  }

  .panel-header {
    display: grid;
  }

  .platform-actions {
    justify-items: stretch;
  }

  .platform-actions small {
    text-align: left;
  }

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

  .user-detail-grid {
    grid-template-columns: 1fr;
  }
}
