:root {
  --teal: #7acfd0;
  --teal-dark: #247f82;
  --teal-soft: #e8f7f6;
  --coral: #ffad92;
  --coral-soft: #fff2ed;
  --lavender: #d9cef7;
  --mint: #caead8;
  --rose: #ffb7c0;
  --sky: #bce8fb;
  --sun: #ffd977;
  --ink: #172326;
  --muted: #66777b;
  --line: #dbe5e6;
  --paper: #f8fbfb;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Roboto, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(122, 207, 208, 0.92), rgba(255, 173, 146, 0.78)),
    url("./assets/BlueNxt.png") center/520px no-repeat;
}

.login-panel {
  width: min(430px, 100%);
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(8, 43, 47, 0.28);
}

.brand-lockup,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-shell {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 999px;
  isolation: isolate;
  background: #5b8b98;
}

.logo-shell.small {
  width: 54px;
  height: 54px;
}

.brand-mark {
  width: 76px;
  height: 76px;
  object-fit: contain;
  grid-area: 1 / 1;
  display: block;
  transform: none;
  -webkit-box-reflect: unset;
}

.logo-shell.small .brand-mark {
  width: 54px;
  height: 54px;
}

.logo-fallback {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  display: none;
  place-items: center;
  border-radius: 999px;
  border: 2px solid #eaf9fb;
  background: #5b8b98;
  color: #82d9f6;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  text-align: center;
}

.logo-shell.small .logo-fallback {
  font-size: 10px;
}

.logo-shell.logo-missing .brand-mark {
  display: none;
}

.logo-shell.logo-missing .logo-fallback {
  display: grid;
}

.eyebrow {
  color: var(--coral);
  font-weight: 900;
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: 12px;
}

.login-panel h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-form input,
.filter-block select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  min-height: 42px;
  padding: 9px 10px;
}

.login-form button,
.header-actions button,
.filter-actions button {
  min-height: 38px;
  border-radius: 6px;
  background: var(--coral);
  color: var(--white);
  font-weight: 900;
  padding: 0 14px;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: #b86a62;
  font-weight: 700;
}

.login-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.dashboard-view.panel-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  transition: padding 180ms ease, opacity 180ms ease;
}

.dashboard-view.panel-collapsed .sidebar {
  padding: 0;
  overflow: visible;
}

.dashboard-view.panel-collapsed .sidebar > :not(.panel-toggle) {
  opacity: 0;
  pointer-events: none;
}

.panel-toggle {
  position: fixed;
  left: 270px;
  top: 92px;
  z-index: 20;
  width: 30px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: var(--white);
  color: var(--teal-dark);
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(23, 35, 38, 0.09);
  transition: left 180ms ease;
}

.dashboard-view.panel-collapsed .panel-toggle {
  left: 0;
}

.sidebar-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand span {
  color: var(--coral);
  font-size: 12px;
  font-weight: 900;
  margin-top: 3px;
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0;
}

.filter-actions button:first-child {
  background: #9edbdc;
}

.filters {
  display: grid;
  gap: 16px;
}

.filter-block {
  position: relative;
}

.filter-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 7px;
}

.filter-trigger {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd5dc;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 500;
}

.filter-trigger::after {
  content: "";
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid var(--ink);
  margin-left: 10px;
}

.filter-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid #cbd5dc;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(23, 35, 38, 0.14);
  overflow: hidden;
}

.filter-search {
  width: calc(100% - 22px);
  margin: 12px 11px;
  min-height: 42px;
  border: 1px solid #d5dadd;
  border-radius: 8px;
  padding: 0 12px;
}

.filter-choice-actions {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #edf0f1;
  border-bottom: 1px solid #edf0f1;
  padding: 10px 14px;
}

.filter-choice-actions button {
  background: transparent;
  color: var(--teal-dark);
  font-weight: 900;
  padding: 0;
}

.filter-options {
  max-height: 240px;
  overflow-y: auto;
  padding: 8px 0;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 16px;
}

.filter-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal-dark);
}

.content {
  min-width: 0;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 80px;
  padding: 14px 22px;
  background: #81cfd0;
  color: var(--white);
}

.main-header h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 900;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.header-actions button {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

#downloadBtn {
  background: #ffb49b;
  border-color: #ffb49b;
}

.privacy-banner {
  margin: 18px 22px 0;
  padding: 11px 14px;
  border: 1px solid #ffd8ca;
  background: var(--coral-soft);
  color: #9f7469;
  border-radius: 6px;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  padding: 18px 22px 8px;
}

.metric {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 6px solid #9edbdc;
  border-radius: 8px;
  padding: 14px;
  min-height: 118px;
  display: grid;
  align-content: space-between;
}

.metric:nth-child(even) {
  border-left-color: #ffbca8;
}

.metric-icon {
  width: 28px;
  height: 28px;
  color: var(--teal-dark);
  opacity: 0.86;
}

.metric .value {
  font-size: 32px;
  line-height: 1;
  font-weight: 900;
  color: var(--teal-dark);
}

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

.visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 12px 22px;
}

.trend-panel {
  grid-column: 1 / -1;
  overflow: visible;
  padding: 0;
}

.trend-panel .panel-heading {
  background: var(--lavender);
  margin: 0 0 12px;
  padding: 14px 16px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  background: currentColor;
  color: var(--teal-dark);
  opacity: 0.9;
}

.icon-chart {
  mask: linear-gradient(#000 0 0) 2px 14px/4px 8px no-repeat,
    linear-gradient(#000 0 0) 10px 8px/4px 14px no-repeat,
    linear-gradient(#000 0 0) 18px 3px/4px 19px no-repeat;
}

.icon-bars {
  mask: linear-gradient(#000 0 0) 2px 8px/5px 14px no-repeat,
    linear-gradient(#000 0 0) 10px 4px/5px 18px no-repeat,
    linear-gradient(#000 0 0) 18px 12px/5px 10px no-repeat;
}

.icon-table {
  border: 2px solid currentColor;
  background: none;
  position: relative;
}

.icon-table::before,
.icon-table::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.icon-table::before {
  left: 0;
  right: 0;
  top: 8px;
  height: 2px;
}

.icon-table::after {
  top: 0;
  bottom: 0;
  left: 8px;
  width: 2px;
}

.icon-users {
  border: 2px solid currentColor;
  border-radius: 999px 999px 5px 5px;
  background: none;
}

.chart-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  height: 456px;
  padding: 0 16px 14px;
}

canvas {
  display: block;
  max-width: none;
  height: auto;
}

.chart-tooltip {
  position: absolute;
  z-index: 40;
  min-width: 220px;
  pointer-events: none;
  background: rgba(25, 25, 25, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(23, 35, 38, 0.14);
  padding: 10px 12px;
  color: #ffffff;
  font-size: 12px;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 7px;
}

.chart-tooltip div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.chart-tooltip .tip-line {
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
}

.tip-swatch {
  width: 12px;
  height: 12px;
  display: inline-block;
  border: 2px solid currentColor;
  background: transparent;
}

.tip-swatch.fill {
  border: 0;
}

.table-panel,
.user-panel {
  margin: 4px 22px 22px;
}

.table-wrap {
  overflow: auto;
  max-height: 460px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--teal-soft);
  color: var(--teal-dark);
  z-index: 1;
}

th button {
  background: transparent;
  color: inherit;
  font-weight: 900;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sort-arrow {
  color: #6c7f84;
  font-size: 12px;
  min-width: 12px;
}

.user-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 140px 150px minmax(140px, 1fr) 110px;
  gap: 10px;
  margin-bottom: 14px;
}

.user-form input,
.user-form select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.user-form button,
.user-card button {
  min-height: 38px;
  border-radius: 6px;
  background: var(--teal);
  color: var(--white);
  font-weight: 900;
  padding: 0 12px;
}

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

.user-card strong,
.user-card span {
  display: block;
}

.user-card span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.user-card button {
  background: #ffb49b;
  margin-top: 10px;
}

body.public-mode {
  user-select: none;
}

body.public-mode .content::after {
  content: "PUBLIC READ-ONLY";
  position: fixed;
  right: 20px;
  bottom: 16px;
  color: rgba(8, 127, 131, 0.22);
  font-weight: 900;
  font-size: 26px;
  pointer-events: none;
}

@media print {
  body.public-mode .dashboard-view {
    display: none;
  }
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

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

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

  .sidebar {
    position: static;
    height: auto;
  }

  .panel-toggle,
  .dashboard-view.panel-collapsed .panel-toggle {
    left: auto;
    right: 12px;
    top: 94px;
    border-radius: 8px;
  }

  .main-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

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

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

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