: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;
  padding-left: 244px;
}

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

.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: linear-gradient(90deg, #f6f7ff, #f7f3ff);
  border-bottom: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  display: flex;
  justify-content: space-between;
  margin: 24px 28px 0;
  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,
h3,
h4 {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

h4 {
  font-size: 15px;
  margin-top: 16px;
}

.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;
}

main {
  padding: 24px 28px;
}

.app-sidebar {
  background: #050505;
  bottom: 0;
  color: #f7f7f4;
  display: flex;
  flex-direction: column;
  left: 0;
  position: fixed;
  top: 0;
  width: 244px;
  z-index: 20;
}

.sidebar-brand {
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  height: 118px;
  justify-content: center;
  padding: 18px;
}

.brand-car {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .22em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
}

.sidebar-nav {
  display: block;
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
}

.tab {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(255, 255, 255, .82);
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 10px;
  margin: 2px 0;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.tab:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.tab.active {
  background: #151519;
  border-color: #c6a12a;
  box-shadow: inset 0 0 0 1px rgba(198, 161, 42, .22);
  color: #fff;
}

.nav-icon {
  color: #d0a928;
  display: inline-flex;
  font-size: 15px;
  justify-content: center;
  width: 18px;
}

.nav-group {
  color: rgba(255, 255, 255, .34);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  margin: 22px 12px 8px;
  text-transform: uppercase;
}

.sidebar-user {
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  gap: 10px;
  padding: 14px 18px;
}

.sidebar-user .avatar {
  align-items: center;
  background: #151519;
  border-radius: 999px;
  color: #d0a928;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.sidebar-user strong,
.sidebar-user span {
  display: block;
}

.sidebar-user strong {
  font-size: 13px;
}

.sidebar-user span {
  color: rgba(255, 255, 255, .5);
  font-size: 11px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

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

.sync-panel {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(32, 33, 36, .96), rgba(62, 63, 66, .94)),
    var(--brand);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(30, 31, 35, .16);
  color: #fff;
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  margin-bottom: 18px;
  padding: 14px;
}

.sync-panel.is-off {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(250, 249, 246, .96)),
    var(--panel);
  border-color: var(--line);
  box-shadow: none;
  color: var(--ink);
}

.sync-orb {
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  display: inline-flex;
  font-size: 20px;
  font-weight: 900;
  height: 44px;
  justify-content: center;
  opacity: .9;
  width: 44px;
}

.sync-copy p,
.sync-copy h2 {
  margin: 0;
}

.sync-copy p {
  color: inherit;
  font-size: 13px;
  opacity: .78;
}

.sync-copy .sync-hint {
  font-weight: 700;
  margin-top: 6px;
  opacity: .95;
}

.sync-title-row {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

.sync-status {
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 3px 8px;
  text-transform: uppercase;
}

.sync-controls {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, auto);
}

.sync-controls label {
  color: inherit;
  font-size: 11px;
  letter-spacing: .06em;
  min-width: 92px;
  text-transform: uppercase;
}

.sync-controls input,
.sync-controls select {
  background: rgba(255, 255, 255, .96);
  border-color: rgba(0, 0, 0, .12);
  color: var(--ink);
  min-height: 34px;
}

.sync-controls button {
  min-height: 34px;
}

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

.success-banner {
  background: #e6f4ea;
  border: 1px solid #b7dfc4;
  border-radius: 8px;
  color: var(--good);
  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;
}

select.contract-select {
  appearance: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 32px;
  padding: 6px 10px;
}

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

.sidebar-nav .tab {
  display: flex;
  justify-content: flex-start;
}

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

.contract-panel .muted {
  margin: 4px 0 0;
}

.contract-grid {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 360px) auto;
  padding: 16px;
}

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

.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: #edf2f7;
  color: #4d5a6e;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.check-cell {
  color: #16a34a;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.empty-check {
  border: 2px solid #d2d5d9;
  border-radius: 999px;
  display: inline-block;
  height: 16px;
  width: 16px;
}

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

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

.inline-text,
.text-preview,
.text-full {
  line-height: 1.35;
  white-space: normal;
}

.expandable-text details {
  display: inline;
  margin-left: 4px;
}

.expandable-text summary {
  color: var(--blue);
  cursor: pointer;
  display: inline;
  font-weight: 800;
}

.expandable-text details[open] summary {
  display: none;
}

.text-full {
  display: inline;
}

.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;
}

.listing-log-panel {
  margin-top: 18px;
}

.listing-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 7px;
  height: 84px;
  object-fit: cover;
  width: 112px;
}

.listing-main-image {
  border-radius: 8px;
  max-height: 360px;
  max-width: 100%;
  object-fit: contain;
}

.comment-row {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.comment-header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.comment-row:last-child {
  border-bottom: 0;
}

.seller-comment {
  background: #f7fbf7;
  border-radius: 7px;
  padding: 10px;
}

.needs-reply-comment {
  background: #fff8e6;
  border-radius: 7px;
  padding: 10px;
}

.highlight-comment {
  border: 2px solid var(--blue);
  border-radius: 7px;
  padding: 10px;
}

.comment-category {
  margin: 8px 8px 0 0;
}

.comment-category.needs_reply,
.comment-category.review {
  background: #fef7e0;
  color: var(--warn);
}

.comment-category.seller_replied,
.comment-category.seller {
  background: #e6f4ea;
  color: var(--good);
}

.comment-category.general {
  background: #eceff3;
  color: #4b5563;
}

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

.admin-details {
  margin-top: 18px;
}

.admin-details summary {
  cursor: pointer;
  font-weight: 800;
  padding: 14px 16px;
}

.admin-actions {
  padding: 0 16px 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;
}

.reply-composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reply-composer textarea {
  padding-right: 10px;
}

.composer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  order: -1;
}

.icon-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  font-size: 12px;
  min-height: 28px;
  min-width: 36px;
  padding: 4px 7px;
}

.voice-status {
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.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) {
  body {
    padding-left: 0;
  }

  .app-sidebar {
    position: static;
    width: 100%;
  }

  .sidebar-brand {
    height: 72px;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 360px;
  }

  .nav-group {
    grid-column: 1 / -1;
  }

  .sidebar-user {
    display: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin: 16px;
  }

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

  main {
    padding: 16px;
  }

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

  .sync-panel {
    grid-template-columns: 1fr;
  }

  .sync-controls {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    width: 100%;
  }

  .sync-panel {
    align-items: stretch;
    padding: 18px;
  }

  .sync-icon {
    height: 38px;
    width: 38px;
  }

  .section-actions,
  .panel-actions,
  .contract-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .section-actions button,
  .panel-actions button,
  .contract-actions button,
  .contract-select {
    width: 100%;
  }

  .stats-grid,
  .contract-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    border-radius: 8px;
    margin-inline: -8px;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
  }

  table {
    min-width: 900px;
  }

  th,
  td {
    padding: 10px 8px;
  }

  .table-reply-editor,
  .table-note-editor {
    min-width: 260px;
  }

  .reply-tools {
    position: static;
    justify-content: flex-start;
    margin-bottom: 6px;
  }

  .listing-detail-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal,
  .listing-modal-content {
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    width: calc(100vw - 24px);
  }

  .modal-body,
  .listing-detail-body {
    max-height: calc(100vh - 120px);
    overflow: auto;
  }
}

/* SELLER_SUBMISSIONS_DASHBOARD_V1 */
#seller-submissions .card .value { font-size: 28px; }
#seller-submissions td { vertical-align: top; }
#seller-submissions .panel-header input[type="search"] { min-width: 290px; }
@media (max-width: 760px) { #seller-submissions .panel-header input[type="search"] { min-width: 0; width: 100%; } }

/* SELLER_SUBMISSION_FILES_V2 */
.seller-file-count { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
