:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-soft: #f9faf7;
  --line: #dfe4dc;
  --line-strong: #c9d2c7;
  --text: #1e2521;
  --muted: #697168;
  --green: #176b52;
  --green-soft: #e8f2ee;
  --blue: #285f8f;
  --blue-soft: #e8f0f7;
  --amber: #9d6b1d;
  --amber-soft: #fbf2df;
  --red: #a84438;
  --shadow: 0 14px 34px rgba(36, 44, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  color: var(--text);
  background: var(--bg);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body.is-locked {
  grid-template-columns: 1fr;
}

body.is-locked .admin-shell {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-screen.is-hidden {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card .brand-mark {
  width: 44px;
  height: 44px;
}

.login-presets {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
}

.permission-hidden {
  display: none !important;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: #fbfcf9;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.nav-item.is-active {
  color: var(--green);
  background: var(--green-soft);
  font-weight: 700;
}

.sidebar-note {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sidebar-note span,
.sidebar-note strong {
  display: block;
}

.sidebar-note span {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-note strong {
  margin-top: 4px;
  color: var(--green);
  font-size: 13px;
}

.shell {
  min-width: 0;
  padding: 22px 26px 38px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 16px;
}

.topbar-actions {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.ghost-button,
.link-button,
.segmented button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.ghost-button {
  height: 34px;
  padding: 0 12px;
}

.link-button {
  height: 30px;
  padding: 0 10px;
  color: var(--green);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.workspace--teams {
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
}

.form-stack {
  display: grid;
  gap: 14px;
}

.team-management {
  display: grid;
  gap: 14px;
}

.team-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-head {
  min-height: 54px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head--stacked {
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.panel-head--stacked .subtle {
  white-space: normal;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.form-panel {
  padding-bottom: 16px;
}

.embedded-form {
  padding: 14px 16px 16px;
  display: grid;
  gap: 12px;
}

.embedded-form h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
}

.form-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.subform-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.embedded-form--border {
  border-left: 1px solid var(--line);
  background: var(--surface-soft);
}

form label {
  display: grid;
  gap: 7px;
  margin: 14px 16px 0;
  color: var(--muted);
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px;
}

.form-row--single {
  grid-template-columns: minmax(0, 1fr);
}

.form-row--event-meta {
  grid-template-columns: minmax(150px, 0.8fr) minmax(260px, 1.6fr);
}

.event-location-field {
  min-width: 0;
}

.form-row label {
  margin: 14px 0 0;
}

.embedded-form label,
.embedded-form .form-row label,
.embedded-form .step-list,
.embedded-form .founder-preview {
  margin: 0;
}

.embedded-form .form-row {
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.embedded-form .primary-button,
.embedded-form .secondary-button {
  margin: 0;
  width: fit-content;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.stats-filter {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) auto;
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.stats-filter label {
  margin: 0;
}

.primary-button--inline {
  margin: 0;
}

.step-list {
  display: grid;
  gap: 8px;
  margin: 14px 16px 0;
}

.step-list span {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  outline: 0;
}

input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 94px;
  resize: vertical;
  padding: 10px;
  line-height: 1.6;
}

.reason-field textarea {
  min-height: 126px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 82, 0.12);
}

.primary-button {
  height: 40px;
  margin: 16px 16px 0;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  height: 38px;
  margin: 16px 16px 0;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--green);
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  background: #125840;
}

.founder-preview {
  min-height: 76px;
  margin: 14px 16px 0;
  padding: 12px;
  display: grid;
  gap: 6px;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
}

.founder-preview strong {
  color: var(--text);
}

.founder-preview span {
  color: var(--muted);
}

.founder-preview.is-ready {
  border-style: solid;
  border-color: rgba(23, 107, 82, 0.28);
  background: var(--green-soft);
}

.founder-preview.is-warning {
  border-style: solid;
  border-color: rgba(157, 107, 29, 0.36);
  background: var(--amber-soft);
  color: var(--amber);
}

.table-panel {
  min-width: 0;
}

.audit-log .name-cell {
  min-width: 280px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.name-cell {
  min-width: 180px;
  white-space: normal;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.badge.green {
  background: var(--green-soft);
  color: var(--green);
}

.badge.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.red {
  background: #f8e7e4;
  color: var(--red);
}

.table-action {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.table-action:hover {
  background: var(--green-soft);
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented button {
  height: 28px;
  border: 0;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--green);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(30, 37, 33, 0.92);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  pointer-events: none;
  font-size: 13px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .workspace,
  .team-config-grid,
  .subform-grid,
  .layout-grid,
  .metric-grid,
  .stats-filter {
    grid-template-columns: 1fr;
  }
}
