  :root {
    --bg: #0d1117;
    --card: #161b22;
    --card-2: #1c2330;
    --line: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #79c0ff;
    --accent-ink: #0d1117;
    --good: #56d364;
    --late: #f0883e;
    --bad: #ff7b72;
    --radius: 16px;
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html { color-scheme: dark; }
  html, body { margin: 0; background: var(--bg); color: var(--text); }
  body {
    font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    padding: max(16px, env(safe-area-inset-top)) 16px calc(110px + env(safe-area-inset-bottom));
    max-width: 560px; margin: 0 auto; min-height: 100vh;
  }
  button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
  h2 {
    font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); margin: 28px 4px 10px; display: flex; justify-content: space-between;
  }
  h2 small { font-weight: 500; letter-spacing: 0; text-transform: none; }

  /* Header */
  .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
  .hello { color: var(--muted); font-size: 15px; }
  .day { font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 2px; }
  .ring { position: relative; width: 72px; height: 72px; flex: none; }
  .ring svg { transform: rotate(-90deg); }
  .ring .num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 17px; line-height: 1.1; }
  .ring .num small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }

  /* Cards */
  .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
  .focus { margin-top: 18px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; border-color: var(--accent); }
  .focus .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; animation: pulse 1.6s infinite; }
  @keyframes pulse { 50% { opacity: .3; } }
  .focus .what { flex: 1; min-width: 0; }
  .focus .what b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .focus .what span { color: var(--muted); font-size: 14px; }

  .next { margin-top: 18px; padding: 18px; background: linear-gradient(160deg, #1b2a3d, var(--card) 70%); }
  .next .label { font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
  .next .title { font-size: 22px; font-weight: 700; margin: 6px 0 4px; overflow-wrap: anywhere; }
  .next .meta { color: var(--muted); font-size: 15px; }
  .next .actions { display: flex; gap: 10px; margin-top: 16px; }
  .btn { min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
  .btn.primary { background: var(--accent); color: var(--accent-ink); flex: 1; }
  .btn.ghost { background: var(--card-2); border: 1px solid var(--line); }
  .btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 10px; }

  /* Task rows */
  .list { overflow: hidden; }
  .row { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px; min-height: 60px; border-top: 1px solid var(--line); }
  .row:first-child { border-top: 0; }
  .time { width: 64px; flex: none; font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; }
  .time small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
  /* The tap area is 44px; the drawn circle inside is 30px. */
  .tick { width: 44px; height: 44px; margin: -7px; flex: none; border: 0; background: none; display: grid; place-items: center; }
  .tick::before { content: ''; grid-area: 1 / 1; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--muted); transition: background .15s, border-color .15s; }
  .tick svg { grid-area: 1 / 1; opacity: 0; transition: opacity .15s; }
  .row.done .tick::before { background: var(--good); border-color: var(--good); }
  .row.done .tick svg { opacity: 1; }
  .body { flex: 1; min-width: 0; }
  .body b { font-weight: 600; display: block; overflow-wrap: anywhere; }
  .row.done .body b { text-decoration: line-through; color: var(--muted); }
  .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 13px; color: var(--muted); }
  .tag.late { color: var(--late); font-weight: 600; }
  .tag.high { color: var(--bad); font-weight: 600; }
  .tag.missed { color: var(--bad); }
  .more { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--muted); border-radius: 10px; }
  .row.now { background: rgba(121, 192, 255, .07); }
  /* Drag to reorder (TASK-009). touch-action: none lets the finger drag the row instead of scrolling the page. */
  .handle { width: 44px; height: 44px; margin-left: -8px; flex: none; display: grid; place-items: center; color: var(--muted); touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .list.sorting { overflow: visible; }
  .row.dragging { position: relative; z-index: 2; background: var(--card-2); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); cursor: grabbing; }
  .row.dragging .handle { color: var(--accent); }
  .drag-hint { margin: 8px 4px 0; }
  .row.now .time { color: var(--accent); }

  /* Habits */
  .habits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .habit { padding: 14px; text-align: left; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
  .habit b { font-weight: 600; overflow-wrap: anywhere; }
  .habit .sub { font-size: 13px; color: var(--muted); }
  .bar { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
  .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
  .habit.done { border-color: rgba(86, 211, 100, .5); }
  .habit.done .bar i { background: var(--good); }
  .habit.done .sub { color: var(--good); }

  /* Goals */
  .goal { padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
  .goal + .goal { margin-top: 10px; }
  .goal .body .bar { margin-top: 8px; }

  /* Done list */
  details.card { padding: 0; }
  details summary { list-style: none; padding: 14px 16px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; cursor: pointer; }
  details summary::-webkit-details-marker { display: none; }
  details[open] summary { border-bottom: 1px solid var(--line); }

  .empty { padding: 22px 16px; text-align: center; color: var(--muted); }
  .empty b { display: block; color: var(--text); font-size: 18px; margin-bottom: 4px; }
  .foot { margin-top: 28px; text-align: center; color: var(--muted); font-size: 13px; display: flex; justify-content: center; align-items: center; gap: 10px; }
  .foot button { color: var(--accent); font-weight: 600; min-height: 44px; padding: 0 8px; }
  .banner { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #2d1f12; color: #ffc58a; font-size: 14px; }

  /* Bottom sheet and toast */
  .sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; }
  .sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; background: var(--card); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; z-index: 31; }
  .sheet.open { transform: none; visibility: visible; transition: transform .22s ease; }
  .sheet-bg.open { opacity: 1; pointer-events: auto; }
  .sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
  .sheet .what { font-weight: 700; font-size: 18px; margin: 0 4px 12px; overflow-wrap: anywhere; }
  .sheet button { width: 100%; text-align: left; min-height: 52px; padding: 0 14px; border-radius: 12px; font-size: 17px; display: flex; align-items: center; gap: 12px; }
  .sheet button:active { background: var(--card-2); }
  .sheet .cancel { justify-content: center; color: var(--muted); margin-top: 6px; }
  /* Tab bar */
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: rgba(13, 17, 23, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar[hidden] { display: none; }
  .tabbar .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
  .tab { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 12px; }
  .tab.on { color: var(--accent); }
  .tab.plus .circle { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(121, 192, 255, .35); }
  .tab.plus { color: var(--text); }

  /* Goals and Habits lists */
  .item { display: flex; align-items: center; gap: 12px; padding: 14px 8px 14px 16px; }
  .item + .item { margin-top: 10px; }
  .item .body { flex: 1; min-width: 0; }
  .item .body b { display: block; overflow-wrap: anywhere; }
  .item .sub { color: var(--muted); font-size: 14px; margin-top: 3px; overflow-wrap: anywhere; }
  .item .sub.ok { color: var(--good); }
  .pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: var(--muted); margin-left: 6px; vertical-align: middle; }
  .pagehead { margin-top: 8px; display: flex; align-items: baseline; justify-content: space-between; }
  .pagehead .day { font-size: 30px; font-weight: 700; }
  .hint { color: var(--muted); font-size: 14px; margin: 6px 4px 0; }

  /* + form */
  .form { position: fixed; left: 0; right: 0; bottom: 0; top: max(24px, env(safe-area-inset-top)); max-width: 560px; margin: 0 auto; background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; z-index: 12; display: flex; flex-direction: column; transform: translateY(105%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
  .form.open { transform: none; visibility: visible; transition: transform .25s ease; }
  .fhead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); }
  .fhead b { font-size: 17px; }
  .fhead button { min-height: 44px; padding: 0 10px; font-weight: 600; color: var(--muted); }
  .fhead button:first-child { justify-self: start; }
  .fhead .save { justify-self: end; color: var(--accent); }
  .fhead .save[disabled] { opacity: .5; }
  .fbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
  .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; }
  .seg button { min-height: 44px; border-radius: 9px; font-weight: 600; color: var(--muted); }
  .seg button.on { background: var(--card-2); color: var(--text); box-shadow: 0 0 0 1px var(--line) inset; }
  .field { margin-bottom: 16px; }
  .field[hidden] { display: none; }
  .field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 4px 6px; }
  .field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 12px; -webkit-appearance: none; appearance: none; }
  .field input[type=date], .field input[type=time] { display: block; text-align: left; }
  .field textarea { min-height: 84px; resize: none; }
  .field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--accent); }
  .field.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .field.row2 label { margin-top: 0; }
  .field select { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%238b949e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
  .ferr { color: var(--bad); font-weight: 600; margin: 4px 4px 0; min-height: 22px; }
  .toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: 528px; margin: 0 auto; background: #e6edf3; color: #0d1117; border-radius: 14px; padding: 12px 12px 12px 16px; display: flex; align-items: center; gap: 12px; font-weight: 600; transform: translateY(150%); visibility: hidden; transition: transform .2s, visibility 0s .2s; z-index: 40; }
  .toast.show { transform: none; visibility: visible; transition: transform .2s; }
  .toast span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .toast button { color: #0550ae; font-weight: 700; min-height: 44px; padding: 0 10px; }

  .skeleton { height: 60px; border-radius: var(--radius); background: var(--card); margin-top: 12px; animation: pulse 1.4s infinite; }
  .gate { margin-top: 30vh; text-align: center; }
  .gate b { font-size: 22px; display: block; margin-bottom: 8px; }
  .gate p { color: var(--muted); margin: 0 auto; max-width: 320px; }
  @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

  /* More menu rows */
  .row.menu { width: 100%; text-align: left; min-height: 64px; }
  .row.menu .mi { width: 32px; font-size: 22px; text-align: center; flex: none; }
  .row.menu .sub { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
  .row.menu .chev { color: var(--muted); font-size: 24px; padding-right: 8px; }

  .btn.danger { background: transparent; border: 1px solid var(--bad); color: var(--bad); }

  .quick { display: flex; gap: 10px; margin-top: 14px; }
  .quick .btn { flex: 1; }
