:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #5d6875;
  --line: #d9e1e8;
  --paper: #f7f9fb;
  --panel: #ffffff;
  --teal: #117c7a;
  --coral: #d85a47;
  --gold: #c28a16;
  --blue: #2b67b8;
  --green: #347c4f;
  --shadow: 0 16px 40px rgba(23, 33, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(18px, 4vw, 56px) 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 22px auto 48px;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats span,
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--muted);
}

.stats strong {
  color: var(--ink);
}

.controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px) minmax(150px, 190px);
  gap: 12px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(17, 124, 122, 0.22);
  outline-offset: 2px;
}

.quick-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.chip {
  cursor: pointer;
  white-space: nowrap;
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}

.planner,
.app-card,
dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.planner {
  position: sticky;
  top: 16px;
  padding: 18px;
}

.focus-meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  gap: 8px;
  height: 108px;
  padding: 12px;
  background: #eef4f4;
  border-radius: 8px;
  margin-bottom: 14px;
}

.focus-meter span {
  display: block;
  border-radius: 6px 6px 2px 2px;
  background: var(--teal);
}

.subject-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.subject-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 12px;
}

.section-head p {
  margin-bottom: 10px;
  color: var(--muted);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.app-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 260px;
  padding: 16px;
  box-shadow: 0 1px 0 rgba(23, 33, 43, 0.04);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
}

.favorite {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.favorite.saved {
  border-color: var(--gold);
  background: #fff6df;
  color: var(--gold);
}

.app-card h3 {
  margin: 14px 0 7px;
  font-size: 1.05rem;
}

.description {
  color: var(--muted);
  line-height: 1.5;
}

.tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #435160;
  font-size: 0.74rem;
  font-weight: 800;
}

.open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(560px, calc(100% - 26px));
  padding: 24px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(23, 33, 43, 0.42);
}

.close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.steps {
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 780px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .controls,
  .layout {
    grid-template-columns: 1fr;
  }

  .planner {
    position: static;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }
}

