:root {
  --bg: #f6f8fe;
  --bg-soft: #eef2ff;
  --panel: #ffffff;
  --panel-2: #f8f9ff;
  --line: #e2e7f3;
  --text: #131b31;
  --muted: #5c6784;
  --brand: #7d3cff;
  --brand-2: #5f2bd6;
  --danger: #d23b5d;
  --shadow: 0 12px 30px rgba(14, 23, 42, 0.08);
}

body.dark {
  --bg: #0b0f1a;
  --bg-soft: #121a2f;
  --panel: #111a30;
  --panel-2: #1a2644;
  --line: #2b3a5e;
  --text: #e9efff;
  --muted: #9eabca;
  --brand: #9b74ff;
  --brand-2: #7d3cff;
  --danger: #ff6a86;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(125, 60, 255, 0.12), transparent 32%),
    radial-gradient(circle at 100% 100%, rgba(125, 60, 255, 0.06), transparent 38%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button,
a,
input {
  font: inherit;
  color: inherit;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

.dashboard-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 290px;
  background: linear-gradient(180deg, #0b0f1a, #131b31);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  align-self: center;
  text-align: center;
}

.brand img {
  width: 140px;
  height: 42px;
  border-radius: 0;
  object-fit: contain;
}

.brand h2 {
  font-size: 16px;
  font-weight: 800;
}

.brand p {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.sidebar-close {
  position: absolute;
  right: 0;
  top: 0;
}

.card-soft {
  background: linear-gradient(145deg, rgba(125, 60, 255, 0.16), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(153, 181, 219, 0.14);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.profile-mini {
  padding: 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.profile-meta h3 {
  font-size: 15px;
}

.profile-meta p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #ffffff;
}

.avatar.large {
  width: 98px;
  height: 98px;
  border-radius: 24px;
  font-size: 26px;
}

.avatar.large.has-photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
}

.avatar.has-photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
}

.avatar-upload-trigger {
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.avatar-camera {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  border: 2px solid var(--panel);
  box-shadow: var(--shadow);
}

.avatar-camera i {
  font-size: 16px;
}

.wallet-badge {
  grid-column: 1 / -1;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.wallet-badge.connected {
  background: rgba(55, 230, 165, 0.16);
  color: #4bf2b7;
}

.wallet-badge.disconnected {
  background: rgba(255, 95, 123, 0.12);
  color: #ff8da0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.nav-link i {
  font-size: 19px;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(125, 60, 255, 0.18);
  transform: translateX(3px);
}

.nav-link.logout {
  margin-top: 10px;
  color: #ff9eb0;
}

.dashboard-sidebar .brand p,
.dashboard-sidebar .profile-meta p {
  color: #b8c5e6;
}

.dashboard-sidebar .nav-link {
  color: #edf1ff;
}
.dashboard-main {
  grid-column: 2 / -1;
  padding: 28px;
}

.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

body.dark .dashboard-header {
  background: rgba(11, 15, 26, 0.78);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-header h1 {
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 800;
}

.dashboard-header p {
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn,
.btn-soft,
.btn-ghost,
.btn-danger,
.filter-btn,
.mark-read {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
}

.btn-ghost {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-soft:hover,
.icon-btn:hover,
.btn-ghost:hover,
.filter-btn:hover,
.mark-read:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.btn-danger {
  border-color: rgba(255, 95, 123, 0.45);
  color: #ff9cb0;
}

.dashboard-section {
  display: none;
  animation: fadeSlide 0.25s ease;
}

.dashboard-section.active {
  display: block;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head {
  margin: 8px 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 24px;
  font-weight: 800;
}

.stats-grid,
.ecosystem-grid,
.card-grid {
  display: grid;
  gap: 14px;
}

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

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

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

.panel,
.stat-card,
.eco-card,
.notice-item {
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.stat-card,
.eco-card,
.notice-item,
.panel {
  padding: 16px;
}

.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover,
.eco-card:hover {
  transform: translateY(-4px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: rgba(36, 200, 219, 0.16);
  color: var(--brand);
  margin-bottom: 12px;
}

.stat-card h3,
.eco-card h3,
.panel h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.stat-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-title-row h3 {
  margin-bottom: 0;
}

.balance-toggle-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 10px;
}

.stat-card p,
.metric {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 12px;
}

.profile-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
}

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

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

.profile-info-grid h4 {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.profile-info-grid p {
  font-size: 15px;
  font-weight: 600;
}

.finance-top {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.finance-top h4 {
  color: var(--muted);
  margin-bottom: 6px;
}

.finance-actions {
  display: grid;
  gap: 8px;
}

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

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn.active {
  background: rgba(125, 60, 255, 0.16);
  border-color: var(--brand);
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.status {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.status.active {
  background: rgba(55, 230, 165, 0.16);
  color: #4bf2b7;
}

.status.pending {
  background: rgba(255, 199, 79, 0.16);
  color: #ffcb66;
}

.eco-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.eco-card i {
  font-size: 30px;
  color: var(--brand);
}

.eco-card p {
  color: var(--muted);
  margin: 8px 0 10px;
}

.status-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status-badge.ready {
  background: rgba(55, 230, 165, 0.16);
  color: #4bf2b7;
}

.status-badge.coming {
  background: rgba(255, 199, 79, 0.16);
  color: #ffcb66;
}

.chart-panel {
  min-height: 250px;
}

.chart-placeholder {
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  min-height: 180px;
}

.chart-placeholder.bars {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 14px;
}

.chart-placeholder.bars span {
  flex: 1;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.chart-placeholder.donut {
  display: grid;
  place-items: center;
}

.donut-core {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 24px;
  background:
    radial-gradient(circle closest-side, var(--panel) 72%, transparent 73% 100%),
    conic-gradient(var(--brand) 68%, rgba(64, 98, 145, 0.4) 0);
}

.notice-list {
  display: grid;
  gap: 12px;
}

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

.notice-item h4 {
  margin-bottom: 4px;
}

.notice-item p {
  color: var(--muted);
}

.notice-item.read {
  opacity: 0.55;
}

.mark-read {
  white-space: nowrap;
}

.form-grid {
  display: grid;
  gap: 8px;
}

.form-grid input {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  padding: 10px;
}

.activity-list {
  list-style: none;
  display: grid;
  gap: 8px;
}

.activity-list li {
  color: var(--muted);
}

.panel.danger {
  border-color: rgba(255, 95, 123, 0.45);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  margin: 8px 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #4b5f83;
  transition: 0.2s;
}

.slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #fff;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--brand-2);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 950;
}

.sidebar-close,
#sidebarOpen {
  display: none;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .dashboard-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .dashboard-sidebar.open {
    transform: translateX(0);
  }

    .dashboard-main {
    grid-column: 1 / -1;
    padding: 18px;
  }

  .profile-card,
  .card-grid.two,
  .notice-item {
    grid-template-columns: 1fr;
  }

  .sidebar-close,
  #sidebarOpen {
    display: grid;
  }

  .sidebar-overlay.show {
    display: block;
  }
}

@media (max-width: 620px) {
  .stats-grid,
  .ecosystem-grid,
  .finance-top,
  .profile-info-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    position: static;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.dashboard-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1400;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.dashboard-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.dashboard-toast.success {
  border-color: rgba(55, 230, 165, 0.55);
}

.dashboard-toast.warn {
  border-color: rgba(255, 199, 79, 0.55);
}

.dashboard-toast.info {
  border-color: rgba(125, 60, 255, 0.55);
}

@media (max-width: 620px) {
  .dashboard-toast {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }
}





.profile-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-photo-input {
  display: none;
}

#profilePhotoSaveBtn {
  display: none;
}

#profilePhotoSaveBtn.show {
  display: inline-flex;
}

.profile-edit-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.profile-edit-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(125, 60, 255, 0.15);
}

/* Dashboard responsive polish */
.header-subtext {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-main {
  max-width: 100%;
  overflow-x: hidden;
}

.dashboard-header {
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.06);
}

@media (max-width: 1024px) {
  .dashboard-main {
    padding: 20px;
  }

  .dashboard-header {
    padding: 12px 14px;
    border-radius: 14px;
  }

  .dashboard-header h1 {
    font-size: 24px;
  }
}

@media (max-width: 900px) {
  .dashboard-sidebar {
    width: min(84vw, 320px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
  }

  .dashboard-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
  }

  .header-left {
    min-width: 0;
    gap: 10px;
  }

  .header-left > div {
    min-width: 0;
  }

  .dashboard-header h1 {
    font-size: 20px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-subtext {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    flex-wrap: nowrap;
    justify-self: end;
  }
}

@media (max-width: 620px) {
  .dashboard-main {
    padding: 14px;
  }

  .dashboard-header {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .header-left {
    gap: 8px;
  }

  .header-actions {
    width: auto;
    justify-content: flex-end;
    gap: 8px;
  }

  .header-actions .btn-ghost {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }

  .header-actions .btn-ghost i {
    font-size: 20px;
    margin: 0;
  }

  .section-head h2 {
    font-size: 20px;
  }

  .panel,
  .stat-card,
  .eco-card,
  .notice-item {
    padding: 14px;
  }

  th,
  td {
    padding: 10px 8px;
  }
}

@media (max-width: 420px) {
  .dashboard-header h1 {
    font-size: 18px;
  }

  .header-subtext {
    font-size: 12px;
  }
}
