:root {
  color-scheme: light;
  --bg: #f5f7f2;
  --surface: #ffffff;
  --surface-2: #eef3ec;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d9e2d5;
  --green: #19735a;
  --blue: #255f9f;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 18px 48px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(25, 115, 90, 0.08), rgba(37, 95, 159, 0.04) 34%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

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

.topbar,
.toolbar,
.metrics,
.content-grid {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

#cycleMeta,
#deadlineMeta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

#deadlineMeta {
  color: #344054;
}

.phase-pill {
  padding: 8px 12px;
  border: 1px solid rgba(25, 115, 90, 0.24);
  color: var(--green);
  background: rgba(25, 115, 90, 0.08);
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.metric strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

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

.segments {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  min-width: 264px;
}

.segment {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  min-width: 76px;
}

.segment.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(31, 41, 51, 0.12);
}

.search {
  min-width: min(360px, 100%);
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.search span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

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

.list-panel,
.side-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.section-head {
  min-height: 58px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.submission-list {
  display: grid;
}

.submission-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  min-height: 118px;
}

.submission-card:last-child {
  border-bottom: 0;
}

.submission-card:hover {
  background: #fbfcfa;
}

.rank {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.rank-number {
  width: 44px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--green);
  font-weight: 800;
}

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

.submission-main {
  min-width: 0;
}

.submission-title {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.submission-summary {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status {
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.published,
.status.selected {
  background: rgba(25, 115, 90, 0.1);
  color: var(--green);
}

.status.pending {
  background: rgba(183, 121, 31, 0.12);
  color: var(--amber);
}

.status.rejected {
  background: rgba(180, 35, 24, 0.1);
  color: var(--red);
}

.side-panel {
  padding-bottom: 16px;
}

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

.top-box.empty {
  color: var(--muted);
}

.top-title {
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.top-votes {
  margin-top: 10px;
  color: var(--green);
  font-weight: 800;
}

.command-box {
  display: grid;
  gap: 8px;
}

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

code {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: normal;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

dialog {
  border: 0;
  border-radius: 8px;
  width: min(720px, calc(100vw - 32px));
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(31, 41, 51, 0.36);
}

.dialog-shell {
  position: relative;
  padding: 22px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.detail-title {
  padding-right: 44px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.detail-body {
  margin-top: 16px;
  white-space: pre-wrap;
  line-height: 1.7;
  color: #344054;
}

.voter-list {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.voter {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 20px, 680px);
    padding-top: 16px;
  }

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

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

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

  .search,
  .segments {
    width: 100%;
    min-width: 0;
  }

  .submission-card {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .submission-card .status {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 22px;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .metric {
    min-height: 78px;
    padding: 12px;
  }

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

  .submission-card {
    padding: 14px 12px;
    gap: 10px;
  }
}
