:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --bg: #f3f3f0;
  --surface: #ffffff;
  --surface-muted: #f8f8f6;
  --text: #171714;
  --muted: #6d6d66;
  --border: #d8d8d1;
  --accent: #ff6b00;
  --accent-dark: #d95700;
  --success: #19764a;
  --success-soft: #e9f5ee;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --focus: #8a3b00;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

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

button,
a,
input,
select,
textarea {
  outline-color: var(--focus);
}

.app-bar {
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-block,
.brand-block h1,
.brand-block p,
.editor-heading h2,
.editor-heading p,
.queue-heading p,
.review-actions p {
  margin: 0;
}

.brand-block h1 {
  font-size: 22px;
  line-height: 1.2;
}

.brand-and-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.view-switch,
.range-switch {
  display: flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
  background: var(--surface-muted);
}

.view-tab,
.range-button {
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  padding: 5px 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.view-tab.is-active,
.range-button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.eyebrow,
.section-label {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.app-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.connection-state {
  color: var(--muted);
  margin-right: 4px;
}

.button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 13px;
  cursor: pointer;
  font-weight: 700;
  background: var(--surface);
  color: var(--text);
}

.button:hover:not(:disabled) {
  border-color: #aaa9a0;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-quiet {
  border-color: var(--border);
}

.button-dark {
  background: var(--text);
  color: #fff;
}

.button-primary {
  background: var(--accent);
  color: #171714;
}

.button-primary:hover:not(:disabled) {
  background: #f06400;
  border-color: #a74400;
}

.button-danger {
  border-color: #e2aaa5;
  color: var(--danger);
  background: var(--danger-soft);
}

.button-danger-quiet {
  border-color: #e2aaa5;
  color: var(--danger);
  background: #fff;
}

.workspace {
  width: min(1440px, 100%);
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}

.analytics-page {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.hot-admin-page {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px 24px 42px;
}

.hot-admin-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hot-admin-heading h2,
.hot-admin-heading p {
  margin: 0;
}

.hot-admin-heading h2 {
  margin-top: 4px;
  font-size: 24px;
}

.hot-admin-heading > div > p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.role-summary {
  display: flex;
  align-items: center;
  gap: 9px;
}

#roleBadge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.hot-admin-message {
  border: 1px dashed #bebeb5;
  border-radius: 7px;
  padding: 40px 20px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.hot-admin-workspace {
  min-height: 680px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
}

.hot-event-panel {
  border-right: 1px solid var(--border);
  background: var(--surface-muted);
}

.hot-event-panel-heading {
  min-height: 52px;
  border-bottom: 1px solid var(--border);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hot-event-panel-heading span {
  color: var(--muted);
  font-size: 11px;
}

.hot-admin-list {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}

.hot-admin-item {
  width: 100%;
  min-height: 74px;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 12px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 34px;
  align-items: start;
  gap: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.hot-admin-item:hover,
.hot-admin-item.is-selected {
  background: var(--surface);
}

.hot-admin-item.is-selected {
  box-shadow: inset 3px 0 0 var(--accent);
}

.hot-admin-rank,
.hot-admin-heat {
  color: var(--muted);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.hot-admin-item-main {
  min-width: 0;
}

.hot-admin-item-main strong,
.hot-admin-item-main small {
  display: block;
}

.hot-admin-item-main strong {
  font-size: 13px;
  line-height: 1.4;
}

.hot-admin-item-main small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.hot-admin-heat {
  color: var(--accent-dark);
  text-align: right;
}

.hot-editor-panel {
  min-width: 0;
  padding: 24px 28px;
}

.field small {
  color: var(--muted);
  font-size: 10px;
}

.source-checks {
  margin-top: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.source-checks label {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 9px;
  background: var(--surface-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.hot-content-heading,
.hot-content-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hot-content-heading {
  margin-bottom: 14px;
}

.hot-content-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.hot-content-heading > div {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

#hotContentCount {
  color: var(--muted);
  font-size: 11px;
}

.hot-content-workspace {
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 7px;
  display: grid;
  grid-template-columns: minmax(220px, 290px) minmax(0, 1fr);
  overflow: hidden;
}

.hot-content-list {
  max-height: 620px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface-muted);
}

.hot-content-item {
  width: 100%;
  min-height: 68px;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 11px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 22px;
  align-items: start;
  gap: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.hot-content-item:hover,
.hot-content-item.is-selected {
  background: #fff;
}

.hot-content-item.is-selected {
  box-shadow: inset 3px 0 0 var(--accent);
}

.hot-content-item > span:first-child,
.hot-content-item em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.hot-content-item strong,
.hot-content-item small {
  display: block;
}

.hot-content-item strong {
  font-size: 11px;
  line-height: 1.4;
}

.hot-content-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.hot-content-editor {
  min-width: 0;
  padding: 18px;
}

.hot-media-preview {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.hot-media-preview-frame {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #edede8;
}

.hot-media-preview-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.hot-media-preview-placeholder {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hot-media-preview-play {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.68);
  font-size: 18px;
}

.hot-media-preview p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.hot-content-editor-head {
  margin-bottom: 16px;
}

.hot-content-empty,
.hot-content-list-empty {
  padding: 30px 16px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.hot-content-advanced {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.hot-content-advanced summary {
  margin-bottom: 14px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.analytics-heading,
.analytics-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.analytics-heading {
  margin-bottom: 22px;
}

.analytics-heading h2,
.analytics-heading p,
.analytics-section-heading h3,
.analytics-section-heading p {
  margin: 0;
}

.analytics-heading h2 {
  margin-top: 4px;
  font-size: 24px;
}

.analytics-heading > div > p:last-child,
.analytics-section-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.analytics-message {
  border: 1px dashed #bebeb5;
  border-radius: 6px;
  padding: 42px 20px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.analytics-metric {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 18px;
  background: var(--surface);
}

.analytics-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.analytics-metric strong {
  display: block;
  margin-top: 9px;
  overflow-wrap: anywhere;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1;
}

.analytics-metric strong.metric-up {
  color: var(--success);
}

.analytics-metric strong.metric-down {
  color: var(--danger);
}

.analytics-section {
  min-width: 0;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 18px;
  background: var(--surface);
}

.analytics-section-heading {
  align-items: flex-start;
  margin-bottom: 18px;
}

.analytics-section-heading h3 {
  font-size: 15px;
}

.bar-chart {
  height: 260px;
  padding: 8px 2px 0;
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
}

.bar-column {
  flex: 1 0 24px;
  min-width: 24px;
  height: 100%;
  display: grid;
  grid-template-rows: 22px minmax(0, 1fr) 26px;
  align-items: end;
  justify-items: center;
}

.bar-value,
.bar-label {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.bar {
  width: min(20px, 72%);
  min-height: 2px;
  align-self: end;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}

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

.rank-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.rank-table th,
.rank-table td {
  border-top: 1px solid #ecece7;
  padding: 10px 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.rank-table th {
  color: var(--muted);
  font-size: 11px;
}

.rank-table th:last-child,
.rank-table td:last-child {
  width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.analytics-empty,
.privacy-note {
  color: var(--muted);
  font-size: 12px;
}

.privacy-note {
  margin: 16px 2px 0;
}

.queue-panel {
  border-right: 1px solid var(--border);
  background: var(--surface-muted);
  min-width: 0;
}

.queue-heading {
  min-height: 76px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.queue-updated {
  margin-top: 4px !important;
  color: var(--muted);
  font-size: 12px;
}

.pending-count {
  border: 1px solid #edb186;
  border-radius: 999px;
  padding: 4px 8px;
  color: #7d3300;
  background: #fff4eb;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.filters {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.filter {
  border: 0;
  border-radius: 5px;
  padding: 7px 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.filter.is-active {
  background: var(--text);
  color: #fff;
  font-weight: 700;
}

.candidate-list {
  max-height: calc(100vh - 202px);
  overflow-y: auto;
}

.candidate-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 15px 18px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.candidate-item:hover,
.candidate-item.is-selected {
  background: var(--surface);
}

.candidate-item.is-selected {
  box-shadow: inset 3px 0 0 var(--accent);
}

.candidate-item-top,
.candidate-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.candidate-item h3 {
  margin: 8px 0 10px;
  font-size: 14px;
  line-height: 1.4;
}

.candidate-item-bottom,
.candidate-source {
  color: var(--muted);
  font-size: 12px;
}

.queue-empty,
.queue-error {
  padding: 28px 18px;
  color: var(--muted);
}

.queue-error {
  color: var(--danger);
}

.editor-panel {
  min-width: 0;
  background: var(--surface);
}

.empty-state {
  min-height: calc(100vh - 72px);
  padding: 32px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state p {
  margin: 5px 0;
}

.empty-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.editor-heading {
  padding: 24px clamp(20px, 4vw, 52px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.editor-heading h2 {
  max-width: 850px;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.35;
}

.editor-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.editor-original {
  margin-top: 8px !important;
  color: var(--muted);
  font-size: 12px;
}

.status-badge {
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff1e6;
  color: #803500;
  font-weight: 800;
}

.status-badge.approved {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.rejected {
  background: var(--danger-soft);
  color: var(--danger);
}

.source-link {
  color: var(--accent-dark);
  white-space: nowrap;
  font-weight: 700;
}

.form-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 52px) 28px;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.form-section legend {
  float: left;
  width: 100%;
  margin-bottom: 18px;
  padding: 0;
  font-size: 15px;
  font-weight: 800;
}

.form-section legend + * {
  clear: both;
}

.field-grid {
  display: grid;
  gap: 16px;
}

.field-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.field > span {
  color: #4e4e49;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #c9c9c1;
  border-radius: 5px;
  background: #fff;
  color: var(--text);
}

.field input,
.field select {
  min-height: 40px;
  padding: 8px 10px;
}

.field textarea {
  padding: 10px;
  resize: vertical;
}

.review-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  padding: 14px clamp(20px, 4vw, 52px);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.review-actions p {
  color: var(--muted);
  font-size: 12px;
}

.review-actions > div {
  display: flex;
  gap: 8px;
}

dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}

dialog::backdrop {
  background: rgba(20, 20, 18, 0.42);
}

#settingsForm {
  padding: 22px;
  display: grid;
  gap: 16px;
}

.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.dialog-close {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 25px;
}

.dialog-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 14px;
  background: var(--text);
  color: #fff;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.16);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .app-bar {
    align-items: flex-start;
  }

  .connection-state {
    display: none;
  }

  .workspace {
    display: block;
  }

  .queue-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .candidate-list {
    max-height: 310px;
  }

  .empty-state {
    min-height: 420px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hot-admin-workspace {
    grid-template-columns: 1fr;
  }

  .hot-event-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .hot-admin-list {
    max-height: 320px;
  }

  .hot-content-workspace {
    grid-template-columns: 1fr;
  }

  .hot-content-list {
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 620px) {
  .app-bar {
    padding: 12px 14px;
    flex-direction: column;
  }

  .brand-and-nav {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .view-switch {
    width: 100%;
  }

  .view-tab {
    flex: 1;
  }

  .app-actions {
    width: 100%;
    justify-content: stretch;
  }

  .app-actions .button {
    flex: 1;
  }

  .field-grid-two {
    grid-template-columns: 1fr;
  }

  .editor-heading,
  .review-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .source-link {
    align-self: flex-start;
  }

  .review-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .analytics-page {
    width: min(100% - 28px, 1240px);
    padding-top: 24px;
  }

  .hot-admin-page {
    padding: 22px 14px 34px;
  }

  .hot-admin-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .hot-content-heading,
  .hot-content-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .role-summary {
    justify-content: space-between;
  }

  .hot-editor-panel {
    padding: 20px 16px;
  }

  .analytics-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .range-switch {
    align-self: flex-start;
  }

  .metric-grid,
  .analytics-tables {
    grid-template-columns: 1fr;
  }
}
