:root {
  --bg-main: #1f1610;
  --bg-surface: #2d1f15;
  --bg-subtle: #3a281b;
  --bg-input: #241910;
  --text-main: #ffedc7;
  --text-sub: #e7cfa0;
  --text-dim: #b49366;
  --accent: #ffbf3a;
  --accent-strong: #e39a1c;
  --danger: #ff6b56;
  --stroke: #5b3f2a;
  --pixel-shadow: #140c07;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: "Pixelify Sans", "Lato", sans-serif;
  image-rendering: pixelated;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  font-size: 16px;
}

.app-shell {
  min-height: 100vh;
  width: 100%;
}

.main-panel {
  width: 100%;
  min-height: 100vh;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.main-header {
  width: 100%;
  min-height: 78px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface);
  border: 3px solid var(--stroke);
  border-radius: 0;
  padding: 14px 18px;
  box-shadow: 4px 4px 0 0 var(--pixel-shadow);
}

.title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}

.main-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.notice {
  font-family: "Lato", sans-serif;
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 16px;
  line-height: 1.5;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-links a {
  font-family: "Lato", sans-serif;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 15px;
  border: 2px solid var(--stroke);
  background: var(--bg-subtle);
  padding: 6px 9px;
  box-shadow: 2px 2px 0 0 var(--pixel-shadow);
}

.header-links a:hover {
  color: #2d1f15;
  background: var(--accent);
  border-color: var(--accent);
}

.panel {
  width: 100%;
  background: var(--bg-surface);
  border: 3px solid var(--stroke);
  border-radius: 0;
  padding: 16px;
  box-shadow: 4px 4px 0 0 var(--pixel-shadow);
}

.server-browser .browser-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.server-browser .browser-top h2 {
  margin: 0;
  font-size: 24px;
}

.guild-search {
  width: 320px;
  border: 3px solid var(--stroke);
  border-radius: 0;
  background: var(--bg-input);
  color: var(--text-main);
  padding: 11px 12px;
  font-size: 16px;
}

.guild-search::placeholder {
  color: var(--text-dim);
}

.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.guild-card {
  width: 100%;
  max-width: none;
  min-height: 236px;
  height: 236px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  border: 3px solid var(--stroke);
  border-radius: 0;
  background: var(--bg-subtle);
  padding: 16px;
  text-align: left;
  color: var(--text-main);
  box-shadow: 4px 4px 0 0 var(--pixel-shadow);
}

.guild-card img {
  width: 64px;
  height: 64px;
  border-radius: 0;
  border: 3px solid var(--stroke);
  flex: 0 0 auto;
}

.guild-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.guild-head-copy {
  flex: 1;
  min-width: 0;
}

.guild-card.selectable {
  cursor: pointer;
  transition: border-color 0.14s ease, transform 0.14s ease;
  appearance: none;
}

.guild-card.selectable:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.guild-card.disabled {
  opacity: 0.9;
}

.guild-copy {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.guild-top-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.guild-name {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 700;
}

.guild-badges {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.guild-badge {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--stroke);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  background: #202226;
}

.guild-badge.online {
  color: #7adf9b;
  border-color: #2d7d46;
}

.guild-badge.owner {
  color: #79b8ff;
  border-color: #2a5d8f;
}

.guild-badge.danger {
  color: #ff8f93;
  border-color: #7f2a2d;
}

.guild-description {
  font-family: "Lato", sans-serif;
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: calc(1.45em * 2);
}

.guild-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
}

.card-cta-btn {
  display: inline-flex;
  align-items: center;
}

.workspace-top {
  margin-bottom: 12px;
}

.workspace-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.workspace-sidebar {
  align-self: start;
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-back {
  width: 100%;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-label {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.workspace-tab {
  text-align: left;
  width: 100%;
  background: var(--bg-subtle);
  color: var(--text-main);
  margin: 0;
}

.workspace-tab.active {
  background: var(--accent);
  color: #2d1f15;
  border-color: var(--accent);
}

.workspace-content {
  min-width: 0;
}

.workspace-view {
  display: block;
}

.compact-panel {
  margin-top: 12px;
}

.welcome-module {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.welcome-title {
  margin: 0 0 4px;
  font-size: 30px;
}

.welcome-card {
  background: var(--bg-subtle);
  border: 3px solid var(--stroke);
  box-shadow: 3px 3px 0 0 var(--pixel-shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.welcome-card h3 {
  margin: 0;
  font-size: 22px;
}

.welcome-card p {
  margin: 0;
}

.welcome-home {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.welcome-module-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 3px solid var(--stroke);
  padding: 12px;
}

.welcome-module-card h3 {
  margin: 0;
  font-size: 21px;
}

.welcome-module-card p {
  margin: 0;
  font-family: "Lato", sans-serif;
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1.4;
}

.welcome-module-card .card-open {
  margin-top: 2px;
  font-family: "Lato", sans-serif;
  color: var(--accent);
  font-weight: 700;
}

.welcome-module-card:hover {
  border-color: var(--accent);
}

.welcome-detail {
  margin-top: 2px;
}

.welcome-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.welcome-detail-head h3 {
  margin: 0;
  font-size: 24px;
}

.ticket-module {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.ticket-module-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 3px solid var(--stroke);
  padding: 12px;
}

.ticket-module-card h3 {
  margin: 0;
  font-size: 21px;
}

.ticket-module-card p {
  margin: 0;
  font-family: "Lato", sans-serif;
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1.4;
}

.ticket-module-card .card-open {
  margin-top: 2px;
  font-family: "Lato", sans-serif;
  color: var(--accent);
  font-weight: 700;
}

.ticket-module-card:hover {
  border-color: var(--accent);
}

.ticket-detail {
  margin-top: 2px;
}

.ticket-panel-manager {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-input);
  border: 3px solid var(--stroke);
  padding: 10px;
}

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

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-list-item {
  background: var(--bg-input);
  border: 3px solid var(--stroke);
  padding: 10px;
  box-shadow: 2px 2px 0 0 var(--pixel-shadow);
  font-family: "Lato", sans-serif;
  display: grid;
  gap: 4px;
}

.ticket-list-item .status-pill {
  display: inline-flex;
  width: fit-content;
  border: 2px solid var(--stroke);
  padding: 2px 8px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.ticket-list-item .status-pill.open {
  color: #89e28c;
  border-color: #2f7e3c;
}

.ticket-list-item .status-pill.closed {
  color: #ffd28b;
  border-color: #8a5a22;
}

.ticket-list-item .status-pill.deleted {
  color: #ff9d90;
  border-color: #8d3f35;
}

.ticket-panel-checklist {
  display: grid;
  gap: 8px;
}

.ticket-panel-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-family: "Lato", sans-serif;
  background: var(--bg-input);
  border: 2px solid var(--stroke);
  padding: 8px;
}

.ticket-panel-check-item strong {
  display: block;
  color: var(--text-main);
}

.ticket-panel-check-item span {
  color: var(--text-sub);
  font-size: 14px;
}

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.welcome-actions .status {
  margin: 0;
}

.stats-grid {
  width: 100%;
  display: flex;
  gap: 12px;
}

.stat-card {
  flex: 1 1 0;
  min-height: 92px;
  background: var(--bg-subtle);
  border: 3px solid var(--stroke);
  border-radius: 0;
  padding: 12px;
  box-shadow: 3px 3px 0 0 var(--pixel-shadow);
}

.stat-card p {
  margin: 0;
  color: var(--text-sub);
  font-size: 15px;
}

.stat-card h3 {
  margin: 10px 0 0;
  font-size: 26px;
}

.top-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-user-row {
  font-family: "Lato", sans-serif;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-subtle);
  border: 3px solid var(--stroke);
  border-radius: 0;
  padding: 10px 12px;
  color: var(--text-sub);
  font-size: 15px;
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.hidden {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-family: "Lato", sans-serif;
  color: var(--text-sub);
  font-size: 15px;
}

.subsection-title {
  margin: 12px 0 0;
  font-size: 20px;
}

.field-hint {
  margin: 0;
  font-size: 14px;
  font-family: "Lato", sans-serif;
}

.checkbox-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.checkbox-row input[type="checkbox"] {
  width: 56px;
  height: 32px;
  border: 3px solid var(--stroke);
  border-radius: 999px;
  background: #343840;
  padding: 0;
  margin: 0;
  cursor: pointer;
  position: relative;
  appearance: none;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.checkbox-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--stroke);
  background: #f6f1de;
  transition: transform 0.14s ease;
}

.checkbox-row input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: #906633;
}

.checkbox-row input[type="checkbox"]:checked::before {
  transform: translateX(24px);
}

.checkbox-row input[type="checkbox"]:focus-visible {
  outline: 3px solid #f5cb8e;
  outline-offset: 2px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 3px solid var(--stroke);
  border-radius: 0;
  background: var(--bg-input);
  padding: 11px 12px;
  color: var(--text-main);
  font-size: 16px;
}

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

button,
.btn {
  border: 3px solid var(--stroke);
  border-radius: 0;
  background: var(--accent);
  color: #2d1f15;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 4px 4px 0 0 var(--pixel-shadow);
}

button:hover,
.btn:hover {
  background: var(--accent-strong);
}

.btn.ghost {
  background: transparent;
  border: 3px solid var(--stroke);
  color: var(--text-main);
}

.btn.mini {
  margin-top: 0;
  padding: 9px 13px;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-subtle);
  border: 3px solid var(--stroke);
  border-radius: 999px;
  padding: 6px 10px;
}

.user-chip img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.user-chip small {
  font-family: "Lato", sans-serif;
  display: block;
  color: var(--text-dim);
  font-size: 14px;
}

.moderation-panel {
  border-top: 1px solid var(--stroke);
}

.moderation-shared-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.moderation-shared-grid .field {
  flex: 1 1 280px;
}

.moderation-home {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.moderation-module-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 3px solid var(--stroke);
  padding: 12px;
}

.moderation-module-card h3 {
  margin: 0;
  font-size: 21px;
}

.moderation-module-card p {
  margin: 0;
  font-family: "Lato", sans-serif;
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1.4;
}

.moderation-module-card .card-open {
  margin-top: 2px;
  font-family: "Lato", sans-serif;
  color: var(--accent);
  font-weight: 700;
}

.moderation-module-card:hover {
  border-color: var(--accent);
}

.moderation-detail {
  margin-top: 10px;
}

.moderation-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.moderation-detail-head h3 {
  margin: 0;
  font-size: 24px;
}

.moderation-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.moderation-grid .field {
  flex: 1 1 280px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mod-btn.danger {
  background: var(--danger);
}

.warnings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.warning-card {
  font-family: "Lato", sans-serif;
  background: var(--bg-subtle);
  border: 3px solid var(--stroke);
  border-left: 3px solid #f0b232;
  border-radius: 0;
  padding: 9px 10px;
  font-size: 15px;
}

.warning-card span,
.warning-card small {
  color: var(--text-sub);
  display: block;
}

.warning-card p {
  margin: 6px 0;
}

.status {
  font-family: "Lato", sans-serif;
  min-height: 20px;
  margin: 6px 0 0;
  font-weight: 700;
  font-size: 15px;
}

.status.ok {
  color: var(--accent);
}

.status.err {
  color: var(--danger);
}

.muted {
  color: var(--text-dim);
}

.inline-loader {
  width: 14px;
  height: 14px;
  display: inline-block;
  border-radius: 0;
  border: 2px solid #5b616a;
  border-top-color: #d7dade;
  margin-right: 8px;
  vertical-align: -2px;
  animation: spin 0.75s linear infinite;
}

.loading-card {
  pointer-events: none;
}

.skeleton-icon {
  width: 68px;
  height: 68px;
  border-radius: 0;
  background: #3a3d44;
  animation: pulse 1.1s ease-in-out infinite;
}

.skeleton-copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.skeleton-line {
  height: 11px;
  border-radius: 0;
  width: 82%;
  background: #3a3d44;
  animation: pulse 1.1s ease-in-out infinite;
}

.skeleton-line.lg {
  width: 54%;
  height: 14px;
}

.skeleton-line.sm {
  width: 38%;
}

@keyframes pulse {
  0% {
    opacity: 0.45;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.45;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .main-panel {
    padding: 14px;
  }

  .server-browser .browser-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .guild-search {
    width: 100%;
  }

  .stats-grid {
    flex-direction: column;
  }

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

  .workspace-sidebar {
    position: static;
  }

  .guild-grid {
    grid-template-columns: 1fr;
  }

  .guild-card {
    height: auto;
    min-height: 224px;
  }

  .guild-card img {
    width: 58px;
    height: 58px;
  }

  .guild-top-row {
    flex-direction: column;
    gap: 8px;
  }

  .guild-badges {
    justify-content: flex-start;
  }

  .main-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .moderation-home {
    grid-template-columns: 1fr;
  }

  .welcome-home {
    grid-template-columns: 1fr;
  }

  .ticket-home {
    grid-template-columns: 1fr;
  }

  .user-section {
    width: 100%;
    justify-content: space-between;
  }

  .header-links {
    width: 100%;
    justify-content: flex-start;
  }
}
