:root {
  --color-primary: #2196f3;
  --color-secondary: #4a4a4a;
  --color-surface: #ffffff;
  --color-bg: #f5f7fb;
  --color-muted: #7a7a7a;
  --color-border: #d9e2ef;
  --color-success: #4caf50;
  --color-error: #e53935;
  --spacing: 12px;
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-secondary);
}

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

button {
  border: none;
  border-radius: 999px;
  background: var(--color-primary);
  color: white;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  transition: filter 0.2s ease;
}

button:hover {
  filter: brightness(1.05);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.container {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  padding: 1rem;
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(55, 70, 95, 0.08);
  overflow: hidden;
}

.header {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__title {
  font-size: 1rem;
  font-weight: 700;
}

.header__meta {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1rem;
}

.sidebar__section {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.sidebar__section-title,
.card__title {
  font-size: 0.95rem;
  font-weight: 700;
}

.channel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.channel-item {
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: #f5f9ff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.channel-item:hover,
.channel-item.active {
  background: var(--color-primary);
  color: white;
}

.channel-item__name {
  font-weight: 600;
}

.channel-item__meta {
  font-size: 0.82rem;
  color: var(--color-muted);
}

.main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  padding: 1rem;
}

.section {
  padding: 1rem;
}

.section--transparent {
  padding: 0;
  border: none;
  background: transparent;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.card__content {
  padding: 1rem;
}

.form-group {
  display: grid;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  color: var(--color-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fafbff;
  color: var(--color-secondary);
}

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

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

.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.message {
  padding: 1rem;
  border-radius: var(--radius);
  background: #f8fbff;
  border: 1px solid var(--color-border);
}

.message__header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.message__author {
  font-weight: 700;
}

.message__time {
  color: var(--color-muted);
  font-size: 0.82rem;
}

.message__content {
  white-space: pre-wrap;
  line-height: 1.5;
}

.alert {
  padding: 0.95rem 1rem;
  border-radius: var(--radius);
  background: #fff4f2;
  color: var(--color-error);
  border: 1px solid #f1c1bc;
}

.hidden {
  display: none !important;
}

.auth-panel {
  max-width: 420px;
  margin: 2rem auto;
}

.auth-panel__tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.auth-tab {
  flex: 1;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: #eef5ff;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.auth-tab.active {
  background: var(--color-primary);
  color: white;
}

.auth-footer {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.auth-footer a {
  color: var(--color-primary);
  text-decoration: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.toolbar__badge {
  background: #eef5ff;
  color: var(--color-primary);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font-size: 0.86rem;
}

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

  .sidebar {
    order: 2;
  }

  .main {
    order: 1;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 0.75rem;
  }

  .header,
  .sidebar__section,
  .card__content,
  .section {
    padding: 0.9rem;
  }
}
