/* Design system — "Dieter Rams / Braun" recipe (see dieter-rams-braun.md):
   less but better, functional honesty, industrial restraint. Single signal
   accent used only on functional elements — never decorative. */

:root {
  --ground: #f5f4f0;
  --ground-concrete: #e4e1dc;
  --surface-1: #ffffff;
  --surface-2: #ece9e3;
  --surface-3: #ddd9d1;
  --hairline: rgba(25, 25, 25, 0.14);
  --hairline-strong: rgba(25, 25, 25, 0.28);
  --ink: #191919;
  --text-primary: #191919;
  --text-secondary: #5c5c5c;
  --text-muted: #a8a8a8;
  --accent: #e96a26;
  --accent-strong: #c8571c;
  --danger: #a83a20;
  --danger-soft: rgba(168, 58, 32, 0.1);
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 4px;
  --ease-out: ease;
  --font-display: "Akzidenz-Grotesk", "Helvetica Now", "Inter Tight", Helvetica, Arial, sans-serif;
  --font-body: "Helvetica Now Text", "Akzidenz-Grotesk", "Söhne", Inter, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "Berkeley Mono", ui-monospace, "SFMono-Regular", Consolas,
    monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--ground);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0;
}

p {
  margin: 0;
  color: var(--text-secondary);
}

code,
.mono {
  font-family: var(--font-mono);
  background: var(--surface-2);
  color: var(--ink);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
}

.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Layout */

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav {
  border-bottom: 1px solid var(--hairline-strong);
  background: var(--ground);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.005em;
}

.brand__mark {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--hairline-strong);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 100ms var(--ease-out), border-color 100ms var(--ease-out),
    color 100ms var(--ease-out);
  white-space: nowrap;
}

.btn:active {
  background-color: var(--surface-3);
}

.btn-primary {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-primary:active {
  background: var(--accent-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--hairline-strong);
  color: var(--text-primary);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--surface-2);
}

.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

/* Cards / panels */

.panel {
  background: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
}

/* Scrollbar restraint */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  border: 2px solid var(--ground);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* Dashboard layout: sidebar + content, shared by every guild settings page */

.dash-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}

.side-nav {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  padding: 8px;
}

.side-nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-left: 3px solid transparent;
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: background-color 100ms var(--ease-out), color 100ms var(--ease-out),
    border-color 100ms var(--ease-out);
}

.side-nav__link .icon {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 100ms var(--ease-out);
}

.side-nav__link:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.side-nav__link.is-active {
  background: var(--surface-2);
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 500;
}

.side-nav__link.is-active .icon {
  color: var(--accent);
}

.dash-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dash-content h1 {
  font-size: 19px;
}

.dash-content .section-desc {
  font-size: 13px;
  margin-top: 2px;
}

@media (max-width: 860px) {
  .dash-layout {
    grid-template-columns: 1fr;
  }
  .side-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* Forms */

.form-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

label {
  font-size: 13px;
  color: var(--text-secondary);
}

input[type='text'],
input[type='color'],
input:not([type]),
select,
textarea {
  background: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 100ms var(--ease-out);
  width: 100%;
}

input[type='color'] {
  padding: 4px;
  height: 36px;
  width: 56px;
}

textarea {
  resize: vertical;
  min-height: 72px;
  font-family: var(--font-body);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-danger {
  background: transparent;
  border: 1px solid rgba(168, 58, 32, 0.4);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

/* Simple data table — spec listing is a first-class element, not hidden behind a toggle */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Loading indicator — the single signal dot doubling as a "busy" state */

.spinner {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  vertical-align: -1px;
  animation: signal-blink 900ms steps(2, jump-none) infinite;
}

@keyframes signal-blink {
  50% {
    opacity: 0.25;
  }
}

.table-loading-row td {
  padding: 32px 12px !important;
  text-align: center;
  color: var(--text-secondary);
  border-bottom: none !important;
  font-family: var(--font-body);
  font-size: 13.5px;
}

.table-loading-row .spinner {
  margin-right: 10px;
}

@keyframes row-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.data-table tbody tr {
  animation: row-fade-in 120ms var(--ease-out);
}

/* Shared page-level loading state for dashboard feature pages */

.state-panel {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.state-panel.is-visible {
  display: flex;
}

.page-content {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: row-fade-in 120ms var(--ease-out);
}

.page-content.is-visible {
  display: flex;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-1);
  color: var(--text-secondary);
}

.badge--on {
  color: var(--ink);
  border-color: var(--accent);
}

.badge--on::before {
  content: '';
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: 1px;
}

/* Toast */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  border: 1px solid var(--ink);
  color: var(--ground);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms var(--ease-out);
  z-index: 50;
}

.toast.is-visible {
  opacity: 1;
}

.toast--error {
  border-color: var(--danger);
  box-shadow: inset 3px 0 0 var(--danger);
}

/* Discord message / embed live preview — colors intentionally match Discord's own
   dark theme (not the site's design tokens) so it reads as a faithful preview. */

.discord-preview {
  background: #313338;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  color: #dbdee1;
  font-family: var(--font-body);
}

.discord-preview__content {
  margin-bottom: 8px;
  white-space: pre-wrap;
  color: #f2f3f5;
}

.discord-preview__empty {
  margin: 0;
  color: #80848e;
  font-size: 13px;
}

.discord-embed {
  background: #2b2d31;
  border-left: 4px solid #5c5c5c;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  max-width: 420px;
}

.discord-embed__author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #f2f3f5;
}

.discord-embed__author img {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  object-fit: cover;
}

.discord-embed__title {
  display: block;
  font-weight: 600;
  color: #00a8fc;
  margin-bottom: 4px;
  text-decoration: none;
}

.discord-embed__title:hover {
  text-decoration: underline;
}

.discord-embed__description {
  color: #dbdee1;
  line-height: 1.4;
  margin-bottom: 8px;
}

.discord-embed__image {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: block;
}

.discord-embed__footer {
  font-size: 11.5px;
  color: #949ba4;
}
