:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-soft: #f2f4f8;
  --surface-warm: #fff7df;
  --ink: #172033;
  --muted: #4b5568;
  --line: #d7dce5;
  --line-strong: #b9c1cf;
  --accent: #c72b25;
  --accent-strong: #9f1f1a;
  --blue: #1f5f86;
  --green: #2f765e;
  --amber: #9a6a17;
  --danger: #b3261e;
  --shadow: 0 10px 28px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0;
}

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

button.ghost {
  min-height: 34px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

button.ghost:hover,
button.ghost.is-active {
  border-color: var(--accent);
  background: #fff1f0;
  color: var(--accent-strong);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(199, 43, 37, 0.12);
}

input[type="file"] {
  padding: 8px;
}

input[type="file"]::file-selector-button {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  margin-right: 12px;
  padding: 7px 11px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

pre,
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.auth-panel,
.profile-box,
.side-panel,
.preview-panel,
.editor-panel,
.empty-state,
.post {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(420px, 100%);
  padding: 30px;
}

.auth-panel.wide {
  width: min(560px, 100%);
}

.auth-panel h1,
.section-title h1,
.profile-box h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.15;
}

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

.stack {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

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

.auth-links {
  display: flex;
  gap: 18px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.notice {
  border: 1px solid #a9d8c4;
  border-radius: 6px;
  margin: 18px 0 0;
  padding: 12px 14px;
  background: #eefaf4;
  color: var(--ink);
}

.notice.error {
  border-color: #edbbb8;
  background: #fff1f0;
  color: var(--danger);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
}

.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.topbar nav {
  display: flex;
  flex: 1;
  gap: 16px;
  font-weight: 700;
}

.topbar nav a {
  color: var(--muted);
}

.topbar nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.page-grid,
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  width: min(1120px, calc(100% - 42px));
  margin: 30px auto;
}

.workspace {
  align-items: start;
}

.home-main {
  width: min(1120px, calc(100% - 42px));
  margin: 30px auto;
}

.content-flow {
  display: grid;
  gap: 18px;
}

.section-title {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.post {
  display: grid;
  gap: 13px;
  padding: 18px 20px;
}

.post:hover {
  border-color: var(--line-strong);
}

.post h2,
.side-panel h2,
.preview-panel h2,
.empty-state h2 {
  margin: 0;
  font-size: 18px;
}

.post p {
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.side-panel,
.preview-panel,
.editor-panel,
.empty-state,
.profile-box {
  padding: 20px;
}

.member-list,
.slot-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.member-list li,
.slot-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface-soft);
}

.slot-list code {
  color: var(--blue);
}

.mini-profile {
  margin-top: 20px;
}

.mini-profile pre {
  overflow: auto;
  max-height: 280px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #111827;
  color: #d1fae5;
  font-size: 12px;
  white-space: pre-wrap;
}

.editor-panel {
  display: grid;
  gap: 14px;
}

.preview-panel {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 14px;
}

.banner-preview {
  display: grid;
  min-height: 150px;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: var(--surface-soft);
}

.banner-preview strong {
  font-size: 20px;
}

.banner-preview span {
  color: var(--ink);
  font-weight: 650;
}

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

.public-banner {
  position: relative;
  display: grid;
  min-height: 170px;
  align-content: end;
  gap: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.public-banner::before {
  content: "AD";
  position: absolute;
  top: 14px;
  right: 16px;
  border: 1px solid rgba(23, 32, 51, 0.16);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.public-banner span {
  font-size: 21px;
  font-weight: 850;
}

.public-banner p {
  max-width: 36ch;
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.public-banner.mint {
  background: #e3f3e8;
}

.public-banner.blue {
  background: #e3eef9;
}

.public-banner.amber {
  background: #fff0c9;
}

.public-banner.rose {
  background: #fde4e1;
}

.narrow {
  width: min(680px, calc(100% - 42px));
  margin: 30px auto;
}

.narrow.wide {
  width: min(980px, calc(100% - 42px));
}

.profile-box dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  margin: 24px 0 0;
}

.profile-box dt {
  color: var(--muted);
  font-weight: 700;
}

.profile-box dd {
  margin: 0;
}

.flag-title {
  word-break: break-all;
  text-transform: none;
}

.profile-form {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 22px;
}

.inline-status {
  min-height: 18px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.inline-status[data-state="ok"] {
  color: var(--green);
}

.inline-status[data-state="bad"] {
  color: var(--danger);
}

.check-row,
.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.action-row {
  justify-content: flex-start;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.topic-buttons {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.topic-buttons button {
  justify-content: flex-start;
  text-align: left;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 20px;
  }

  .topbar nav {
    flex-wrap: wrap;
  }

  .page-grid,
  .workspace {
    grid-template-columns: 1fr;
    width: min(100% - 28px, 680px);
  }

  .preview-panel {
    position: static;
  }

  .public-banner-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .grid-two {
    grid-template-columns: 1fr;
  }

  .auth-panel h1,
  .section-title h1,
  .profile-box h1 {
    font-size: 25px;
  }
}
