:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef3f1;
  --ink: #19201d;
  --muted: #66736e;
  --line: #d9e0dc;
  --accent: #0c7c59;
  --accent-strong: #075c42;
  --danger: #b42318;
  --warn: #9a5b00;
  --shadow: 0 10px 30px rgba(25, 32, 29, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

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

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 40px);
}

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

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

h1 {
  font-size: 24px;
  margin-bottom: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.session {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  padding: 20px clamp(16px, 4vw, 40px) 40px;
}

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

.login-panel {
  justify-self: center;
  max-width: 440px;
  width: min(100%, 440px);
}

.store-card,
.list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.store-card {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.store-card h2,
.list-panel h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

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

.event-create-panel[hidden] {
  display: none;
}

.invite-panel[hidden] {
  display: none;
}

.invite-panel {
  display: grid;
  gap: 12px;
}

.invite-copy-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.invite-copy-row input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.invite-copy-row button.copied {
  background: #0c7c59;
  border-color: #0c7c59;
  color: #ffffff;
}

.list-heading {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.month-selector {
  min-width: 180px;
}

.month-selector select {
  min-width: 180px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

.metric {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric strong {
  display: block;
  font-size: 22px;
}

.metric span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

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

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

textarea {
  min-height: 80px;
  resize: vertical;
}

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

.event-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.event-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 96px;
  padding: 14px 16px;
}

.event-card.done {
  background: #f0faf5;
}

.event-card.open,
.event-card.pending {
  background: #f4f8ff;
}

.event-card.error {
  background: #fff6f4;
}

.event-card.future {
  background: #ffffff;
}

.event-title {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.event-date {
  font-size: 20px;
}

.event-body p {
  color: var(--muted);
  margin: 8px 0 0;
}

.total-diff {
  color: var(--accent-strong);
  display: block;
  margin-top: 6px;
}

.event-action {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  min-width: 132px;
}

.event-action button {
  min-width: 120px;
  justify-content: center;
}

button.event-button {
  box-shadow: 0 6px 14px rgba(25, 32, 29, 0.12);
  font-weight: 800;
}

button.result-button {
  background: #1660a8;
  border-color: #1660a8;
}

button.upload-button {
  background: #c45a10;
  border-color: #c45a10;
}

button.retry-button {
  background: var(--danger);
  border-color: var(--danger);
}

button.manual-button {
  background: #7457b8;
  border-color: #7457b8;
}

.event-waiting {
  background: #dff4ec;
  border-radius: 4px;
  color: var(--accent-strong);
  display: inline-block;
  font-weight: 800;
  padding: 8px 12px;
}

.field-card,
.result-title-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  display: grid;
  gap: 6px;
  padding: 12px;
}

.field-card span,
.result-title-card span {
  color: var(--muted);
}

.notice.soft {
  background: #e8f6ef;
  border: 0;
  color: var(--accent-strong);
  font-weight: 800;
  margin-top: 12px;
  text-align: center;
}

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

.summary-card {
  background: #e8f6ef;
  border: 1px solid #d1eadf;
  border-radius: 4px;
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 12px;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  font-size: 18px;
}

.result-table {
  min-width: 860px;
}

.manual-settings-table {
  min-width: 900px;
}

.manual-settings-table select {
  min-width: 96px;
}

.manual-setting-row.setting-4 td {
  background: #008000;
  color: #ffffff;
}

.manual-setting-row.setting-5 td {
  background: #0000ff;
  color: #ffffff;
}

.manual-setting-row.setting-6 td {
  background: #ff0000;
  color: #ffffff;
}

.manual-setting-row.setting-4 select,
.manual-setting-row.setting-5 select,
.manual-setting-row.setting-6 select {
  border-color: rgba(255, 255, 255, 0.7);
}

.manual-actions {
  margin-top: 14px;
}

.template-download {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.template-note {
  background: #fff8eb;
  border: 1px solid #f3ddb8;
  border-radius: 6px;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
}

.template-note strong {
  color: var(--warn);
  font-size: 12px;
}

.template-note span {
  color: #74420b;
  font-size: 13px;
  font-weight: 800;
}

.validation-help {
  background: #fff4f2;
  border: 1px solid #f0b9b3;
  border-radius: 6px;
  color: #7a1d16;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.validation-help strong {
  color: #7a1d16;
  font-size: 15px;
}

.validation-help p,
.validation-help ul {
  margin: 0;
}

.validation-help ul {
  display: grid;
  gap: 6px;
  padding-left: 1.2em;
}

.validation-help li {
  line-height: 1.5;
}

button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
}

button,
.button-link {
  text-decoration: none;
}

.button-link {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  font-weight: 700;
  gap: 6px;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
}

button.secondary {
  background: #ffffff;
  color: var(--accent-strong);
}

.button-link.secondary {
  background: #ffffff;
  color: var(--accent-strong);
}

button.secondary:disabled {
  background: #f5f7f6;
  border-color: #d7dfda;
  color: #87968e;
  opacity: 1;
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.compact-table {
  min-width: 0;
}

.wp-mode-table {
  table-layout: fixed;
}

.operator-events-table {
  min-width: 1080px;
  table-layout: fixed;
}

.operator-events-table th:nth-child(1),
.operator-events-table td:nth-child(1) {
  width: 72px;
}

.operator-events-table th:nth-child(2),
.operator-events-table td:nth-child(2) {
  width: 210px;
}

.operator-events-table th:nth-child(3),
.operator-events-table td:nth-child(3) {
  width: 230px;
}

.operator-events-table th:nth-child(4),
.operator-events-table td:nth-child(4),
.operator-events-table th:nth-child(5),
.operator-events-table td:nth-child(5) {
  width: 220px;
}

.operator-project-cell {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 88px minmax(0, 1fr);
}

.operator-project-thumb {
  align-items: center;
  background: #f5f7f4;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: block;
  height: 32px;
  overflow: hidden;
  padding: 0;
  width: 88px;
}

.operator-project-thumb img {
  display: block;
  height: 100%;
  object-fit: contain;
  object-position: center;
  width: 100%;
}

.operator-project-cell span {
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.operator-workflow-cell {
  display: grid;
  gap: 8px;
  width: 100%;
}

.operator-row-actions {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  width: 100%;
}

.operator-row-actions button,
.operator-row-actions .button-link {
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.operator-row-actions .publish-button:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.x-notice-preview-panel {
  border-color: #cce6da;
  box-shadow: none;
  margin: 16px 0;
}

.x-preview-grid {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: 220px minmax(0, 1fr);
  margin-top: 14px;
}

.x-preview-image {
  align-items: center;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 124px;
  overflow: hidden;
}

.x-preview-image img {
  display: block;
  height: 100%;
  max-height: 220px;
  object-fit: contain;
  width: 100%;
}

.x-preview-copy {
  display: grid;
  gap: 10px;
}

.x-preview-copy textarea {
  min-height: 150px;
}

.x-preview-copy button {
  justify-self: start;
  min-width: 120px;
}

.x-preview-copy button.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.x-preview-actions {
  align-items: center;
}

.x-notice-status {
  margin-top: 12px;
  text-align: left;
}

.x-notice-status strong {
  margin-right: 8px;
}

.table-subtext {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.operator-sub-panel summary {
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}

.operator-sub-panel .muted {
  margin-top: 12px;
}

.revision-layout {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 0.75fr) minmax(520px, 1.25fr);
}

.revision-screen,
.revision-preview-panel {
  min-width: 0;
}

.revision-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.revision-form textarea {
  min-height: 120px;
}

.revision-preview-panel {
  background: #050505;
  color: #ffffff;
  position: sticky;
  top: 16px;
}

.revision-preview-panel .section-label,
.revision-preview-panel h2 {
  color: #ffffff;
}

.revision-preview-frame {
  background: #000000;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  height: calc(100vh - 180px);
  min-height: 720px;
  width: 100%;
}

.wp-mode-table select {
  max-width: 100%;
  min-width: 112px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.status {
  border-radius: 999px;
  display: block;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
  padding: 4px 8px;
  text-align: center;
  width: 100%;
}

.status.ready,
.status.wp_posted,
.status.published {
  background: #dff4ec;
  color: #075c42;
}

.status.validation_error,
.status.wp_failed,
.status.failed {
  background: #fde7e5;
  color: var(--danger);
}

.status.wp_queued,
.status.wp_posting,
.status.draft_queued,
.status.draft_creating {
  background: #fff2d8;
  color: var(--warn);
}

.notice,
.empty {
  background: #ffffff;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

.notice.warning {
  background: #fff2d8;
  border-color: #f2c36b;
  color: var(--warn);
}

.error {
  background: #fde7e5;
  border: 1px solid #fac5c0;
  border-radius: 8px;
  color: var(--danger);
  padding: 12px;
  white-space: pre-wrap;
}

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

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .grid.two,
  .metrics,
  .form-two,
  .result-summary-grid,
  .revision-layout,
  .x-preview-grid {
    grid-template-columns: 1fr;
  }

  .revision-preview-panel {
    position: static;
  }

  .revision-preview-frame {
    height: auto;
    min-height: 980px;
  }

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

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

  .month-selector,
  .month-selector select {
    min-width: 0;
  }

  .store-card button {
    justify-content: center;
    width: 100%;
  }

  .event-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .event-action {
    justify-content: stretch;
    min-width: 0;
  }

  .event-action button,
  .stack-mobile button {
    justify-content: center;
    width: 100%;
  }

  .stack-mobile {
    flex-direction: column;
  }

  .panel {
    padding: 14px;
  }

  .compact-table th,
  .compact-table td {
    font-size: 12px;
    padding: 8px 6px;
  }

  .wp-mode-table th:first-child,
  .wp-mode-table td:first-child {
    width: 40%;
  }

  .wp-mode-table th:nth-child(2),
  .wp-mode-table td:nth-child(2) {
    width: 28%;
  }

  .wp-mode-table th:nth-child(3),
  .wp-mode-table td:nth-child(3) {
    width: 32%;
  }

  .wp-mode-table select {
    font-size: 12px;
    min-width: 0;
  }
}
