/* Styles for: Staff, Applications (builder), Users (mod view) and the public /a/<code> form.
   Built on the tokens, keyframes (viewIn, drawerIn, fadeIn) and focus ring in app.css. */

.admin-page {
  padding: 32px 32px 80px;
  max-width: 960px;
  margin: 0 auto;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head h1,
.page-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}
.page-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 20px;
  max-width: 560px;
}
.dim {
  color: var(--text-dimmer);
}
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
}
.stack > * + * {
  margin-top: 16px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 16px;
  transition: color var(--t-color) var(--ease);
}
.back:hover {
  color: var(--text);
}
.back svg {
  width: 16px;
  height: 16px;
}

/* ── Inputs & buttons ── */
.input {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  transition:
    border-color var(--t-color) var(--ease),
    background var(--t-color) var(--ease);
}
.input::placeholder {
  color: var(--text-dimmer);
}
.input:hover {
  background: var(--panel-3);
}
.input:focus,
.input:focus-visible {
  border-color: var(--text);
  outline-offset: 0;
}
textarea.input {
  resize: vertical;
  min-height: 80px;
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23a8a8a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-size: 16px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
input[type="datetime-local"].input,
input[type="date"].input {
  color-scheme: dark;
}
.input.sm {
  padding: 4px 8px;
}
.f-label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: block;
}
.f-hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  background: var(--panel-3);
  color: var(--text);
  transition:
    background var(--t-color) var(--ease),
    color var(--t-color) var(--ease),
    opacity var(--t-color) var(--ease),
    transform var(--t-color) var(--ease);
  white-space: nowrap;
}
.btn:hover {
  background: var(--panel-4);
}
.btn:active {
  transform: scale(0.98);
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn-primary {
  background: var(--text);
  color: #000;
}
.btn-primary:hover {
  background: var(--text);
  opacity: 0.88;
}
.btn-discord {
  background: var(--discord);
  color: #fff;
}
.btn-discord:hover {
  background: var(--discord-hover);
}
.btn-danger {
  color: var(--bad);
}
.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  line-height: 16px;
}
.btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}
.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-dim);
  transition:
    background var(--t-color) var(--ease),
    color var(--t-color) var(--ease);
}
.icon-btn:hover {
  background: var(--panel-3);
  color: var(--text);
}
.icon-btn.danger:hover {
  color: var(--bad);
}
.icon-btn[disabled] {
  opacity: 0.3;
  pointer-events: none;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
}
.switch-row input {
  margin-top: 2px;
  accent-color: #fff;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.switch-row .sub {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
  margin-top: 2px;
}
.switch-row.compact {
  color: var(--text-dim);
  align-items: center;
}
.switch-row.compact input {
  margin-top: 0;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  padding: 8px 12px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--t-color) var(--ease);
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.tab .n {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text-dim);
}
.tab.active .n {
  color: var(--text);
}
.user-section-mobile {
  display: none;
}

/* ── Staff ── */
.person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.person:last-child {
  border-bottom: none;
}
.person img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--panel-2);
  flex-shrink: 0;
}
.person .who {
  min-width: 0;
  flex: 1;
}
.person .nm {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person .id {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
}
.person-added {
  font-size: 12px;
  line-height: 16px;
}
.list-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.list-empty {
  padding: 24px 16px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-dimmer);
}
.add-row {
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 8px;
}

/* ── Applications list ── */
.app-grid {
  display: grid;
  gap: 8px;
}
.app-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  transition: background var(--t-color) var(--ease);
}
.app-row:hover {
  background: var(--panel-2);
}
.app-row .t {
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  margin-bottom: 2px;
}
.app-row .s {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
}
.app-row .grow {
  flex: 1;
  min-width: 0;
}
.app-row .counts {
  text-align: right;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
}
.app-row .counts b {
  color: var(--text);
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  display: block;
  font-variant-numeric: tabular-nums;
}
.new-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* ── Editor ── */
.ed-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.title-input {
  flex: 1;
  min-width: 192px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text);
  font: inherit;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  padding: 4px 8px;
  margin-left: -8px;
  transition:
    border-color var(--t-color) var(--ease),
    background var(--t-color) var(--ease);
}
.title-input:hover {
  border-color: var(--line-strong);
}
.title-input:focus {
  border-color: var(--text-dim);
  background: var(--panel);
  outline-offset: 0;
}
.share-line {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 20px;
}
.share-line a {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t-color) var(--ease);
}
.share-line a:hover {
  color: var(--text);
}
.share-line .icon-btn {
  margin-left: auto;
}
.save-state {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
}
.save-state.dirty {
  color: var(--warn);
}

.fcard {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.fcard + .fcard {
  margin-top: 8px;
}
.fcard-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.ftype {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--panel-2);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.ftype svg {
  width: 14px;
  height: 14px;
}
.fcard-tools {
  margin-left: auto;
  display: flex;
  gap: 2px;
}
.fcard .input + .input {
  margin-top: 8px;
}
.fcard .label-in {
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
}
.fextras {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.fextras .wide {
  grid-column: 1 / -1;
}
.fcard .switch-row {
  margin-top: 12px;
}
.add-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 16px;
  background: var(--panel-2);
  border-radius: var(--radius-lg);
}
.add-bar .lead {
  width: 100%;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.empty-fields {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dimmer);
  font-size: 14px;
  line-height: 20px;
  background: var(--panel);
  border-radius: var(--radius-lg);
}
.set-block {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.set-block:last-child {
  border-bottom: none;
}
.preview-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.preview-banner svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Responses ── */
.resp {
  background: var(--panel);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.resp + .resp {
  margin-top: 8px;
}
.resp summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--t-color) var(--ease);
}
.resp summary::-webkit-details-marker {
  display: none;
}
.resp summary:hover {
  background: var(--panel-2);
}
.resp summary .nm {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}
.resp summary .sub {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
}
.resp summary .chev {
  margin-left: auto;
  color: var(--text-dimmer);
  transition: transform var(--t-pop) var(--ease);
}
.resp[open] summary .chev {
  transform: rotate(90deg);
}
.resp-body {
  padding: 4px 16px 16px;
}
.ans {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.ans:last-of-type {
  border-bottom: none;
}
.ans .q {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
  margin-bottom: 4px;
}
.ans .a {
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ans .a.empty {
  color: var(--text-dimmer);
  font-style: normal;
}
.resp-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.tag-red {
  color: var(--bad);
}
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.filter-row .input {
  width: 192px;
}

/* ── Form renderer (shared by preview + public page) ── */
.qform .q {
  margin-bottom: 24px;
}
.qform .q-heading {
  margin: 32px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.qform .q-heading:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.qform .q-heading h3 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}
.qform .q-heading p,
.q-desc {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-dim);
}
.q-label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}
.q-label .req {
  color: var(--bad);
  margin-left: 4px;
}
.q-desc {
  margin-bottom: 8px;
}
.q .input {
  margin-top: 8px;
}
.q.has-error .input,
.q.has-error .choices,
.q.has-error .scale {
  border-color: var(--bad);
}
.q-err {
  font-size: 12px;
  line-height: 16px;
  color: var(--bad);
  margin-top: 4px;
}
.q-err:empty {
  display: none;
}
.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  transition: border-color var(--t-color) var(--ease);
}
.choice:hover {
  border-color: var(--text-dimmer);
}
.choice:focus-within {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.choice input {
  accent-color: #fff;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
}
.choice:has(input:checked) {
  border-color: var(--text);
}
.scale {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.scale label {
  flex: 1;
  position: relative;
}
.scale input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.scale span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition:
    background var(--t-color) var(--ease),
    color var(--t-color) var(--ease),
    border-color var(--t-color) var(--ease);
}
.scale span:hover {
  border-color: var(--text-dimmer);
}
.scale input:checked + span {
  background: var(--text);
  color: #000;
  border-color: var(--text);
}
.scale input:focus-visible + span {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
  margin-top: 4px;
}

/* ── Public application page ── */
.apply-wrap {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 48px 16px 80px;
}
.apply-col {
  width: 100%;
  max-width: 640px;
}
.apply-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 32px;
}
.apply-brand img {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
}
.apply-brand .who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
}
.apply-brand .who img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.apply-title {
  font-size: 30px;
  line-height: 36px;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  font-weight: 600;
}
.apply-desc {
  margin: 0 0 32px;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 24px;
  white-space: pre-wrap;
}
.apply-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.apply-state {
  text-align: center;
  padding: 16px 8px;
}
.apply-state h3 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 28px;
}
.apply-state p {
  margin: 0 0 24px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 20px;
}
.apply-state .ic-wrap {
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dimmer);
}
.apply-state .ic-wrap svg {
  width: 32px;
  height: 32px;
}
.apply-submit {
  margin-top: 8px;
  width: 100%;
  font-size: 16px;
  line-height: 24px;
}

/* ── Users (moderator view) ── */
.ud-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.ud-av {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  flex-shrink: 0;
  object-fit: cover;
}
.ud-name {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}
.ud-sub {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-dim);
}
.ro-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.ro-pill svg {
  width: 14px;
  height: 14px;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  margin: 16px 0 24px;
}
.stat {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.stat b {
  display: block;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat span {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
}
.stat.warn b {
  color: var(--warn);
}
.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel + .panel {
  margin-top: 16px;
}
.panel-h {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  padding: 16px 16px 8px;
  color: var(--text);
}
.panel .kv-v .tag + .tag {
  margin-left: 0;
}
.sanc {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.sanc:last-child {
  border-bottom: none;
}
.sanc-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.sanc-top .ty {
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
}
.sanc-reason {
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  margin-bottom: 12px;
}
.sanc-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 8px 16px;
  font-size: 12px;
  line-height: 16px;
}
.sanc-meta div span {
  display: block;
  color: var(--text-dimmer);
  margin-bottom: 2px;
}
.sanc-note {
  margin-top: 12px;
  background: var(--panel-2);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-dim);
  white-space: pre-wrap;
}
.sanc-ev {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.note-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.note-item:last-child {
  border-bottom: none;
}
.note-item .m {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.note-item .c {
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  word-break: break-word;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
.tbl th {
  text-align: left;
  font-weight: 500;
  color: var(--text-dimmer);
  font-size: 12px;
  line-height: 16px;
  padding: 12px 16px 8px;
}
.tbl td {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.tbl-wrap {
  overflow-x: auto;
}
.grp-list {
  max-height: 360px;
  overflow-y: auto;
}
.wear {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  padding: 16px;
}
.wear a {
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
}
.wear img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: var(--panel-2);
  margin-bottom: 4px;
  object-fit: cover;
}
.tree {
  padding-left: 16px;
  border-left: 1px solid var(--line);
  margin: 8px 0 8px 4px;
}
.tree-sec {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.tree-sec:last-child {
  border-bottom: none;
}
.tree-k {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.tree-item {
  margin: 8px 0;
}
.eco-store {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 16px 16px 4px;
  flex-wrap: wrap;
}
.eco-store b {
  font-size: 14px;
  font-weight: 600;
}
details.other > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--text-dim);
  list-style: none;
  transition: color var(--t-color) var(--ease);
}
details.other > summary::-webkit-details-marker {
  display: none;
}
details.other > summary:hover {
  color: var(--text);
}
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.search-bar .input {
  flex: 1;
}
.quota-admin-list {
  display: grid;
  gap: 12px;
}
.quota-admin-row {
  padding: 16px;
}
.quota-admin-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.quota-admin-top h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.quota-admin-top p {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.quota-admin-top > strong {
  white-space: nowrap;
}
.quota-admin-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.quota-admin-controls label {
  display: grid;
  gap: 4px;
  color: var(--text-dim);
  font-size: 12px;
}
.quota-admin-controls input {
  width: 120px;
}
.quota-admin-history {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 13px;
}
.quota-admin-history summary {
  cursor: pointer;
  color: var(--text);
}
.quota-admin-history h3 {
  margin: 12px 0 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.quota-admin-history ul,
.quota-admin-history p {
  margin: 0;
  padding-left: 20px;
}
@media (max-width: 600px) {
  .quota-admin-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .quota-admin-controls input {
    width: 100%;
  }
}
.u-loading {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-dimmer);
  font-size: 14px;
  line-height: 20px;
}

@media (max-width: 820px) {
  .admin-page {
    padding: 16px 16px 64px;
  }
  .user-section-mobile {
    display: block;
    margin: 0 0 24px;
  }
  .user-section-toggle {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
  .user-section-toggle svg:last-child {
    margin-left: auto;
    transition: transform var(--t-pop) var(--ease);
  }
  .user-section-toggle[aria-expanded="true"] svg:last-child {
    transform: rotate(180deg);
  }
  .user-section-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgb(0 0 0 / 60%);
    border: 0;
    padding: 0;
  }
  .user-section-backdrop[hidden],
  .user-section-drawer[hidden] {
    display: none;
  }
  .user-section-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 101;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: min(82vw, 300px);
    padding: 24px 16px;
    overflow-y: auto;
    background: var(--panel);
    box-shadow: 0 0 48px rgb(0 0 0 / 50%);
    animation: drawerIn var(--t-move) var(--ease) both;
  }
  .user-section-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    color: var(--text-dim);
    text-align: left;
    transition:
      background var(--t-color) var(--ease),
      color var(--t-color) var(--ease);
  }
  .user-section-item:hover {
    color: var(--text);
    background: var(--panel-2);
  }
  .user-section-item.active {
    color: var(--text);
    background: var(--panel-3);
  }
  .user-section-item .n {
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    color: var(--text-dim);
  }
  .tabs {
    display: none;
  }
  .cols-2 {
    grid-template-columns: 1fr;
  }
  .list-card .person {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .list-card .person .who {
    flex: 1 1 calc(100% - 56px);
  }
  .list-card .person .person-added {
    margin-left: 52px;
    flex: 1 1 96px;
    font-size: 12px;
  }
  .list-card .person .switch-row {
    margin-left: 52px;
    flex: 1 1 96px;
  }
  .list-card .person > .tag,
  .list-card .person > .rv-open-btn,
  .list-card .person > .icon-btn {
    flex: 0 0 auto;
  }
  .add-row {
    grid-template-columns: 1fr;
  }
  .app-row {
    flex-wrap: wrap;
  }
  .ud-head {
    align-items: flex-start;
  }
  .apply-card {
    padding: 24px;
  }
  .apply-title {
    font-size: 24px;
    line-height: 32px;
  }
}

/* Eight tabs for the owner: let the nav scroll instead of wrapping/overflowing */
.topbar-nav {
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-nav::-webkit-scrollbar {
  display: none;
}
.topbar-tab {
  white-space: nowrap;
}

/* ── Account switcher (top bar) ── */
.acct {
  position: relative;
}
.acct-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-md);
  color: var(--text);
  transition: background var(--t-color) var(--ease);
}
.acct-btn:hover,
.acct-btn[aria-expanded="true"] {
  background: var(--panel-2);
}
.acct-btn svg {
  color: var(--text-dimmer);
}
/* Menus float, so they keep a border and a shadow. Item radius = 12 − 8 = 4. */
.acct-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 288px;
  max-width: calc(100vw - 32px);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 60;
  animation: viewIn var(--t-pop) var(--ease) both;
}
.acct-menu.open {
  display: block;
}
.acct-head {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-dimmer);
  padding: 8px 8px 4px;
}
.acct-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.acct-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  color: var(--text);
  background: none;
  transition: background var(--t-color) var(--ease);
}
.acct-item:hover:not([disabled]) {
  background: var(--panel-3);
}
.acct-item[disabled] {
  cursor: default;
}
.acct-item.active {
  background: var(--panel-3);
}
.acct-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}
.acct-item .nm {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-item .nm small {
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-item .plus {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--panel-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.acct-x {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-dimmer);
  transition:
    background var(--t-color) var(--ease),
    color var(--t-color) var(--ease);
}
.acct-x:hover {
  background: var(--panel-3);
  color: var(--bad);
}
.acct-sep {
  height: 1px;
  background: var(--line-strong);
  margin: 8px 4px;
}
.acct-full {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-dimmer);
  padding: 8px;
}
@media (max-width: 820px) {
  .acct-menu {
    right: -8px;
  }
}

/* ── Caesar page ── */
.key-row {
  padding: 4px 16px 12px;
}
.keybox {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 20px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--text);
}
pre.code {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 20px;
  overflow-x: auto;
  color: var(--text-dim);
}
.step {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 16px;
}
.step-h {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  margin-bottom: 16px;
}
.step-h .n {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  color: var(--text);
  font-size: 12px;
  line-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cond-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  color: var(--text-dim);
  transition:
    background var(--t-color) var(--ease),
    color var(--t-color) var(--ease);
}
button.chip:hover {
  color: var(--text);
  background: var(--panel-4);
}
/* Role chips: a colour dot instead of a one-sided accent border */
.chip.role {
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
}
.chip.role::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c, var(--text-dimmer));
  flex-shrink: 0;
}
.chip.role button {
  color: var(--text-dimmer);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: color var(--t-color) var(--ease);
}
.chip.role button:hover {
  color: var(--bad);
}
.embed-box {
  background: var(--panel-2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.chk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 8px 12px;
  max-height: 152px;
  overflow-y: auto;
  padding: 4px 2px;
}
.test-row {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 20px;
}
.test-row .dc {
  margin-top: 8px;
}
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 640px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: viewIn var(--t-pop) var(--ease) both;
}

/* Discord message preview.
   This is a replica of Discord's own interface, so it keeps Discord's colours,
   sizes and left-bordered embed on purpose. It is the one place those rules are waived. */
.dc {
  background: #1a1b1e;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #dbdee1;
}
.dc-who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.dc-who b {
  color: #fff;
}
.dc-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #5865f2;
}
.dc-bot {
  font-size: 10px;
  font-weight: 700;
  background: #5865f2;
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
}
.dc-txt {
  word-break: break-word;
}
.dc-m {
  background: rgba(88, 101, 242, 0.3);
  color: #c9cdfb;
  border-radius: 4px;
  padding: 0 3px;
}
.dc-emb {
  margin-top: 6px;
  background: #2b2d31;
  border-left: 4px solid #5865f2;
  border-radius: 4px;
  padding: 10px 12px;
  max-width: 480px;
}
.dc-et {
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.dc-ed {
  font-size: 13.5px;
  word-break: break-word;
}
.dc-ef {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}
.dc-ef div {
  grid-column: span 3;
}
.dc-ef div.in {
  grid-column: span 1;
}
.dc-eft {
  margin-top: 8px;
  font-size: 12px;
  color: #949ba4;
}
@media (max-width: 820px) {
  .cond-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .acct-menu,
  .modal,
  .user-section-drawer {
    animation-name: fadeIn;
  }
  .resp .chev,
  .user-section-toggle svg:last-child {
    transition: none;
  }
}

/* Custom listbox controls retain the original select as the form value. */
.custom-select {
  position: relative;
  min-width: 0;
  width: 100%;
}
.custom-select.is-open {
  z-index: 80;
}
.custom-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%);
  white-space: nowrap;
}
.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}
.custom-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.custom-select-caret {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin: -4px 3px 0 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--t-color) var(--ease);
}
.custom-select.is-open .custom-select-caret {
  margin-top: 4px;
  transform: rotate(225deg);
}
.custom-select-menu {
  position: absolute;
  z-index: 90;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: min(280px, 42vh);
  overflow-y: auto;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgb(0 0 0 / 28%);
}
.custom-select-menu[hidden] {
  display: none;
}
.custom-select.is-above .custom-select-menu {
  top: auto;
  bottom: calc(100% + 4px);
}
.custom-select-group {
  padding: 8px 10px 4px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 16px;
}
.custom-select-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-align: left;
  font-size: 14px;
  line-height: 20px;
}
.custom-select-option:hover,
.custom-select-option.active,
.custom-select-option.selected {
  background: var(--panel-3);
}
.custom-select-option:disabled {
  color: var(--text-dimmer);
  cursor: not-allowed;
}

@media (max-width: 820px) {
  .tabs.app-editor-tabs,
  .tabs.caesar-tabs {
    display: flex;
    width: 100%;
    gap: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .tabs.app-editor-tabs .tab,
  .tabs.caesar-tabs .tab {
    min-height: 44px;
    padding: 10px 12px;
    flex: 0 0 auto;
  }
  .app-row {
    padding: 14px;
    gap: 8px 12px;
  }
  .app-row .grow {
    flex: 1 1 calc(100% - 88px);
  }
  .app-row .counts {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-align: left;
  }
  .app-row .counts b {
    font-size: 16px;
    line-height: 24px;
  }
  .resp summary {
    min-height: 60px;
    gap: 8px;
    padding: 12px;
  }
  .resp summary > div:first-child {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
  }
  .resp summary .tag {
    flex: 0 0 auto;
  }
  .resp-body {
    padding: 4px 12px 12px;
  }
  .resp-actions {
    gap: 8px;
  }
  .resp-actions .btn {
    min-height: 44px;
  }
  .filter-row {
    align-items: center;
  }
  .filter-row .custom-select {
    width: min(100%, 240px);
  }
  .members-view.has-member #msf,
  .members-view.has-member #mres {
    display: none;
  }
}

.member-role-panel {
  margin-top: 16px;
}
.person-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: var(--panel-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.member-role-heading {
  border: 0;
}
.member-back {
  display: none;
}
.members-view .person[data-act="pick-member"]:hover {
  background: var(--panel-2);
}
.member-role-content {
  padding: 0 16px 16px;
}
.member-role-content > .f-label {
  margin-bottom: 8px;
}
.member-role-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.member-role-controls .custom-select {
  flex: 1 1 220px;
  max-width: 320px;
}
.member-role-controls .btn {
  min-height: 40px;
}
.chip.role button {
  min-width: 32px;
  min-height: 32px;
}
.role-locked {
  color: var(--text-dimmer);
  font-size: 11px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.apply-form .qform {
  display: grid;
  gap: 12px;
}
.apply-form .qform > .q {
  margin: 0;
  padding: 20px;
  background: var(--panel);
  border-radius: var(--radius-lg);
}
.apply-form .qform > .q-heading,
.apply-form .qform > .q-heading:first-child {
  padding: 20px;
  border: 0;
  background: var(--panel-2);
}
.apply-form .qform > .q-heading h3 {
  margin-bottom: 4px;
}
.apply-submit-card {
  padding: 16px;
  background: var(--panel);
  border-radius: var(--radius-lg);
}
.apply-submit-card .apply-submit {
  margin-top: 0;
}

@media (max-width: 820px) {
  .custom-select-trigger,
  .custom-select-option {
    min-height: 44px;
  }
  .search-bar .input,
  .search-bar .btn {
    min-height: 44px;
  }
  .member-role-heading {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .member-role-heading .btn {
    margin-left: 52px;
  }
  .member-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    color: var(--text-dim);
  }
  .member-role-content {
    padding: 0 12px 12px;
  }
  .member-role-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .member-role-controls .custom-select {
    max-width: none;
    flex: none;
  }
  .member-role-controls .btn {
    min-height: 44px;
  }
  .apply-form .qform > .q {
    padding: 16px;
  }
  .apply-submit-card {
    padding: 12px;
  }
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(270px, 0.8fr);
  align-items: start;
  gap: 20px;
}
.builder-editor {
  min-width: 0;
}
.builder-live-preview {
  position: sticky;
  top: 20px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #101010;
}
.builder-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #151515;
}
.builder-preview-head h3 {
  margin: 0;
  font-size: 13px;
}
.builder-preview-head p {
  margin: 2px 0 0;
  color: var(--text-dimmer);
  font-size: 11px;
}
.builder-preview-head svg {
  width: 16px;
  height: 16px;
  color: #888;
}
.builder-preview-form {
  padding: 20px 16px;
}
.builder-preview-form h2 {
  margin: 0;
  font-size: 17px;
  line-height: 24px;
}
.builder-preview-form > p {
  margin: 8px 0 20px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 18px;
}
.builder-preview-form .btn {
  margin-top: 16px;
}
.sanction-manager,
.dashboard-settings,
.server-ai-page,
.staff-page {
  max-width: 1040px;
}
.member-search {
  display: flex;
  gap: 8px;
  max-width: 700px;
}
.member-search .input {
  min-width: 0;
  flex: 1;
}
.member-results {
  display: grid;
  gap: 4px;
  max-width: 700px;
  margin-top: 12px;
}
.member-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  border-radius: 6px;
  background: var(--panel);
}
.member-result:hover {
  background: var(--panel-2);
}
.member-result img,
.selected-member img {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--panel-3);
}
.member-result > span {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}
.member-result strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-result small,
.selected-member p {
  color: var(--text-dimmer);
  font-size: 11px;
}
.member-result svg {
  width: 16px;
  height: 16px;
  color: var(--text-dimmer);
}
.selected-member {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
  margin-top: 22px;
}
.selected-member img {
  width: 48px;
  height: 48px;
}
.selected-member h2,
.sanction-section h2 {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
}
.selected-member p {
  margin: 3px 0 0;
}
.sanction-section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.sanction-section h2 {
  margin-bottom: 12px;
}
.sanction-history {
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel);
}
.sanction-history-row {
  display: grid;
  grid-template-columns: 90px minmax(100px, 1fr) 80px 150px;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
}
.sanction-history-row + .sanction-history-row {
  border-top: 1px solid var(--line);
}
.sanction-kind {
  color: #eee;
  text-transform: capitalize;
}
.sanction-reason {
  overflow: hidden;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sanction-status,
.sanction-history time {
  color: var(--text-dimmer);
  font-size: 11px;
  text-transform: capitalize;
}
.sanction-history time {
  text-align: right;
}
.sanction-form {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(180px, 0.8fr);
  gap: 16px;
  max-width: 760px;
}
.sanction-reason-field,
.sanction-form-actions {
  grid-column: 1 / -1;
}
.sanction-form-actions,
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sanction-form-actions p,
.settings-actions .f-hint {
  max-width: 560px;
}
.access-group {
  min-width: 0;
  padding: 18px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: var(--panel);
}
.access-group + .access-group {
  margin-top: 12px;
}
.access-group legend {
  padding: 0;
  font-size: 15px;
  font-weight: 600;
}
.access-group > p {
  margin: 4px 0 14px;
  color: var(--text-dim);
  font-size: 12px;
}
.access-select {
  position: relative;
  max-width: 640px;
}
.access-select > summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid #303030;
  border-radius: 6px;
  color: #e5e5e5;
  background: #101010;
  cursor: pointer;
  list-style: none;
}
.access-select > summary::-webkit-details-marker {
  display: none;
}
.access-select > summary::after {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: rotate(45deg) translateY(-2px);
}
.access-select[open] > summary::after {
  transform: rotate(225deg) translate(-2px, -1px);
}
.access-select-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  padding: 10px;
  border: 1px solid #303030;
  border-radius: 6px;
  background: #111;
  box-shadow: 0 8px 24px #0009;
}
.access-role-search {
  display: block;
  margin-bottom: 8px;
}
.access-role-search .input {
  width: 100%;
}
.access-role-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 4px 12px;
  max-height: 240px;
  overflow: auto;
}
.access-role {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  color: #ddd;
  font-size: 12px;
  cursor: pointer;
}
.access-role[hidden],
.access-role-empty[hidden] {
  display: none;
}
.access-role input {
  width: 15px;
  height: 15px;
  accent-color: #e7e7e7;
}
.settings-actions {
  padding-top: 18px;
}
.staff-search {
  max-width: 520px;
  margin-bottom: 14px;
}
.staff-list {
  max-width: 900px;
}
.staff-row {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.staff-row > img {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
}
.staff-identity {
  min-width: 0;
  flex: 1;
}
.staff-identity strong,
.staff-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.staff-identity small {
  margin-top: 3px;
  color: var(--text-dimmer);
  font-size: 12px;
}
.staff-roles {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}
.staff-role {
  padding: 3px 8px;
  border-radius: 4px;
  color: #ccc;
  background: #1b1b1b;
  font-size: 11px;
}
.dashboard-blacklist {
  max-width: 860px;
}
.blacklist-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr);
  gap: 12px;
  padding: 16px;
  border-radius: 6px;
  background: var(--panel);
}
.blacklist-form > label {
  display: grid;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12px;
}
.blacklist-form > label:nth-child(2) {
  grid-column: 1 / -1;
}
.blacklist-form textarea {
  min-height: 64px;
  resize: vertical;
}
.blacklist-form > .btn {
  justify-self: start;
}
.blacklist-toolbar {
  max-width: 800px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 8px;
}
.blacklist-toolbar .input {
  max-width: 360px;
}
.blacklist-toolbar .f-hint {
  flex: 0 0 auto;
  margin: 0;
}
.blacklist-list {
  max-width: 800px;
}
.blacklist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.blacklist-info {
  min-width: 0;
}
.blacklist-info strong {
  font-family: var(--font-mono);
  font-size: 13px;
}
.blacklist-info p {
  margin: 4px 0;
  overflow-wrap: anywhere;
}
.blacklist-info small,
.blacklist-actions > span {
  color: var(--text-dimmer);
  font-size: 12px;
}
.blacklist-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.blacklist-empty {
  padding: 20px 0;
  color: var(--text-dim);
}
.staff-truncated {
  margin: 12px 0;
  color: var(--text-dim);
  font-size: 12px;
}
/* ---- Server AI: a normal scrolling chat, with the composer docked at the bottom ---- */
.server-ai-page {
  max-width: 860px;
  padding-bottom: 0;
}
.ai-safety-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: #111;
  color: #bdbdbd;
  font-size: 12px;
  line-height: 18px;
}
.ai-safety-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: #9dc5a9;
}
/* No inner scrollbar: the page scrolls. */
.ai-conversation {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 38vh;
  padding: 18px 0 28px;
}
.ai-empty {
  margin: auto 0;
  padding: 24px 0;
}
.ai-empty > strong {
  font-size: 18px;
}
.ai-empty > p {
  margin: 6px 0 16px;
  color: var(--text-dim);
  font-size: 13px;
}
.ai-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-prompts button {
  padding: 8px 12px;
  border: 1px solid #303030;
  border-radius: 999px;
  color: #ddd;
  background: #111;
  cursor: pointer;
}
.ai-prompts button:hover {
  border-color: #555;
}
.ai-turn {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.ai-message {
  min-width: 0;
}
/* You: a bubble on the right. Caesar: plain text across the page, like Claude. */
.ai-message.user {
  align-self: flex-end;
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 18px;
  background: #1c1c1c;
}
.ai-message.assistant {
  padding: 0 2px;
}
.ai-message p {
  margin: 0;
  color: #e8e8e8;
  font-size: 14px;
  line-height: 23px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-thinking {
  color: var(--text-dim);
  font-size: 13px;
}
.ai-stream-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: #e5e5e5;
  animation: ai-cursor-blink 900ms steps(2, start) infinite;
}
.ai-mention {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.ai-mention-role {
  color: #fff;
  background-color: var(--mention-color, #333);
  background-image: var(--mention-background);
  text-shadow: 0 1px 2px rgb(0 0 0 / 55%);
}
.ai-mention-channel {
  color: #c9d6ff;
  background: #222b3b;
}
@keyframes ai-cursor-blink {
  to {
    visibility: hidden;
  }
}
@keyframes ai-spin {
  to {
    transform: rotate(360deg);
  }
}
.ai-spin {
  animation: ai-spin 900ms linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .ai-stream-cursor,
  .ai-spin {
    animation: none;
  }
}

/* Proposed changes sit under the message that made them. Compact by default, open while they need you. */
.ai-changes {
  align-self: stretch;
  min-width: 0;
  border: 1px solid #262626;
  border-radius: 10px;
  background: #111;
  overflow: hidden;
}
.ai-changes.is-done {
  border-color: #23302a;
}
.ai-changes-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ai-changes-head:hover {
  background: #161616;
}
.ai-changes-lead {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--text-dim);
}
.ai-changes.is-done .ai-changes-lead {
  color: #9dc5a9;
}
.ai-changes-lead svg,
.ai-changes-chevron {
  width: 16px;
  height: 16px;
}
.ai-changes-text {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.ai-changes-text strong {
  flex: 0 0 auto;
  font-size: 13px;
}
.ai-changes-sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dim);
  font-size: 12px;
}
.ai-changes-chevron {
  flex: 0 0 auto;
  color: var(--text-dimmer);
  transition: transform 120ms ease;
}
.ai-changes.is-open .ai-changes-chevron {
  transform: rotate(90deg);
}
.ai-change-list {
  margin: 0;
  padding: 0 4px;
  list-style: none;
  border-top: 1px solid #1f1f1f;
}
.ai-change {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 8px;
}
.ai-change + .ai-change {
  border-top: 1px solid #1a1a1a;
}
.ai-change-check {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: #9dc5a9;
}
.ai-change-icon {
  display: grid;
  place-items: center;
  height: 20px;
  color: var(--text-dim);
}
.ai-change-icon svg {
  width: 15px;
  height: 15px;
}
.ai-change-applied .ai-change-icon {
  color: #9dc5a9;
}
.ai-change-failed .ai-change-icon {
  color: #e08a8a;
}
.ai-change-applied .ai-change-main,
.ai-change-skipped .ai-change-main {
  opacity: 0.6;
}
.ai-change-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}
.ai-change-title strong {
  font-size: 13px;
}
.ai-swatch {
  width: 28px;
  height: 12px;
  flex: 0 0 auto;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
}
.ai-tag {
  padding: 1px 6px;
  border-radius: 999px;
  color: #e9b0b0;
  background: #2b1a1a;
  font-size: 10px;
}
.ai-change-detail {
  margin: 2px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 19px;
  overflow-wrap: anywhere;
}
.ai-change-error {
  margin: 4px 0 0;
  color: #e08a8a;
  font-size: 12px;
}
.ai-change pre {
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 5px;
  color: #ddd;
  background: #090909;
  font-size: 11px;
  line-height: 17px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-change-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}
.ai-link:hover {
  color: var(--text);
  text-decoration: underline;
}
.ai-more {
  display: block;
  margin: 0 0 6px 36px;
}
.ai-changes-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #1f1f1f;
}
.ai-foot-warning {
  margin-right: auto;
  color: #e9b0b0;
  font-size: 12px;
}

/* The composer stays at the bottom of the screen while the page scrolls above it. */
.ai-dock {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 16px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg, #0b0b0b) 72%, transparent);
}
.ai-composer {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #303030;
  border-radius: 14px;
  background: #111;
  transition: border-color 120ms ease;
}
.ai-composer:focus-within {
  border-color: #686868;
}
.ai-composer textarea {
  width: 100%;
  min-height: 28px;
  max-height: 180px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--text);
  color-scheme: dark;
  font: inherit;
  resize: none;
  line-height: 20px;
}
.ai-composer textarea:focus {
  outline: 0;
}
.ai-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ai-composer-actions > span {
  color: var(--text-dimmer);
  font-size: 11px;
}
.ai-composer button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 7px;
}
.ai-composer button svg {
  width: 18px;
  height: 18px;
}
.ai-dock .f-hint {
  margin: 8px 0 0;
  text-align: center;
}
.ai-head-actions {
  display: flex;
  gap: 8px;
}
.ai-head-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ai-head-actions svg {
  width: 14px;
  height: 14px;
}
.ai-history {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid #262626;
  border-radius: 10px;
  background: #111;
}
.ai-history[hidden] {
  display: none;
}
.ai-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-size: 12px;
}
.ai-history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-history-item {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
}
.ai-history-item:hover {
  background: #161616;
}
.ai-history-item.is-active {
  background: #1b1b1b;
}
.ai-history-open {
  display: flex;
  flex: 1;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 8px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ai-history-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.ai-history-meta {
  flex: 0 0 auto;
  color: var(--text-dimmer);
  font-size: 11px;
}
.ai-history-del {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text-dimmer);
  cursor: pointer;
}
.ai-history-del:hover {
  color: #e08a8a;
  background: #1f1717;
}
.ai-history-del svg {
  width: 14px;
  height: 14px;
}
.ai-history-empty {
  margin: 0;
  padding: 6px 4px;
  color: var(--text-dim);
  font-size: 12px;
}
.ai-history .ai-more {
  margin: 4px 0 0 8px;
}
@media (max-width: 900px) {
  .builder-layout {
    grid-template-columns: 1fr;
  }
  .builder-live-preview {
    position: static;
  }
}
@media (max-width: 600px) {
  .sanction-history-row {
    grid-template-columns: 72px minmax(0, 1fr) 70px;
    gap: 8px;
  }
  .sanction-history time {
    display: none;
  }
  .sanction-form {
    grid-template-columns: 1fr;
  }
  .sanction-reason-field,
  .sanction-form-actions {
    grid-column: auto;
  }
  .sanction-form-actions,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .sanction-form-actions .btn,
  .settings-actions .btn {
    align-self: flex-start;
  }
  .ai-message.user {
    max-width: 92%;
  }
  .ai-change {
    grid-template-columns: 20px minmax(0, 1fr);
  }
  .ai-change-actions {
    grid-column: 2;
  }
  .ai-changes-text {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .ai-more {
    margin-left: 8px;
  }
  .ai-history-meta {
    display: none;
  }
  .ai-prompts {
    display: grid;
    grid-template-columns: 1fr;
  }
  .staff-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .staff-roles {
    grid-column: 2;
    justify-content: flex-start;
  }
  .blacklist-form {
    grid-template-columns: 1fr;
  }
  .blacklist-form > label:nth-child(2) {
    grid-column: auto;
  }
  .blacklist-toolbar,
  .blacklist-row {
    align-items: stretch;
    flex-direction: column;
  }
  .blacklist-toolbar .input {
    max-width: none;
  }
  .blacklist-actions {
    flex-wrap: wrap;
  }
}
