:root {
  color-scheme: light;
  --bg: #f7f3ee;
  --panel: #fffdf9;
  --ink: #1f2328;
  --muted: #6f6258;
  --soft: #f3eee8;
  --line: #eadfd3;
  --primary: #a71919;
  --primary-ink: #ffffff;
  --success: #067647;
  --success-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --danger: #b42318;
  --danger-bg: #fff1f3;
}

* {
  box-sizing: border-box;
}

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

body.is-logged-out {
  background: #0f172a;
}

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

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

body.is-logged-out .shell {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}

.sidebar {
  background: #111927;
  color: #eef4f8;
  padding: 22px 16px;
}

body.is-logged-out .sidebar,
body.is-logged-out .topbar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 6px;
  background: #a71919;
  font-weight: 800;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: #a8b3c2;
  font-size: 12px;
}

.session-card {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.session-card div {
  font-size: 14px;
  font-weight: 800;
}

.session-card span {
  display: block;
  margin-top: 5px;
  color: #a8b3c2;
  font-size: 12px;
  word-break: break-all;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav button {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d7e2e8;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

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

body.is-logged-out .workspace {
  width: min(420px, 100%);
  padding: 0;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions,
.endpoint,
.toolbar,
.toolbar-actions,
.filters,
.pagination,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

input,
select {
  width: 220px;
  height: 38px;
  padding: 0 10px;
}

textarea {
  width: 100%;
  min-height: 112px;
  padding: 10px;
  resize: vertical;
}

button {
  height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
  cursor: pointer;
}

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

button.ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #344054;
}

button.small {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

button.small.primary {
  background: var(--primary);
}

button.small.muted {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #344054;
}

button.small.warning {
  background: var(--warn-bg);
  color: var(--warn);
}

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

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

body.is-logged-out #loginPanel {
  width: 100%;
  padding: 34px;
  border-color: rgba(255, 255, 255, 0.14);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

.hidden {
  display: none !important;
}

.login-form {
  display: grid;
  gap: 14px;
  max-width: 360px;
}

body.is-logged-out .login-form {
  max-width: none;
}

.login-head {
  margin-bottom: 22px;
  text-align: center;
}

.login-logo {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-size: 22px;
  font-weight: 900;
}

.login-head h1 {
  font-size: 22px;
}

.login-head p {
  margin-top: 8px;
}

.login-form label,
.action-modal label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
}

.login-form button {
  width: 100%;
}

.toolbar {
  justify-content: space-between;
}

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

.summary-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 12px;
}

.summary-card strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.summary-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

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

th {
  background: var(--soft);
  color: #344054;
  font-weight: 800;
  white-space: nowrap;
}

td {
  max-width: 260px;
  color: #344054;
  word-break: break-word;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fbff;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--soft);
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.status.published,
.status.active,
.status.paid,
.status.approved,
.status.resolved {
  background: var(--success-bg);
  color: var(--success);
}

.status.pending,
.status.reviewing,
.status.deposit_pending,
.status.unpaid,
.status.open {
  background: var(--warn-bg);
  color: var(--warn);
}

.status.rejected,
.status.closed,
.status.platform_closed,
.status.banned {
  background: var(--danger-bg);
  color: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 150px;
}

.pagination {
  justify-content: flex-end;
  margin-top: 14px;
}

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

.message {
  margin-top: 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff5f5;
  color: var(--danger);
  padding: 10px 12px;
}

.message.success {
  border-color: #abefc6;
  background: var(--success-bg);
  color: var(--success);
}

.detail-drawer {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 92vw);
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -12px 0 28px rgba(16, 24, 40, 0.16);
  padding: 18px;
}

.drawer-head,
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-drawer pre {
  overflow: auto;
  max-height: calc(100vh - 94px);
  margin: 18px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101828;
  color: #eef4f8;
  padding: 14px;
  font-size: 12px;
  line-height: 1.55;
}

.modal-mask {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.54);
}

.action-modal {
  display: grid;
  gap: 16px;
  width: min(560px, 94vw);
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
  box-shadow: 0 24px 56px rgba(16, 24, 40, 0.24);
}

.action-modal input,
.action-modal select {
  width: 100%;
}

.banner-modal {
  width: min(760px, 94vw);
  max-height: 92vh;
  overflow: auto;
}

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

.banner-wide {
  grid-column: 1 / -1;
}

.banner-enabled-line {
  align-self: end;
  min-height: 38px;
}

.confirm-line {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: 8px !important;
  color: #344054 !important;
}

.confirm-line input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.modal-actions {
  justify-content: flex-end;
}

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

  .topbar,
  .toolbar,
  .topbar-actions,
  .endpoint,
  .filters,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  input,
  select {
    width: 100%;
  }

  .workspace {
    padding: 18px;
  }
}
