:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef6f3;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee7;
  --line-strong: #b9c3d0;
  --green: #0b7f68;
  --green-dark: #075f4e;
  --blue: #2563eb;
  --amber: #d88916;
  --shadow: 0 18px 50px rgba(18, 32, 46, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo,
    sans-serif;
}

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

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.status-pill.is-demo .status-dot,
.status-dot.is-demo {
  background: var(--amber);
}

.status-pill.is-live .status-dot,
.status-dot.is-live {
  background: var(--green);
}

.status-pill.is-error .status-dot,
.status-dot.is-error {
  background: #c2410c;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.control-pane,
.output-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-pane {
  padding: 18px;
}

.output-pane {
  padding: 22px;
}

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

.field,
.toggle-row,
.actions {
  min-width: 0;
}

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

label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input[type="date"],
input[type="number"],
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 11px;
  outline: none;
}

input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11, 127, 104, 0.13);
}

.member-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-picker-row select {
  flex: 1 1 auto;
  min-width: 0;
}

.selected-members {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.member-chip {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
}

.member-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e7eef8;
  color: #184a90;
  font-size: 12px;
  font-weight: 800;
}

.member-meta {
  min-width: 0;
}

.member-name {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.member-mail {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-member {
  min-height: 42px;
  padding: 11px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f5f7;
}

.segmented label {
  margin: 0;
  color: var(--muted);
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--green-dark);
  box-shadow: 0 1px 5px rgba(20, 28, 38, 0.12);
}

.toggle-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
  gap: 9px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #ccd4df;
  transition: background 160ms ease;
}

.toggle span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 28, 38, 0.2);
  transition: transform 160ms ease;
}

.toggle input:checked + span {
  background: var(--green);
}

.toggle input:checked + span::after {
  transform: translateX(18px);
}

.buffer-choice {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.buffer-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-compact span {
  min-height: 30px;
  font-size: 12px;
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.secondary-button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.is-hidden {
  display: none !important;
}

.primary-button {
  width: 100%;
  min-height: 44px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

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

.primary-button svg,
.secondary-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip-remove {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.chip-remove:hover {
  background: rgba(11, 127, 104, 0.1);
  color: var(--green-dark);
}

.chip-remove svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

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

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--text);
  padding: 16px;
  line-height: 1.8;
  outline: none;
}

.source-notice {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.source-notice.is-error {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  white-space: pre-wrap;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.summary-strip > div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-strip strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.slot-list {
  display: grid;
  gap: 8px;
}

.slot-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.slot-date {
  color: var(--green-dark);
  font-weight: 900;
}

.slot-time {
  font-size: 16px;
  font-weight: 900;
}

.slot-badge {
  min-width: 64px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef6f3;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.empty-state {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8eb;
  color: #8a540d;
  font-weight: 700;
}

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

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 18px;
  }

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

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

  .form-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .slot-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .member-picker-row {
    align-items: stretch;
    flex-direction: column;
  }

  .slot-badge {
    width: max-content;
  }
}
