:root {
  color-scheme: light;
  --background: #f4f4f2;
  --surface: #ffffff;
  --surface-alt: #f8f8f6;
  --text: #2a2a2a;
  --muted: #62625e;
  --border: #d9d9d4;
  --accent: #ff6600;
  --accent-hover: #e55a00;
  --link: #a83e00;
  --accent-soft: #fff0e5;
  --danger: #a12820;
  --danger-soft: #fff0ee;
  --success: #287a42;
  --radius: 6px;
  --space: 8px;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --background: #1b1b1b;
    --surface: #242424;
    --surface-alt: #2a2a2a;
    --text: #eeeeea;
    --muted: #b6b6ae;
    --border: #444440;
    --link: #ff9148;
    --accent-soft: #38271d;
    --danger: #ffaaa1;
    --danger-soft: #3c2423;
    --success: #71bd87;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --background: #1b1b1b;
  --surface: #242424;
  --surface-alt: #2a2a2a;
  --text: #eeeeea;
  --muted: #b6b6ae;
  --border: #444440;
  --link: #ff9148;
  --accent-soft: #38271d;
  --danger: #ffaaa1;
  --danger-soft: #3c2423;
  --success: #71bd87;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
}
a {
  color: var(--link);
  text-underline-offset: 3px;
}
button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
}
h1,
h2,
h3,
p,
figure {
  margin: 0;
}
h1 {
  font-size: clamp(1.65rem, 3vw, 2rem);
  letter-spacing: -0.035em;
  line-height: 1.2;
  font-weight: 650;
}
h2,
.field-heading {
  font-size: 1.05rem;
  font-weight: 650;
}
p + p {
  margin-top: 8px;
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
code,
pre {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
}
code {
  overflow-wrap: anywhere;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 440px;
  background: var(--surface-alt);
  padding: 8px;
  border-radius: 4px;
}
.muted,
.lede {
  color: var(--muted);
}
.lede {
  max-width: 720px;
  margin-top: 12px;
}
.eyebrow {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 20;
  background: var(--surface);
  padding: 12px 16px;
}
.skip-link:focus {
  top: 16px;
}
.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.sidebar .brand {
  padding: 0 12px 24px;
}
.brand-logo {
  display: block;
  flex: 0 0 44px;
  height: 44px;
  width: 44px;
  object-fit: contain;
  border-radius: 50%;
}
.brand-subtitle {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 500;
  color: var(--muted);
}
.nav-caption {
  margin: 24px 12px 8px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.nav-link {
  display: block;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 4px;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.nav-link:hover {
  background: var(--surface-alt);
  color: var(--text);
}
.nav-link.is-active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}
.sidebar-footer {
  margin-top: auto;
  padding: 24px 12px 0;
  display: grid;
  gap: 4px;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
.sidebar-footer form {
  margin-top: 12px;
}
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 80px;
  padding: 16px 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.guild-context {
  min-width: 0;
  overflow-wrap: anywhere;
}
.guild-context select {
  max-width: min(100%, 360px);
}
.theme-control select {
  font-size: 0.8rem;
  width: auto;
  min-height: 36px;
}
.main-content {
  width: 100%;
  max-width: 1320px;
  padding: 40px;
  margin: 0 auto;
}
.page-heading {
  margin-bottom: 32px;
}
.page-footer {
  padding: 24px 40px;
  margin-top: auto;
  color: var(--muted);
  font-size: 0.75rem;
}
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  min-width: 0;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-heading h2 {
  overflow-wrap: anywhere;
}
.badge,
.count {
  display: inline-block;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 550;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.badge-pending {
  color: var(--link);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.badge-active {
  color: var(--success);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat h2 {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 16px;
}
.stat p {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.stat-unit {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}
.status-dot {
  display: inline-block;
  background: var(--muted);
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-online {
  background: var(--success);
}
.details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 0;
}
dt {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 4px;
}
dd {
  margin: 0;
  font-weight: 500;
}
.module-list,
.permission-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.module-list li + li {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}
.module-list p {
  font-size: 0.9rem;
  margin-top: 4px;
}
.permission-list li + li {
  margin-top: 8px;
}
.permission-list code {
  display: block;
  color: var(--muted);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: background-color 120ms;
}
.button-primary {
  background: var(--accent);
  color: #202020;
}
.button-primary:hover {
  background: var(--accent-hover);
}
.button-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.button-secondary:hover,
.button-quiet:hover {
  background: var(--surface-alt);
}
.button-quiet {
  padding: 8px;
  min-height: 36px;
  background: transparent;
  color: var(--link);
}
.button:disabled {
  color: var(--muted);
  opacity: 0.65;
  cursor: default;
}
input,
select,
textarea {
  min-height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 4px;
  max-width: 100%;
}
input,
textarea {
  width: 100%;
}
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-alt);
  color: var(--muted);
  opacity: 1;
}
[aria-invalid='true'] {
  border-color: var(--danger);
}
textarea {
  resize: vertical;
}
label {
  display: block;
  font-weight: 550;
  font-size: 0.85rem;
}
.field {
  display: grid;
  gap: 8px;
}
.field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.setting-section .field-row {
  max-width: 560px;
}
.color-picker {
  width: 48px;
  min-width: 48px;
  height: 40px;
  padding: 4px;
}
.field-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 8px;
}
.field-error:empty {
  display: none;
}
.setting-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 24px;
  font-size: 0.8rem;
}
.panel-preview {
  position: relative;
  padding: 16px 24px;
  margin-top: 24px;
  max-width: 560px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.preview-accent {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
}
.panel-preview figcaption {
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 12px;
}
.panel-preview p {
  font-size: 0.9rem;
}
.notice {
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  margin-bottom: 24px;
  font-size: 0.9rem;
}
.notice-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-left-color: var(--danger);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}
.form-actions {
  margin-top: 24px;
}
.feature-form {
  grid-template-columns: minmax(0, 1fr);
}
[hidden] {
  display: none !important;
}
.feature-fields {
  display: grid;
  gap: 16px;
  margin: 0;
}
.check-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.check-row input {
  width: auto;
  margin-top: 4px;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.row-actions .button {
  white-space: nowrap;
}
.reaction-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(120px, 2fr) minmax(140px, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding-bottom: 16px;
}
.message-preview {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 24px;
  background: var(--surface-alt);
}
.message-preview p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 720px) {
  .reaction-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
fieldset {
  border: 0;
  padding: 0;
  margin: 24px 0 0;
  min-width: 0;
}
legend {
  font-weight: 600;
  padding: 0;
  margin-bottom: 8px;
}
.module-switch {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.module-switch label span {
  display: block;
  font-weight: 400;
  margin-top: 4px;
}
.role-mapping,
.role-hint {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 24px;
}
summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.role-mapping > p {
  margin-top: 16px;
}
.role-form {
  margin-top: 24px;
  max-width: 760px;
}
.role-form .field-row {
  margin-top: 8px;
}
.table-surface {
  padding: 0;
  overflow: hidden;
}
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}
th,
td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
thead th {
  font-weight: 550;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-alt);
  white-space: nowrap;
}
tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}
.audit-table time {
  white-space: nowrap;
}
.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px;
  padding: 20px;
}
.filter-form .field {
  flex: 1;
  min-width: 160px;
}
.text-link {
  font-size: 0.85rem;
  padding: 8px 0;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}
.empty-state {
  color: var(--muted);
  padding: 32px 20px;
}
.signed-out-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.signed-out {
  max-width: 560px;
  margin: 10vh auto;
  padding: 24px;
}
.login-card {
  border-top: 3px solid var(--accent);
  padding: 32px;
  background: var(--surface);
  border-radius: 4px;
}
.login-card .button {
  margin-top: 32px;
}
.error-page {
  padding: 24px 0;
}
.error-id {
  margin: 16px 0 32px;
}
@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 208px minmax(0, 1fr);
  }
  .topbar,
  .main-content {
    padding: 24px;
  }
  .stat {
    padding: 16px;
  }
  .module-switch {
    grid-template-columns: 1fr auto;
  }
  .module-switch .badge {
    display: none;
  }
}
@media (max-width: 720px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar .brand {
    padding: 0 0 8px;
  }
  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav-caption {
    width: 100%;
    margin: 12px 8px 4px;
  }
  .nav-link {
    padding: 8px;
    margin-bottom: 0;
  }
  .sidebar-footer {
    padding: 16px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .sidebar-footer form {
    margin: 0 0 0 auto;
  }
  .sidebar-footer .muted {
    display: none;
  }
  .topbar {
    min-height: 64px;
    padding: 12px 16px;
  }
  .main-content {
    padding: 24px 16px;
  }
  .surface {
    padding: 20px;
  }
  .table-surface {
    padding: 0;
  }
  .stat-grid {
    gap: 8px;
  }
  .stat p {
    font-size: 1.25rem;
  }
  .stat {
    padding: 12px;
  }
  .stat h2 {
    font-size: 0.7rem;
  }
  .details-grid,
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .setting-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .section-heading {
    flex-wrap: wrap;
  }
  .signed-out-bar {
    padding: 16px;
  }
  .signed-out {
    margin-top: 6vh;
    padding: 16px;
  }
  .login-card {
    padding: 24px;
  }
  .page-footer {
    padding: 24px 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
