:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --panel: #ffffff;
  --ink: #1f2724;
  --muted: #63706b;
  --line: #d8ddd8;
  --accent: #246b5f;
  --accent-strong: #174d43;
  --warm: #b45f3b;
  --soft: #eaf2ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

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

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

.topbar,
.quick-add,
.tasks-heading,
.calendar-heading,
.calendar-controls,
.task-topline,
.task-title-wrap,
.task-actions,
.auth-actions,
.dialog-header {
  display: flex;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.app-mark {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.app-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.menu-wrap {
  position: relative;
}

.view-tab,
.filter-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 7px 11px;
  cursor: pointer;
}

.menu-button {
  font-size: 1.35rem;
}

.app-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  width: 150px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  box-shadow: 0 12px 28px rgb(31 39 36 / 0.12);
}

.app-menu .view-tab {
  border: 0;
  border-radius: 6px;
  text-align: left;
}

.view-tab.is-active,
.filter-button.is-active {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.guest-view {
  min-height: calc(100vh - 68px);
  display: grid;
  place-items: center;
}

.guest-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.guest-panel img {
  width: 64px;
  height: 64px;
}

.guest-panel h1,
.guest-panel p {
  margin-bottom: 0;
}

.quick-add {
  gap: 10px;
  margin-bottom: 18px;
}

.top-quick-add {
  flex: 1;
  margin-bottom: 0;
}

.quick-add input {
  flex: 1;
}

.tasks-panel,
.archive-panel,
.calendar-panel,
.settings-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.tasks-heading,
.calendar-heading {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-toolbar-left {
  display: flex;
}

.task-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filters,
.task-meta,
.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-list.compact-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.task-list.is-reordering {
  gap: 18px;
}

.task-list.is-reordering .task-card {
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease,
    margin 120ms ease;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.task-card.compact {
  width: fit-content;
  padding: 8px 10px;
  gap: 0;
}

.task-card.compact .task-topline {
  align-items: center;
}

.task-card.compact .task-title-wrap {
  align-items: center;
}

.task-card.compact .task-actions {
  display: none;
}

.task-card.compact .task-notes,
.task-card.compact .detail-row {
  display: none;
}

.task-card.is-child {
  margin-left: 28px;
  border-left: 4px solid var(--line);
}

.task-card.is-done {
  opacity: 0.72;
}

.task-topline {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-title-wrap {
  gap: 10px;
  align-items: flex-start;
}

.collapse-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 18px;
  font-weight: 700;
}

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

.task-title-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
  font-weight: 700;
}

.task-card.is-dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.task-card.is-drop-target-before {
  margin-top: 0;
}

.drop-preview {
  opacity: 0.5;
  border-style: dashed;
  pointer-events: none;
}

.task-list.is-reordering .task-card {
  min-height: 42px;
}

.drag-handle {
  color: var(--muted);
  cursor: grab;
  font-size: 0.95rem;
  line-height: 1;
  user-select: none;
}

.task-card:active .drag-handle {
  cursor: grabbing;
}

.task-card:hover {
  border-color: #bcc8c3;
  box-shadow: 0 4px 12px rgb(31 39 36 / 0.08);
}

.badge {
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  padding: 4px 8px;
  font-size: 0.8rem;
}

.badge.urgent,
.badge.asap {
  background: #f6e8e2;
  color: var(--warm);
}

.badge.stage {
  background: #f4efe3;
  color: #7a5a1d;
}

.task-notes {
  color: var(--muted);
  margin: 0;
}

.task-actions {
  justify-content: flex-end;
  gap: 8px;
}

.icon-action-button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-action-button svg {
  width: 18px;
  height: 18px;
}

.icon-action-button path {
  fill: currentColor;
}

.action-button,
.delete-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.primary-button,
.ghost-button,
.icon-button {
  border: 1px solid transparent;
  cursor: pointer;
}

.detail-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.danger-button {
  color: #9b3d32;
}

.primary-button {
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 11px 14px;
  font-weight: 700;
}

.ghost-button {
  border-color: var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 9px 12px;
}

.toolbar-icon-button,
.filter-button {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
}

.toolbar-icon-button svg,
.filter-button svg {
  width: 21px;
  height: 21px;
  color: currentColor;
}

.toolbar-icon-button svg {
  display: block;
}

.filter-all path {
  fill: currentColor;
}

.filter-someday path,
.filter-shopping path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-icon-button.is-detailed {
  grid-template-rows: repeat(3, 4px);
  gap: 4px;
  align-content: center;
}

.density-simple {
  display: inline-grid;
}

.toolbar-icon-button.is-detailed span {
  display: block;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.toolbar-icon-button.is-detailed span {
  width: 20px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

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

.detail-card,
.auth-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-header {
  align-items: center;
  justify-content: space-between;
}

.dialog-header h2 {
  margin-bottom: 0;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tag-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.tag-fieldset legend {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-option {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 7px 11px;
  cursor: pointer;
}

.tag-option.is-selected {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.is-hidden {
  display: none;
}

.view.is-hidden {
  display: none;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink);
}

.check-pill input {
  width: auto;
  margin: 0;
}

.helper-text,
.auth-message {
  color: var(--muted);
}

.setting-block {
  display: grid;
  gap: 10px;
  max-width: 680px;
}

.setting-block h3 {
  margin-bottom: 0;
}

.calendar-controls {
  align-items: center;
  gap: 10px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-cell {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.calendar-cell.is-muted {
  opacity: 0.45;
}

.calendar-date {
  font-weight: 700;
}

.calendar-entry {
  border-radius: 6px;
  background: var(--soft);
  padding: 6px 7px;
  font-size: 0.82rem;
}

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

.archive-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.archive-actions {
  display: flex;
  gap: 8px;
}

.work-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.confirm-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.confirm-card p {
  margin-bottom: 0;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.work-details {
  display: grid;
  gap: 8px;
}

.stopwatch {
  display: grid;
  gap: 4px;
}

.stopwatch strong {
  font-size: 2rem;
}

.work-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

dialog {
  width: min(620px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgb(31 39 36 / 0.35);
}

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
}

@media (max-width: 820px) {
  .calendar-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 18px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}
