:root {
  --bg: #070d17;
  --bg-soft: #0d1627;
  --panel: #0f1b30;
  --panel-strong: #132540;
  --border: rgba(111, 145, 198, 0.22);
  --border-strong: rgba(112, 172, 255, 0.35);
  --text: #e7edf9;
  --text-soft: #a6b6d3;
  --text-dim: #7f90ae;
  --primary: #22d3ee;
  --primary-strong: #0fb9df;
  --good: #57d18f;
  --warn: #f4c45a;
  --bad: #ff7f7f;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --sidebar-w: 286px;
  --sidebar-collapsed-w: 94px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.dashboard-page {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  overflow-x: hidden;
}

.background-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(85rem 45rem at -12% -28%, rgba(34, 211, 238, 0.16), transparent 48%),
    radial-gradient(65rem 35rem at 112% -22%, rgba(64, 140, 255, 0.18), transparent 46%),
    linear-gradient(180deg, #07101c 0%, #07101c 20%, #070d17 100%);
}

.background-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(70, 132, 220, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 132, 220, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.9) 25%, transparent 82%);
}

.app-shell {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 0;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(8, 16, 29, 0.96) 0%, rgba(8, 16, 29, 0.9) 100%);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.2), rgba(17, 96, 182, 0.2));
  color: #d5fbff;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-family: "Space Mono", monospace;
  font-size: 0.75rem;
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(13, 31, 55, 0.9);
  color: #d9ecff;
  cursor: pointer;
}

.sidebar-toggle:hover {
  border-color: rgba(34, 211, 238, 0.62);
}

.org-context {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(12, 28, 50, 0.66);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.org-logo-shell {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0d213d;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.org-logo-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.org-logo-fallback {
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: #b5c9eb;
  text-transform: uppercase;
}

.org-context-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.org-context-copy strong {
  font-size: 0.96rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-context-copy span {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 0.82rem;
}

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

.sidebar-nav-btn {
  border: 1px solid var(--border);
  background: rgba(13, 32, 58, 0.55);
  color: var(--text-soft);
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
}

.sidebar-nav-btn:hover {
  border-color: rgba(94, 162, 255, 0.55);
  color: var(--text);
}

.sidebar-nav-btn.is-active {
  color: #d8faff;
  border-color: rgba(34, 211, 238, 0.65);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(24, 103, 193, 0.16));
}

.sidebar-nav-icon {
  width: 29px;
  height: 29px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(12, 29, 51, 0.85);
  display: grid;
  place-items: center;
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  font-weight: 700;
}

.sidebar-nav-label {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-auth {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.workspace-main {
  padding: 20px 22px 24px;
  min-width: 0;
}

.workspace-header {
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(15, 31, 54, 0.88), rgba(10, 21, 39, 0.75));
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 420px);
  gap: 18px;
}

.workspace-title-block h1 {
  margin: 8px 0 8px;
  font-size: clamp(1.45rem, 2vw, 2.05rem);
  letter-spacing: -0.025em;
}

.workspace-title-block p {
  margin: 0;
  color: var(--text-soft);
  max-width: 58ch;
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5de0f4;
}

.workspace-controls {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  align-content: start;
  width: min(560px, 100%);
  justify-self: end;
  border: 1px solid rgba(111, 145, 198, 0.22);
  border-radius: 14px;
  background: rgba(8, 20, 35, 0.46);
  padding: 10px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
}

.upload-btn,
.export-btn,
.ghost-btn,
.solid-btn,
.auth-primary-btn,
.team-remove-btn {
  border-radius: 10px;
  border: 1px solid var(--border);
  min-height: 38px;
  font: inherit;
  font-size: 0.9rem;
  padding: 0 14px;
  cursor: pointer;
  transition: 140ms ease;
}

.upload-btn,
.export-btn,
.solid-btn,
.auth-primary-btn {
  background: linear-gradient(120deg, rgba(34, 211, 238, 0.22), rgba(61, 156, 255, 0.22));
  color: #ebfbff;
  border-color: rgba(58, 188, 245, 0.55);
}

.upload-btn:hover,
.export-btn:hover,
.solid-btn:hover,
.auth-primary-btn:hover,
.team-remove-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.85);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
}

.upload-btn.is-disabled {
  opacity: 0.48;
  pointer-events: none;
  cursor: not-allowed;
}

.target-controls {
  display: grid;
  grid-template-columns: auto minmax(74px, 86px) minmax(74px, 86px) auto;
  grid-template-areas: "label min max apply";
  align-items: end;
  column-gap: 8px;
  row-gap: 6px;
  justify-content: end;
}

.target-label {
  grid-area: label;
  font-size: 0.74rem;
  font-family: "Space Mono", monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-right: 4px;
  align-self: center;
  white-space: nowrap;
}

.target-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.target-field:first-of-type { grid-area: min; }
.target-field:nth-of-type(2) { grid-area: max; }

.target-field span {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.target-field input {
  width: 100%;
  min-height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(8, 19, 34, 0.9);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 0.9rem;
}

.target-apply-btn {
  min-height: 36px;
  grid-area: apply;
}

.dataset-meta {
  width: 100%;
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
  border-top: 1px solid rgba(111, 145, 198, 0.2);
  padding-top: 8px;
}

.dataset-meta span {
  font-size: 0.81rem;
  color: var(--text-soft);
}

.message-banner {
  margin-top: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 0.9rem;
}

.message-banner.info {
  background: rgba(47, 125, 212, 0.14);
  border-color: rgba(78, 151, 238, 0.4);
  color: #deedff;
}

.message-banner.warning {
  background: rgba(244, 196, 90, 0.12);
  border-color: rgba(244, 196, 90, 0.45);
  color: #ffeab8;
}

.message-banner.error {
  background: rgba(255, 127, 127, 0.12);
  border-color: rgba(255, 127, 127, 0.48);
  color: #ffd5d5;
}

.workspace-content {
  margin-top: 14px;
}

.workspace-panel {
  display: none;
}

.workspace-panel.is-active {
  display: grid;
  gap: 14px;
}

.global-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card,
.panel,
.team-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(13, 28, 49, 0.86), rgba(11, 22, 40, 0.72));
}

.kpi-card {
  padding: 12px 14px;
}

.kpi-label {
  color: var(--text-dim);
  font-size: 0.73rem;
  font-family: "Space Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kpi-value {
  display: block;
  margin-top: 7px;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  gap: 12px;
}

.detail-stack {
  display: grid;
  gap: 12px;
}

.panel {
  padding: 14px;
}

.panel-heading {
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.46rem;
  letter-spacing: -0.02em;
}

.panel-heading p {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.detail-heading h2 {
  font-size: 1.35rem;
}

.senders-actions {
  margin-bottom: 10px;
}

#view-overall.active {
  border-color: rgba(34, 211, 238, 0.85);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35);
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(111, 145, 198, 0.18);
  scrollbar-color: rgba(108, 160, 228, 0.7) rgba(9, 24, 42, 0.65);
  scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar,
.status-modal-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track,
.status-modal-list::-webkit-scrollbar-track {
  background: rgba(9, 24, 42, 0.65);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb,
.status-modal-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(91, 162, 238, 0.85), rgba(78, 121, 209, 0.85));
  border-radius: 999px;
  border: 1px solid rgba(8, 20, 34, 0.8);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(111, 145, 198, 0.16);
  font-size: 0.9rem;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #12253f;
  color: #d7e7ff;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#sender-table .sender-row {
  cursor: pointer;
}

#sender-table .sender-row:hover {
  background: rgba(52, 122, 216, 0.14);
}

#sender-table .sender-row.active {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.12), rgba(72, 128, 255, 0.16));
}

#sender-table th:first-child,
#sender-table td:first-child {
  max-width: 255px;
  width: 255px;
}

#sender-table td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-cell {
  color: var(--text-dim);
  text-align: center;
  padding: 16px;
}

.score-cell {
  width: 82px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: "Space Mono", monospace;
}

.score-band {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(9, 23, 41, 0.68);
  padding: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.score-ring {
  width: 132px;
  height: 132px;
  position: relative;
  flex-shrink: 0;
}

.score-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-track {
  fill: none;
  stroke: rgba(132, 161, 208, 0.24);
  stroke-width: 10;
}

.score-ring-progress {
  fill: none;
  stroke: var(--ring-color, #6fd4f3);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 280ms ease, stroke 280ms ease;
}

.score-ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0;
  transform: translateY(1px);
}

.score-ring-inner strong {
  display: block;
  margin: 0;
  font-size: 1.44rem;
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--ring-color, #dff3ff);
}

.score-ring-inner span {
  display: block;
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.score-copy h3 {
  margin: 0 0 4px;
  font-size: 1.22rem;
  color: var(--ring-color, var(--text));
}

.score-copy p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

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

.metric-card {
  border-radius: 11px;
  border: 1px solid rgba(111, 145, 198, 0.22);
  background: rgba(12, 27, 48, 0.64);
  padding: 10px 11px;
}

.metric-label {
  display: block;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-family: "Space Mono", monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
}

.metric-help {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(111, 145, 198, 0.42);
  background: rgba(17, 40, 69, 0.88);
  color: #a7c7ef;
  font-size: 0.67rem;
  font-family: "Space Mono", monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  position: relative;
  flex-shrink: 0;
}

.metric-help:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.72);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.22);
}

.metric-tooltip {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  width: min(280px, 70vw);
  border-radius: 10px;
  border: 1px solid rgba(111, 145, 198, 0.34);
  background: rgba(10, 22, 40, 0.97);
  color: #d6e5fb;
  font-size: 0.78rem;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  padding: 8px 9px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  z-index: 7;
}

.metric-help:hover .metric-tooltip,
.metric-help:focus .metric-tooltip,
.metric-help:focus-within .metric-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.metric-value {
  display: block;
  margin-top: 7px;
  font-size: 1.45rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

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

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

.chart-card h3 {
  margin: 0 0 10px;
  font-size: 1.03rem;
}

.chart-area {
  border-radius: 10px;
  border: 1px solid rgba(111, 145, 198, 0.16);
  background: rgba(8, 21, 39, 0.64);
  min-height: 236px;
  padding: 10px;
}

.empty-state-chart {
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.mini-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.mini-item {
  border-radius: 9px;
  border: 1px solid rgba(111, 145, 198, 0.2);
  background: rgba(12, 28, 49, 0.72);
  padding: 8px 10px;
  display: grid;
  gap: 2px;
}

.mini-item-title {
  color: #edf4ff;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-item-sub {
  color: var(--text-soft);
  font-size: 0.79rem;
}

.mini-empty {
  border-radius: 9px;
  border: 1px dashed rgba(111, 145, 198, 0.24);
  background: rgba(11, 25, 44, 0.58);
  color: var(--text-dim);
  padding: 12px;
  text-align: center;
  font-size: 0.85rem;
}

.reco-legend {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reco-legend-item {
  border: 1px solid rgba(111, 145, 198, 0.22);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.75rem;
  color: var(--text-soft);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.reco-legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.legend-critical i { background: var(--bad); }
.legend-warning i { background: var(--warn); }
.legend-positive i { background: var(--good); }
.legend-neutral i { background: #6ba3f4; }

.recommendations {
  display: grid;
  gap: 9px;
}

.reco-card {
  border-radius: 10px;
  border: 1px solid rgba(111, 145, 198, 0.2);
  background: rgba(11, 27, 45, 0.62);
  padding: 10px 11px;
}

.reco-chip {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgba(111, 145, 198, 0.2);
  padding: 3px 8px;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #e9f6ff;
}

.reco-title {
  margin: 7px 0 4px;
  font-size: 0.96rem;
}

.reco-body {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.reco-card.reco-critical {
  border-color: rgba(255, 127, 127, 0.48);
  background: rgba(255, 127, 127, 0.09);
}

.reco-card.reco-warning {
  border-color: rgba(244, 196, 90, 0.46);
  background: rgba(244, 196, 90, 0.11);
}

.reco-card.reco-positive {
  border-color: rgba(87, 209, 143, 0.46);
  background: rgba(87, 209, 143, 0.1);
}

.metric-def-panel table th,
.metric-def-panel table td {
  white-space: normal;
}

.metric-def-panel table td {
  color: var(--text-soft);
}

.workspace-panel[data-workspace-panel="reports"] .panel,
.workspace-panel[data-workspace-panel="team"] .panel,
.workspace-panel[data-workspace-panel="organization"] .panel {
  padding: 18px;
}

.reports-library-list {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.team-card {
  padding: 14px;
}

.team-card h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.team-card p {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 0.87rem;
}

.team-form-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.team-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.team-role-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(111, 145, 198, 0.28);
  padding: 4px 10px;
  font-size: 0.74rem;
  text-transform: capitalize;
}

.team-role-pill.role-admin {
  border-color: rgba(34, 211, 238, 0.48);
  color: #d6f8ff;
  background: rgba(34, 211, 238, 0.12);
}

.team-role-pill.role-viewer {
  border-color: rgba(111, 145, 198, 0.28);
  color: #d6e2f8;
  background: rgba(92, 121, 168, 0.16);
}

.team-role-select {
  min-height: 34px;
}

.team-remove-btn {
  min-height: 32px;
  background: rgba(255, 127, 127, 0.12);
  border-color: rgba(255, 127, 127, 0.4);
  color: #ffe2e2;
}

.org-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.org-settings-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 8px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field > span {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.auth-input {
  width: 100%;
  min-height: 39px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(7, 17, 32, 0.94);
  color: var(--text);
  padding: 0 11px;
  font: inherit;
  font-size: 0.9rem;
}

.auth-input:focus-visible,
.target-field input:focus-visible {
  outline: none;
  border-color: rgba(34, 211, 238, 0.72);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.22);
}

.ghost-btn {
  background: rgba(14, 32, 58, 0.55);
  color: #d6e5ff;
}

.solid-btn {
  color: #ecfbff;
}

.auth-primary-btn {
  color: #eaffff;
}

.auth-status {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-soft);
}

.auth-status[data-tone="warning"] {
  color: #ffe2aa;
}

.auth-status[data-tone="error"] {
  color: #ffc4c4;
}

.auth-status[data-tone="info"] {
  color: #bedbff;
}

.auth-modal,
.org-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 10, 18, 0.7);
  backdrop-filter: blur(8px);
  z-index: 50;
}

.auth-modal.open,
.org-modal.open {
  display: flex;
}

.auth-dialog,
.org-dialog {
  width: min(560px, 100%);
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(160deg, #10233e, #0d1d35);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.42);
  padding: 20px 20px 18px;
  position: relative;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10, 24, 43, 0.75);
  color: #d8e8ff;
  font-size: 1.2rem;
  cursor: pointer;
}

.auth-eyebrow {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5de0f4;
}

.auth-dialog h2,
.org-dialog h2 {
  margin: 8px 0 6px;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.auth-subcopy {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.auth-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.auth-mode-btn {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(8, 20, 35, 0.82);
  color: var(--text-soft);
  padding: 9px 10px;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.auth-mode-btn.active {
  color: #e6fcff;
  border-color: rgba(34, 211, 238, 0.62);
  background: rgba(34, 211, 238, 0.16);
}

.auth-fields {
  display: grid;
  gap: 10px;
}

.auth-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.auth-link-btn {
  border: none;
  background: transparent;
  color: #8dd8ff;
  font: inherit;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
}

.auth-link-btn:hover {
  color: #c2f5ff;
}

.auth-row {
  margin-top: 10px;
}

.auth-recovery-row {
  display: none;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.auth-recovery-row.is-visible {
  display: grid;
}

.auth-gate-note {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.org-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 9, 17, 0.72);
  backdrop-filter: blur(8px);
  z-index: 56;
}

.status-modal.open {
  display: flex;
}

.status-modal-dialog {
  width: min(740px, 100%);
  max-height: min(84vh, 900px);
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(170deg, rgba(16, 33, 57, 0.98), rgba(11, 22, 40, 0.96));
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 14px;
}

.status-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-modal-head h3 {
  margin: 0;
  font-size: 1.14rem;
}

.status-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(9, 23, 40, 0.86);
  color: #deecff;
  font-size: 1.2rem;
  cursor: pointer;
}

.status-modal-subtitle {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.87rem;
}

.status-modal-list {
  margin-top: 10px;
  overflow: auto;
  max-height: 58vh;
  padding-right: 2px;
}

body.org-setup-open .app-shell {
  filter: blur(2px) saturate(0.8);
  pointer-events: none;
  user-select: none;
}

body.app-locked .workspace-main {
  filter: saturate(0.92);
}

.bar-chart {
  min-height: 200px;
  display: flex;
  align-items: end;
}

.bar-chart > div {
  display: flex;
  gap: 8px;
  width: 100%;
}

.bar-column {
  flex: 1;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 6px;
}

.bar {
  width: 100%;
  max-width: 36px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.96), rgba(61, 156, 255, 0.75));
  border: 1px solid rgba(34, 211, 238, 0.45);
}

.bar-label {
  color: var(--text-dim);
  font-size: 0.69rem;
  text-align: center;
}

.bar-value {
  color: #ecf7ff;
  font-size: 0.75rem;
  font-family: "Space Mono", monospace;
}

.line-chart {
  min-height: 214px;
}

.line-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.line-grid {
  stroke: rgba(111, 145, 198, 0.18);
  stroke-width: 1;
}

.line-stroke {
  fill: none;
  stroke: #44d4ed;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line-area {
  pointer-events: none;
}

.line-point {
  fill: #7ee9fb;
  stroke: #0f263f;
  stroke-width: 1;
}

.line-value {
  fill: #dff5ff;
  font-size: 10px;
  font-weight: 600;
}

.line-x-label,
.line-y-label {
  fill: var(--text-dim);
  font-size: 11px;
}

.line-x-label {
  text-anchor: middle;
}

.status-recipient-hint {
  margin-top: 10px;
  border: 1px dashed rgba(111, 145, 198, 0.24);
  border-radius: 9px;
  padding: 10px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.stack-track {
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(111, 145, 198, 0.18);
  overflow: hidden;
  background: rgba(10, 24, 41, 0.74);
}

.stack-segment {
  height: 100%;
}

.legend {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-item {
  border-radius: 999px;
  border: 1px solid rgba(111, 145, 198, 0.22);
  padding: 5px 9px;
  font-size: 0.74rem;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: var(--sidebar-collapsed-w) minmax(0, 1fr);
}

body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .org-context-copy,
body.sidebar-collapsed .sidebar-nav-label,
body.sidebar-collapsed .sidebar-auth .ghost-btn,
body.sidebar-collapsed .sidebar-auth .solid-btn {
  opacity: 0;
  width: 0;
  max-width: 0;
  overflow: hidden;
  padding: 0;
  border-width: 0;
  pointer-events: none;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
}

body.sidebar-collapsed .org-context {
  justify-content: center;
  padding: 10px 8px;
}

body.sidebar-collapsed .sidebar-nav-btn {
  justify-content: center;
  padding-inline: 6px;
}

body.sidebar-collapsed .sidebar-top {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

body.sidebar-collapsed .sidebar-auth {
  justify-items: center;
}

@media (max-width: 1290px) {
  .workspace-header {
    grid-template-columns: 1fr;
  }

  .workspace-controls,
  .dataset-meta,
  .control-row,
  .target-controls {
    justify-items: start;
    justify-content: flex-start;
    text-align: left;
  }

  .workspace-controls {
    justify-self: stretch;
    width: 100%;
  }

  .target-controls {
    grid-template-columns: auto minmax(74px, 90px) minmax(74px, 90px) auto;
  }
}

@media (max-width: 1180px) {
  .overview-layout {
    grid-template-columns: 1fr;
  }

  .senders-panel {
    order: 1;
  }

  .detail-stack {
    order: 2;
  }

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

  .team-grid,
  .org-settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: min(280px, calc(100vw - 24px));
    border: 1px solid var(--border);
    border-radius: 18px;
    z-index: 30;
  }

  body.sidebar-collapsed .app-sidebar {
    width: 74px;
  }

  .workspace-main {
    padding: 14px;
    margin-left: 86px;
  }

  body.sidebar-collapsed .workspace-main {
    margin-left: 86px;
  }

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

  .chart-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .workspace-main {
    margin-left: 0;
    padding: 12px;
  }

  .app-sidebar {
    width: calc(100vw - 24px);
    max-width: 320px;
  }

  body.sidebar-collapsed .app-sidebar {
    transform: translateX(-90%);
    width: calc(100vw - 24px);
  }

  body.sidebar-collapsed .sidebar-top {
    flex-direction: row;
    justify-content: space-between;
  }

  body.sidebar-collapsed .brand-name,
  body.sidebar-collapsed .org-context-copy,
  body.sidebar-collapsed .sidebar-nav-label {
    opacity: 1;
    width: auto;
    max-width: none;
    overflow: visible;
    padding: initial;
    border-width: initial;
    pointer-events: auto;
  }

  body.sidebar-collapsed .sidebar-auth .ghost-btn,
  body.sidebar-collapsed .sidebar-auth .solid-btn {
    opacity: 1;
    width: auto;
    max-width: none;
    overflow: visible;
    padding: 0 14px;
    border-width: 1px;
    pointer-events: auto;
  }

  body.sidebar-collapsed .sidebar-nav-btn {
    justify-content: flex-start;
  }

  .target-controls {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "label label"
      "min max"
      "apply apply";
  }

  .target-apply-btn {
    width: 100%;
  }

  .dataset-meta {
    justify-items: start;
    text-align: left;
  }
}
