:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --panel: #ffffff;
  --ink: #17211c;
  --muted: #64706a;
  --line: #dfe5dd;
  --green: #157f54;
  --red: #b23a48;
  --gold: #b88722;
  --blue: #235f9f;
  --shadow: 0 10px 30px rgba(23, 33, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(245, 246, 242, 0.2)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar,
.metrics,
.layout {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

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

.hidden {
  display: none !important;
}

.page-tabs {
  display: inline-grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 4px;
  width: min(100%, 1040px);
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1eb;
}

.page-tab {
  min-height: 38px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.page-tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(23, 33, 28, 0.08);
}

.page {
  display: none;
}

.active-page {
  display: block;
}

.sub-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 760px);
  margin-bottom: 18px;
}

.sub-page {
  display: none;
}

.active-sub-page {
  display: block;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.page-tab {
  background: transparent;
  color: var(--muted);
}

.page-tab.active {
  background: var(--panel);
  color: var(--ink);
}

.tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: min(100%, 360px);
  margin: 0 0 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1eb;
}

.tab-button {
  min-height: 36px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
}

.tab-button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(23, 33, 28, 0.08);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.online::before {
  background: var(--green);
}

.status-dot.offline::before {
  background: var(--red);
}

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

.metrics article,
.alert-card,
.side-column section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  min-height: 92px;
  padding: 16px;
}

.x-connection-card {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.x-connection-card.connected {
  border-color: rgba(21, 127, 84, 0.38);
  background: #edf8f1;
}

.x-connection-card.connected strong {
  color: var(--green);
}

.x-connection-card.disconnected {
  border-color: rgba(178, 58, 72, 0.35);
  background: #fbebee;
}

.x-connection-card.disconnected strong {
  color: var(--red);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  letter-spacing: 0;
}

.metric-action {
  min-height: 30px;
  margin-top: 10px;
  border: 1px solid var(--line);
  background: #edf1eb;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
}

.danger-action {
  border-color: rgba(178, 58, 72, 0.26);
  background: #f9ecef;
  color: var(--red);
}

.positive-text {
  color: var(--green);
}

.negative-text {
  color: var(--red);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.investment-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.analytics-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.tweet-generator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
  align-items: start;
}

.tweet-generator-layout .wide-panel {
  grid-column: auto;
}

.analytics-panel {
  min-height: 260px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.admin-login-panel {
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 16px;
  align-items: center;
  margin: 0 0 24px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.admin-login-panel.visible {
  display: grid;
}

.admin-login-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
}

.admin-login-form input {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.newsletter-panel {
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: 16px;
  align-items: center;
  margin: 0 0 24px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.newsletter-panel.visible {
  display: grid;
}

.newsletter-panel h2 {
  margin-top: 3px;
}

.newsletter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.newsletter-form input {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.form-message {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.subscription-list {
  display: grid;
  gap: 10px;
}

.subscription-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfa;
}

.subscription-row strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
}

.subscription-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.subscription-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 6px;
  padding: 0 9px;
  text-transform: capitalize;
}

.subscription-status.active {
  background: #e8f4ee;
  color: var(--green);
}

.subscription-status.paused {
  background: #f7ecee;
  color: var(--red);
}

.tweet-draft-list {
  display: grid;
  gap: 12px;
}

.training-game-list {
  display: grid;
  gap: 12px;
}

.tweet-draft-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.training-card {
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    border-color 140ms ease;
}

.training-card-decided {
  border-color: rgba(21, 127, 84, 0.35);
  opacity: 0.55;
  transform: scale(0.99);
  pointer-events: none;
}

.tweet-draft-top,
.tweet-draft-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.tweet-draft-top strong {
  display: block;
  color: #235f9f;
  font-size: 14px;
}

.tweet-draft-top span {
  color: #8a5f16;
  font-size: 12px;
  font-weight: 800;
}

.tweet-copy {
  color: #17211c;
  font-size: 15px;
  line-height: 1.5;
}

.tweet-image-preview {
  position: relative;
  overflow: visible;
  width: min(560px, 100%);
  aspect-ratio: 1 / 1;
  border: 1px solid #d8e1dc;
  border-radius: 8px;
  background: #101418;
}

.tweet-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tweet-image-preview span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: 999px;
  background: rgba(16, 33, 26, 0.82);
  color: #ffffff;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
}

.tweet-image-preview.unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  color: #8a5f16;
  font-size: 13px;
  font-weight: 900;
}

.tweet-image-preview.hidden {
  display: none;
}

.tweet-draft-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.tweet-draft-meta span {
  min-height: 24px;
  border-radius: 999px;
  background: #edf1eb;
  color: #47564e;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.tweet-draft-meta span:last-child {
  background: #fff6e3;
  color: #8a5f16;
}

.tweet-draft-meta a {
  min-height: 24px;
  border-radius: 999px;
  background: #edf4fb;
  color: var(--blue);
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.tweet-source {
  display: -webkit-box;
  overflow: hidden;
  color: #6f5a22;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sp500-update-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
  gap: 16px;
}

.sp500-update-layout .wide-panel {
  grid-column: auto;
}

.sp500-update-list {
  display: grid;
  gap: 16px;
}

.sp500-update-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.sp500-mover-grid {
  display: grid;
  gap: 12px;
}

.sp500-mover-card {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid #dfe5dd;
  border-radius: 8px;
  background: #ffffff;
}

.sp500-mover-card.positive {
  border-left: 4px solid #22c55e;
}

.sp500-mover-card.negative {
  border-left: 4px solid var(--red);
}

.sp500-mover-image {
  width: 100%;
  min-height: 0;
}

.sp500-mover-body {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.sp500-mover-body > p {
  color: #17211c;
  font-size: 15px;
  line-height: 1.45;
}

.sp500-posted-panel {
  position: sticky;
  top: 14px;
}

.weekly-campaign-toolbar,
.weekly-campaign-editor {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.weekly-campaign-picker,
.weekly-campaign-fields label,
.weekly-post-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.weekly-campaign-toolbar select,
.weekly-campaign-editor input,
.weekly-post-fields input,
.weekly-post-fields textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 11px;
  font: inherit;
}

.weekly-toolbar-actions,
.weekly-editor-actions,
.weekly-post-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.weekly-validation-errors {
  margin-bottom: 14px;
  border: 1px solid #efb1b8;
  border-radius: 8px;
  background: #fff1f3;
  color: #8f2534;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.weekly-validation-errors ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.weekly-validation-errors .secondary-button {
  margin-top: 10px;
}

.weekly-campaign-editor {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.weekly-campaign-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr) minmax(190px, 1fr);
  gap: 12px;
}

.weekly-editor-actions {
  align-items: center;
}

.weekly-editor-actions span {
  margin-right: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.weekly-posts-section {
  padding-top: 4px;
}

.weekly-posts-list {
  display: grid;
  gap: 14px;
}

.weekly-post-card {
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #9aa69f;
  border-radius: 8px;
  background: var(--panel);
}

.weekly-post-card[data-status="queued"],
.weekly-post-card[data-status="posting"] {
  border-left-color: var(--blue);
}

.weekly-post-card[data-status="posted"] {
  border-left-color: var(--green);
}

.weekly-post-card[data-status="failed"],
.weekly-post-card[data-status="cancelled"] {
  border-left-color: var(--red);
}

.weekly-post-card[data-status="paused"] {
  border-left-color: var(--gold);
}

.weekly-post-image {
  display: grid;
  align-content: start;
  gap: 9px;
}

.weekly-post-image img {
  display: block;
  width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111;
  object-fit: contain;
}

.weekly-post-image button {
  width: 100%;
}

.weekly-post-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.weekly-post-heading,
.weekly-post-status-line,
.weekly-character-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.weekly-post-heading strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.weekly-status-badge {
  border-radius: 999px;
  background: #edf1eb;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.weekly-status-badge.posted {
  background: #e7f5ee;
  color: var(--green);
}

.weekly-status-badge.failed,
.weekly-status-badge.cancelled {
  background: #fbeaec;
  color: var(--red);
}

.weekly-status-badge.queued,
.weekly-status-badge.posting {
  background: #eaf2fb;
  color: var(--blue);
}

.weekly-status-badge.paused {
  background: #fff4d9;
  color: #8a5f16;
}

.weekly-post-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr);
  gap: 10px;
}

.weekly-post-fields .weekly-text-field {
  grid-column: 1 / -1;
}

.weekly-post-fields textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.45;
}

.weekly-character-line {
  margin-top: -5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.weekly-character-line .over-limit {
  color: var(--red);
}

.weekly-post-error {
  border-radius: 6px;
  background: #fff1f3;
  color: var(--red);
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 800;
}

.weekly-post-actions button,
.weekly-post-actions a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.weekly-post-actions .danger-button {
  border: 1px solid #efb1b8;
  background: #fff1f3;
  color: var(--red);
}

.weekly-post-actions .x-link {
  background: #edf4fb;
  color: var(--blue);
}

.metric-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 7px;
  background: #edf4fb;
  color: var(--blue);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

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

.x-posted-panel {
  min-height: auto;
  padding: 0;
  overflow: hidden;
}

.x-posted-panel summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.x-posted-panel summary::-webkit-details-marker {
  display: none;
}

.x-posted-panel summary::after {
  content: "+";
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: #edf1eb;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
}

.x-posted-panel[open] summary::after {
  content: "-";
}

.x-posted-panel summary span {
  color: var(--ink);
}

.x-posted-panel summary strong {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.x-posted-panel .freshness-list {
  max-height: 70vh;
  overflow: auto;
  padding: 0 16px 16px;
}

.x-posted-panel .freshness-item {
  background: #fbfcfa;
  border-color: #d9e3df;
}

.x-posted-panel .freshness-item strong {
  color: var(--green);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.x-posted-panel .freshness-item span {
  color: #8a5f16;
}

.x-posted-panel .freshness-item p {
  color: #17211c;
  font-size: 13px;
  line-height: 1.5;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact {
  margin-bottom: 10px;
}

.alert-list {
  display: grid;
  gap: 12px;
}

.signal-list {
  margin-bottom: 24px;
}

.alert-card {
  padding: 16px;
}

.group-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.group-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  padding: 15px 16px;
  cursor: pointer;
  list-style: none;
}

.group-summary::-webkit-details-marker {
  display: none;
}

.group-summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #edf1eb;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.group-card[open] .group-summary::after {
  content: "-";
}

.group-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.group-action {
  display: -webkit-box;
  overflow: hidden;
  color: #26342d;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.group-meta {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.group-meta strong {
  color: var(--ink);
  font-size: 24px;
}

.group-news {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.group-news-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfcfa;
}

.group-news-item > div:first-child,
.group-news-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.group-news-item strong {
  font-size: 13px;
}

.group-news-item span,
.group-news-footer span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.group-news-item p {
  margin-top: 8px;
  color: #26342d;
  font-size: 14px;
  line-height: 1.45;
}

.contract-image-preview {
  display: grid;
  width: min(100%, 460px);
  min-height: 220px;
  margin-top: 12px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #c8b27a;
  border-radius: 7px;
  background: #111512;
  color: #d7ddd9;
  font-size: 13px;
  font-weight: 800;
}

.contract-image-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1834 / 1828;
  object-fit: contain;
}

.contract-image-preview:not(.loaded, .unavailable)::after {
  content: "Generating X image preview";
}

.contract-image-preview.unavailable {
  min-height: 90px;
}

.contract-board {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  align-items: start;
  gap: 22px;
}

.contract-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.8fr) repeat(2, minmax(130px, 0.7fr)) minmax(190px, 1fr) repeat(2, minmax(145px, 0.8fr)) auto auto;
  align-items: end;
  gap: 10px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf7;
}

.contract-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.contract-filters label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.contract-filters input,
.contract-filters select {
  width: 100%;
  min-height: 42px;
}

@media (max-width: 1180px) {
  .contract-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .contract-search {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .contract-filters {
    grid-template-columns: 1fr;
  }

  .contract-search {
    grid-column: auto;
  }
}

.contract-active-column,
.contract-posted-section {
  min-width: 0;
}

.contract-posted-section {
  position: sticky;
  top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf7;
}

.contract-posted-section .section-heading {
  margin-bottom: 12px;
}

.contract-posted-section .alert-list {
  max-height: 75vh;
  overflow-y: auto;
}

.contract-date-heading {
  color: var(--ink);
  font-size: 15px;
}

.group-news-footer {
  margin-top: 10px;
}

.group-news-footer a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ticker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ticker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 6px;
  background: #e8f4ee;
  color: #0f6d47;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 900;
}

.alert-time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.alert-text {
  color: #26342d;
  line-height: 1.55;
}

.alert-source {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.alert-source a {
  color: var(--blue);
  text-decoration: none;
}

.empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd4cc;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 24px;
}

.compact-empty {
  min-height: 172px;
}

.analytics-bars,
.ticker-rank,
.freshness-list {
  display: grid;
  gap: 10px;
}

.analytics-bar {
  display: grid;
  gap: 7px;
}

.analytics-bar-label,
.rank-row,
.freshness-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analytics-bar-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.analytics-bar-label strong,
.rank-row strong {
  color: var(--ink);
  font-size: 13px;
}

.analytics-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1eb;
}

.analytics-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.rank-row {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fbfcfa;
}

.freshness-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfa;
}

.freshness-item strong {
  font-size: 13px;
}

.freshness-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.freshness-item p {
  display: -webkit-box;
  margin-top: 7px;
  overflow: hidden;
  color: #26342d;
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.event-table {
  display: grid;
  gap: 8px;
}

.event-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.7fr 0.8fr;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #fbfcfa;
}

.event-row strong {
  font-size: 13px;
  text-transform: capitalize;
}

.event-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.performance-highlight {
  min-height: 172px;
}

.performance-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.performance-card.positive {
  border-color: rgba(21, 127, 84, 0.35);
}

.performance-card.negative {
  border-color: rgba(178, 58, 72, 0.35);
}

.performance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.performance-top strong {
  font-size: 22px;
}

.performance-top span {
  color: var(--green);
  font-size: 24px;
  font-weight: 900;
}

.performance-card.negative .performance-top span {
  color: var(--red);
}

.performance-card p {
  color: #26342d;
  font-size: 13px;
  line-height: 1.45;
}

.performance-mention {
  color: var(--muted) !important;
  font-weight: 700;
}

.performance-card a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.sparkline {
  width: 100%;
  height: 58px;
  overflow: visible;
}

.sparkline path,
.sparkline line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-base {
  stroke: #dfe5dd;
  stroke-dasharray: 3 5;
}

.sparkline-up,
.sparkline-down {
  stroke-width: 3;
}

.sparkline-up {
  stroke: var(--green);
}

.sparkline-down {
  stroke: var(--red);
}

.side-column {
  display: grid;
  gap: 16px;
}

.side-column section {
  padding: 14px;
}

.source-list,
.watch-grid {
  display: grid;
  gap: 8px;
}

.source-item,
.watch-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfa;
}

.source-item strong,
.watch-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.source-item span,
.watch-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 860px) {
  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  button {
    width: 100%;
  }

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

  .layout {
    grid-template-columns: 1fr;
  }

  .investment-layout {
    grid-template-columns: 1fr;
  }

  .analytics-layout {
    grid-template-columns: 1fr;
  }

  .tweet-generator-layout {
    grid-template-columns: 1fr;
  }

  .sp500-update-layout {
    grid-template-columns: 1fr;
  }

  .contract-board {
    grid-template-columns: 1fr;
  }

  .contract-posted-section {
    position: static;
    grid-row: 1;
  }

  .weekly-campaign-toolbar,
  .weekly-campaign-editor,
  .weekly-post-card {
    grid-template-columns: 1fr;
  }

  .weekly-campaign-fields {
    grid-template-columns: 1fr;
  }

  .sp500-posted-panel {
    position: static;
  }

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

  .admin-login-panel,
  .admin-login-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 18px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .alert-head,
  .alert-source {
    align-items: flex-start;
    flex-direction: column;
  }

  .alert-time {
    white-space: normal;
  }

  .newsletter-form,
  .subscription-row,
  .tweet-draft-top {
    grid-template-columns: 1fr;
    align-items: flex-start;
    flex-direction: column;
  }

  .tweet-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .weekly-post-fields {
    grid-template-columns: 1fr;
  }

  .weekly-post-fields .weekly-text-field {
    grid-column: auto;
  }

  .weekly-toolbar-actions,
  .weekly-editor-actions,
  .weekly-post-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .event-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .group-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .group-meta {
    justify-items: start;
  }

  .group-news-item > div:first-child,
  .group-news-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .performance-grid {
    grid-template-columns: 1fr;
  }

  .freshness-item > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
