:root {
  --bg: #0b1117;
  --panel: rgba(15, 22, 31, 0.92);
  --panel-strong: #16212c;
  --text: #f3efe8;
  --muted: #97a6b5;
  --line: rgba(151, 175, 196, 0.14);
  --accent: #3dc8a4;
  --accent-soft: rgba(61, 200, 164, 0.14);
  --danger: #ff8768;
  --danger-soft: rgba(255, 135, 104, 0.14);
  --success: #8ee59d;
  --success-soft: rgba(142, 229, 157, 0.14);
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.34);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(61, 200, 164, 0.14), transparent 24%),
    radial-gradient(circle at bottom right, rgba(255, 135, 104, 0.12), transparent 20%),
    linear-gradient(180deg, #091017 0%, #0d141d 100%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  padding: 32px;
}

.login-hero,
.login-panel,
.sidebar,
.workspace,
.panel,
.stat-card,
.team-card,
.lead-card,
.modal,
.drawer,
.leaderboard-row,
.topbar,
.sidebar-note,
.kanban-column {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-hero,
.login-panel,
.workspace,
.sidebar {
  border-radius: 32px;
}

.login-hero {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-hero h1,
.page-header h1,
.panel-header h2,
.drawer-head h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-hero h1 {
  font-size: clamp(3.4rem, 7vw, 5.8rem);
  max-width: 10ch;
}

.login-hero p,
.page-header p,
.panel-header p,
.empty-state p,
.sidebar-note p,
.topbar span,
.table-wrap span,
.lead-card p,
.team-card span,
.team-card small {
  color: var(--muted);
}

.hero-metrics {
  display: grid;
  gap: 12px;
}

.hero-metrics article,
.profile-stats article {
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(151, 175, 196, 0.08);
}

.hero-metrics strong,
.stat-card strong,
.profile-stats strong {
  display: block;
  font-size: 1.2rem;
}

.login-panel {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stack-form,
.form-grid,
.plain-list,
.timeline,
.action-list,
.pager {
  display: grid;
  gap: 16px;
}

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

.form-grid .wide,
label.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
}

label span,
.control span {
  font-size: 0.9rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(151, 175, 196, 0.18);
  border-radius: 16px;
  background: rgba(4, 9, 15, 0.6);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(13, 138, 106, 0.1);
}

.primary-button,
.ghost-button,
.text-button,
.chip-button,
.icon-button {
  border: 0;
  border-radius: 999px;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.primary-button:hover,
.ghost-button:hover,
.text-button:hover,
.chip-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, #0d8a6a 0%, #0f6f88 100%);
  color: white;
  padding: 14px 20px;
  font-weight: 700;
}

.ghost-button,
.chip-button,
.icon-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.ghost-button {
  padding: 12px 18px;
  border: 1px solid rgba(151, 175, 196, 0.16);
}

.icon-button {
  padding: 10px 14px;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.chip-button {
  padding: 10px 16px;
}

.chip-button.active {
  background: var(--accent);
  color: white;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  padding: 20px;
}

.sidebar {
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 24px;
}

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

.brand-mark,
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, #ff8768 0%, #23b8ff 100%);
}

.avatar.muted {
  background: linear-gradient(135deg, #7f6a53 0%, #4d5f64 100%);
}

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

.nav-link {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--muted);
}

.nav-link.active,
.nav-link:hover {
  background: rgba(61, 200, 164, 0.12);
  color: #ffffff;
}

.workspace {
  padding: 20px;
  display: grid;
  align-content: start;
  gap: 20px;
  position: relative;
}

.topbar,
.page-header,
.panel-header,
.drawer-head,
.team-group-head,
.lead-card-head,
.table-actions,
.button-row,
.topbar-controls,
.page-actions,
.panel-actions,
.topbar-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  padding: 16px 20px;
  border-radius: 24px;
}

.topbar-controls {
  flex-wrap: wrap;
}

.control {
  display: grid;
  gap: 6px;
}

.control.compact select {
  min-width: 140px;
}

.page-header {
  padding: 8px 4px;
}

.page-header h1 {
  font-size: clamp(2rem, 3.6vw, 3.2rem);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.overview-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 320px;
  gap: 16px;
}

.overview-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.stat-card {
  padding: 18px 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(23, 34, 46, 0.96) 0%, rgba(16, 24, 34, 0.96) 100%);
  border: 1px solid rgba(151, 175, 196, 0.18);
}

.stat-card span,
.stat-card small {
  display: block;
}

.overview-side .stat-card {
  position: relative;
  overflow: hidden;
}

.overview-side .stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #ff8768 0%, #3dc8a4 100%);
}

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

.panel {
  padding: 20px;
  border-radius: 28px;
}

.panel.wide,
.layout-grid > .wide {
  grid-column: 1 / -1;
}

.panel-body {
  margin-top: 18px;
}

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

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

.table-wrap {
  overflow: auto;
}

.nowrap {
  white-space: nowrap;
}

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

th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(61, 45, 32, 0.08);
  vertical-align: top;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-neutral {
  background: rgba(61, 45, 32, 0.08);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8768 0%, #3dc8a4 100%);
}

.leaderboard {
  display: grid;
  gap: 12px;
}

.leaderboard-row {
  padding: 16px 18px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 16px;
}

.leaderboard-rank {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}

.sparkline-card {
  display: grid;
  gap: 14px;
}

.sparkline {
  width: 100%;
  height: 220px;
  display: block;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.01) 100%),
    repeating-linear-gradient(
      to top,
      rgba(151, 175, 196, 0.06) 0,
      rgba(151, 175, 196, 0.06) 1px,
      transparent 1px,
      transparent 25%
    );
  padding: 10px;
}

.sparkline polyline {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-meta {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
}

.sparkline-meta > div {
  flex: 1;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(151, 175, 196, 0.08);
}

.donut-layout {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.donut-legend {
  display: grid;
  gap: 12px;
}

.donut-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: center;
}

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

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

.kanban-column {
  padding: 18px;
  border-radius: 24px;
}

.kanban-column header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kanban-stack,
.team-grid {
  display: grid;
  gap: 12px;
}

.lead-card,
.team-card {
  padding: 16px;
  border-radius: 22px;
}

.team-card {
  gap: 10px;
}

.lead-card h3,
.team-card strong {
  margin: 4px 0;
}

.team-card small,
.team-card .ghost-button,
.team-card .primary-button,
.team-card form {
  display: block;
}

.team-card .primary-button,
.team-card .ghost-button {
  width: 100%;
  text-align: center;
}

.drawer {
  margin-top: 8px;
  padding: 22px;
  border-radius: 28px;
}

.drawer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.drawer-section {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(151, 175, 196, 0.12);
}

.timeline-item,
.order-summary,
.team-group,
.sidebar-note {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(151, 175, 196, 0.08);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 17, 12, 0.34);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal {
  width: min(820px, 100%);
  border-radius: 30px;
  padding: 24px;
}

.empty-state {
  padding: 24px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 8px;
}

.alert {
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 700;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
}

.loading-overlay {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(35, 184, 255, 0.14);
  color: #7dd7ff;
  font-weight: 700;
}

.pager {
  margin-top: 16px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.pager span {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.plain-list {
  gap: 12px;
}

@media (max-width: 1180px) {
  .app-shell,
  .login-shell,
  .kanban,
  .overview-hero,
  .layout-grid,
  .drawer-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .workspace {
    order: 1;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .login-shell {
    padding: 12px;
  }

  .workspace,
  .sidebar,
  .login-hero,
  .login-panel {
    padding: 18px;
  }

  .form-grid,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .topbar,
  .page-header,
  .topbar-controls {
    align-items: flex-start;
    flex-direction: column;
  }
}
