:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef1f5;
  --text: #1c2026;
  --muted: #6d7581;
  --line: #e1e5ea;
  --primary: #2e66e8;
  --primary-soft: #eaf0ff;
  --green: #25835a;
  --green-soft: #e7f5ed;
  --orange: #b96925;
  --orange-soft: #fff3e5;
  --red: #ba4550;
  --red-soft: #fff0f1;
  --shadow: 0 10px 30px rgba(24, 30, 40, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.app-shell { width: min(100%, 760px); min-height: 100vh; margin: 0 auto; background: var(--bg); }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 18px 12px; }
.app-name { font-size: 24px; font-weight: 650; letter-spacing: -0.04em; }
.app-subtitle { margin-top: 2px; color: var(--muted); font-size: 12px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--text); }
.icon-button:hover { background: var(--line); }
.app-main { padding: 8px 16px 98px; }
.screen[hidden] { display: none; }
[hidden] { display: none !important; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 12px 0 18px; }
.page-heading h1 { margin: 0; font-size: 27px; font-weight: 650; letter-spacing: -0.04em; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
h3 { margin: 0; font-size: 15px; }
p { line-height: 1.55; }

.surface { margin: 12px 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.surface-soft { margin: 12px 0; padding: 14px; border-radius: 14px; background: var(--surface-soft); }
.surface-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.muted { color: var(--muted); font-size: 13px; }
.small { color: var(--muted); font-size: 12px; }
.empty-state { padding: 34px 14px; color: var(--muted); text-align: center; }

.status-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 20px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.status-banner.is-confirmed { border-color: #b8dfc8; background: var(--green-soft); color: var(--green); }
.status-banner.is-warning { border-color: #f1d4af; background: var(--orange-soft); color: var(--orange); }
.status-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.current-intro { margin: 26px 0 14px; }
.current-intro h1 { margin: 6px 0 0; font-size: 30px; line-height: 1.1; letter-spacing: -0.05em; }
.current-card { padding: 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.current-card.is-active { border: 2px solid var(--primary); }
.task-kicker { color: var(--muted); font-size: 12px; }
.current-title { margin: 8px 0 15px; font-size: 24px; font-weight: 650; letter-spacing: -0.04em; }
.live-timer { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-soft); color: var(--primary); font-size: 20px; font-variant-numeric: tabular-nums; font-weight: 700; text-align: center; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.task-meta strong { color: var(--text); font-weight: 650; }
.action-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.primary-button, .secondary-button, .danger-button, .ghost-button { min-height: 42px; border: 0; border-radius: 11px; padding: 10px 13px; font-weight: 650; }
.primary-button { background: var(--primary); color: #fff; }
.secondary-button { background: var(--surface-soft); color: var(--text); }
.danger-button { background: var(--red-soft); color: var(--red); }
.ghost-button { min-height: 34px; padding: 6px 10px; background: transparent; color: var(--primary); }
.primary-button:hover { filter: brightness(0.96); }
.action-row .primary-button { grid-column: 1 / -1; }

.notice { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); color: #2754b8; font-size: 13px; }
.notice.warning { background: var(--orange-soft); color: var(--orange); }
.notice.danger { background: var(--red-soft); color: var(--red); }
.conflict-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 12px; }

.timeline { display: grid; gap: 0; margin-top: 12px; }
.timeline-row { display: grid; grid-template-columns: 55px 14px minmax(0, 1fr); gap: 8px; min-height: 61px; }
.timeline-time { padding-top: 9px; color: var(--muted); font-size: 11px; text-align: right; }
.timeline-rail { position: relative; display: flex; justify-content: center; }
.timeline-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.timeline-marker { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 11px; border-radius: 50%; background: var(--muted); }
.timeline-content { margin-bottom: 5px; padding: 9px 11px; border-left: 3px solid var(--line); border-radius: 0 10px 10px 0; background: var(--surface); }
.timeline-content.task { border-left-color: var(--primary); }
.timeline-content.current { border-left-color: var(--green); }
.timeline-content.fixed { border-left-color: var(--muted); }
.timeline-content.conflict { border-left-color: var(--red); background: var(--red-soft); }
.timeline-title { font-size: 13px; font-weight: 600; }
.timeline-detail { margin-top: 3px; color: var(--muted); font-size: 11px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .primary-button, .toolbar .secondary-button, .toolbar .ghost-button { width: auto; }
.toolbar .date-input { flex: 1 1 150px; }
.date-input { min-height: 39px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); color: var(--text); }
.plan-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stat { padding: 12px; border-radius: 12px; background: var(--surface-soft); }
.stat-value { font-size: 21px; font-weight: 700; }
.stat-label { margin-top: 2px; color: var(--muted); font-size: 11px; }
.plan-block { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.plan-block:last-child { border-bottom: 0; }
.plan-block-time { flex: 0 0 78px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.plan-block-body { min-width: 0; flex: 1; }
.plan-block-title { overflow-wrap: anywhere; font-size: 14px; font-weight: 650; line-height: 1.35; }
.plan-block-detail { margin-top: 3px; color: var(--muted); font-size: 12px; }
.plan-block-status { flex: 0 0 auto; max-width: 48px; font-size: 11px; line-height: 1.35; text-align: right; white-space: normal; }
.plan-block-status.completed { color: var(--green); }
.plan-block-status.missed, .plan-block-status.partial { color: var(--orange); }
.plan-block-status.scheduled, .plan-block-status.active { color: var(--primary); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-field { display: grid; gap: 6px; margin: 10px 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field legend { padding: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.deadline-choice { min-width: 0; padding: 0; border: 0; }
.choice-row { display: flex; gap: 8px; }
.choice { display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13px; white-space: nowrap; }
.choice input { accent-color: var(--primary); }
.advanced-panel { margin: 14px 0 2px; border-top: 1px solid var(--line); }
.advanced-panel summary { padding: 13px 0 7px; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 650; }
.advanced-panel[open] summary { color: var(--primary); }
.advanced-panel > .form-field:first-of-type { margin-top: 4px; }
.form-field label { color: var(--muted); font-size: 12px; font-weight: 600; }
.form-field input, .form-field select, .form-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface); color: var(--text); }
.form-field textarea { resize: vertical; }
.form-hint { margin: -2px 0 8px; color: var(--muted); font-size: 12px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.checkbox-line input { width: 16px; height: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.form-actions .primary-button, .form-actions .secondary-button { flex: 1 1 160px; }

.list { display: grid; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.list-main { min-width: 0; flex: 1; }
.list-title { overflow-wrap: anywhere; font-weight: 650; line-height: 1.35; }
.list-detail { margin-top: 4px; color: var(--muted); font-size: 12px; }
.list-actions { display: flex; gap: 4px; }
.task-followup { margin-top: 8px; }
.task-followup summary { color: var(--primary); cursor: pointer; font-size: 12px; }
.followup-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.followup-row input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface); color: var(--text); }
.mode-followup { display: grid; gap: 9px; padding: 10px; border-radius: 11px; background: var(--surface-soft); }
.mode-prompt { color: var(--text); font-size: 13px; line-height: 1.5; }
.mode-hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.mode-followup .primary-button { width: 100%; }
.mode-choice-list { display: grid; gap: 6px; }
.mode-choice { display: grid; gap: 2px; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.mode-choice:hover, .mode-choice:focus-visible { border-color: var(--primary); }
.mode-choice.is-suggested { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.mode-choice-title { font-size: 13px; font-weight: 700; }
.mode-choice-detail { color: var(--muted); font-size: 11px; line-height: 1.35; }
.mode-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mode-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 600; }
.mode-controls input, .mode-controls select { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface); color: var(--text); }
.mode-followup details { border-top: 1px solid var(--line); padding-top: 7px; }
.mode-alternatives { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.mode-alternatives .ghost-button { flex: 1 1 120px; }
.rolling-goals { display: grid; gap: 8px; }
.rolling-goal { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px; border-radius: 11px; background: var(--surface-soft); }
.rolling-goal .pill { flex: 0 0 auto; }
.rolling-week { display: grid; gap: 7px; }
.rolling-day { min-width: 0; padding: 10px; border-radius: 11px; background: var(--surface-soft); }
.rolling-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.rolling-day-head strong { color: var(--text); font-size: 13px; }
.rolling-day-detail { margin-top: 4px; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; line-height: 1.45; }
.rolling-day-conflict { color: var(--red); }
.pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 3px 7px; background: var(--surface-soft); color: var(--muted); font-size: 10px; }
.pill.primary { background: var(--primary-soft); color: var(--primary); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }

.review-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.review-stat { padding: 14px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.review-stat .value { font-size: 24px; font-weight: 700; }
.review-stat .label { margin-top: 3px; color: var(--muted); font-size: 12px; }
.session-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.session-row:last-child { border-bottom: 0; }
.session-title { font-weight: 650; }
.session-detail { margin-top: 4px; color: var(--muted); font-size: 12px; }

.bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr); width: min(100%, 760px); margin: 0 auto; padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); }
.nav-item { display: grid; justify-items: center; gap: 3px; border: 0; padding: 5px 2px; background: transparent; color: var(--muted); }
.nav-item span { font-size: 17px; line-height: 1; }
.nav-item small { font-size: 11px; }
.nav-item.is-active { color: var(--primary); font-weight: 700; }

.toast { position: fixed; right: 16px; bottom: 78px; left: 16px; z-index: 20; width: min(520px, calc(100% - 32px)); margin: auto; padding: 12px 14px; border-radius: 12px; background: #20242b; color: #fff; font-size: 13px; text-align: center; box-shadow: var(--shadow); }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; align-items: end; padding: 16px; background: rgba(20, 24, 30, 0.45); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(100%, 560px); margin: auto; padding: 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.modal-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-header h2 { margin-top: 4px; }

@media (min-width: 680px) {
  .app-header { padding-inline: 24px; }
  .app-main { padding-inline: 24px; }
  .surface { padding: 20px; }
  .bottom-nav { border-right: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 16px 16px 0 0; }
}

@media (max-width: 430px) {
  .app-header { padding: 16px 14px 10px; }
  .app-name { font-size: 22px; }
  .app-main { padding: 6px 12px 88px; }
  .page-heading { margin: 10px 0 14px; }
  .page-heading h1 { font-size: 24px; }
  .surface { padding: 14px; border-radius: 14px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .plan-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .stat { padding: 9px; }
  .stat-value { font-size: 18px; }
  .action-row { grid-template-columns: 1fr 1fr; }
  .action-row .primary-button { grid-column: 1 / -1; }
  .plan-block-time { flex-basis: 65px; font-size: 11px; }
  .plan-block-status { max-width: 42px; font-size: 10px; }
  .toolbar { align-items: stretch; }
  .toolbar .date-input { flex-basis: 100%; }
  .toolbar .primary-button, .toolbar .ghost-button { flex: 1 1 0; }
  .nav-item { gap: 2px; padding-inline: 0; }
  .nav-item span { font-size: 15px; }
  .nav-item small { font-size: 10px; }
  .list-item { align-items: flex-start; padding: 11px; }
  .list-item .pill { margin-top: 2px; }
  .list-actions { align-self: flex-start; }
  .mode-controls { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100dvh - 20px); overflow-y: auto; padding: 15px; }
}

@media (max-width: 360px) {
  .review-grid { grid-template-columns: 1fr; }
  .plan-summary { grid-template-columns: 1fr; }
  .action-row { grid-template-columns: 1fr; }
  .action-row .primary-button { grid-column: auto; }
  .bottom-nav { padding-inline: 4px; }
}
