:root {
  color-scheme: light;
  --accent: #9f1010;
  --accent-strong: #7f0d0d;
  --accent-soft: #f4dddd;
  --yes: #117a58;
  --yes-soft: #ddf4eb;
  --no: #ad5b15;
  --no-soft: #faead8;
  --bg: #f2f2f1;
  --shell: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f6;
  --surface-3: #ededec;
  --text: #111111;
  --muted: #6c6c68;
  --faint: #9a9a94;
  --border: #d9d9d5;
  --shadow: 0 16px 50px rgba(17, 17, 17, 0.08);
  --ring: rgba(159, 16, 16, 0.16);
}

[data-theme="dark"] {
  color-scheme: dark;
  --accent: #9f1010;
  --accent-strong: #d44b4b;
  --accent-soft: rgba(159, 16, 16, 0.18);
  --yes: #4fd0a0;
  --yes-soft: rgba(79, 208, 160, 0.14);
  --no: #f0a14a;
  --no-soft: rgba(240, 161, 74, 0.14);
  --bg: #050505;
  --shell: #0c0c0d;
  --surface: #111112;
  --surface-2: #171719;
  --surface-3: #202024;
  --text: #f7f7f4;
  --muted: #aaa9a3;
  --faint: #73736e;
  --border: #2b2b2f;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  --ring: rgba(159, 16, 16, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  scroll-padding-top: 118px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

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

button {
  color: inherit;
}

button,
select,
input,
textarea {
  border-radius: 8px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  display: grid;
  gap: 18px;
  width: min(440px, 100%);
  padding: 22px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 8px;
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.auth-copy,
.auth-form {
  display: grid;
  gap: 10px;
}

.auth-copy strong {
  font-size: 24px;
  line-height: 1.08;
}

.auth-copy span,
.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-note {
  display: grid;
  gap: 4px;
  padding: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.auth-note strong {
  color: var(--text);
  font-size: 14px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: 16px;
  padding: 18px 24px;
  background: var(--shell);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.brand {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.brand-name {
  justify-self: start;
  min-height: 36px;
  min-width: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  text-align: left;
}

.brand-name:hover {
  color: var(--accent-strong);
}

.community-pill,
.status-pill,
.tag-pill,
.role-pill,
.notice-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.community-pill {
  width: max-content;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: transparent;
}

.tag-link {
  cursor: pointer;
}

.tag-link:hover,
.tag-link:focus-visible {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.user-row,
.member-row,
.comment-head,
.activity-row,
.position-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #ffffff;
  background: #111111;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.avatar.small {
  width: 26px;
  height: 26px;
  font-size: 10px;
}

.identity {
  min-width: 0;
}

.identity strong,
.market-title,
.panel-title {
  display: block;
  overflow-wrap: anywhere;
}

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

.field input,
.field select,
.field textarea,
.trade-input {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

.field input,
.field select,
.trade-input {
  padding: 0 11px;
}

.field textarea {
  min-height: 96px;
  padding: 10px 11px;
  resize: vertical;
}

.nav {
  display: grid;
  gap: 5px;
}

.page-nav {
  position: fixed;
  right: 24px;
  bottom: 16px;
  left: 24px;
  z-index: 30;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.nav-button,
.ghost-button,
.primary-button,
.danger-button,
.segment-button,
.trade-side-card,
.market-main-button,
.market-side-button,
.leaderboard-row,
.filter-button,
.subject-check,
.resolve-button,
.link-button,
.profile-theme-button,
.profile-menu-button {
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  text-align: center;
}

.nav-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-button:hover,
.nav-button.active {
  color: var(--text);
  background: var(--surface-2);
}

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

.main {
  min-width: 0;
  padding: 24px;
  padding-bottom: 112px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 2px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  letter-spacing: 0;
}

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

.profile-menu-wrap {
  position: relative;
  z-index: 12;
  flex: 0 0 auto;
}

.profile-trigger {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.profile-trigger .avatar {
  width: 32px;
  height: 32px;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100vw - 32px));
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.profile-menu-actions {
  display: grid;
  gap: 8px;
}

.profile-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.profile-card-link {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 10px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.profile-menu-head .identity {
  flex: 1 1 auto;
}

.profile-card-link:hover strong,
.profile-card-link:focus-visible strong {
  color: var(--accent-strong);
}

.profile-theme-button {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  border-radius: 50%;
  font-size: 19px;
  line-height: 1;
}

.profile-theme-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.theme-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sun-icon {
  overflow: visible;
}

.sun-icon .sun-ray {
  fill: currentColor;
  stroke: none;
}

.sun-icon circle {
  fill: none;
  stroke: currentColor;
}

.moon-icon path {
  fill: currentColor;
  stroke: none;
}

.profile-menu-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
  border-radius: 8px;
  text-align: left;
}

.profile-menu-button:hover {
  background: var(--surface);
  border-color: var(--border);
}

.profile-menu-button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-menu-button strong {
  font-size: 13px;
}

.profile-menu-list {
  display: grid;
  gap: 4px;
}

.profile-option {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 7px 8px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.profile-option:hover,
.profile-option.active {
  background: var(--surface-2);
  border-color: var(--border);
}

.profile-option span {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
}

.notification-center-wrap {
  position: relative;
  z-index: 13;
  flex: 0 0 auto;
}

.notification-trigger {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
}

.notification-trigger:hover,
.notification-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.notification-trigger svg {
  width: 25px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.bell-body {
  transition: fill 140ms ease;
}

.notification-trigger:hover .bell-body,
.notification-trigger[aria-expanded="true"] .bell-body {
  fill: currentColor;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 184px));
  padding: 10px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notification-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px;
}

.notification-panel-head h2 {
  margin-bottom: 2px;
  font-size: 18px;
}

.notification-panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.notification-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.notification-panel-actions .link-button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

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

.notification-tab {
  min-height: 34px;
  padding: 0 8px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 850;
}

.notification-tab.active {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-card {
  position: relative;
  gap: 9px;
  border-left: 3px solid transparent;
}

.notification-card.unread {
  border-left-color: var(--accent);
}

.notification-card-head {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 30px;
  gap: 9px;
  align-items: start;
}

.notification-unread-dot {
  width: 7px;
  height: 7px;
  margin-top: 7px;
  background: transparent;
  border-radius: 50%;
}

.notification-card.unread .notification-unread-dot {
  background: var(--accent);
}

.notification-delete {
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  font-size: 20px;
}

.notification-delete:hover {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.notification-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.notification-actions {
  justify-content: flex-start;
}

.notification-actions .ghost-button,
.notification-actions .link-button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.primary-button,
.ghost-button,
.danger-button,
.link-button,
.resolve-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  white-space: nowrap;
}

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

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.primary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled,
.link-button:disabled,
.resolve-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--accent);
}

.ghost-button,
.link-button,
.resolve-button {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.ghost-button:hover,
.link-button:hover,
.resolve-button:hover {
  background: var(--surface-2);
}

.danger-button {
  color: #ffffff;
  background: #9e1c25;
  border-color: #9e1c25;
}

.danger-button:hover {
  background: #82141c;
}

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

.panel,
.market-card,
.market-detail,
.trade-panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.market-detail,
.trade-panel,
.form-panel {
  padding: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  line-height: 1;
}

.stats-grid.portfolio-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.filter-row,
.segment-row,
.tag-row,
.resolution-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-row {
  margin-bottom: 12px;
}

.filter-button,
.segment-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.filter-button.active,
.segment-button.active {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.filter-row .filter-button:not(.active):hover,
.filter-row .filter-button:not(.active):focus-visible {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

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

.market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 250px) 132px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
}

.market-card-link {
  cursor: pointer;
}

.market-row:hover,
.market-row:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.position-card:hover,
.position-card:focus-visible {
  outline: none;
  background: var(--surface-2);
  border-color: var(--border);
  box-shadow: none;
}

.market-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.market-main-button {
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
}

.market-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.market-side-button {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: 54px;
  overflow: hidden;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
}

.market-side-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.market-side-button:not(:disabled):hover,
.market-side-button:not(:disabled):focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.market-side-button.yes .side-price {
  color: var(--yes);
}

.market-side-button.no .side-price {
  color: var(--accent-strong);
}

.side-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.side-value {
  position: relative;
  display: block;
  min-height: 29px;
}

.side-price,
.side-picked {
  display: block;
  width: 100%;
  overflow: hidden;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 140ms ease, transform 140ms ease;
}

.side-picked {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
}

.market-side-button:not(:disabled):hover .side-price,
.market-side-button:not(:disabled):focus-visible .side-price {
  opacity: 0;
  transform: translateY(-3px);
}

.market-side-button:not(:disabled):hover .side-picked,
.market-side-button:not(:disabled):focus-visible .side-picked {
  opacity: 1;
  transform: translateY(0);
}

.market-title {
  font-size: 16px;
  font-weight: 850;
  line-height: 1.25;
}

.market-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.probability-block {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.probability {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.probability.small {
  font-size: 18px;
}

.bar {
  overflow: hidden;
  width: 100%;
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
}

.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--yes));
  border-radius: inherit;
}

.market-time {
  display: grid;
  gap: 4px;
  justify-items: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-pill.open {
  color: var(--yes);
  background: var(--yes-soft);
  border-color: transparent;
}

.status-pill.closed,
.status-pill.due {
  color: var(--no);
  background: var(--no-soft);
  border-color: transparent;
}

.status-pill.resolved {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: transparent;
}

.detail-header {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.chart-box {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
}

#probability-chart {
  height: 240px;
}

.price-stack {
  display: grid;
  gap: 10px;
}

.price-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.price-card.yes strong {
  color: var(--yes);
}

.price-card.no strong {
  color: var(--no);
}

.criteria {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.market-detail-actions {
  justify-content: flex-start;
}

.review-warning {
  display: grid;
  gap: 3px;
  padding: 12px;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid rgba(159, 16, 16, 0.24);
  border-radius: 8px;
}

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

.privacy-card {
  display: grid;
  gap: 12px;
  max-width: 720px;
}

.privacy-card p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
}

.privacy-icon {
  width: max-content;
  padding: 5px 9px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.privacy-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.trade-panel {
  display: grid;
  gap: 10px;
  scroll-margin-top: 118px;
}

.trade-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.trade-panel-head h2 {
  margin-bottom: 0;
}

.trade-market-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.trade-market-stats strong {
  color: var(--text);
}

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

.trade-side-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
}

.trade-side-card:hover,
.trade-side-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.trade-side-card:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.trade-side-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.trade-side-card.yes strong {
  color: var(--yes);
}

.trade-side-card.no strong {
  color: var(--accent-strong);
}

.trade-order-row {
  display: grid;
  grid-template-columns: 180px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.trade-field {
  gap: 5px;
}

.trade-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.preview-chip {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.preview-chip strong {
  color: var(--text);
}

.preview-row,
.data-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.preview-row strong,
.data-row strong {
  color: var(--text);
}

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

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

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

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

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.field-hint strong {
  color: var(--text);
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 10px;
  align-items: center;
}

input[type="range"] {
  accent-color: var(--accent);
}

.subject-select {
  position: relative;
}

.subject-select-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}

.subject-select-button::-webkit-details-marker {
  display: none;
}

.subject-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 800;
}

.subject-select-caret {
  width: 0;
  height: 0;
  justify-self: end;
  border-top: 6px solid var(--muted);
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  transition: transform 160ms ease;
}

.subject-select[open] .subject-select-caret {
  transform: rotate(180deg);
}

.subject-select[open] .subject-select-button {
  border-color: var(--accent);
}

.subject-menu {
  display: grid;
  gap: 8px;
  max-height: 310px;
  margin-top: 8px;
  padding: 8px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.subject-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 9px;
  background: var(--surface-2);
  border-color: var(--border);
  border-radius: 8px;
  color: var(--text);
}

.subject-check:hover {
  border-color: var(--accent);
}

.subject-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.stack {
  display: grid;
  gap: 12px;
}

.comment-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.comment-form textarea {
  display: block;
  width: 100%;
  min-height: 104px;
  padding: 14px 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  line-height: 1.35;
  resize: vertical;
}

.comment-card,
.activity-card,
.member-card,
.invite-card,
.notice-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.member-card-link {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.member-card-link:hover,
.member-card-link:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.comment-card p,
.notice-card p {
  margin-bottom: 0;
}

.invite-flow-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.invite-flow-form .top-actions {
  align-items: end;
  align-self: end;
}

.invite-card.accepted {
  border-color: var(--yes);
}

.invite-card.expired {
  opacity: 0.72;
}

.invite-actions {
  justify-content: flex-start;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
}

.leaderboard-row:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.leaderboard-stat {
  min-width: 0;
  justify-self: end;
  text-align: right;
}

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

.moderation-market-card {
  gap: 10px;
}

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

.moderation-metrics span {
  display: grid;
  min-width: 0;
  min-height: 34px;
  place-items: center;
  padding: 6px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.moderation-actions,
.funds-actions {
  justify-content: flex-start;
}

.liquidity-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tool-section {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

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

.section-head h3 {
  margin-bottom: 0;
}

.invite-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.invite-filter-row .filter-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.report-card {
  border-left: 3px solid transparent;
}

.report-card.open {
  border-left-color: var(--accent);
}

.report-card p {
  margin: 0;
  color: var(--muted);
}

.report-actions {
  justify-content: flex-start;
}

.audit-card {
  gap: 10px;
}

.audit-head {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.audit-head time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.audit-target {
  padding: 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.audit-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-details span {
  display: grid;
  gap: 2px;
  min-width: 92px;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.audit-details small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.audit-details strong {
  color: var(--text);
  font-size: 13px;
}

.portfolio-owner {
  margin-bottom: 12px;
}

.rank {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 50%;
  font-weight: 900;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.empty-state span {
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state.compact {
  min-height: auto;
  padding: 14px;
}

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

.modal {
  display: grid;
  gap: 14px;
  width: min(520px, 100%);
  padding: 18px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.modal-head h2 {
  margin-bottom: 0;
}

.modal-market-title {
  margin: 0;
  font-weight: 850;
  line-height: 1.25;
}

.confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

.toast {
  position: fixed;
  right: 22px;
  bottom: 94px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 14px;
  color: #ffffff;
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-weight: 750;
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .content-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .trade-panel {
    position: static;
  }

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

@media (max-width: 820px) {
  .app-header {
    padding: 16px 18px;
  }

  .header-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .page-nav {
    right: 18px;
    bottom: 14px;
    left: 18px;
  }

  .nav-button {
    justify-content: center;
    text-align: center;
  }

  .main {
    padding: 18px;
    padding-bottom: 108px;
  }

  .trade-panel-head {
    display: grid;
    align-items: start;
  }

  .trade-market-stats {
    justify-content: flex-start;
  }

  .trade-order-row {
    grid-template-columns: 1fr;
  }

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

  .market-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .probability-block {
    justify-items: start;
  }

  .market-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .form-grid,
  .two-column,
  .privacy-facts {
    grid-template-columns: 1fr;
  }

  .leaderboard-row {
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
  }

  .leaderboard-stat {
    grid-column: 2;
    justify-self: start;
    text-align: left;
  }

  .leaderboard-stat strong,
  .leaderboard-stat .meta {
    display: inline;
  }

  .leaderboard-stat .meta {
    margin-left: 4px;
  }

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

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

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

@media (max-width: 680px) {
  .header-actions > .primary-button {
    display: none;
  }

  .page-nav {
    gap: 6px;
    padding: 7px;
  }

  .nav-button {
    padding: 0 6px;
    font-size: 14px;
  }
}

@media (max-width: 540px) {
  .app-header {
    padding: 12px 14px;
  }

  .header-row {
    gap: 10px;
  }

  .brand-name {
    min-height: 32px;
    font-size: 24px;
  }

  .community-pill {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    gap: 7px;
  }

  .header-actions .primary-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .profile-menu {
    position: fixed;
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 92px);
    overflow: auto;
  }

  .notification-panel {
    position: fixed;
    top: 72px;
    right: 12px;
    bottom: 88px;
    left: 12px;
    width: auto;
    max-height: none;
  }

  .notification-panel-head {
    display: grid;
  }

  .notification-panel-actions {
    justify-content: flex-start;
  }

  .main {
    padding: 14px;
    padding-bottom: 104px;
  }

  .page-nav {
    right: 12px;
    bottom: 12px;
    left: 12px;
    gap: 5px;
    padding: 6px;
  }

  .nav-button {
    min-height: 38px;
    padding: 0 4px;
    font-size: 12.5px;
  }

  .portfolio-stats .stat {
    padding: 10px;
  }

  .portfolio-stats .stat strong {
    font-size: 20px;
  }

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

  .liquidity-overview {
    grid-template-columns: 1fr;
  }

  .filter-row,
  .segment-row,
  .resolution-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .market-row,
  .panel,
  .market-detail,
  .trade-panel,
  .form-panel {
    padding: 14px;
  }

  .market-actions,
  .trade-side-grid {
    gap: 7px;
  }

  .market-side-button {
    min-height: 48px;
  }

  .invite-flow-form {
    grid-template-columns: 1fr;
  }

  .market-time {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .moderation-menu {
    grid-template-columns: 1fr;
  }

  .audit-head {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .audit-head time {
    grid-column: 2;
  }

  .audit-details span {
    flex: 1 1 120px;
    min-width: 0;
  }

  .section-head {
    display: grid;
    justify-items: stretch;
  }

  .invite-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

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

  .modal {
    padding: 14px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button,
  .danger-button,
  .resolve-button,
  .filter-button,
  .segment-button {
    width: 100%;
  }

  .notification-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .notification-actions .ghost-button,
  .notification-actions .link-button {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
  }

  .header-actions .primary-button {
    width: auto;
  }

  .profile-trigger {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 380px) {
  .page-nav {
    right: 8px;
    left: 8px;
    gap: 3px;
    padding: 5px;
  }

  .nav-button {
    padding: 0 2px;
    font-size: 11.25px;
  }
}
