* { box-sizing: border-box; }
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --panel: #f8fafc;
  --line: #d8e0ea;
  --line-soft: #e9eef5;
  --text: #07172f;
  --muted: #607086;
  --accent: #ff4f1f;
  --accent-dark: #e13f12;
  --shadow: 0 12px 30px rgba(9, 23, 47, .07);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 250px minmax(280px, 640px) minmax(160px, auto);
  gap: 18px;
  align-items: center;
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  gap: 9px;
  align-items: center;
  width: max-content;
  font-size: 21px;
  font-weight: 950;
  color: var(--accent);
  letter-spacing: .01em;
}
.brand span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  box-shadow: 0 8px 18px rgba(255, 79, 31, .26);
}
.search {
  display: flex;
  width: 100%;
  margin: 0 auto;
  border: 1px solid #ff9f73;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(255, 79, 31, .08);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 10px 18px;
  outline: none;
  background: transparent;
}
.search button {
  min-width: 84px;
  border: 0;
  border-left: 1px solid var(--line-soft);
  background: white;
  padding: 0 18px;
  font-weight: 850;
}
.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-weight: 850;
  white-space: nowrap;
}
.primary, button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 10px 18px rgba(255, 79, 31, .18);
}
.primary:hover, button.primary:hover { background: var(--accent-dark); color: white; }
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1160px);
  gap: 32px;
  max-width: 1420px;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: 58px;
  min-height: calc(100vh - 58px);
  align-self: start;
  border-right: 1px solid var(--line);
  padding: 18px 10px;
  background: rgba(255, 255, 255, .55);
}
.sidebar a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-weight: 650;
}
.sidebar a.active, .sidebar a:hover {
  background: #edf2f8;
  color: var(--text);
  font-weight: 900;
}
.content {
  min-width: 0;
  padding: 24px 18px 88px;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 744px) 320px;
  gap: 24px;
  align-items: start;
}
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}
.card h1, .card h2, .card h3 { margin-top: 0; }
h1 {
  margin: 6px 0 22px;
  font-size: clamp(30px, 3vw, 38px);
  line-height: 1.05;
  letter-spacing: 0;
}
h2 { font-size: 24px; line-height: 1.18; }
h3 { font-size: 20px; }
.post {
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  background: transparent;
  padding: 18px 16px;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.post:hover {
  border-color: var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.post-meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.post h2 { margin: 10px 0 8px; font-size: 22px; line-height: 1.2; }
.post p { line-height: 1.55; }
.post img {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #eef3f8;
}
.actions {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}
button, .button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 15px;
  font-weight: 850;
  font: inherit;
  line-height: 1;
}
button:hover, .button:hover { background: #edf2f8; color: var(--text); }
button:disabled { opacity: .55; cursor: not-allowed; }
input, textarea, select {
  width: 100%;
  border: 1px solid #cfd9e6;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: #ff9f73;
  box-shadow: 0 0 0 4px rgba(255, 79, 31, .1);
}
textarea { min-height: 116px; resize: vertical; }
.form-grid {
  display: grid;
  gap: 12px;
}
.form-grid.card {
  background: var(--surface);
  box-shadow: var(--shadow);
}
.form-grid button.primary { width: 100%; min-height: 42px; }
.alert {
  border-radius: 14px;
  padding: 14px 16px;
  margin: 12px 0;
  font-weight: 750;
}
.alert.warn { background: #fff5ec; border: 1px solid #ffbd91; color: #a43a00; }
.alert.ok { background: #ebfff4; border: 1px solid #a8e8c3; color: #08723c; }
.muted { color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
}
.forum-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.forum-grid .card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
}
.forum-grid .card:hover {
  border-color: #ffb08a;
  box-shadow: var(--shadow);
}
.message-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.message-layout aside {
  display: grid;
  gap: 12px;
}
.message-layout > .card {
  min-height: 400px;
}
.bubble {
  max-width: 76%;
  border-radius: 18px;
  padding: 13px 15px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.bubble.mine {
  margin-left: auto;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.center-card {
  max-width: 560px;
  margin: 34px auto;
  background: var(--surface);
  box-shadow: var(--shadow);
}
aside .card {
  background: #f7f9fc;
}
aside .card p {
  margin: 12px 0;
}
@media (max-width: 1050px) {
  .topbar { grid-template-columns: 1fr; height: auto; padding: 10px; }
  .top-actions { justify-content: flex-start; }
  .shell, .grid, .message-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 6px;
    overflow-x: auto;
    background: white;
  }
  .sidebar a { white-space: nowrap; margin-bottom: 0; }
  .forum-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .content { padding: 16px 10px 72px; }
  .card, .post { padding: 14px; }
  .top-actions { font-size: 14px; }
  .bubble { max-width: 100%; }
}
