:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-alt: #f1f3f4;
  --border: #dee2e6;
  --text: #212529;
  --muted: #6c757d;
  --accent: #0d6efd;
  --danger: #dc3545;
  --success: #198754;
  --badge-warn: #fd7e14;
  --badge-ban: #dc3545;
  --badge-staff: #6f42c1;
  --badge-kick: #fd7e14;
  --badge-mute: #20c997;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 1200px) {
  .app-shell {
    padding: 2.5rem 2rem;
  }
}

.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
  line-height: 1.45;
}

.hero-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.user-name {
  font-weight: 500;
  color: var(--text);
}

.user-id {
  color: var(--muted);
  font-size: 0.8rem;
}

.button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
}

.button:hover {
  background: var(--surface-alt);
  border-color: var(--accent);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.2rem;
}

.chip {
  padding: 0.25rem 0.75rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.sanctions-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sanction-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface);
  display: grid;
  gap: 0.75rem;
  transition: border-color 0.2s ease;
}

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

.sanction-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sanction-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.warn { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
.badge.ban { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.badge.staff-ban { background: #e2e3f3; color: #383d41; border: 1px solid #c3c6d4; }
.badge.kick { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
.badge.mute { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.timestamp {
  color: var(--muted);
  font-size: 0.8rem;
}

.sanction-body {
  color: var(--muted);
  line-height: 1.4;
}

.sanction-body p {
  margin: 0.1rem 0;
}

.sanction-body .note {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
}

.note-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.note-actions .note {
  margin: 0;
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
}

.alert {
  text-align: center;
  color: var(--muted);
}

.alert strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.chat-page {
  background: var(--bg);
  margin: 0;
  min-height: 100vh;
}

.chat-app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: calc(100vh - 4rem);
}

.chat-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}



.chat-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  height: 450px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface-alt);
}

article.message {
  display: flex;
  gap: 0.75rem;
  max-width: 80%;
  align-items: flex-start;
}

.message.user {
  margin-left: auto;
  flex-direction: row-reverse;
  text-align: right;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.message-name {
  font-weight: 600;
  color: var(--text);
}

.message-role {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.message-time {
  font-size: 0.75rem;
  color: var(--muted);
}

.message-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  line-height: 1.4;
}

.message.user .message-bubble {
  background: #e3f2fd;
  border-color: #90caf9;
}

.chat-inputbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-input-controls {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.chat-input-controls[hidden] {
  display: none;
}

.chat-inputbar input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: var(--surface-alt);
  transition: border-color 0.2s ease;
}

.chat-inputbar input:focus {
  outline: none;
  border-color: var(--accent);
}

.send-btn {
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  min-width: 100px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.send-btn:hover:not(:disabled) {
  background: #0b5ed7;
}

.send-btn:disabled,
.chat-inputbar input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-closed-banner {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-alt);
}

.chat-closed-banner[hidden] {
  display: none;
}

/* Mobile First Responsive Design */
@media (max-width: 480px) {
  .app-shell {
    padding: 1rem 0.75rem;
    gap: 1rem;
  }

  .panel,
  .card {
    padding: 1rem;
    border-radius: 6px;
  }

  .hero {
    flex-direction: column;
    gap: 1rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 0.9rem;
  }

  .sanction-card {
    padding: 0.75rem;
  }

  .sanction-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .chat-app {
    padding: 1rem 0.75rem;
  }

  .chat-main {
    height: 300px;
  }

  .chat-messages {
    padding: 1rem;
  }

  .chat-header h1 {
    font-size: 1.25rem;
  }

  .chat-messages {
    padding: 1rem;
  }

  article.message {
    max-width: 95%;
    gap: 0.5rem;
  }

  .message-avatar {
    width: 32px;
    height: 32px;
  }

  .message-bubble {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  .chat-inputbar {
    padding: 0.75rem;
  }

  .chat-input-controls {
    flex-direction: column;
    gap: 0.5rem;
  }

  .send-btn {
    width: 100%;
    padding: 0.75rem;
  }
}

@media (max-width: 768px) {
  .app-shell {
    padding: 1.5rem 1rem;
  }

  .chat-app {
    padding: 1rem;
  }

  .chat-main {
    height: 350px;
  }

  .chat-messages {
    padding: 1rem;
  }

  .chat-inputbar {
    padding: 0.75rem;
  }

  .hero {
    flex-direction: column;
    text-align: left;
  }

  .hero-meta {
    align-items: flex-start;
  }

  .user-profile {
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
  }

  .user-info {
    align-items: flex-start;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

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

  .chat-inputbar {
    flex-direction: column;
  }

  .chat-input-controls {
    flex-direction: column;
  }

  article.message {
    max-width: 90%;
  }

  .send-btn {
    width: 100%;
  }
}

@media (max-width: 1024px) {
  .hero {
    flex-direction: column;
    gap: 1rem;
  }

  .hero-meta {
    align-items: flex-start;
  }
}
