:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1e1f23;
  --muted: #68655f;
  --line: #ded9cf;
  --brand: #202124;
  --good: #137333;
  --warn: #b06000;
  --bad: #b3261e;
  --blue: #185abc;
}

* {
  box-sizing: border-box;
}

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

.login-page {
  min-height: 100vh;
}

.login-shell {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-form {
  max-width: 420px;
  width: 100%;
}

.reset-panel {
  display: none;
}

.login-page .reset-panel {
  display: block;
}

.panel-header.compact {
  padding-bottom: 12px;
}

.form-message {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.form-message.good {
  color: var(--good);
}

.form-message.bad {
  color: var(--bad);
}

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

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

.topbar-actions form {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.status-pill,
.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 10px;
}

.status-pill.running,
.badge.posted,
.badge.ready_to_post {
  background: #e6f4ea;
  color: var(--good);
}

.status-pill.stopped,
.badge.post_verification_failed,
.badge.post_failed,
.badge.post_wrong_submit_clicked,
.badge.blocked {
  background: #fce8e6;
  color: var(--bad);
}

.badge.pending,
.badge.needs_review,
.badge.needs_approval,
.badge.scheduled {
  background: #fef7e0;
  color: var(--warn);
}

.badge.ignored,
.badge.failed {
  background: #eceff3;
  color: #4b5563;
}

.tabs {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 24px;
}

.tab {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  padding: 14px 12px 12px;
}

.tab.active {
  border-bottom-color: var(--brand);
  color: var(--ink);
}

main {
  padding: 24px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.warning-banner {
  background: #fce8e6;
  border: 1px solid #f4b9b4;
  border-radius: 8px;
  color: var(--bad);
  font-weight: 800;
  margin-bottom: 18px;
  padding: 12px 14px;
}

button,
a.button {
  align-items: center;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  text-decoration: none;
}

button.secondary,
a.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

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

button.small,
a.small {
  font-size: 13px;
  min-height: 32px;
  padding: 6px 10px;
}

button:disabled {
  cursor: progress;
  opacity: .55;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card {
  align-items: stretch;
  color: var(--ink);
  display: block;
  min-height: 96px;
  padding: 16px;
  text-align: left;
  width: 100%;
}

.metric-card {
  background: var(--panel);
  border-color: var(--line);
  cursor: default;
}

.metric-card.clickable {
  cursor: pointer;
}

.metric-card.clickable:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 10px rgba(24, 90, 188, .12);
}

.card .label,
.account-grid .label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.card .value,
.account-grid .value {
  color: var(--ink);
  display: block;
  font-size: 24px;
  font-weight: 800;
  word-break: break-word;
}

.account-grid .value {
  font-size: 15px;
  font-weight: 700;
}

.path-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.panel {
  overflow: hidden;
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

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

.inline-filter {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

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

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

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

th {
  background: #faf9f6;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

td.clip {
  max-width: 280px;
}

.truncate {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

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

.logs {
  background: #151515;
  color: #f4f1ea;
  font-size: 13px;
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.settings-form {
  padding-bottom: 16px;
}

.settings-form .muted {
  margin: 14px 16px 0;
}

.settings-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  padding: 16px;
}

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

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  width: 100%;
}

.reply-cell {
  min-width: 320px;
}

.note-preview-cell {
  min-width: 420px;
}

.reply-editor {
  line-height: 1.4;
}

.table-reply-editor {
  min-height: 120px;
}

.table-note-editor {
  min-height: 150px;
}

.modal-reply-editor {
  min-height: 220px;
}

.note-editor {
  font-family: inherit;
  white-space: pre-wrap;
}

#modal-note-editor {
  min-height: 420px;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.compact-actions {
  margin: 8px 0 12px;
}

.file-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.file-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.file-row a {
  color: var(--blue);
  font-weight: 700;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  max-height: 86vh;
  max-width: 980px;
  padding: 0;
  width: min(94vw, 980px);
}

#listing-note-modal {
  max-width: 1120px;
  width: min(96vw, 1120px);
}

dialog::backdrop {
  background: rgba(0, 0, 0, .35);
}

.modal-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.job-detail {
  display: grid;
  gap: 14px;
  max-height: calc(86vh - 65px);
  overflow: auto;
  padding: 16px;
}

.detail-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.account-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.account-summary {
  align-items: flex-start;
  display: flex;
  gap: 12px;
}

.account-summary h3 {
  margin: 0 0 4px;
}

.account-summary p {
  margin: 0;
}

.profile-upload-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.profile-upload-form h3 {
  margin: 0 0 4px;
}

.profile-upload-form p {
  margin: 0 0 10px;
}

.profile-upload-form pre {
  background: #faf9f6;
  border-radius: 7px;
  margin: 0;
  overflow: auto;
  padding: 10px;
}

.compact-warning {
  margin-bottom: 0;
}

.detail-block h3 {
  font-size: 14px;
  margin: 0 0 8px;
}

pre.json {
  background: #faf9f6;
  border-radius: 7px;
  margin: 0;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
}

.help-panel {
  padding-bottom: 16px;
}

.help-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  padding: 16px;
}

.help-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.help-block h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

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

.help-block pre {
  background: #151515;
  border-radius: 7px;
  color: #f4f1ea;
  font-size: 13px;
  margin: 8px 0 12px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.help-block ul {
  color: var(--muted);
  line-height: 1.5;
  margin: 8px 0 0;
  padding-left: 20px;
}

.toast {
  background: var(--brand);
  border-radius: 8px;
  bottom: 18px;
  color: #fff;
  left: 50%;
  max-width: min(520px, calc(100vw - 36px));
  padding: 12px 14px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 10;
}

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

  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 16px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
