:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --line: #e4e4e7;
  --text: #111111;
  --sub: #767676;
  --danger: #e53935;
  --ok: #0a7f3f;
}

* {
  box-sizing: border-box;
}

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

body.login-only {
  display: block;
}

body.login-only .sidebar,
body.login-only .topbar {
  display: none;
}

body.login-only .main {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

body.login-only #content {
  width: min(840px, calc(100vw - 44px));
  padding: 0;
}

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

.sidebar {
  width: 220px;
  background: #151515;
  color: white;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px 22px;
  border-bottom: 1px solid #333;
  margin-bottom: 16px;
}

.brand strong {
  font-size: 26px;
  letter-spacing: 0;
}

.brand span {
  color: #aaa;
  font-size: 13px;
}

.nav {
  width: 100%;
  display: block;
  border: 0;
  background: transparent;
  color: #d4d4d4;
  text-align: left;
  padding: 12px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.nav:hover,
.nav.active {
  background: #2a2a2a;
  color: white;
}

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 245, 247, 0.92);
  position: sticky;
  top: 0;
  z-index: 2;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#admin-label {
  color: var(--sub);
  font-size: 13px;
  margin-right: 4px;
}

h1 {
  margin: 0;
  font-size: 30px;
}

p {
  margin: 0;
}

#project-label {
  color: var(--sub);
  margin-top: 4px;
}

#content {
  padding: 24px 28px 60px;
}

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

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

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

.metric span {
  display: block;
  color: var(--sub);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 30px;
}

.dashboard-log {
  margin-top: 34px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 7px;
  padding: 8px 11px;
  cursor: pointer;
}

button.compact {
  padding: 7px 10px;
}

button.primary {
  background: #111;
  color: white;
  border-color: #111;
}

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

button.quiet {
  color: #333;
  background: #fff;
}

button.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 700;
}

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

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: white;
}

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

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  background: #fafafa;
  color: #555;
  position: sticky;
  top: 0;
}

td.actions {
  white-space: nowrap;
  width: 1%;
}

td.actions button {
  margin: 0 4px 4px 0;
}

.reports-table {
  min-width: 920px;
  table-layout: fixed;
}

.reports-table th:nth-child(1),
.reports-table td:nth-child(1) {
  width: 98px;
}

.reports-table th:nth-child(2),
.reports-table td:nth-child(2) {
  width: 230px;
}

.reports-table th:nth-child(4),
.reports-table td:nth-child(4) {
  width: 132px;
}

.reports-table th:nth-child(5),
.reports-table td:nth-child(5) {
  width: 238px;
}

.report-target,
.report-content {
  overflow: hidden;
}

.report-target strong,
.report-target span,
.report-target small,
.report-content strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: keep-all;
}

.report-target span {
  margin-top: 3px;
}

.report-target small {
  margin-top: 2px;
  color: var(--sub);
  font-size: 12px;
}

.report-content strong {
  margin-bottom: 3px;
}

.report-actions {
  position: relative;
}

.line-clamp {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.45;
  color: var(--sub);
  word-break: normal;
  overflow-wrap: anywhere;
}

.nowrap {
  white-space: nowrap;
}

.overflow {
  position: relative;
  display: inline-flex;
  vertical-align: top;
}

.overflow-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  width: 178px;
  display: none;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  z-index: 8;
}

.overflow.open .overflow-menu {
  display: grid;
  gap: 2px;
}

.overflow-menu button {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 6px;
  padding: 8px 9px;
  text-align: left;
  background: transparent;
  color: var(--text);
}

.overflow-menu button:hover {
  background: #f5f5f5;
}

.overflow-menu .danger-text {
  color: var(--danger);
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.narrow {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eeeeef;
  font-size: 12px;
}

.pill.active {
  color: var(--ok);
  background: #e8f5ed;
}

.pill.pending {
  color: #a15d00;
  background: #fff3df;
}

.pill.hidden,
.pill.deleted,
.pill.suspended,
.pill.rejected,
.pill.dismissed,
.pill.user_suspended,
.pill.content_hidden_user_suspended,
.pill.inactive {
  color: var(--danger);
  background: #ffecec;
}

.pill.resolved,
.pill.approved,
.pill.no_action,
.pill.post_hidden,
.pill.comment_hidden,
.pill.duplicate {
  color: var(--ok);
  background: #e8f5ed;
}

.pill.reviewing {
  color: #4b5d85;
  background: #eef2ff;
}

.snippet {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #171717;
  color: white;
  padding: 12px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.18);
  z-index: 20;
  padding: 24px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.16);
  z-index: 20;
}

.drawer {
  width: min(560px, 100vw);
  height: 100vh;
  overflow: auto;
  background: white;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 54px rgba(0, 0, 0, 0.16);
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-size: 22px;
}

.drawer-body {
  padding: 18px 20px 28px;
}

.drawer-actions {
  margin: 14px 0 20px;
}

.source-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.source-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.source-card h4 {
  margin: 12px 0 6px;
  font-size: 17px;
}

.source-card p {
  white-space: pre-wrap;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.source-meta,
.source-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--sub);
  font-size: 13px;
}

.source-meta strong {
  color: var(--text);
}

.source-card dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
  margin: 0;
}

.source-card dt {
  color: var(--sub);
}

.source-card dd {
  margin: 0;
}

.action-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.action-section h3 {
  margin: 0 0 10px;
  color: var(--sub);
  font-size: 13px;
}

.action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-zone {
  margin-top: 28px;
}

.danger-zone h3 {
  color: var(--danger);
}

.modal {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.detail-list {
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

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

.detail-row span {
  color: var(--sub);
}

.detail-row strong {
  font-weight: 500;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--sub);
}

.login-panel {
  width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 46px;
}

.login-panel h2 {
  margin: 0 0 8px;
  font-size: 44px;
}

.login-panel form {
  display: grid;
  gap: 14px;
  margin-top: 34px;
}

.login-panel label {
  display: grid;
  gap: 6px;
  font-size: 24px;
  font-weight: 700;
}

.login-panel input {
  font-size: 26px;
  padding: 18px 20px;
}

.login-panel button {
  margin-top: 14px;
  font-size: 26px;
  font-weight: 700;
  padding: 18px 20px;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 0;
}

.pagination button {
  min-width: 74px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #111;
}

.pagination button:disabled {
  color: var(--muted);
  background: #f5f5f5;
}

@media (max-width: 860px) {
  body {
    display: block;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding: 12px;
  }

  .brand {
    display: none;
  }

  .nav {
    width: auto;
    white-space: nowrap;
  }
}
