:root {
      color-scheme: light;
      --bg: #f7f8fb;
      --surface: rgba(255, 255, 255, 0.92);
      --surface-solid: #ffffff;
      --surface-soft: #f1f5f9;
      --surface-hover: #eef2f7;
      --text: #0f172a;
      --muted: #667085;
      --faint: #98a2b3;
      --border: rgba(15, 23, 42, 0.1);
      --border-strong: rgba(15, 23, 42, 0.16);
      --primary: #155eef;
      --primary-2: #004eeb;
      --primary-soft: rgba(21, 94, 239, 0.1);
      --green: #12b76a;
      --green-soft: rgba(18, 183, 106, 0.11);
      --orange: #f79009;
      --orange-soft: rgba(247, 144, 9, 0.12);
      --red: #f04438;
      --shadow: 0 22px 60px rgba(15, 23, 42, 0.08);
      --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.06);
      --radius-xl: 28px;
      --radius-lg: 22px;
      --radius-md: 16px;
      --radius-sm: 12px;
      --sidebar: 300px;
      --ease: cubic-bezier(.2,.8,.2,1);
    }

    [data-theme="dark"] {
      color-scheme: dark;
      --bg: #070b14;
      --surface: rgba(15, 23, 42, 0.86);
      --surface-solid: #0f172a;
      --surface-soft: #121a2b;
      --surface-hover: #172033;
      --text: #f8fafc;
      --muted: #a3aab8;
      --faint: #677084;
      --border: rgba(255, 255, 255, 0.09);
      --border-strong: rgba(255, 255, 255, 0.16);
      --primary: #84adff;
      --primary-2: #528bff;
      --primary-soft: rgba(132, 173, 255, 0.14);
      --green: #47cd89;
      --green-soft: rgba(71, 205, 137, 0.13);
      --orange: #fdb022;
      --orange-soft: rgba(253, 176, 34, 0.14);
      --red: #f97066;
      --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
      --shadow-soft: 0 14px 44px rgba(0, 0, 0, 0.28);
    }

    * { box-sizing: border-box; }

    html { scroll-behavior: smooth; }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background:
        radial-gradient(circle at 15% 0%, rgba(21, 94, 239, 0.10), transparent 28%),
        radial-gradient(circle at 92% 10%, rgba(18, 183, 106, 0.08), transparent 24%),
        var(--bg);
      color: var(--text);
      line-height: 1.55;
      letter-spacing: -0.015em;
    }

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

    .app {
      display: grid;
      grid-template-columns: var(--sidebar) 1fr;
      min-height: 100vh;
    }

    .sidebar {
      position: sticky;
      top: 0;
      height: 100vh;
      padding: 22px 18px;
      border-right: 1px solid var(--border);
      background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
      backdrop-filter: blur(22px);
      overflow: auto;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 22px;
      padding: 8px 6px;
    }

    .brand-mark {
      width: 38px;
      height: 38px;
      display: grid;
      place-items: center;
      border-radius: 13px;
      background: linear-gradient(145deg, var(--primary), var(--primary-2));
      color: white;
      font-weight: 900;
      box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 30%, transparent);
    }

    .brand-title {
      font-size: 15px;
      font-weight: 850;
      letter-spacing: -0.03em;
    }

    .brand-subtitle {
      margin-top: 1px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
    }

    .progress-card {
      padding: 16px;
      margin-bottom: 18px;
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      background: var(--surface);
      box-shadow: var(--shadow-soft);
    }

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

    .progress-label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .progress-number {
      font-size: 28px;
      font-weight: 900;
      letter-spacing: -0.05em;
    }

    .ring {
      --value: 0deg;
      width: 58px;
      height: 58px;
      border-radius: 50%;
      background: conic-gradient(var(--primary) var(--value), var(--surface-soft) 0);
      position: relative;
      flex: 0 0 auto;
    }

    .ring::after {
      content: "";
      position: absolute;
      inset: 7px;
      border-radius: inherit;
      background: var(--surface-solid);
    }

    .bar {
      height: 9px;
      border-radius: 999px;
      overflow: hidden;
      background: var(--surface-soft);
      border: 1px solid var(--border);
    }

    .bar-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--primary), var(--green));
      border-radius: inherit;
      transition: width 420ms var(--ease);
    }

    .side-section { margin-top: 20px; }

    .side-heading {
      margin: 0 0 10px;
      padding: 0 8px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 850;
      text-transform: uppercase;
      letter-spacing: 0.09em;
    }

    .nav-list {
      display: grid;
      gap: 6px;
    }

    .nav-btn {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 11px;
      border: 1px solid transparent;
      border-radius: 13px;
      background: transparent;
      color: var(--muted);
      text-align: left;
      font-size: 14px;
      font-weight: 750;
      transition: 180ms var(--ease);
    }

    .nav-btn:hover,
    .nav-btn.active {
      color: var(--text);
      background: var(--surface-soft);
      border-color: var(--border);
    }

    .nav-btn .count {
      min-width: 25px;
      padding: 2px 7px;
      border-radius: 999px;
      background: var(--surface-solid);
      border: 1px solid var(--border);
      color: var(--muted);
      font-size: 11px;
      text-align: center;
    }

    .day-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 6px;
    }

    .day-jump {
      height: 34px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--surface-soft);
      color: var(--muted);
      font-size: 12px;
      font-weight: 850;
      transition: 160ms var(--ease);
    }

    .day-jump:hover {
      transform: translateY(-1px);
      border-color: var(--primary);
      color: var(--text);
    }

    .day-jump.done {
      background: var(--green-soft);
      border-color: color-mix(in srgb, var(--green) 34%, var(--border));
      color: var(--green);
    }

    .main {
      min-width: 0;
      padding: 24px clamp(22px, 4vw, 54px) 70px;
    }

    .topbar {
      position: sticky;
      top: 16px;
      z-index: 50;
      display: grid;
      grid-template-columns: minmax(240px, 1fr) auto auto auto;
      gap: 10px;
      align-items: center;
      margin-bottom: 22px;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: 20px;
      background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
      backdrop-filter: blur(24px);
      box-shadow: var(--shadow-soft);
    }

    .search {
      position: relative;
    }

    .search input {
      width: 100%;
      height: 44px;
      padding: 0 14px 0 42px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--surface-soft);
      color: var(--text);
      outline: none;
      font-size: 14px;
      font-weight: 650;
      transition: 180ms var(--ease);
    }

    .search input:focus {
      border-color: var(--primary);
      background: var(--surface-solid);
      box-shadow: 0 0 0 4px var(--primary-soft);
    }

    .search::before {
      content: "/";
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      width: 20px;
      height: 20px;
      display: grid;
      place-items: center;
      border-radius: 6px;
      background: var(--surface-solid);
      border: 1px solid var(--border);
      color: var(--muted);
      font-size: 12px;
      font-weight: 850;
      pointer-events: none;
    }

    .select,
    .action-btn {
      height: 44px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--surface-soft);
      color: var(--text);
      outline: none;
      font-size: 14px;
      font-weight: 750;
    }

    .select {
      min-width: 155px;
      padding: 0 12px;
    }

    .action-btn {
      padding: 0 14px;
      transition: 180ms var(--ease);
    }

    .action-btn:hover {
      border-color: var(--primary);
      background: var(--primary-soft);
    }

    .action-btn.primary {
      color: white;
      border-color: var(--primary);
      background: var(--primary);
    }

    .hero {
      position: relative;
      overflow: hidden;
      display: grid;
      grid-template-columns: 1fr 340px;
      gap: 22px;
      margin-bottom: 22px;
      padding: 28px;
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 80%, transparent), transparent 44%),
        var(--surface);
      box-shadow: var(--shadow);
    }

    .hero::after {
      content: "";
      position: absolute;
      width: 480px;
      height: 480px;
      right: -260px;
      top: -260px;
      border-radius: 50%;
      border: 1px solid var(--border);
      background: radial-gradient(circle, var(--primary-soft), transparent 60%);
      pointer-events: none;
    }

    .kicker {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 14px;
      padding: 6px 10px;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: var(--surface-solid);
      color: var(--muted);
      font-size: 12px;
      font-weight: 850;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .status-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--green);
      box-shadow: 0 0 0 4px var(--green-soft);
    }

    h1 {
      margin: 0 0 14px;
      max-width: 820px;
      font-size: clamp(34px, 5vw, 62px);
      line-height: 0.98;
      letter-spacing: -0.06em;
      font-weight: 920;
    }

    .lead {
      margin: 0;
      max-width: 760px;
      color: var(--muted);
      font-size: 17px;
    }

    .hero-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 22px;
    }

    .hero-btn {
      height: 44px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0 15px;
      border-radius: 14px;
      border: 1px solid var(--border);
      background: var(--surface-solid);
      color: var(--text);
      font-weight: 800;
      text-decoration: none;
      transition: 180ms var(--ease);
    }

    .hero-btn:hover {
      transform: translateY(-1px);
      border-color: var(--primary);
    }

    .hero-btn.primary {
      background: var(--primary);
      border-color: var(--primary);
      color: white;
    }

    .today-card {
      position: relative;
      z-index: 1;
      align-self: stretch;
      display: grid;
      align-content: space-between;
      gap: 18px;
      padding: 20px;
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      background: var(--surface-solid);
    }

    .today-label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 850;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .today-title {
      margin: 7px 0 8px;
      font-size: 24px;
      line-height: 1.12;
      font-weight: 900;
      letter-spacing: -0.04em;
    }

    .today-focus {
      margin: 0;
      color: var(--muted);
      font-size: 14px;
    }

    .metric-strip {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-bottom: 22px;
    }

    .metric {
      padding: 17px;
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      background: var(--surface);
      box-shadow: var(--shadow-soft);
    }

    .metric-label {
      margin-bottom: 8px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 850;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .metric-value {
      font-size: 30px;
      line-height: 1;
      font-weight: 920;
      letter-spacing: -0.055em;
    }

    .metric-note {
      margin-top: 8px;
      color: var(--faint);
      font-size: 12px;
      font-weight: 650;
    }

    .bento {
      display: grid;
      grid-template-columns: 1.25fr 0.75fr;
      gap: 16px;
      margin-bottom: 22px;
    }

    .panel {
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      background: var(--surface);
      box-shadow: var(--shadow-soft);
      overflow: hidden;
    }

    .panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 18px 20px;
      border-bottom: 1px solid var(--border);
      background: color-mix(in srgb, var(--surface-soft) 58%, transparent);
    }

    .panel-title {
      margin: 0;
      font-size: 16px;
      font-weight: 900;
      letter-spacing: -0.03em;
    }

    .panel-subtitle {
      margin-top: 2px;
      color: var(--muted);
      font-size: 13px;
      font-weight: 650;
    }

    .panel-body { padding: 18px 20px; }

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

    .rule {
      display: grid;
      grid-template-columns: 28px 1fr;
      gap: 11px;
      align-items: start;
      padding: 12px;
      border: 1px solid var(--border);
      border-radius: 15px;
      background: var(--surface-solid);
    }

    .rule-index {
      width: 28px;
      height: 28px;
      display: grid;
      place-items: center;
      border-radius: 9px;
      background: var(--primary-soft);
      color: var(--primary);
      font-size: 12px;
      font-weight: 900;
    }

    .rule strong {
      display: block;
      margin-bottom: 2px;
      font-size: 14px;
      font-weight: 850;
    }

    .rule span {
      color: var(--muted);
      font-size: 13px;
    }

    .phase-list {
      display: grid;
      gap: 10px;
    }

    .phase {
      padding: 13px;
      border: 1px solid var(--border);
      border-radius: 15px;
      background: var(--surface-solid);
    }

    .phase-top {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 8px;
      font-size: 13px;
      font-weight: 850;
    }

    .phase-days { color: var(--muted); }

    .section-title-row {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 18px;
      margin: 26px 0 14px;
    }

    .section-kicker {
      margin: 0 0 4px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 850;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .section-title {
      margin: 0;
      font-size: 26px;
      line-height: 1.1;
      font-weight: 920;
      letter-spacing: -0.045em;
    }

    .view-toggle {
      display: inline-flex;
      padding: 4px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--surface);
    }

    .view-toggle button {
      height: 34px;
      padding: 0 11px;
      border: 0;
      border-radius: 10px;
      background: transparent;
      color: var(--muted);
      font-size: 13px;
      font-weight: 800;
    }

    .view-toggle button.active {
      background: var(--surface-soft);
      color: var(--text);
      box-shadow: inset 0 0 0 1px var(--border);
    }

    .timeline {
      display: grid;
      gap: 14px;
    }

    .timeline.compact .day-card .day-content { display: none; }
    .timeline.compact .day-card.open .day-content { display: grid; }

    .day-card {
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      background: var(--surface);
      box-shadow: var(--shadow-soft);
      overflow: hidden;
      transition: 200ms var(--ease);
    }

    .day-card.hidden { display: none; }

    .day-card:hover {
      border-color: var(--border-strong);
      transform: translateY(-1px);
    }

    .day-head {
      display: grid;
      grid-template-columns: auto 1fr auto;
      gap: 16px;
      align-items: center;
      padding: 18px 20px;
      background: linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 60%, transparent), transparent);
    }

    .day-number {
      width: 48px;
      height: 48px;
      display: grid;
      place-items: center;
      border-radius: 16px;
      border: 1px solid var(--border);
      background: var(--surface-solid);
      color: var(--text);
      font-weight: 920;
      letter-spacing: -0.04em;
    }

    .day-card.done .day-number {
      background: var(--green-soft);
      border-color: color-mix(in srgb, var(--green) 34%, var(--border));
      color: var(--green);
    }

    .day-main-title {
      margin: 0 0 5px;
      font-size: 19px;
      line-height: 1.2;
      font-weight: 900;
      letter-spacing: -0.035em;
    }

    .day-focus {
      margin: 0;
      color: var(--muted);
      font-size: 13px;
    }

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

    .badge {
      display: inline-flex;
      align-items: center;
      height: 24px;
      padding: 0 8px;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: var(--surface-solid);
      color: var(--muted);
      font-size: 11px;
      font-weight: 850;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .badge.primary {
      color: var(--primary);
      background: var(--primary-soft);
      border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
    }

    .day-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .check-day {
      width: 42px;
      height: 42px;
      display: grid;
      place-items: center;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--surface-solid);
      color: var(--muted);
      font-weight: 900;
      transition: 170ms var(--ease);
    }

    .check-day:hover { border-color: var(--green); color: var(--green); }
    .day-card.done .check-day { background: var(--green-soft); border-color: var(--green); color: var(--green); }

    .expand-day {
      width: 42px;
      height: 42px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--surface-solid);
      color: var(--muted);
      font-weight: 900;
      transition: 170ms var(--ease);
    }

    .expand-day:hover { border-color: var(--primary); color: var(--primary); }
    .day-card.open .expand-day { transform: rotate(180deg); }

    .day-content {
      display: grid;
      grid-template-columns: 1.35fr 0.65fr;
      gap: 14px;
      padding: 0 20px 20px;
      animation: reveal 220ms var(--ease);
    }

    @keyframes reveal {
      from { opacity: 0; transform: translateY(-4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .task-panel,
    .mini-panel {
      border: 1px solid var(--border);
      border-radius: 18px;
      background: var(--surface-solid);
      overflow: hidden;
    }

    .mini-panels {
      display: grid;
      gap: 14px;
    }

    .mini-head,
    .task-head {
      padding: 12px 14px;
      border-bottom: 1px solid var(--border);
      background: var(--surface-soft);
      color: var(--muted);
      font-size: 12px;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .task-list {
      list-style: none;
      margin: 0;
      padding: 6px 14px;
    }

    .task-list li {
      display: grid;
      grid-template-columns: 22px 1fr;
      gap: 10px;
      align-items: start;
      padding: 10px 0;
      border-bottom: 1px solid var(--border);
    }

    .task-list li:last-child { border-bottom: 0; }

    .task-list input {
      width: 17px;
      height: 17px;
      margin-top: 3px;
      accent-color: var(--green);
    }

    .task-list span {
      font-size: 14px;
    }

    .task-list span.done {
      color: var(--faint);
      text-decoration: line-through;
    }

    .mini-list {
      margin: 0;
      padding: 12px 14px 14px 31px;
      color: var(--text);
      font-size: 14px;
    }

    .mini-list li + li { margin-top: 7px; }

    .extra-text {
      margin: 0;
      padding: 12px 14px 14px;
      color: var(--text);
      font-size: 14px;
    }

    .template-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-top: 16px;
    }

    pre {
      margin: 0;
      padding: 16px;
      overflow: auto;
      border: 1px solid var(--border);
      border-radius: 18px;
      background: #0b1220;
      color: #dbeafe;
      font-size: 12.5px;
      line-height: 1.65;
      white-space: pre-wrap;
      letter-spacing: 0;
    }

    .empty {
      display: none;
      padding: 34px;
      border: 1px dashed var(--border-strong);
      border-radius: var(--radius-xl);
      background: var(--surface);
      color: var(--muted);
      text-align: center;
      font-weight: 700;
    }

    .toast {
      position: fixed;
      right: 22px;
      bottom: 22px;
      z-index: 100;
      transform: translateY(18px);
      opacity: 0;
      pointer-events: none;
      padding: 12px 14px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: var(--surface-solid);
      box-shadow: var(--shadow);
      color: var(--text);
      font-size: 14px;
      font-weight: 750;
      transition: 220ms var(--ease);
    }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    @media (max-width: 1120px) {
      :root { --sidebar: 270px; }
      .hero, .bento, .day-content, .template-grid { grid-template-columns: 1fr; }
      .metric-strip { grid-template-columns: repeat(2, 1fr); }
    }

    @media (max-width: 860px) {
      .app { display: block; }
      .sidebar {
        position: static;
        width: auto;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
      }
      .main { padding: 18px 16px 54px; }
      .topbar {
        position: static;
        grid-template-columns: 1fr;
        border-radius: 18px;
      }
      .metric-strip { grid-template-columns: 1fr; }
      h1 { font-size: 38px; }
      .day-head { grid-template-columns: auto 1fr; }
      .day-actions { grid-column: 1 / -1; justify-content: flex-end; }
    }

    @media print {
      body { background: white; }
      .sidebar, .topbar, .hero-actions, .day-actions, .toast { display: none !important; }
      .app, .main { display: block; padding: 0; }
      .hero, .metric, .panel, .day-card { box-shadow: none; break-inside: avoid; }
      .day-content { display: grid !important; }
    }
