:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --ink: #202326;
  --muted: #64707a;
  --line: #dfe4e8;
  --accent: #e94832;
  --accent-2: #1f7a6b;
  --warn: #b76d00;
  --today: #fff0ea;
  --today-line: #ff8f73;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
}

button, input, textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
}

button:hover {
  border-color: #b8c1c8;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 20px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar .toolbar {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 25px;
}

h2 {
  font-size: 16px;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
}

.toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

input[type="date"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface);
}

input[type="text"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
}

main {
  padding: 18px 24px 28px;
}

.today-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
  padding: 18px;
  background: var(--today);
  border: 1px solid var(--today-line);
  border-radius: 8px;
}

.today-hero h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.today-hero p:not(.eyebrow) {
  color: #5e3930;
  line-height: 1.6;
}

.today-actions,
.button-row,
.main-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.today-actions button,
#generateMessage,
.main-actions button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.work-panel {
  min-height: 620px;
}

.mini-calendar-panel {
  position: sticky;
  top: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.step-label {
  margin: 4px 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.import-box {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.campaign-form {
  display: grid;
  gap: 10px;
}

.campaign-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  padding: 10px;
  background: #fbfcfd;
  color: var(--ink);
}

#bulkUrls {
  min-height: 86px;
}

.post-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 350px);
  overflow: auto;
}

.post-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.post-item img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-2);
}

.post-item strong {
  display: block;
  font-size: 13px;
  word-break: break-all;
}

.post-item span {
  color: var(--muted);
  font-size: 12px;
}

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

.month-calendar {
  display: grid;
  gap: 10px;
}

.month-title {
  font-size: 18px;
  font-weight: 800;
}

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

.month-weekdays span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.month-cell {
  min-height: 54px;
  display: grid;
  align-content: start;
  gap: 8px;
  text-align: left;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.month-cell span {
  font-weight: 800;
}

.month-cell small {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.month-cell b {
  display: none;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-cell.muted {
  opacity: .45;
}

.month-cell.has-task {
  border-color: #bdd8cf;
}

.month-cell.today {
  background: var(--today);
  border-color: var(--today-line);
  box-shadow: 0 0 0 3px rgba(255, 143, 115, .22);
}

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

.day {
  min-height: 620px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.day-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f9fafb;
}

.today-day {
  border-color: var(--today-line);
  box-shadow: 0 0 0 3px rgba(255, 143, 115, .18);
}

.today-day .day-head {
  background: var(--today);
}

.day-head strong {
  display: block;
  font-size: 14px;
}

.day-head span {
  color: var(--muted);
  font-size: 12px;
}

.day-head em {
  display: inline-flex;
  margin-top: 8px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-style: normal;
}

.task {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.task:hover,
.task.active {
  background: #fff5f2;
}

.task.done {
  opacity: .55;
}

.task-title {
  display: flex;
  align-items: start;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.task-title input {
  margin-top: 2px;
}

.task small {
  display: block;
  margin: 6px 0;
  color: var(--muted);
}

.mini-checklist {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.pill-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.pill.hot {
  background: #ffe6df;
  color: var(--accent);
}

.pill.money {
  background: #e4f4ef;
  color: var(--accent-2);
}

.selected-meta {
  min-height: 72px;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.selected-meta strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.selected-meta span {
  color: var(--muted);
}

.today-checklist {
  display: grid;
  gap: 8px;
  margin: 12px 0 20px;
}

.check-row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  line-height: 1.5;
}

.ai-status {
  margin-bottom: 10px;
  padding: 9px;
  border-radius: 6px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ai-status.error {
  background: #fff4f2;
  color: #a33826;
}

.message-box {
  min-height: 280px;
  line-height: 1.65;
}

.main-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

#copyMessage {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

#completeTask {
  background: #202326;
  border-color: #202326;
}

.advanced {
  margin-top: 14px;
}

.advanced summary {
  cursor: pointer;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--muted);
}

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

.compact-toolbar {
  margin-bottom: 12px;
}

.setting-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

pre {
  overflow: auto;
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #202326;
  color: #fff;
  font-size: 12px;
  line-height: 1.55;
}

.rules {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 1180px) {
  .operator-layout,
  .advanced-grid {
    grid-template-columns: 1fr;
  }
  .calendar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .day {
    min-height: 360px;
  }
}

@media (max-width: 720px) {
  .topbar,
  .toolbar,
  .today-hero,
  .today-actions {
    display: grid;
    align-items: stretch;
  }
  main {
    padding: 12px;
  }
  .status-band,
  .calendar,
  .month-weekdays,
  .month-grid {
    grid-template-columns: 1fr;
  }
  .month-cell {
    min-height: 58px;
  }
}
