:root {
  --bg: #ffffff;
  --surface: #f7f7f5;
  --border: #e4e4e0;
  --text: #1a1a18;
  --muted: #6b6b66;
  --accent: #2563eb;
  --danger: #b42318;
  --ok: #067647;
  --radius: 10px;
  --wrap: 940px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14141a;
    --surface: #1d1d25;
    --border: #2e2e38;
    --text: #e8e8ea;
    --muted: #9b9ba6;
    --accent: #7aa2f7;
    --danger: #f27c72;
    --ok: #57c78d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* шапка */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { font-weight: 600; text-decoration: none; color: var(--text); font-size: 17px; }
.nav { display: flex; gap: 20px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); }
.account { position: relative; display: flex; align-items: center; }

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.menu {
  position: absolute;
  top: 46px; right: 0;
  min-width: 190px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.menu-head {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.menu a, .menu button {
  display: block; width: 100%;
  padding: 9px 12px;
  text-align: left;
  border: none; background: none;
  color: var(--text);
  font: inherit; font-size: 15px;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--surface); }
.menu button.danger { color: var(--danger); }

/* содержимое */
.content { flex: 1; padding: 40px 20px 64px; }
h1 { font-size: 30px; margin: 0 0 10px; font-weight: 600; }
h2 { font-size: 20px; font-weight: 600; margin: 32px 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; font-size: 17px; }
.hero { padding: 24px 0 8px; }
.big { font-size: 22px; font-weight: 600; margin: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card p { color: var(--muted); margin: 0 0 12px; font-size: 15px; }

.post { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 24px; }
.post h2 { margin-top: 0; }
.meta { color: var(--muted); font-size: 14px; margin: 0 0 10px; }

/* формы */
.form { display: flex; flex-direction: column; gap: 6px; max-width: 360px; }
.form.narrow { max-width: 340px; }
.form label { font-size: 14px; color: var(--muted); margin-top: 10px; }
.form label.checkbox {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); font-size: 15px; margin: 14px 0 4px;
}
input[type=text], input[type=password] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
input[type=text]:focus, input[type=password]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.hint { font-size: 13px; color: var(--muted); margin: 2px 0 0; }

button.primary, .btn.primary {
  margin-top: 16px;
  padding: 11px 18px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit; font-size: 15px; font-weight: 500;
  cursor: pointer;
}
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { color: #fff; border: none; }

.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 18px;
  max-width: 360px;
}
.alert.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.alert.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }

.login-page { max-width: 360px; margin: 32px auto; }

/* модальное окно */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: grid; place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bg);
  border-radius: 14px;
  padding: 24px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,.28);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal .form { max-width: none; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 560px) {
  .nav { gap: 14px; margin-left: 12px; }
  .nav a { font-size: 14px; }
  h1 { font-size: 25px; }
}
