:root {
  --bg: #050816;
  --bg-elevated: #0b1020;
  --bg-soft: #121629;
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.1);
  --accent-strong: #22c55e;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border-subtle: #1f2937;
  --danger: #f97373;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    sans-serif;
  background: radial-gradient(circle at top left, #1d283a 0, #020617 40%),
    radial-gradient(circle at bottom right, #0f172a 0, #020617 45%);
  color: var(--text);
  min-height: 100vh;
}

.app-shell {
  max-width: 1120px;
  margin: 24px auto;
  padding: 0 16px 24px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.top-bar h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.day-counter {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.9rem;
}

.day-counter span {
  font-weight: 600;
  color: var(--accent);
}

.day-counter small {
  color: var(--text-muted);
}

main {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 18px;
}

.today-panel {
  background: linear-gradient(145deg, #020617, #020617, #020617);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow-soft);
  padding: 18px 18px 14px;
}

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

.card {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(30, 64, 175, 0.45);
  padding: 12px 14px 10px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.85rem;
}

.today-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.today-header h2 {
  margin: 0;
}

.progress-ring-wrapper {
  position: relative;
  width: 70px;
  height: 70px;
  padding: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.35), transparent 60%);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.55);
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring__bg {
  fill: transparent;
  stroke: rgba(30, 64, 175, 0.5);
}

.progress-ring__value {
  fill: transparent;
  stroke: url(#grad) var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 175;
  stroke-dashoffset: 175;
  transition: stroke-dashoffset 0.35s ease-out;
}

.progress-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.progress-ring-label span {
  font-size: 1rem;
  font-weight: 600;
}

.progress-ring-label small {
  color: var(--text-muted);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 10px 11px;
  border-radius: var(--radius-md);
  background: radial-gradient(
        circle at top left,
        rgba(56, 189, 248, 0.18),
        transparent 50%
      ),
    linear-gradient(135deg, #020617, #020617 50%, #020617);
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.task-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-title span {
  font-weight: 500;
}

.chip {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-muted);
}

.task-help {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #022c22;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(21, 128, 61, 0.6),
    0 15px 30px rgba(22, 163, 74, 0.4);
}

.primary-button:hover {
  filter: brightness(1.05);
}

.ghost-button {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.ghost-button:hover {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
}

.small-button {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.task-item.completed {
  opacity: 0.9;
  background: linear-gradient(135deg, #022c22, #022c22 50%, #020617);
  border-color: rgba(34, 197, 94, 0.9);
}

.task-item.completed .task-title span {
  text-decoration: line-through;
  color: var(--accent);
}

.task-item.completed .task-help {
  color: #6ee7b7;
}

.task-item.completed .chip {
  border-color: rgba(34, 197, 94, 0.7);
  color: #bbf7d0;
}

.preset-info {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(75, 85, 99, 0.6);
}

details summary {
  cursor: pointer;
  font-size: 0.9rem;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  font-size: 0.75rem;
}

details[open] summary::before {
  content: "▾";
}

.preset-form {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-form ol {
  margin: 0 0 4px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preset-form input {
  width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(55, 65, 81, 0.8);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 0.82rem;
}

.preset-form input:focus {
  outline: 1px solid rgba(74, 222, 128, 0.7);
  border-color: transparent;
}

.stats-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.stats-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-list span {
  color: var(--text-muted);
}

.stats-list strong {
  font-weight: 600;
}

.export-card {
  border-style: dashed;
}

.export-actions {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.challenge-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.challenge-meter-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
}

.challenge-meter-label span {
  color: var(--text-muted);
}

.challenge-meter-label strong {
  font-size: 1rem;
  color: var(--accent);
}

.challenge-ring {
  transform: rotate(-90deg);
}

.challenge-ring__bg {
  fill: transparent;
  stroke: rgba(30, 64, 175, 0.55);
}

.challenge-ring__value {
  fill: transparent;
  stroke-linecap: round;
  stroke-dasharray: 138;
  stroke-dashoffset: 138;
  transition: stroke-dashoffset 0.4s ease-out;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.8);
}

.badge-pill.unlocked {
  border-color: rgba(74, 222, 128, 0.95);
  background: radial-gradient(circle at top left, #22c55e, #16a34a);
  color: #022c22;
  font-weight: 600;
}

.badge-pill span {
  opacity: 0.85;
}

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

.history-cell {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  border: 1px solid rgba(30, 64, 175, 0.6);
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  position: relative;
}

.history-cell::after {
  content: attr(data-date);
  position: absolute;
  bottom: 2px;
  left: 4px;
  font-size: 0.5rem;
  color: rgba(148, 163, 184, 0.75);
}

.history-cell[data-level="0"] {
  opacity: 0.25;
}

.history-cell[data-level="1"] {
  background: rgba(163, 230, 53, 0.2);
  border-color: rgba(132, 204, 22, 0.6);
}

.history-cell[data-level="2"] {
  background: rgba(74, 222, 128, 0.2);
  border-color: rgba(22, 163, 74, 0.8);
}

.history-cell[data-level="3"] {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(5, 150, 105, 0.9);
}

.history-cell[data-level="4"] {
  background: rgba(22, 163, 74, 0.45);
  border-color: rgba(21, 128, 61, 0.95);
}

.footer {
  margin-top: 18px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.info-section {
  margin-top: 28px;
  padding: 16px 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(
        circle at top left,
        rgba(34, 197, 94, 0.12),
        transparent 55%
      ),
    rgba(15, 23, 42, 0.95);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.85);
}

.info-header h2 {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 1.3rem;
}

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

.info-card {
  padding: 10px 11px 11px;
  border-radius: 12px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(
        circle at top left,
        rgba(37, 99, 235, 0.25),
        transparent 55%
      ),
    rgba(15, 23, 42, 0.95);
}

.info-card-accent {
  background: radial-gradient(
        circle at top left,
        rgba(74, 222, 128, 0.35),
        transparent 55%
      ),
    rgba(6, 78, 59, 0.95);
  border-color: rgba(34, 197, 94, 0.9);
}

.info-card h3 {
  margin: 4px 0 6px;
  font-size: 0.98rem;
}

.info-card-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: rgba(209, 213, 219, 0.9);
}

.info-card p,
.info-card ul {
  margin: 2px 0 4px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: #e5e7eb;
}

.info-card ul {
  padding-left: 16px;
}

.info-card li {
  margin-bottom: 2px;
}

.celebration-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.4), #020617ee);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);
}

.celebration-card {
  position: relative;
  max-width: 360px;
  padding: 18px 20px 16px;
  border-radius: 18px;
  border: 1px solid rgba(74, 222, 128, 0.95);
  background: radial-gradient(
        circle at top left,
        rgba(74, 222, 128, 0.3),
        transparent 55%
      ),
    rgba(15, 23, 42, 0.98);
  box-shadow: 0 28px 60px rgba(22, 163, 74, 0.7);
  text-align: center;
}

.celebration-card h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.celebration-card p {
  margin: 3px 0;
}

.celebration-card .primary-button {
  margin-top: 10px;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 6px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confetti-fall 1.8s linear infinite;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(120vh) rotate(360deg);
    opacity: 0;
  }
}

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

@media (max-width: 640px) {
  .info-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.badge-toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1100;
}

.badge-toast {
  min-width: 240px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 12px;
  background: radial-gradient(
        circle at top left,
        rgba(74, 222, 128, 0.3),
        transparent 55%
      ),
    rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(74, 222, 128, 0.9);
  box-shadow: 0 18px 40px rgba(21, 128, 61, 0.75);
  font-size: 0.82rem;
  animation: badge-toast-in 0.3s ease-out;
}

.badge-toast-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.badge-toast-name {
  font-weight: 600;
  color: #bbf7d0;
  margin-bottom: 2px;
}

.badge-toast-desc {
  color: #e5e7eb;
}

.badge-toast-hide {
  animation: badge-toast-out 0.35s ease-in forwards;
}

@keyframes badge-toast-in {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes badge-toast-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

.dashboard-table-wrapper {
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(
        circle at top left,
        rgba(37, 99, 235, 0.25),
        transparent 55%
      ),
    rgba(15, 23, 42, 0.95);
  max-height: 260px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.dashboard-table thead {
  background: rgba(15, 23, 42, 0.95);
  position: sticky;
  top: 0;
  z-index: 1;
}

.dashboard-table th,
.dashboard-table td {
  padding: 5px 7px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 41, 55, 0.85);
}

.dashboard-table th {
  font-weight: 500;
  color: rgba(209, 213, 219, 0.9);
}

.dashboard-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.85);
}

.dashboard-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.75);
}

.dashboard-table tbody tr:hover {
  background: rgba(30, 64, 175, 0.55);
}

.dashboard-table td:nth-child(4),
.dashboard-table td:nth-child(2) {
  text-align: right;
}

.dashboard-table td:nth-child(3) {
  white-space: nowrap;
}

.percent-low {
  color: #fca5a5;
  font-weight: 600;
}

.percent-high {
  color: #bbf7d0;
  font-weight: 600;
}

.dashboard-table-wrapper #dashboardEmpty {
  margin: 6px 8px 6px;
}

.line-chart-wrapper {
  margin-top: 8px;
  padding: 6px 8px 8px;
  border-radius: 10px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(
        circle at top left,
        rgba(129, 140, 248, 0.25),
        transparent 55%
      ),
    rgba(15, 23, 42, 0.95);
}

.line-chart {
  width: 100%;
  height: 110px;
  display: block;
}

.line-chart-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.line-chart-grid line {
  stroke: rgba(55, 65, 81, 0.9);
  stroke-width: 0.6;
}

.line-chart-grid text {
  fill: rgba(148, 163, 184, 0.9);
  font-size: 8px;
}

.line-chart-path {
  fill: none;
  stroke: #4ade80;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line-chart-point {
  fill: #4ade80;
  stroke: rgba(15, 23, 42, 0.9);
  stroke-width: 1;
}

@media (max-width: 840px) {
  main {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    flex-direction: row;
    overflow-x: auto;
  }

  .card {
    min-width: 220px;
  }
}

@media (max-width: 640px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar {
    flex-direction: column;
  }
}


