:root {
  color-scheme: dark;
  --bg: #1e1f22;
  --surface: #2b2d31;
  --text: #f2f3f5;
  --muted: #949ba4;
  --accent: #5865f2;
  --accent-hover: #4752c4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--surface);
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.25rem;
}

.logout {
  color: var(--muted);
  text-decoration: none;
}

.content {
  display: flex;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
}

.card.center {
  text-align: center;
}

.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

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

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
}

.badge-super {
  background: #f23f42;
}

.badge-global {
  background: #5865f2;
}

.badge-lead {
  background: #faa61a;
  color: #1e1f22;
}

.departments {
  padding-left: 1.25rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 1.5rem;
}

.card.wide {
  max-width: 900px;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

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

.list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}

.list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.list li a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.list li a:hover {
  text-decoration: underline;
}

.inline-form {
  margin-left: auto;
}

.btn-small {
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
}

.btn-danger {
  background: #f23f42;
  color: #fff;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 480px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.form input[type="text"],
.form input[type="url"],
.form input[type="time"],
.form input[type="number"],
.form select,
.form textarea {
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.form textarea {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.form button {
  align-self: flex-start;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
}

.card.editor-wrap {
  max-width: 1400px;
}

.editor-3pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.pane {
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem 1.2rem;
}

.pane h3 {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pane h4 {
  margin: 1rem 0 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
}

.pane-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-height: 80vh;
  overflow-y: auto;
}

.pane-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.pane-form input,
.pane-form textarea {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
}

.pane-form textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.4;
}

.pane-form input[type="color"] {
  padding: 0.15rem;
  height: 2.2rem;
  width: 100%;
}

.field-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1rem 0 0.4rem;
}

.field-section-header h4 {
  margin: 0;
}

.pane-right {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.field-row:last-child {
  border-bottom: none;
}

.field-row-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.field-row input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
}

.field-row textarea.f-field-value {
  width: 100%;
  min-height: 3.2rem;
  resize: vertical;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.code-header h3 {
  margin: 0;
}

.code-header input[type="text"] {
  flex: 1;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: var(--text);
  font-size: 0.9rem;
}

.code-header select {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: var(--text);
  font-family: inherit;
}

.pane-code textarea {
  width: 100%;
  min-height: 360px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
}

.actions-row form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.actions-row .btn {
  margin-top: 0;
}

.actions-row select {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.65rem 0.6rem;
  color: var(--text);
  font-family: inherit;
  line-height: 1.2;
}

.actions-row button:disabled,
.actions-row select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.flash {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.flash-ok {
  background: rgba(59, 165, 92, 0.2);
  color: #3ba55c;
}

.flash-error {
  background: rgba(242, 63, 66, 0.15);
  color: #f23f42;
}

/* Discord-style embed preview */
.discord-embed {
  display: flex;
  background: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  max-width: 480px;
  overflow: hidden;
}

.embed-strip {
  width: 4px;
  flex-shrink: 0;
}

.embed-body {
  padding: 0.7rem 1rem;
  flex: 1;
  min-width: 0;
}

.embed-author {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.embed-author img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.embed-title {
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.embed-desc {
  font-size: 0.9rem;
  white-space: pre-wrap;
  color: #dbdee1;
}

.embed-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.embed-field {
  flex: 1 1 100%;
}

.embed-field.inline {
  flex: 1 1 30%;
}

.field-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.field-value {
  font-size: 0.85rem;
  color: #dbdee1;
  white-space: pre-wrap;
}

.embed-image {
  max-width: 100%;
  border-radius: 4px;
  margin-top: 0.6rem;
}

.embed-footer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.embed-footer img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.embed-with-thumb {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.embed-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin: 0.7rem 1rem 0 0;
}
