:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #1c1f22;
  color: #f4f2ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #353a3f;
}

button,
.primary-link,
.secondary-link {
  border: 1px solid #d8755d;
  border-radius: 6px;
  background: #d8755d;
  color: #141516;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
  text-decoration: none;
}

button[data-action="remove"],
.topbar button,
.secondary-link {
  background: transparent;
  color: #f4f2ee;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #1b1f22;
  border-radius: 5px;
  background: #272c31;
  color: #f4f2ee;
  font: inherit;
  padding: 11px 12px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: #c8c8c8;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(460px, calc(100% - 32px));
}

.layout {
  display: grid;
  gap: 18px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.login-panel,
section,
.guild-card,
.server-card {
  border: 1px solid #262b30;
  border-radius: 8px;
  background: #30353a;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  border-bottom: 1px solid #262b30;
  background: #1a1d20;
  padding: 0 38px;
}

.select-topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
}

.select-topbar h1 {
  justify-self: center;
}

.select-topbar form {
  justify-self: end;
}

.login-panel h1,
.topbar h1 {
  margin: 4px 0 12px;
  font-size: 34px;
}

.brand,
.topnav,
.topbar-actions,
.section-title,
.row,
.footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  color: #d8755d;
  font-size: 28px;
  letter-spacing: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid #d8755d;
  border-radius: 8px;
  font-size: 18px;
}

.topnav a {
  color: #f4f2ee;
  font-size: 15px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: 74px 250px minmax(0, 1fr);
  min-height: calc(100vh - 80px);
}

.guild-rail {
  border-right: 1px solid #262b30;
  background: #202428;
  padding: 18px 10px;
}

.guild-list {
  display: grid;
  align-content: start;
  gap: 14px;
}

.guild-list-item {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  padding: 0;
}

.guild-list-item.active {
  border-color: #d8755d;
  background: transparent;
}

.guild-list-item .guild-list-text {
  display: none;
}

.side-nav {
  border-right: 1px solid #262b30;
  background: #282d32;
  padding: 18px 0;
}

.active-guild-card {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 18px 14px 22px;
  border-bottom: 1px solid #333940;
  text-align: center;
}

.active-guild-card strong {
  font-size: 18px;
}

.active-guild-card span {
  color: #b8b8b8;
  font-size: 12px;
}

.side-nav > button {
  width: calc(100% - 28px);
  margin: 14px;
}

.feature-nav {
  display: grid;
  margin-top: 8px;
}

.feature-nav a {
  display: block;
  border-left: 3px solid transparent;
  color: #f4f2ee;
  font-size: 16px;
  font-weight: 750;
  padding: 14px 18px;
  text-decoration: none;
}

.feature-nav a.active,
.feature-nav a:hover {
  border-color: #d8755d;
  background: #24282d;
  color: #ff8a70;
}

.global-panel .feature-nav,
.global-panel .topnav [data-tab-link] {
  display: none;
}

.content-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 38px;
}

.section-title {
  justify-content: space-between;
  margin-bottom: 16px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
}

h2 {
  font-size: 26px;
}

h3 {
  margin-bottom: 16px;
  font-size: 20px;
}

h4 {
  color: #f4f2ee;
  font-size: 16px;
}

.eyebrow {
  margin: 0;
  color: #d8755d;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.row {
  margin-top: 10px;
}

.row input {
  flex: 1;
}

.guild-card {
  background: transparent;
  border: 0;
  padding: 0;
}

.server-card {
  margin-top: 12px;
  background: #292f34;
}

.ticket-panel-card {
  border-color: #363d43;
}

.ticket-panel-card.disabled,
.display-panel-card.disabled {
  opacity: 0.58;
}

.ticket-panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticket-panel-actions .checkbox-row {
  margin: 0;
}

.settings-block {
  margin: 14px 0;
  border-color: #363d43;
  background: #292f34;
}

.settings-block .compact {
  margin-top: 0;
}

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

.grid .full {
  grid-column: 1 / -1;
}

.field-help {
  margin: -6px 0 0;
  color: #b8b8b8;
  font-size: 12px;
}

.emoji-picker {
  position: relative;
  display: grid;
  gap: 8px;
}

.emoji-picker > button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  background: #272c31;
  color: #f4f2ee;
}

.emoji-picker [data-emoji-preview] {
  font-size: 20px;
  line-height: 1;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 38px);
  gap: 6px;
  border: 1px solid #1b1f22;
  border-radius: 8px;
  background: #202428;
  padding: 8px;
}

.emoji-grid[hidden] {
  display: none;
}

.emoji-choice {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-color: #363d43;
  background: #2d3338;
  color: #f4f2ee;
  font-size: 20px;
  padding: 0;
}

.emoji-choice.empty {
  grid-column: span 2;
  width: auto;
  font-size: 11px;
  text-transform: uppercase;
}

.emoji-choice.active,
.emoji-choice:hover {
  border-color: #d8755d;
  background: #3a2d2a;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  text-transform: none;
}

.checkbox-row input {
  width: auto;
}

.guild-icon,
.guild-icon img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.guild-icon.large,
.guild-icon.large img {
  width: 92px;
  height: 92px;
}

.guild-icon {
  display: grid;
  place-items: center;
  background: #151719;
  color: #d8755d;
  font-weight: 900;
  overflow: hidden;
}

.guild-icon img {
  display: block;
  object-fit: cover;
}

.admin-add-row,
.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-search-block {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-search-results {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #363d43;
  border-radius: 8px;
  background: #202428;
  padding: 8px;
}

.admin-search-results[hidden] {
  display: none;
}

.admin-search-result {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(120px, auto);
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid #30363c;
  border-radius: 8px;
  background: #292f34;
  color: #f3f3f3;
  padding: 9px;
  text-align: left;
}

.admin-search-result:hover {
  border-color: #d8755d;
  background: #30363c;
}

.admin-search-result span,
.admin-search-result img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.admin-search-result span {
  display: grid;
  place-items: center;
  background: #151719;
  color: #d8755d;
  font-weight: 900;
}

.admin-search-result img {
  display: block;
  object-fit: cover;
}

.admin-search-result strong,
.admin-search-result small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-search-result small {
  color: #b8b8b8;
  font-size: 12px;
}

.admin-user-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #262b30;
  border-radius: 8px;
  background: #292f34;
  margin-top: 8px;
  padding: 10px;
}

.message-result {
  display: grid;
  gap: 8px;
  border: 1px solid #363d43;
  border-radius: 8px;
  background: #292f34;
  padding: 14px;
}

.message-result[hidden] {
  display: none;
}

.message-result code {
  color: #ffb39f;
}

.message-result a {
  color: #ff8a70;
  font-weight: 800;
}

.support-request-card {
  display: grid;
  gap: 12px;
}

.support-request-card > p {
  margin: 0;
  color: #c8c8c8;
}

.support-chat {
  display: grid;
  gap: 10px;
  border: 1px solid #24292e;
  border-radius: 8px;
  background: #202428;
  padding: 12px;
}

.support-message {
  display: grid;
  gap: 6px;
  max-width: 82%;
  border-radius: 8px;
  padding: 10px 12px;
}

.support-message.user {
  justify-self: start;
  background: #30363b;
}

.support-message.management {
  justify-self: end;
  background: #3b2d2a;
  border: 1px solid #d8755d;
}

.support-message strong {
  display: grid;
  gap: 3px;
}

.support-message span {
  color: #b8b8b8;
  font-size: 11px;
  font-weight: 700;
}

.support-message p {
  margin: 0;
  white-space: pre-wrap;
}

.support-reply {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto;
  align-items: end;
  gap: 10px;
}

.file-field {
  display: grid;
  gap: 6px;
  color: #b8b8b8;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.support-group {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.support-group h4 {
  color: #ffb39f;
}

.support-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.support-attachments img {
  display: block;
  width: 150px;
  max-width: 100%;
  border: 1px solid #363d43;
  border-radius: 6px;
}

.support-status {
  font-weight: 900;
  text-transform: uppercase;
}

.message-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 20px;
  align-items: start;
}

.message-editor,
.message-drafts-panel {
  display: grid;
  gap: 14px;
  border: 1px solid #30363c;
  border-radius: 8px;
  background: #202428;
  padding: 16px;
}

.message-editor input,
.message-editor select,
.message-editor textarea {
  font-size: 16px;
}

.message-editor textarea[data-field="messageContent"],
.message-editor textarea[data-field="messageEmbedDescription"] {
  min-height: 260px;
  line-height: 1.55;
}

.message-editor textarea[data-field="messageImageContent"] {
  min-height: 150px;
  line-height: 1.55;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.message-actions-top {
  justify-content: flex-start;
  border-bottom: 1px solid #30363c;
  padding-bottom: 14px;
}

.message-actions-bottom {
  justify-content: flex-end;
  border-top: 1px solid #30363c;
  padding-top: 14px;
}

.char-counter {
  margin: 6px 0 0;
  color: #aeb4b9;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.char-counter.over-limit {
  color: #ff6b6b;
}

.message-draft-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #363d43;
  border-radius: 8px;
  background: #262b30;
  padding: 12px;
}

.message-draft-card.in-use {
  border-color: #46d782;
  box-shadow: inset 4px 0 0 #46d782;
}

.message-draft-card div {
  display: grid;
  gap: 5px;
}

.message-draft-card span,
.message-draft-card small {
  color: #b8b8b8;
  font-size: 12px;
}

.message-draft-card small {
  color: #8ee6b0;
  font-weight: 900;
  text-transform: uppercase;
}

.message-draft-conflict {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(13, 15, 17, 0.72);
  padding: 24px;
}

.message-draft-conflict-dialog {
  display: grid;
  gap: 12px;
  width: min(460px, 100%);
  border: 1px solid #d8755d;
  border-radius: 8px;
  background: #24292e;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  padding: 20px;
}

.message-draft-conflict-dialog strong,
.message-draft-conflict-dialog span {
  min-width: 0;
}

.message-draft-conflict-dialog span {
  color: #d7d0ca;
  font-size: 14px;
}

.message-draft-conflict-dialog div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.message-fetch-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(13, 15, 17, 0.74);
  padding: 24px;
}

.message-fetch-modal[hidden] {
  display: none;
}

.message-fetch-dialog {
  display: grid;
  gap: 14px;
  width: min(520px, 100%);
  border: 1px solid #3a4148;
  border-radius: 8px;
  background: #24292e;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  padding: 18px;
}

.message-fetch-dialog [data-message-fetch-panel][hidden] {
  display: none;
}

.message-fetch-dialog .field-help {
  display: block;
  margin: 8px 0 0;
}

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

.segmented-control button {
  border-color: #3a4148;
  background: #1d2226;
  color: #f4f2ee;
}

.segmented-control button.active {
  border-color: #d8755d;
  background: #d8755d;
  color: #141516;
}

.support-status.open {
  color: #a7d889;
}

.support-status.closed {
  color: #b8b8b8;
}

.admin-avatar,
.admin-avatar img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.admin-avatar {
  display: grid;
  place-items: center;
  background: #151719;
  color: #d8755d;
  font-weight: 900;
  overflow: hidden;
}

.admin-avatar img {
  display: block;
  object-fit: cover;
}

.admin-user-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.bot-profile-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.bot-profile-avatar,
.bot-profile-avatar img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
}

.bot-profile-avatar {
  display: grid;
  place-items: center;
  background: #151719;
  color: #d8755d;
  font-weight: 900;
  overflow: hidden;
}

.bot-profile-avatar img {
  display: block;
  object-fit: cover;
}

.bot-profile-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.bot-profile-card .field-help {
  margin: 12px 0 0;
  padding-left: 86px;
}

.admin-user-text span,
.guild-list-text span,
#status,
.empty-state {
  color: #b8b8b8;
}

.admin-user-text span,
.guild-list-text span {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.guild-access {
  color: #a7d889;
}

.guild-access.expired {
  color: #ef9a9a;
}

.tab-panel[hidden] {
  display: none;
}

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

.status-grid div {
  display: grid;
  gap: 8px;
  border: 1px solid #262b30;
  border-radius: 8px;
  background: #292f34;
  padding: 16px;
}

.status-grid span {
  color: #b8b8b8;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-grid strong {
  font-size: 20px;
}

.doc-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.doc-menu {
  display: grid;
  gap: 8px;
}

.doc-menu button {
  justify-content: flex-start;
  width: 100%;
  border-color: #33383c;
  background: #202427;
  color: #f5f1e8;
  text-align: left;
}

.doc-menu button.active {
  border-color: #d8755d;
  background: #322621;
  color: #ffffff;
}

.doc-page {
  display: grid;
  gap: 13px;
  border: 1px solid #30363c;
  border-radius: 8px;
  background: #202428;
  padding: 18px;
}

.doc-page[hidden] {
  display: none;
}

.doc-page h4 {
  margin: 0 0 4px;
  color: #ffffff;
  font-size: 22px;
}

.doc-page h5 {
  margin: 0;
  color: #f5f1e8;
  font-size: 15px;
}

.doc-page p {
  margin: 0;
  color: #c6c8ca;
  line-height: 1.55;
}

.doc-page code {
  border: 1px solid #363d43;
  border-radius: 5px;
  background: #202427;
  padding: 1px 5px;
  color: #ffffff;
}

.doc-page ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
  color: #c6c8ca;
  line-height: 1.5;
}

.compact {
  margin-top: 22px;
}

.footer-actions {
  justify-content: flex-start;
}

.footer-actions[hidden] {
  display: none;
}

.panel-options {
  display: grid;
  gap: 10px;
}

.panel-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  border-color: #33383c;
  background: #202427;
  color: #f5f1e8;
  text-align: left;
}

.panel-option .guild-list-text {
  display: grid;
  gap: 5px;
}

.role-picker {
  display: grid;
  gap: 10px;
}

.role-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid #363d43;
  border-radius: 999px;
  background: #202427;
  padding: 6px 8px 6px 10px;
}

.role-chip strong {
  overflow-wrap: anywhere;
}

.role-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.role-chip button {
  min-height: 24px;
  padding: 2px 8px;
}

.button-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.button-config-texts,
.button-config-icons {
  display: grid;
  gap: 12px;
}

@media (max-width: 920px) {
  .topnav {
    display: none;
  }

  .app-shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .side-nav {
    display: none;
  }

  .content-panel {
    padding: 22px;
  }
}

@media (max-width: 680px) {
  .topbar {
    height: auto;
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .guild-rail {
    border-right: 0;
    border-bottom: 1px solid #262b30;
    overflow-x: auto;
  }

  .guild-list {
    grid-auto-flow: column;
    grid-auto-columns: 54px;
  }

  .doc-layout {
    grid-template-columns: 1fr;
  }

  .grid,
  .status-grid,
  .message-workspace,
  .message-draft-card,
  .admin-add-row,
  .input-with-action,
  .admin-user-card,
  .support-reply,
  .button-config-grid,
  .bot-profile-row,
  .bot-profile-fields {
    grid-template-columns: 1fr;
  }

  .bot-profile-card .field-help {
    padding-left: 0;
  }
}
