:root {
  color-scheme: light;
  --paper: #f5f1e9;
  --surface: #fffdf8;
  --ink: #24211d;
  --muted: #79736b;
  --line: #ded8ce;
  --orange: #e8552f;
  --orange-soft: #f8dfd4;
  --green: #34765a;
  --green-soft: #dcece4;
  --yellow: #a56b1a;
  --yellow-soft: #f4e7c9;
  --red: #a94037;
  --red-soft: #f2dcd8;
  --shadow: 0 18px 48px rgb(70 55 35 / 8%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 5%, rgb(232 85 47 / 9%), transparent 28rem),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  display: grid;
  grid-template:
    "topbar topbar" 68px
    "sidebar main" minmax(calc(100vh - 68px), auto) /
    224px minmax(0, 1fr);
}

.topbar {
  grid-area: topbar;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgb(245 241 233 / 88%);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.04em;
  text-decoration: none;
}

.brand-mark {
  color: var(--orange);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-weight: 900;
  letter-spacing: -.16em;
}

.account-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.account-name,
.sync-status {
  color: var(--muted);
  font-size: 13px;
}

.sync-status::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--green);
  content: "";
}

.quiet-button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.quiet-button:hover {
  background: var(--surface);
}

.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  padding: 24px 16px;
  border-right: 1px solid var(--line);
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: rgb(255 253 248 / 70%);
  color: var(--ink);
}

.nav-item.active {
  background: var(--surface);
  box-shadow: 0 1px 0 rgb(75 65 50 / 7%);
  color: var(--ink);
  font-weight: 700;
}

.badge {
  min-width: 23px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.sidebar-foot {
  position: absolute;
  bottom: 24px;
  left: 29px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
}

.main {
  grid-area: main;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px clamp(22px, 4vw, 64px) 80px;
}

.center-state {
  display: grid;
  min-height: calc(100vh - 190px);
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.loader {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-card {
  max-width: 580px;
  margin: 0 auto;
}

.auth-card h1 {
  max-width: 540px;
  margin: 10px 0 16px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .98;
}

.auth-card > p {
  max-width: 480px;
  margin: 0 0 26px;
  font-size: 17px;
  line-height: 1.65;
}

.eyebrow {
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.primary-button {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 13px 19px;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.primary-button:hover {
  background: #3a3530;
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: .6;
  cursor: wait;
  transform: none;
}

.primary-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.error {
  color: var(--red);
  font-size: 13px !important;
}

.view-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.view-header h1 {
  margin: 0 0 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(35px, 5vw, 54px);
  font-weight: 500;
  letter-spacing: -.045em;
}

.view-header p {
  margin: 0;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card,
.panel,
.review-card,
.problem-row,
.today-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 0 rgb(75 65 50 / 4%);
}

.stat-card {
  padding: 19px;
  border-radius: 14px;
}

.stat-value {
  display: block;
  margin-bottom: 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  letter-spacing: -.04em;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
}

.cards {
  display: grid;
  gap: 10px;
}

.today-card,
.problem-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 17px 19px;
  border-radius: 13px;
}

.item-title {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pill.easy,
.pill.good,
.pill.solved {
  background: var(--green-soft);
  color: var(--green);
}

.pill.medium,
.pill.hard-rating {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.pill.hard,
.pill.again {
  background: var(--red-soft);
  color: var(--red);
}

.due-time {
  color: var(--orange);
  font-size: 12px;
  font-weight: 750;
}

.empty {
  padding: 48px 22px;
  border: 1px dashed var(--line);
  border-radius: 15px;
  color: var(--muted);
  text-align: center;
}

.review-card {
  padding: 18px 20px;
  border-radius: 13px;
}

.review-head {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.review-note {
  margin: 13px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: #575149;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.55;
}

.problem-table-head {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(80px, .6fr));
  padding: 0 19px 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.problem-row {
  grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(80px, .6fr));
}

.number-cell {
  color: var(--muted);
  font-size: 13px;
}

.calendar-panel {
  padding: 22px;
  border-radius: 15px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  gap: 8px;
}

.calendar-day {
  min-height: 72px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf7f1;
}

.calendar-day.active {
  border-color: #dfbba9;
  background: var(--orange-soft);
}

.calendar-date {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.calendar-count {
  display: block;
  margin-top: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
}

.progress-panel {
  padding: 24px;
  border-radius: 15px;
}

.progress-row {
  display: grid;
  grid-template-columns: 150px 1fr 58px;
  gap: 16px;
  align-items: center;
  margin: 15px 0;
}

.progress-label,
.progress-value {
  font-size: 12px;
}

.progress-value {
  color: var(--muted);
  text-align: right;
}

.progress-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #e8e1d7;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

@media (max-width: 760px) {
  .shell {
    display: block;
  }

  .topbar {
    height: 60px;
    padding: 0 17px;
  }

  .account-name,
  .sync-status {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 1;
    overflow-x: auto;
    width: 100%;
    height: auto;
    padding: 9px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgb(245 241 233 / 94%);
    backdrop-filter: blur(12px);
  }

  .sidebar nav {
    display: flex;
    min-width: max-content;
  }

  .nav-item {
    width: auto;
  }

  .sidebar-foot {
    display: none;
  }

  .main {
    padding: 29px 17px 60px;
  }

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

  .problem-table-head {
    display: none;
  }

  .problem-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .problem-row .number-cell:nth-of-type(2),
  .problem-row .number-cell:nth-of-type(3) {
    display: none;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    min-height: 54px;
    padding: 5px;
  }

  .calendar-count {
    margin-top: 6px;
    font-size: 17px;
  }

  .progress-row {
    grid-template-columns: 96px 1fr 45px;
    gap: 10px;
  }
}
