:root {
  --bg-dark: #070e0b;
  --bg-sidebar: #09130f;
  --bg-panel: #0e1915;
  --bg-card-inner: #14221d;
  --border: #1d3029;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --gold: #d4af37;
  --text-main: #edf3f0;
  --text-muted: #7f948c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 245px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 20px;
}

.crest {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #065f46);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.brand h1 {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  line-height: 1.2;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.brand span {
  display: block;
  font-size: 0.7rem;
  color: var(--gold);
  margin-top: 2px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.18s;
}

.nav-item:hover {
  background: rgba(16, 185, 129, 0.08);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.22), rgba(16, 185, 129, 0.08));
  border-color: rgba(16, 185, 129, 0.35);
  color: #ffffff;
  font-weight: 600;
}

.badge {
  background: var(--gold);
  color: #070e0b;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.xp-footer {
  padding: 4px 6px;
}

.xp-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--emerald);
  margin-bottom: 6px;
}

.xp-bar {
  height: 6px;
  background: #13231d;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}

.xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--emerald), var(--gold));
  transition: width 0.3s ease;
}

.xp-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- MAIN CONTENT --- */
.main-content {
  margin-left: 245px;
  flex: 1;
  padding: 22px 28px;
  max-width: 1440px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #ffffff;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.top-stat-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-stat-box small {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  font-weight: 600;
}

.top-stat-box strong {
  font-size: 1.05rem;
  color: #ffffff;
}

.top-stat-box strong.gold-val {
  color: var(--gold);
}

.week-alert {
  font-size: 0.68rem;
  color: var(--emerald);
  font-weight: 700;
}

.menu-toggle {
  display: none;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

/* --- SUBBAR --- */
.subbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 18px;
}

.pill-tag {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--emerald);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 99px;
}

/* --- VIEWS & CARDS --- */
.view {
  display: none;
}

.view.active {
  display: block;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.card h3 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  margin-bottom: 14px;
  color: #ffffff;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-header h3 {
  margin-bottom: 0;
}

.mb-18 {
  margin-bottom: 18px;
}

.mt-18 {
  margin-top: 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.kpi-title {
  font-size: 1.15rem;
  line-height: 1.3;
  color: #ffffff;
}

.kpi-num {
  font-size: 1.85rem;
  font-weight: 700;
  color: #ffffff;
}

.dashboard-mid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
}

/* --- BOTÕES DE EXECUÇÃO RÁPIDA --- */
.exec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.exec-btn {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.18s;
}

.exec-btn:hover {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.12);
}

.exec-btn strong {
  color: var(--emerald);
  font-size: 0.85rem;
}

/* --- FORMULÁRIOS & BOTÕES --- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
}

input, select {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-family: inherit;
  width: 100%;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--emerald);
}

.btn-primary {
  background: var(--emerald);
  color: #05140e;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--emerald-dark);
  color: #ffffff;
}

.btn-outline {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-outline:hover {
  border-color: var(--gold);
  color: #ffffff;
}

.btn-xs {
  padding: 6px 11px;
  font-size: 0.78rem;
}

.mini-btn {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  cursor: pointer;
}

.mini-btn:hover {
  border-color: var(--emerald);
  color: #ffffff;
}

/* --- LISTAS & CHIPS --- */
.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-row {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: 99px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.gold-text {
  color: var(--gold);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* --- PLANNER SEMANAL --- */
.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.day-col {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-col h4 {
  font-size: 0.88rem;
  color: var(--gold);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.task-card {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-left: 3px solid var(--emerald);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.84rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-card.done {
  opacity: 0.5;
  text-decoration: line-through;
}

.task-top {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.task-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* --- REVISÕES --- */
.rev-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.rev-pill {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.76rem;
  cursor: pointer;
}

.rev-pill.due {
  border-color: var(--gold);
  color: var(--gold);
}

.rev-pill.done {
  border-color: var(--emerald);
  color: var(--emerald);
  text-decoration: line-through;
}

/* --- RECOMPENSAS --- */
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.reward-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.reward-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.reward-cost {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  color: var(--gold);
  font-weight: 700;
}

.reward-del {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* --- WIDGET CONFIG & CHART --- */
.widget-config {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  font-size: 0.84rem;
}

.widget-config label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.widget-config input {
  width: auto;
}

.chart-wrap {
  height: 260px;
  position: relative;
}

/* --- AUTH, PERFIL & RANKING --- */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--emerald);
  padding: 6px 12px 6px 7px;
  border-radius: 99px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.user-chip img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold);
}

.profile-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.profile-preview img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
}

.field-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.toggle-row input {
  width: auto;
}

.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.rank-row.me {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.rank-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-pos {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  width: 28px;
  text-align: center;
  color: var(--gold);
}

.rank-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* --- TOAST --- */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--bg-panel);
  border: 1px solid var(--emerald);
  color: var(--text-main);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- RESPONSIVO --- */
@media (max-width: 960px) {
  .dashboard-mid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 18px;
  }
  .menu-toggle {
    display: inline-block;
  }
}