:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #eff6f2;
  --ink: #1c2523;
  --muted: #65726f;
  --line: #dbe2dd;
  --accent: #206f63;
  --accent-strong: #164e46;
  --accent-soft: #dceee9;
  --warn: #b24d43;
  --warn-soft: #fae7e4;
  --shadow: 0 18px 45px rgba(30, 45, 40, 0.12);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(32, 111, 99, 0.12), transparent 28rem),
    linear-gradient(315deg, rgba(181, 106, 37, 0.10), transparent 24rem),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1380px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.65rem, 2.8vw, 2.65rem);
}

h2 {
  font-size: 1rem;
}

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

.workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  align-items: stretch;
}

.sidebar,
.calendar-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.date-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.date-card > span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 900;
}

.date-card p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.add-track-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.preset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.add-track-form input,
.add-track-form button,
.preset-actions button,
.track-controls input,
.track-controls button,
.selected-actions button,
.text-button,
.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.add-track-form input,
.track-controls input {
  min-width: 0;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.add-track-form button,
.text-button,
.icon-button {
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.add-track-form button {
  background: var(--accent);
  color: #fff;
}

.preset-actions button {
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  padding: 0;
  font-size: 1.55rem;
  line-height: 1;
}

.text-button {
  padding: 0 14px;
}

.track-list,
.selected-list {
  display: grid;
  gap: 10px;
}

.track-item,
.selected-item {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #fff;
}

.track-title,
.selected-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.track-title span,
.selected-title span {
  overflow-wrap: anywhere;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.76rem;
  font-weight: 900;
}

.status-badge.done {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.track-status,
.selected-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.track-controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
}

.track-controls button,
.selected-actions button {
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 900;
}

.track-actions,
.selected-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
}

.delete-button {
  background: var(--warn-soft) !important;
  color: var(--warn) !important;
}

.calendar-panel {
  min-width: 0;
  overflow: hidden;
}

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

.weekday-row {
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.weekday-row span {
  padding: 12px 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  text-align: center;
}

.calendar-grid {
  min-height: 680px;
}

.day-cell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-height: 118px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  outline: none;
}

.day-cell:nth-child(7n) {
  border-right: none;
}

.day-cell.outside {
  background: rgba(244, 246, 243, 0.78);
  color: #9aa39f;
}

.day-cell.selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.day-cell:focus-visible {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.day-cell.today .day-number {
  background: var(--accent);
  color: #fff;
}

.day-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-weight: 900;
}

.marker-row {
  display: grid;
  align-content: start;
  gap: 4px;
  max-width: 100%;
}

.note-marker,
.coverage-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border-radius: 6px;
  padding: 0 7px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 900;
}

.coverage-marker {
  max-width: 100%;
  white-space: nowrap;
}

.coverage-progress {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #d6ddd8;
}

.coverage-progress::before {
  display: block;
  width: var(--coverage, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  content: "";
}

.group-marker {
  display: grid;
  grid-template-columns: 22px auto;
  grid-template-areas:
    "label count"
    "bar bar";
  align-items: center;
  gap: 2px 5px;
  max-width: 100%;
  border-radius: 6px;
  padding: 4px 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.group-marker-label {
  grid-area: label;
  font-size: 0.72rem;
  font-weight: 900;
}

.group-marker-count {
  grid-area: count;
  min-width: 0;
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-marker .coverage-progress {
  grid-area: bar;
  height: 5px;
}

.note-marker {
  min-width: 24px;
  color: #fff;
}

.note-marker.missing {
  background: #d6ddd8 !important;
  color: #68736f;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
  }

  .calendar-grid {
    min-height: auto;
  }

  .day-cell {
    min-height: 92px;
    padding: 7px;
  }

  .track-controls,
  .track-actions,
  .preset-actions,
  .selected-actions {
    grid-template-columns: 1fr;
  }
}
