:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #68736f;
  --line: #dfe5e2;
  --surface: #ffffff;
  --canvas: #f5f7f6;
  --green: #176b4d;
  --green-dark: #10553c;
  --green-soft: #e8f4ee;
  --amber: #a7600a;
  --amber-soft: #fff3dc;
  --red: #b42318;
  --red-soft: #fff0ee;
  --blue: #315b9a;
  --blue-soft: #edf3fc;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { color: var(--green); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .35rem; font-size: 1.85rem; letter-spacing: 0; }
h2 { margin-bottom: .25rem; font-size: 1.08rem; letter-spacing: 0; }

.primary, .secondary, .danger {
  min-height: 42px; padding: 0 18px; border-radius: 6px; border: 1px solid transparent;
  font-weight: 650; transition: background .15s, border-color .15s, transform .15s;
}
.primary { color: white; background: var(--green); }
.primary:hover { background: var(--green-dark); }
.primary:disabled { cursor: not-allowed; opacity: .45; }
.secondary { color: var(--ink); background: white; border-color: var(--line); }
.secondary:hover { border-color: #9eaaa5; background: #fafbfa; }
.danger { color: var(--red); background: white; border-color: #e9b8b2; }
.danger:hover { background: var(--red-soft); border-color: var(--red); }
.danger-text { color: var(--red); }
.wide { width: 100%; }
.icon-button, .close-btn {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 6px; background: white;
  color: var(--ink); font-size: 1.35rem; line-height: 1;
}
.icon-button:hover, .close-btn:hover { background: var(--canvas); }

label { display: grid; gap: 7px; color: #35423d; font-size: .86rem; font-weight: 650; }
input, select, textarea {
  width: 100%; border: 1px solid #cbd4d0; border-radius: 6px; background: white; color: var(--ink);
  padding: 10px 12px; outline: none;
}
input, select { min-height: 43px; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 77, .11); }
.form-error { min-height: 20px; margin-top: 8px; color: var(--red); font-size: .85rem; }
.mode-hint { margin: -6px 0 0; padding: 11px 12px; border-left: 3px solid var(--green); color: var(--muted); background: var(--green-soft); font-size: .82rem; line-height: 1.55; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef2f0; }
.login-panel { width: min(410px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 18px 50px rgba(25, 42, 35, .09); }
.login-panel h1 { margin-top: 22px; }
.login-panel p { margin-bottom: 26px; color: var(--muted); }
.login-panel .primary { margin-top: 18px; }
.brand-mark {
  width: 46px; height: 46px; display: inline-grid; place-items: center; border-radius: 7px;
  color: white; background: var(--green); font-weight: 800; font-family: Georgia, serif; font-size: 1.4rem;
}
.brand-mark.small { width: 32px; height: 32px; border-radius: 5px; font-size: 1rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 24px 14px 18px; display: flex; flex-direction: column;
  background: #18231f; color: white;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand strong { letter-spacing: 0; }
.sidebar nav { margin-top: 38px; }
.nav-item { width: 100%; padding: 11px 12px; border: 0; border-radius: 5px; text-align: left; color: #c9d2ce; background: transparent; }
.nav-item.active { color: white; background: #2c3b35; }
.nav-item.bottom { margin-top: auto; }
.main-content { width: min(1240px, 100%); padding: 38px 44px 60px; margin: 0 auto; }
.page-header, .section-heading, .dialog-header, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-header { margin-bottom: 28px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 30px; }
.summary-item { min-height: 104px; padding: 19px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.summary-item span { color: var(--muted); font-size: .8rem; }
.summary-item strong { display: block; margin-top: 10px; font-size: 1.55rem; }
.content-section { padding-top: 4px; }
.section-heading { margin-bottom: 14px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }
.campaign-list { display: grid; gap: 10px; }
.campaign-row {
  display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(150px, .8fr) repeat(3, minmax(80px, .45fr)) auto;
  align-items: center; gap: 15px; min-height: 82px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 7px; background: white;
}
.campaign-row:hover { border-color: #b7c2bd; }
.campaign-title { min-width: 0; }
.campaign-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-title small, .metric span { color: var(--muted); font-size: .75rem; }
.metric strong { display: block; font-size: .95rem; }
.status-badge { display: inline-flex; align-items: center; width: fit-content; min-height: 28px; padding: 4px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.status-draft { color: var(--amber); background: var(--amber-soft); }
.status-open { color: var(--green); background: var(--green-soft); }
.status-completed { color: var(--blue); background: var(--blue-soft); }
.row-action { white-space: nowrap; }
.empty-state { padding: 48px 20px; border: 1px dashed #bdc7c2; border-radius: 7px; text-align: center; color: var(--muted); background: white; }

dialog { width: min(680px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 70px rgba(16, 29, 24, .25); }
dialog::backdrop { background: rgba(15, 25, 21, .55); }
.detail-dialog { width: min(900px, calc(100% - 32px)); }
.dialog-content { padding: 26px; overflow: auto; }
.dialog-header { margin-bottom: 22px; }
.dialog-header h2 { margin-top: 4px; font-size: 1.35rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.span-2 { grid-column: span 2; }
.dialog-actions { justify-content: flex-end; margin-top: 22px; }
.helper { color: var(--muted); font-size: .86rem; line-height: 1.55; }
.file-input { padding: 15px; border: 1px dashed #aebbb5; border-radius: 6px; background: var(--canvas); }
.file-input input { min-height: auto; padding: 0; border: 0; background: transparent; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: .75rem; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.preview-box { max-height: 220px; overflow: auto; margin-top: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfa; font: .78rem/1.55 Consolas, monospace; white-space: pre-wrap; }
.detail-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.next-step { display: grid; gap: 5px; margin-bottom: 14px; padding: 13px 15px; border: 1px solid #bad8ca; border-radius: 6px; background: var(--green-soft); }
.next-step span { color: var(--green); font-size: .75rem; font-weight: 700; }
.next-step strong { font-size: .88rem; line-height: 1.5; }
.detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 24px; }
.detail-stat { padding: 13px; border-left: 3px solid var(--green); background: var(--canvas); }
.detail-stat span { display: block; color: var(--muted); font-size: .75rem; }
.detail-stat strong { display: block; margin-top: 5px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: var(--canvas); font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 360px; padding: 13px 16px; border-radius: 6px; color: white; background: #26352f; box-shadow: 0 10px 28px rgba(0,0,0,.2); }

.public-body { min-height: 100vh; background: #eef2f0; }
.public-shell { width: min(760px, 100%); min-height: 100vh; margin: 0 auto; padding: 24px 24px 54px; background: white; }
.public-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.campaign-intro { padding: 50px 0 34px; }
.campaign-intro h1 { max-width: 640px; margin: 10px 0 15px; font-size: 2.25rem; line-height: 1.22; }
.campaign-intro > p { max-width: 620px; color: var(--muted); line-height: 1.75; white-space: pre-wrap; }
.public-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.public-meta span { padding: 7px 10px; border-radius: 5px; background: var(--canvas); color: #46534e; font-size: .8rem; }
.participate-panel { padding: 25px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.participate-panel h2 { margin-bottom: 20px; }
.join-form { display: grid; gap: 16px; }
.draw-button { min-height: 56px; font-size: 1.05rem; }
.result-section { text-align: center; padding: 18px 4px; }
.result-symbol { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; font-size: 1.7rem; font-weight: 800; }
.result-symbol.win { color: var(--green); background: var(--green-soft); }
.result-symbol.wait { color: var(--amber); background: var(--amber-soft); }
.result-symbol.lose { color: var(--blue); background: var(--blue-soft); }
.prize-data { margin-top: 18px; padding: 15px; border: 1px solid #bad8ca; border-radius: 6px; text-align: left; background: var(--green-soft); font: .85rem/1.6 Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.prize-download { margin-top: 14px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 18px; }
  .sidebar nav { margin: 0 0 0 25px; }
  .sidebar .nav-item { width: auto; }
  .nav-item.bottom { margin: 0 0 0 auto; }
  .main-content { padding: 28px 22px 50px; }
  .campaign-row { grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(70px, .5fr)) auto; }
  .campaign-row .mode-cell { display: none; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .sidebar nav { display: none; }
  .page-header { align-items: flex-end; }
  .page-header .primary { padding: 0 12px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-item { min-height: 90px; }
  .campaign-row { grid-template-columns: 1fr auto; gap: 10px; }
  .campaign-row .metric, .campaign-row .mode-cell { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
  .dialog-content { padding: 20px; }
  .public-shell { padding: 18px 18px 42px; }
  .campaign-intro { padding: 38px 0 26px; }
  .campaign-intro h1 { font-size: 1.8rem; }
  .participate-panel { padding: 20px; }
}
