:root {
  --bs-primary: #4e79a7;
  --bs-primary-rgb: 78, 121, 167;
  --bs-secondary: #607081;
  --bs-secondary-rgb: 96, 112, 129;
  --bs-success: #3d7a57;
  --bs-success-rgb: 61, 122, 87;
  --bs-danger: #b5534f;
  --bs-danger-rgb: 181, 83, 79;
  --bs-border-color: #d6deea;
  --bs-body-color: #1f2a37;
  --bs-body-bg: #e9eef5;
  --bs-card-border-radius: 8px;
  --bs-card-border-color: rgba(188, 200, 216, 0.75);
  --bs-card-bg: rgba(255, 255, 255, 0.94);
  --bs-border-radius: 8px;
  --bs-border-radius-lg: 10px;
  --bs-box-shadow-sm: 0 1px 4px rgba(40, 56, 76, 0.04);
  --bs-box-shadow: 0 4px 14px rgba(40, 56, 76, 0.06);
  --bg: #e9eef5;
  --bg-accent: #dbe6f2;
  --surface: #ffffff;
  --surface-muted: #f4f7fb;
  --surface-raised: #eef3f9;
  --text: #1f2a37;
  --muted: #607081;
  --muted-strong: #445364;
  --line: #d6deea;
  --line-strong: #bcc8d8;
  --primary: #4e79a7;
  --primary-strong: #365b85;
  --primary-soft: #e5eef8;
  --danger-soft: #faecea;
  --danger-strong: #8f3b3a;
  --info: #5f7f9a;
  --info-soft: #e7eef5;
  --success: #3d7a57;
  --success-soft: #e5f3ea;
  --shadow-sm: 0 1px 4px rgba(40, 56, 76, 0.04);
  --shadow-md: 0 4px 14px rgba(40, 56, 76, 0.06);
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --font-body: "Inter", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

.dashboard-body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(78, 121, 167, 0.12), transparent 28%),
    linear-gradient(180deg, #f5f8fc 0%, var(--bg) 52%, var(--bg-accent) 100%);
}

button,
input,
table {
  font: inherit;
}

button {
  appearance: none;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--primary-strong);
}

.shell {
  max-width: 1240px;
}

.hero {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.topbar,
.hero-main,
.panel,
.widget-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(188, 200, 216, 0.75);
  box-shadow: var(--shadow-md);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
}

.topbar-brand {
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
}

.brand-link:hover {
  color: var(--primary-strong);
}

.brand-logo {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.tab-chip {
  min-height: 1.95rem;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.81rem;
  font-weight: 600;
}

.tab-chip.is-active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 1px 2px rgba(40, 56, 76, 0.08);
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.95rem;
  padding: 0.32rem 0.62rem;
  border-radius: 8px;
  font-size: 0.81rem;
}

.account-avatar {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-muted);
}

.account-avatar svg {
  width: 0.95rem;
  height: 0.95rem;
}

.account-label {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-main {
  padding: 0.8rem 0.95rem;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 245, 252, 0.96)),
    var(--surface);
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.3rem;
  color: var(--primary-strong);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.08rem, 1.8vw, 1.32rem);
}

h3 {
  font-size: 0.95rem;
}

.lede,
.muted,
.panel-header p,
.widget-meta,
.widget-title-row p {
  color: var(--muted);
}

.lede {
  max-width: 50rem;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.hero-chip,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.4rem;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hero-chip {
  border: 1px solid rgba(78, 121, 167, 0.18);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.hero-chip-muted,
.status-badge-neutral {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--muted-strong);
}

.status-badge-info {
  border: 1px solid rgba(95, 127, 154, 0.18);
  background: var(--info-soft);
  color: var(--info);
}

.status-badge-success {
  border: 1px solid rgba(61, 122, 87, 0.18);
  background: var(--success-soft);
  color: var(--success);
}

.status-badge-danger {
  border: 1px solid rgba(181, 83, 79, 0.18);
  background: var(--danger-soft);
  color: var(--danger-strong);
}

.panel-header,
.form-heading,
.widget-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel {
  margin-bottom: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-lg);
}

.panel-header {
  margin-bottom: 0.55rem;
}

.panel-header p,
.panel-note {
  margin: 0;
  line-height: 1.45;
}

.panel-note {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 0.83rem;
}

.auth-grid,
.dashboard-tools {
  display: grid;
  gap: 0.75rem;
}

.auth-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.55rem;
}

.dashboard-tools {
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
}

.invite-panel,
.utility-panel {
  margin: 0;
}

.auth-form {
  display: grid;
  gap: 0.6rem;
  height: 100%;
  padding: 0.8rem;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 251, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.auth-form p {
  margin: 0;
}

.auth-form label {
  display: grid;
  gap: 0.28rem;
  color: var(--muted-strong);
  font-size: 0.81rem;
  font-weight: 600;
}

.auth-form input,
.auth-form .form-control {
  width: 100%;
  min-height: 2.2rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.auth-form input:focus,
.auth-form .form-control:focus {
  outline: none;
  border-color: rgba(78, 121, 167, 0.9);
  box-shadow: 0 0 0 0.2rem rgba(78, 121, 167, 0.16);
}

.auth-form input[readonly],
.auth-form .form-control[readonly] {
  background: var(--surface-muted);
  color: var(--muted-strong);
}

.button,
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.1rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 0.81rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(78, 121, 167, 0.18);
}

.button-primary {
  background: linear-gradient(180deg, #5d86b0 0%, var(--primary) 100%);
  border-color: var(--primary-strong);
  color: #fff;
}

.button-primary:hover {
  background: linear-gradient(180deg, #5079a1 0%, var(--primary-strong) 100%);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--muted-strong);
}

.button-secondary:hover {
  background: var(--surface-muted);
}

.button-danger {
  background: var(--danger-soft);
  border-color: rgba(181, 83, 79, 0.3);
  color: var(--danger-strong);
}

.button-danger:hover {
  background: #f5dfdd;
}

.inline-feedback {
  min-height: 1rem;
  font-size: 0.75rem;
}

.dashboard-screen[hidden] {
  display: none !important;
}

.widget-grid {
  margin-top: 0;
}

.widget-card {
  padding: 0.7rem 0.75rem;
  border-radius: 8px;
}

.widget-title-row {
  display: flex;
  gap: 0.55rem;
}

.widget-title-row h3 {
  margin-bottom: 0.15rem;
  font-size: 0.92rem;
}

.widget-title-row p,
.widget-meta {
  margin: 0;
  font-size: 0.75rem;
}

.widget-icon {
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  border: 1px solid rgba(78, 121, 167, 0.14);
}

.widget-icon svg {
  width: 0.95rem;
  height: 0.95rem;
}

.widget-body {
  padding-top: 0.1rem;
}

.stat-headline {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.stat-value {
  font-size: clamp(1.45rem, 2.1vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stat-delta {
  margin-top: 0.2rem;
  color: var(--success);
  font-weight: 700;
  font-size: 0.75rem;
}

.chart-shell,
.bar-chart {
  display: grid;
  gap: 0.4rem;
}

.chart-svg {
  width: 100%;
  height: auto;
  color: var(--primary);
}

.chart-labels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 120px) 1fr auto;
  gap: 0.4rem;
  align-items: center;
}

.bar-track {
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: #dde6f0;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #89a7c5);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface-raised);
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.8rem;
}

th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:hover {
  background: rgba(244, 247, 251, 0.85);
}

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

.table-user {
  display: grid;
  gap: 0.1rem;
}

.table-user strong {
  color: var(--text);
}

.table-user span {
  color: var(--muted);
  font-size: 0.74rem;
}

.table-empty {
  text-align: center;
  padding: 1rem;
}

.table-actions {
  display: flex;
  justify-content: flex-start;
}

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

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

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .brand-title {
    font-size: 0.88rem;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-nav {
    width: 100%;
  }

  .tab-chip {
    flex: 1 1 0;
  }

  .panel-header,
  .form-heading,
  .widget-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .table > :not(caption) > * > * {
    padding: 0.55rem;
  }
}
