:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-alt: #edf2f1;
  --line: #d7dddc;
  --line-strong: #b8c3c1;
  --text: #17201f;
  --muted: #667372;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --blue: #2563eb;
  --sky: #4f8fba;
  --green: #17803d;
  --amber: #b45309;
  --red: #c2410c;
  --gray: #8a9492;
  --danger: #b42318;
  --shadow: 0 10px 30px rgb(23 32 31 / 0.08);
  --radius: 8px;
  --day-width: 30px;
  --left-width: 390px;
  font-family:
    Inter, "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic",
    Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef3f3 0, #f5f7f8 220px),
    var(--bg);
  font-size: 14px;
}

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

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(15 118 110 / 0.22);
  outline-offset: 1px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  min-height: 82px;
  padding: 10px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #17201f;
  color: #fff;
  font-weight: 800;
}

.brand h1 {
  font-size: 19px;
  line-height: 1.25;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions,
.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) repeat(4, minmax(110px, 0.75fr)) auto auto;
  gap: 12px;
  align-items: end;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.tabbar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 10px 22px 0;
  background: var(--bg);
}

.tab-button {
  min-width: 118px;
  border-color: var(--line);
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  background: #f9fbfb;
  color: var(--muted);
  font-weight: 800;
}

.tab-button.active {
  border-color: var(--line);
  border-bottom-color: #fff;
  background: #fff;
  color: var(--accent-strong);
}

main {
  padding: 0 22px 26px;
}

.view {
  display: none;
  padding-top: 16px;
}

.view.active {
  display: block;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.ghost-button:hover {
  border-color: var(--line-strong);
  background: #f8faf9;
}

.danger-button {
  border-color: rgb(180 35 24 / 0.26);
  background: rgb(180 35 24 / 0.08);
  color: var(--danger);
  font-weight: 800;
}

.danger-button:hover {
  background: rgb(180 35 24 / 0.14);
}

.compact {
  min-height: 34px;
  padding-inline: 12px;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.stat-card em {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(130px, 0.7fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.gantt-shell {
  height: calc(100vh - 305px);
  min-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.gantt-grid {
  --day-count: 1;
  min-width: calc(var(--left-width) + (var(--day-count) * var(--day-width)));
}

.gantt-row {
  display: grid;
  grid-template-columns: var(--left-width) repeat(var(--day-count), var(--day-width));
  min-height: 42px;
  border-bottom: 1px solid #edf0f0;
}

.gantt-row.header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 54px;
  border-bottom-color: var(--line-strong);
  background: #f8fbfb;
}

.gantt-left,
.gantt-day {
  min-width: 0;
}

.gantt-left {
  position: sticky;
  left: 0;
  z-index: 10;
  display: grid;
  align-items: center;
  gap: 2px;
  padding: 7px 12px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.gantt-row.header .gantt-left {
  z-index: 25;
  background: #f8fbfb;
  font-weight: 900;
}

.gantt-row.section .gantt-left {
  background: #eaf3ef;
  color: #153c35;
  font-weight: 900;
}

.gantt-row.section .gantt-day {
  background: #f2f7f5;
}

.gantt-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.gantt-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.gantt-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-status {
  width: 74px;
  height: 28px;
  padding: 0 6px;
  flex: 0 0 auto;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.gantt-day {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-right: 1px solid #eef1f1;
  color: var(--muted);
  font-size: 11px;
}

.day-label {
  display: grid;
  place-items: center;
  gap: 2px;
  line-height: 1.05;
}

.day-label strong {
  color: var(--text);
  font-size: 13px;
}

.weekend {
  background: #fff7ed;
}

.today {
  box-shadow: inset 2px 0 0 #d97706;
  background: #fffbeb;
}

.bar {
  color: transparent;
}

.bar::after {
  content: "";
  display: block;
  width: 22px;
  height: 20px;
  border-radius: 5px;
}

.bar.director::after {
  background: var(--sky);
}

.bar.script::after {
  background: #f0b45a;
}

.bar.shoot::after {
  background: #ef6b52;
}

.bar.edit::after {
  background: #6aa7d9;
}

.bar.post::after {
  background: #74b772;
}

.bar.other::after {
  background: #a5adab;
}

.bar.done::after {
  background: #d5d9d8;
}

.done-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 20px;
  border-radius: 5px;
  background: #17201f;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  font-weight: 800;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
}

.panel h3 {
  margin-bottom: 12px;
  font-size: 15px;
}

.reminder-layout,
.settings-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

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

.reminder-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
}

.reminder-item.sent {
  border-color: #d6d8d7;
  background: #f6f7f7;
}

.reminder-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 7px;
  font-weight: 900;
}

.pill {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #eef3f3;
  color: #33413f;
  font-size: 12px;
  font-weight: 800;
}

.pill.due {
  background: #fee2e2;
  color: #9f1d13;
}

.pill.soon {
  background: #ffedd5;
  color: #9a4a07;
}

.pill.done {
  background: #e5e7eb;
  color: #596260;
}

.reminder-body {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.reminder-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.mini-metrics {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.mini-metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
}

.mini-metric strong {
  color: var(--text);
}

.summary-grid {
  display: grid;
  gap: 14px;
}

.summary-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.summary-table th,
.summary-table td,
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

.summary-table th,
.data-table th {
  background: #f3f7f6;
  color: #30403e;
  font-size: 12px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e9e8;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
}

.role-settings,
.member-list {
  display: grid;
  gap: 10px;
}

.role-row {
  display: grid;
  grid-template-columns: 160px minmax(120px, 1fr) minmax(120px, 1fr) 68px;
  gap: 10px;
  align-items: end;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.role-name {
  align-self: center;
  font-weight: 900;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.member-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-row span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

dialog {
  width: min(720px, calc(100vw - 26px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--text);
  box-shadow: 0 28px 80px rgb(23 32 31 / 0.24);
}

dialog::backdrop {
  background: rgb(23 32 31 / 0.36);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-size: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

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

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #17201f;
  color: #fff;
  padding: 11px 14px;
  font-weight: 800;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1040px) {
  .control-band {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .reminder-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --left-width: 310px;
    --day-width: 28px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .control-band,
  main {
    padding-inline: 12px;
  }

  .control-band,
  .toolbar,
  .stats-grid,
  .form-grid,
  .role-row {
    grid-template-columns: 1fr;
  }

  .tabbar {
    padding-inline: 12px;
  }

  .gantt-shell {
    height: calc(100vh - 390px);
  }

  .reminder-item {
    grid-template-columns: 1fr;
  }

  .reminder-actions {
    justify-content: flex-start;
  }

  .dialog-actions {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions span {
    display: none;
  }
}
