:root {
  --ink: #0b2f2b;
  --ink2: #174943;
  --mint: #45b97c;
  --lime: #9bdc75;
  --paper: #f5f6f2;
  --card: #fff;
  --line: #dfe5df;
  --muted: #697872;
  --red: #e16363;
  --amber: #e7aa3e;
  --shadow: 0 14px 40px rgba(11, 47, 43, 0.08);
}

.score-grid {
  grid-template-columns: 1.25fr repeat(4, 0.72fr) 1.25fr;
}
.fail-card strong,
.fail-cell {
  color: var(--red);
}
.status-btn {
  width: 21px;
  height: 21px;
  border: 1.5px solid #aebbb5;
  border-radius: 5px;
  background: #fff;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
}
.status-btn.done {
  background: var(--ink);
  border-color: var(--ink);
}
.status-btn.failed {
  background: var(--red);
  border-color: var(--red);
}
.status-btn:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}
@media (max-width: 1000px) {
  .score-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
}
.shell {
  max-width: 1550px;
  margin: auto;
  padding: 36px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 26px;
}
.eyebrow,
.kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--mint);
}
h1 {
  font-size: 42px;
  line-height: 1;
  margin: 8px 0;
}
.subtitle {
  color: var(--muted);
  margin: 0;
}
.month-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 16px;
}
.month-controls label {
  display: grid;
  gap: 5px;
}
.month-controls label span {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}
.month-controls select {
  border: 0;
  background: #f3f6f3;
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 700;
  color: var(--ink);
}
button,
.file-label {
  font: inherit;
  cursor: pointer;
}
.icon-btn {
  height: 40px;
  width: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: white;
}
.score-grid {
  display: grid;
  grid-template-columns: 1.25fr repeat(4, 0.72fr) 1.25fr;
  gap: 14px;
  margin-bottom: 14px;
}
.score-card,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.score-card {
  padding: 20px;
  min-height: 128px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.score-card span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.score-card strong {
  font-size: 31px;
  margin-top: 8px;
}
.score-card small {
  color: var(--muted);
}
.hero-score {
  background: var(--ink);
  color: white;
}
.hero-score span {
  color: #b8d1cb;
}
.hero-score strong {
  font-size: 44px;
}
.ring {
  position: absolute;
  right: 17px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: conic-gradient(var(--lime) 0deg, #31534f 0deg);
  display: grid;
  place-items: center;
}
.ring div {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ink);
}
.text-btn {
  margin-top: 10px;
  border: 0;
  background: none;
  color: var(--mint);
  padding: 0;
  text-align: left;
  font-weight: 700;
}
.chart-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.panel {
  padding: 20px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.panel h2 {
  font-size: 18px;
  margin: 5px 0 0;
}
.chart-wrap {
  height: 250px;
}
.tracker-panel {
  padding: 0;
  overflow: hidden;
}
.tracker-head {
  padding: 20px 20px 0;
}
.actions {
  display: flex;
  gap: 8px;
}
.primary-btn,
.ghost-btn,
.file-label {
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
}
.primary-btn {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
}
.ghost-btn,
.file-label {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.table-scroll {
  overflow: auto;
  max-height: 610px;
  border-top: 1px solid var(--line);
}
table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 12px;
}
th,
td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  height: 38px;
  text-align: center;
  padding: 4px;
}
th {
  position: sticky;
  top: 0;
  background: var(--ink);
  color: #fff;
  z-index: 3;
  font-size: 10px;
}
.habit-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  text-align: left;
  min-width: 230px;
  max-width: 230px;
  padding: 0 12px;
  font-weight: 700;
}
.habit-name small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}
.day-cell {
  min-width: 34px;
}
.day-cell.weekend {
  background: #f1f7f3;
}
.day-cell.today {
  box-shadow: inset 0 0 0 2px var(--mint);
}
input[type="checkbox"] {
  appearance: none;
  width: 19px;
  height: 19px;
  border: 1.5px solid #aebbb5;
  border-radius: 5px;
  background: #fff;
  display: inline-grid;
  place-content: center;
  margin: 0;
  cursor: pointer;
}
input[type="checkbox"]:checked {
  background: var(--ink);
  border-color: var(--ink);
}
input[type="checkbox"]:checked:after {
  content: "✓";
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.stat-cell {
  min-width: 65px;
  font-weight: 700;
}
.progress-cell {
  min-width: 110px;
}
.progress {
  height: 8px;
  background: #e9eeea;
  border-radius: 99px;
  overflow: hidden;
}
.progress div {
  height: 100%;
  background: var(--mint);
}
.delete-habit {
  border: 0;
  background: none;
  color: #b1bbb7;
  font-size: 15px;
  padding: 3px;
  float: right;
}
.lower-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.wellbeing-chart {
  height: 300px;
}
.ranking-panel ol {
  padding: 0;
  margin: 0;
  list-style: none;
}
.ranking-panel li {
  display: grid;
  grid-template-columns: 28px 1fr 48px;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ranking-panel li b {
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: #edf3ef;
  display: grid;
  place-items: center;
}
.ranking-panel li span {
  font-size: 12px;
}
.ranking-panel li strong {
  text-align: right;
}
.finance-panel {
  margin-top: 14px;
}
.finance-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  align-items: center;
  gap: 35px;
}
.finance-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.finance-summary div {
  padding: 14px;
  background: #f5f7f5;
  border-radius: 12px;
}
.finance-summary span {
  font-size: 11px;
  color: var(--muted);
  display: block;
}
.finance-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}
.saving-bar {
  height: 22px;
  border-radius: 99px;
  background: #e8eee9;
  overflow: hidden;
}
.saving-bar div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ink), var(--mint));
  transition: 0.3s;
}
footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  color: var(--muted);
  font-size: 12px;
}
.file-label input {
  display: none;
}
dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
  width: min(420px, calc(100% - 30px));
}
dialog::backdrop {
  background: rgba(6, 30, 27, 0.55);
}
dialog form {
  display: grid;
  gap: 14px;
  padding: 24px;
}
dialog h3 {
  margin: 0;
  font-size: 22px;
}
dialog label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}
dialog input,
dialog select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  font: inherit;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
@media (max-width: 1000px) {
  .score-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-score,
  .finance-card {
    grid-column: span 2;
  }
  .chart-grid,
  .lower-grid,
  .finance-layout {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .finance-summary {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
@media (max-width: 620px) {
  .shell {
    padding: 18px 12px;
  }
  h1 {
    font-size: 33px;
  }
  .month-controls {
    width: 100%;
    overflow: auto;
  }
  .score-grid {
    grid-template-columns: 1fr 1fr;
  }
  .score-card {
    padding: 15px;
  }
  .hero-score strong {
    font-size: 38px;
  }
  .ring {
    width: 70px;
    height: 70px;
  }
  .ring div {
    width: 50px;
    height: 50px;
  }
  .panel {
    padding: 15px;
  }
  .tracker-panel {
    padding: 0;
  }
  .tracker-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .actions {
    width: 100%;
  }
  .actions button {
    flex: 1;
  }
  .finance-summary {
    grid-template-columns: 1fr;
  }
  .chart-wrap {
    height: 210px;
  }
}
