:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #657080;
  --line: #d8dee6;
  --brand: #c72620;
  --brand-dark: #981b17;
  --accent: #1f6f8b;
  --ok: #147d4f;
  --bad: #b42318;
  --warn: #9a6700;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  background: var(--brand-dark);
}

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

.icon-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  justify-content: center;
  min-height: 42px;
  padding: 0;
  width: 42px;
}

.icon-button:hover {
  background: #eef2f6;
}

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

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

textarea {
  resize: vertical;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #14181f;
  color: #fff;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 32px;
  padding: 26px 20px;
}

.sidebar h1,
.workspace h2,
.panel h3,
.modal-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.sidebar h1 {
  font-size: 32px;
}

.eyebrow {
  color: #9ba8b8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-button {
  background: transparent;
  border: 1px solid transparent;
  color: #d8dee6;
  justify-content: start;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: #222936;
  border-color: #334052;
}

.session {
  border-top: 1px solid #313a49;
  color: #c7d0dc;
  display: grid;
  gap: 10px;
  padding-top: 18px;
}

.workspace {
  min-width: 0;
  padding: 32px;
}

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

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

.auth-panel {
  margin: 10vh auto 0;
  max-width: 760px;
}

.auth-panel h2 {
  margin: 0 0 18px;
}

.panel-heading {
  align-items: start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-heading p {
  color: var(--muted);
  margin: 4px 0 0;
}

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

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

.full-span {
  grid-column: 1 / -1;
}

.button-row,
.run-grid {
  align-items: end;
  display: flex;
  gap: 10px;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
}

.password-field input {
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
}

.password-toggle {
  border-bottom-left-radius: 0;
  border-left: 0;
  border-top-left-radius: 0;
}

.secondary-button {
  background: var(--accent);
}

.secondary-button:hover {
  background: #18566c;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost-button:hover {
  background: #eef2f6;
}

.sidebar .ghost-button {
  color: #fff;
}

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

.list-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 2fr) auto;
  padding: 14px;
}

.list-row strong {
  display: block;
}

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

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

.row-actions button {
  min-height: 36px;
  padding: 0 12px;
}

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

.danger-button:hover {
  background: #8f1c14;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.status-ok {
  background: #e8f6ef;
  color: var(--ok);
}

.status-failed {
  background: #fff0ed;
  color: var(--bad);
}

.status-queued {
  background: #fff8e1;
  color: var(--warn);
}

.status-running {
  background: #eef2ff;
  color: #3346a8;
}

.status-generating,
.status-uploading-image,
.status-publishing {
  background: #eef2ff;
  color: #3346a8;
}

.status-previewed {
  background: #e9f4f8;
  color: var(--accent);
}

.status-published {
  background: #e8f6ef;
  color: var(--ok);
}

.job-items {
  display: grid;
  gap: 14px;
}

.job-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.job-item-header {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.job-item-header strong {
  display: block;
}

.job-item-header span {
  color: var(--muted);
  font-size: 13px;
}

.job-item h4 {
  margin: 0;
}

.job-log-line {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.post-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.job-item pre {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  margin: 0;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.site-picker {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.site-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.site-group h4 {
  margin: 0 0 12px;
}

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

.checkbox-grid label {
  align-items: center;
  color: var(--ink);
  display: flex;
  flex-direction: row;
  font-weight: 600;
  gap: 8px;
}

.checkbox-grid input {
  height: 16px;
  min-height: 16px;
  width: 16px;
}

.alert {
  border-radius: 6px;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.alert.ok {
  background: #e8f6ef;
  color: var(--ok);
}

.alert.error {
  background: #fff0ed;
  color: var(--bad);
}

.hidden {
  display: none !important;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  align-items: center;
  background: rgba(20, 24, 31, 0.58);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 20;
}

.modal-panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(20, 24, 31, 0.24);
  max-height: calc(100vh - 40px);
  max-width: 640px;
  overflow: auto;
  padding: 22px;
  width: min(100%, 640px);
}

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

  .sidebar {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .workspace {
    padding: 18px;
  }

  .form-grid,
  .dense-form,
  .list-row,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

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

  .button-row button {
    width: 100%;
  }
}
