:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #eef2ef;
  --ink: #17211d;
  --muted: #65736c;
  --line: #d9e0dc;
  --line-strong: #b8c3bd;
  --accent: #0f8f73;
  --accent-dark: #0a6e59;
  --danger: #be3b36;
  --warning: #9a6a00;
  --shadow: 0 18px 50px rgba(28, 41, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 143, 115, 0.1), rgba(33, 82, 102, 0.04)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.workspace {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(217, 224, 220, 0.9);
  box-shadow: var(--shadow);
  min-height: calc(100vh - 72px);
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
}

h2 {
  font-size: 1.1rem;
}

.status-pill,
.counter {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 8px 11px;
  white-space: nowrap;
}

.composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 0;
}

.composer-panel,
.publish-panel {
  padding: 30px;
}

.publish-panel {
  border-left: 1px solid var(--line);
  background: rgba(238, 242, 239, 0.54);
}

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

.dropzone {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 2px dashed var(--line-strong);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(238, 242, 239, 0.84)),
    repeating-linear-gradient(45deg, rgba(15, 143, 115, 0.06) 0 10px, transparent 10px 20px);
  padding: 28px;
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}

.drop-title,
.drop-copy {
  display: block;
}

.drop-title {
  font-size: 1.08rem;
  font-weight: 800;
}

.drop-copy {
  margin-top: 6px;
  color: var(--muted);
}

.preview-frame {
  margin-top: 18px;
  background: #101816;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.preview-frame video,
.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.field-group {
  margin-top: 22px;
}

.field-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 170px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 14px;
  outline: none;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 143, 115, 0.16);
}

.field-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.ghost-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  padding: 8px 11px;
}

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

.platform-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.platform-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #fff;
  font-weight: 900;
}

.platform-copy strong,
.platform-copy span {
  display: block;
}

.platform-copy span {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 2px;
}

.switch {
  position: relative;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #cad4ce;
  transition: 160ms ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  transition: 160ms ease;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.checks {
  display: grid;
  gap: 8px;
  margin: 22px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.check-row strong {
  color: var(--ink);
}

.publish-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.publish-button:disabled {
  cursor: not-allowed;
  background: #b7c4be;
}

.result-log {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px;
  font-size: 0.9rem;
}

.result-item span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.result-item small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.result-platform {
  color: var(--ink);
}

.result-item strong {
  white-space: nowrap;
}

.result-success strong {
  color: var(--accent-dark);
}

.result-pending strong {
  color: var(--warning);
}

.result-error strong {
  color: var(--danger);
}

.automation-panel {
  padding: 30px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.automation-switch {
  flex: 0 0 auto;
}

.automation-settings {
  display: grid;
  gap: 18px;
}

.product-automation-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
}

.product-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.product-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.product-list-item.active {
  border-color: var(--accent);
  background: #fff;
  box-shadow: inset 4px 0 0 var(--accent);
}

.product-list-item span {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: capitalize;
}

.automation-form-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 8px 10px 8px 14px;
  font-weight: 800;
  white-space: nowrap;
}

.automation-grid {
  display: grid;
  grid-template-columns: 180px 160px minmax(240px, 1fr);
  gap: 16px;
  align-items: end;
}

.compact-field {
  margin-top: 0;
}

.naming-guide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: 8px 10px;
  font-weight: 800;
}

.platform-chip input {
  width: 16px;
  min-height: 16px;
}

.naming-guide div {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 14px;
}

.naming-guide strong,
.naming-guide span {
  display: block;
}

.naming-guide span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

code {
  background: rgba(23, 33, 29, 0.08);
  padding: 2px 4px;
}

.save-button {
  width: fit-content;
  min-height: 44px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  padding: 0 16px;
}

.save-button:disabled {
  background: #8f9b95;
  cursor: not-allowed;
}

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

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

.automation-status {
  min-height: 20px;
  color: var(--muted);
  font-weight: 700;
}

.queue-panel {
  display: grid;
  gap: 16px;
  margin-top: 8px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.queue-panel .section-header {
  margin-bottom: 0;
}

.queue-schedule {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.queue-schedule p {
  margin: 0;
}

.queue-schedule p:first-child {
  color: var(--ink);
  font-weight: 800;
}

.queue-dropzone {
  min-height: 140px;
  padding: 18px;
}

.queue-dropzone .upload-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  font-size: 1.5rem;
}

.queue-panel .compact-field textarea {
  min-height: 0;
}

.queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.queue-toolbar .ghost-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.queue-status {
  min-height: 20px;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.queue-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.queue-item {
  display: grid;
  grid-template-columns: auto 96px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
}

.queue-item.queue-next {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.queue-item.queue-failed {
  border-color: var(--danger);
}

.queue-item.queue-posting {
  opacity: 0.75;
}

.queue-check {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
}

.queue-thumb {
  width: 96px;
  height: 64px;
  background: #101816;
  object-fit: cover;
  display: block;
}

.queue-item-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.queue-item-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.queue-position {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.queue-name {
  overflow-wrap: anywhere;
}

.queue-badge {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 8px;
}

.queue-next .queue-badge {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.queue-failed .queue-badge {
  border-color: var(--danger);
  color: var(--danger);
}

.queue-size {
  color: var(--muted);
}

.queue-caption-input {
  min-height: 0;
  padding: 8px 10px;
  font-size: 0.92rem;
}

.queue-note {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.queue-note-error {
  color: var(--danger);
}

@media (max-width: 900px) {
  .app-shell {
    width: 100%;
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    border: 0;
  }

  .topbar,
  .section-header,
  .field-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer-grid {
    grid-template-columns: 1fr;
  }

  .publish-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .composer-panel,
  .publish-panel,
  .topbar {
    padding: 22px;
  }

  .dropzone {
    min-height: 210px;
  }

  .product-automation-layout,
  .automation-form-header,
  .automation-grid,
  .naming-guide {
    grid-template-columns: 1fr;
  }

  .queue-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .queue-thumb {
    grid-column: 2;
  }

  .queue-item-body {
    grid-column: 1 / -1;
  }
}

.queue-option,
.field-group label.queue-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-weight: 400;
  cursor: pointer;
}

.queue-option input {
  width: auto;
  margin: 0;
}

/* Header actions and login page */

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

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.login-card {
  width: min(400px, 100%);
  padding: 32px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 1.6rem;
}

.login-error {
  margin: 18px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: rgba(190, 59, 54, 0.08);
  color: var(--danger);
  font-weight: 700;
}

.login-button {
  width: 100%;
  margin-top: 24px;
}
