:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #151b23;
  --surface-soft: #1b2430;
  --surface-blue: #1d2a3a;
  --text: #edf2f7;
  --muted: #9fb0c3;
  --line: #283548;
  --line-strong: #324760;
  --blue: #6cb6ff;
  --blue-dark: #9ed0ff;
  --teal: #59d5c6;
  --green: #49c47b;
  --amber: #f0b56a;
  --red: #ff8b8b;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans JP", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(108, 182, 255, 0.14), transparent 32rem),
    linear-gradient(180deg, #10161d 0%, var(--bg) 38%);
  color: var(--text);
}

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

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-copy {
  border-color: rgba(108, 182, 255, 0.18);
  background: linear-gradient(135deg, #131922 0%, #18212d 58%, #11211e 100%);
  min-height: 178px;
  padding: 24px;
  border: 1px solid rgba(108, 182, 255, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 820px;
  margin: 8px 0 10px;
  font-size: clamp(2rem, 4.4vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.lead {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.7;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-weight: 850;
  font-size: 0.76rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-strip,
.panel {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px;
}

.status-strip span {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.status-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 2.45rem;
  line-height: 1;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 20px;
  min-width: 0;
}

.wide-panel {
  grid-column: 1 / -1;
}

.calendar-panel {
  padding: 18px;
}

.calendar-toolbar,
.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-toolbar h2,
.section-heading h2 {
  margin: 4px 0 0;
  font-size: 1.3rem;
  letter-spacing: 0;
}

.calendar-actions,
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.month-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-chip,
.pill,
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.summary-chip {
  min-height: 30px;
  padding: 5px 10px;
  background: var(--surface-blue);
  color: var(--blue-dark);
}

.pill {
  min-height: 32px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--teal) 14%, var(--surface));
  color: var(--teal);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  overflow: hidden;
  border-radius: 8px;
  background: var(--line-strong);
}

.weekday,
.calendar-day {
  min-width: 0;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.weekday {
  min-height: 36px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--surface-soft) 82%, white);
  font-weight: 850;
}

.weekday.sun {
  color: var(--red);
  background: #fff1f2;
}

.weekday.sat {
  color: #0067ff;
  background: #eff9ff;
}

.calendar-day {
  position: relative;
  min-height: 112px;
  padding: 8px;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.calendar-day:hover {
  z-index: 1;
  outline: 2px solid rgba(37, 99, 235, 0.34);
  outline-offset: -2px;
  background: var(--surface-soft);
}

.calendar-day.outside {
  background: color-mix(in srgb, var(--surface) 78%, var(--line));
  color: #9aa4b2;
}

.calendar-day.today {
  background: #fff7ed;
}

.calendar-day.today .date-number {
  color: #c2410c;
  background: #fed7aa;
}

.calendar-day.sun .date-number,
.calendar-day.sun .rokuyo {
  color: var(--red);
}

.calendar-day.sat .date-number,
.calendar-day.sat .rokuyo {
  color: #0067ff;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.date-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-weight: 850;
  font-size: 1.04rem;
}

.rokuyo {
  font-size: 0.74rem;
  color: #5f6b7a;
}

.day-events {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.day-event {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 6px;
  padding: 4px 6px;
  background: #203149;
  color: #9ed0ff;
  font-size: 0.74rem;
  font-weight: 750;
}

.day-event.done {
  background: #dcfce7;
  color: #166534;
}

.more-events {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.form-grid,
.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ai-grid {
  grid-template-columns: 1fr 180px 160px 150px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 750;
  font-size: 0.92rem;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 850;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  background: var(--blue);
  color: #fff;
}

.primary:hover {
  background: var(--blue-dark);
}

.secondary {
  background: var(--surface-blue);
  color: var(--blue-dark);
}

.compact {
  min-height: 40px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: #eef6ff;
  color: var(--blue-dark);
  font-size: 1.35rem;
}

.ai-panel {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-blue) 52%, var(--surface)) 0%, var(--surface) 100%);
}

.ai-brief {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.ai-brief div,
.ai-result-head,
.ai-insight {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.ai-brief div {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
}

.ai-brief strong,
.ai-result-head h3 {
  font-size: 0.98rem;
}

.ai-brief span,
.ai-insight span,
.ai-score span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.prompt-chips button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-blue) 65%, var(--surface));
  color: var(--blue-dark);
}

.ai-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.ai-result-head h3 {
  margin: 6px 0 0;
}

.ai-score {
  text-align: right;
}

.ai-score strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
}

.ai-insight {
  display: grid;
  gap: 6px;
  margin: 10px 0 14px;
  padding: 12px 14px;
}

.task-list,
.plan-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  min-height: 72px;
  align-content: center;
  color: var(--muted);
}

.task-card,
.plan-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.task-card.done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.task-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.task-title {
  margin: 0;
  font-weight: 850;
}

.task-meta,
.task-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.task-actions button {
  min-height: 36px;
}

.complete {
  background: #dcfce7;
  color: #166534;
}

.delete {
  background: #fee2e2;
  color: #991b1b;
}

.tag {
  height: 28px;
  padding: 0 9px;
  background: color-mix(in srgb, var(--line) 55%, var(--surface));
  color: var(--text);
  font-size: 0.78rem;
}

.result-box {
  margin-top: 14px;
  min-height: 80px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-soft) 58%, var(--surface));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(520px, calc(100% - 28px));
  padding: 12px 16px;
  border-radius: 8px;
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 920px) {
  .hero,
  .layout,
  .form-grid,
  .ai-grid {
    grid-template-columns: 1fr;
  }

  .ai-brief {
    grid-template-columns: 1fr;
  }

  .wide,
  .wide-panel {
    grid-column: auto;
  }

  .calendar-day {
    min-height: 92px;
    padding: 6px;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1220px);
    padding-top: 16px;
  }

  .hero-copy,
  .status-strip,
  .panel {
    padding: 14px;
  }

  .calendar-toolbar {
    display: grid;
  }

  .month-grid {
    overflow-x: auto;
    grid-template-columns: repeat(7, minmax(74px, 1fr));
  }

  .task-main {
    display: grid;
  }

  .ai-result-head {
    display: grid;
  }
}
