:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-soft: #0a1729;
  --panel: #0f1d32;
  --panel-strong: #13253f;
  --surface: #122238;
  --text: #f7fbff;
  --muted: #9fb1c7;
  --subtle: #6f8198;
  --border: rgba(150, 177, 210, 0.18);
  --accent: #0077ff;
  --accent-2: #35b7ff;
  --success: #29d17d;
  --danger: #ff5870;
  --warning: #ffcc66;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  --radius-sm: 6px;
  --max: 1240px;
}

body.light-theme {
  color-scheme: light;
  --bg: #eef4fb;
  --bg-soft: #f6f9fd;
  --panel: #ffffff;
  --panel-strong: #eaf2fc;
  --surface: #f7fbff;
  --text: #0b1728;
  --muted: #52657b;
  --subtle: #75869a;
  --border: rgba(47, 74, 109, 0.18);
  --shadow: 0 18px 55px rgba(26, 54, 92, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 119, 255, 0.2), transparent 32rem),
    linear-gradient(135deg, var(--bg) 0%, #09172a 46%, var(--bg-soft) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body.light-theme {
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 119, 255, 0.16), transparent 32rem),
    linear-gradient(135deg, var(--bg) 0%, #f8fbff 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(0, 119, 255, 0.55);
  border-radius: var(--radius);
  color: white;
  background: linear-gradient(135deg, var(--accent), #00b7ff);
  box-shadow: 0 16px 34px rgba(0, 119, 255, 0.28);
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  font-size: 1rem;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tool-button,
.icon-button,
.submit-button,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.tool-button {
  padding: 0 13px;
  font-size: 0.88rem;
  font-weight: 750;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.tool-button:hover,
.icon-button:hover,
.primary-link:hover,
.submit-button:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 119, 255, 0.65);
  background: rgba(0, 119, 255, 0.14);
}

.tool-button.danger:hover {
  border-color: rgba(255, 88, 112, 0.7);
  background: rgba(255, 88, 112, 0.12);
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.progress-panel,
.service-callout,
.checklist-panel,
.side-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.progress-panel {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  padding: 34px;
}

.section-label {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 4.4vw, 4.6rem);
  line-height: 0.98;
  font-weight: 900;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: 0;
}

.lead,
.week-header p,
.service-callout p {
  color: var(--muted);
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
  font-size: 1.05rem;
}

.progress-card {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  justify-content: center;
  min-height: 220px;
  padding: 24px;
  border: 1px solid rgba(0, 119, 255, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(0, 119, 255, 0.2), rgba(53, 183, 255, 0.05)),
    var(--panel);
}

.progress-number {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

#progressPercent {
  font-size: clamp(3.2rem, 8vw, 6.2rem);
  line-height: 0.86;
  font-weight: 950;
}

#dayCounter {
  max-width: 110px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
  text-align: right;
}

.progress-track {
  overflow: hidden;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 260ms ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.service-callout {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-color: rgba(0, 119, 255, 0.32);
  background: linear-gradient(90deg, rgba(0, 119, 255, 0.16), rgba(41, 209, 125, 0.06));
}

.service-callout h2 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.service-callout p {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.primary-link {
  flex: 0 0 auto;
  min-width: max-content;
  padding: 0 16px;
  color: white;
  background: var(--accent);
  border-color: var(--accent);
  font-size: 0.92rem;
  font-weight: 850;
}

.primary-link:hover {
  background: #0069df;
  box-shadow: 0 14px 32px rgba(0, 119, 255, 0.28);
}

.checklist-panel {
  overflow: hidden;
  min-width: 0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.tab-button {
  min-height: 74px;
  padding: 14px;
  border: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

.tab-button span {
  display: block;
}

.tab-button .tab-week {
  margin-bottom: 4px;
  color: var(--subtle);
  font-size: 0.73rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tab-button .tab-name {
  color: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
}

.tab-button[aria-selected="true"] {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(0, 119, 255, 0.22), rgba(0, 119, 255, 0.08)),
    var(--panel);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.week-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 24px 12px;
}

.week-header p {
  max-width: 440px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.task-list {
  display: grid;
  gap: 10px;
  padding: 0 18px 22px;
}

.task-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.task-item:hover {
  border-color: rgba(0, 119, 255, 0.45);
  transform: translateY(-1px);
}

.task-item.completed {
  border-color: rgba(41, 209, 125, 0.45);
  background: rgba(41, 209, 125, 0.075);
}

.checkbox-wrap {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  margin-top: 2px;
}

.checkbox-wrap input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.fake-check {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(159, 177, 199, 0.45);
  border-radius: var(--radius-sm);
  color: transparent;
  background: rgba(255, 255, 255, 0.05);
  transition: all 160ms ease;
}

.checkbox-wrap input:focus-visible + .fake-check {
  outline: 3px solid rgba(0, 119, 255, 0.45);
  outline-offset: 2px;
}

.checkbox-wrap input:checked + .fake-check {
  border-color: var(--success);
  color: #052313;
  background: var(--success);
}

.task-content {
  min-width: 0;
}

.task-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 7px;
}

.task-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.28;
  font-weight: 850;
}

.task-time {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(0, 119, 255, 0.35);
  border-radius: var(--radius-sm);
  color: var(--accent-2);
  background: rgba(0, 119, 255, 0.09);
  font-size: 0.78rem;
  font-weight: 850;
}

.task-description,
.task-tip {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.task-tip {
  margin-top: 8px;
  color: var(--text);
}

.task-tip strong {
  color: var(--success);
}

.custom-task-badge {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--warning);
  background: rgba(255, 204, 102, 0.12);
  font-size: 0.7rem;
  font-weight: 850;
  vertical-align: middle;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.side-card {
  padding: 20px;
}

.custom-form {
  display: grid;
  gap: 13px;
}

.custom-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.custom-form input,
.custom-form textarea,
.custom-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  padding: 11px 12px;
  outline: none;
}

.custom-form textarea {
  resize: vertical;
}

.custom-form input:focus,
.custom-form textarea:focus,
.custom-form select:focus {
  border-color: rgba(0, 119, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.18);
}

.submit-button {
  width: 100%;
  padding: 0 15px;
  color: white;
  background: linear-gradient(135deg, var(--accent), #00a7ff);
  border-color: transparent;
  font-weight: 900;
}

.stats-card dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.stats-card div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
}

.stats-card dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.stats-card dd {
  margin: 3px 0 0;
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 950;
}

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

.footer p {
  margin: 0;
  font-size: 0.92rem;
}

.footer a {
  color: var(--text);
  font-weight: 850;
  text-decoration-color: rgba(0, 119, 255, 0.6);
  text-underline-offset: 4px;
}

@media (max-width: 980px) {
  .main-layout,
  .progress-panel {
    grid-template-columns: 1fr;
  }

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

  .side-panel {
    grid-column: 1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .service-callout,
  .week-header,
  .progress-number,
  .progress-meta,
  .task-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 16px;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .progress-panel {
    padding: 22px;
  }

  h1 {
    font-size: clamp(2.1rem, 13vw, 3.4rem);
  }

  #dayCounter,
  .task-time {
    max-width: none;
    text-align: left;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  .tab-button {
    min-height: 58px;
  }

  .primary-link {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media print {
  :root,
  body.light-theme {
    --bg: #ffffff;
    --panel: #ffffff;
    --surface: #ffffff;
    --text: #111827;
    --muted: #374151;
    --border: #d1d5db;
    --shadow: none;
  }

  body {
    background: #ffffff !important;
  }

  .app-shell {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .toolbar,
  .service-callout,
  .side-panel {
    display: none !important;
  }

  .topbar,
  .main-layout,
  .progress-panel,
  .week-header {
    display: block;
  }

  .progress-panel,
  .checklist-panel {
    border: 0;
    box-shadow: none;
    break-inside: avoid;
  }

  .tabs {
    display: none;
  }

  .task-list {
    padding: 0;
  }

  .task-item {
    break-inside: avoid;
    background: #ffffff;
  }

  .footer {
    color: #374151;
  }
}
