body { background: #f7f7f5; }
.card { border-color: #e4e4de; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card-header { background: #fff; font-weight: 600; }
.stat .display-6 { font-weight: 700; }
.post-body { font-size: 1.05rem; line-height: 1.7; overflow-wrap: break-word; }
.post-body p { margin-bottom: 1rem; }
.post-body a { overflow-wrap: anywhere; }
a { text-decoration-thickness: 1px; }
.btn-warning { --bs-btn-bg: #ffcf4a; --bs-btn-border-color: #f2c23e; --bs-btn-hover-bg: #f5c33c; }
.form-check-input:checked { background-color: #212529; border-color: #212529; }
.qr svg { display: block; width: 220px; max-width: 100%; height: auto; }

.brand-icon { width: 32px; height: 32px; object-fit: cover; border-radius: 50%; }

.profile-avatar { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; border: 1px solid #e4e4de; }
.profile-avatar-lg { width: 128px; height: 128px; }
.profile-avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; background: #212529; color: #ffcf4a; font-size: 2rem; font-weight: 700; }
.profile-avatar-lg.profile-avatar-placeholder { font-size: 2.75rem; }
.min-w-0 { min-width: 0; }

.is-submitting { cursor: progress; }
.is-submitting [aria-disabled="true"] { pointer-events: none; opacity: .7; }
.markdown-toolbar { position: sticky; top: .5rem; z-index: 2; background: var(--bs-body-bg); }

.post-cover { width: 100%; max-height: 440px; object-fit: cover; border-radius: .75rem; }
.post-card-cover { height: 180px; object-fit: cover; }
.post-body img { max-width: 100%; height: auto; }
.post-body pre { background: #f4f4f1; padding: 1rem; border-radius: .5rem; overflow-x: auto; }
.post-body .table-responsive { margin-bottom: 1rem; }
.post-body table { width: 100%; margin-bottom: 0; }
.post-body th, .post-body td { border: 1px solid #dee2e6; padding: .4rem .6rem; }
.post-body h2, .post-body h3 { scroll-margin-top: 1rem; }
.post-toc { border-left: 3px solid #ffcf4a; background: var(--bs-tertiary-bg); border-radius: .5rem; padding: .75rem 1rem; }
.post-toc a { color: inherit; }
.post-toc a:hover { text-decoration: underline; }
.post-toc-level-3 { padding-left: 1rem; }

.theme-toggle { width: 2rem; height: 2rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle .theme-icon { display: none; width: 16px; height: 16px; }
[data-bs-theme="light"] .theme-toggle .theme-icon-moon,
[data-bs-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }

[data-bs-theme="dark"] body { background: #101418; }
[data-bs-theme="dark"] .card { border-color: #2b3035; box-shadow: 0 1px 2px rgba(0,0,0,.35); }
[data-bs-theme="dark"] .card-header { background: #1b1f24; border-color: #2b3035; }
[data-bs-theme="dark"] .bg-light { background-color: #1b1f24 !important; }
[data-bs-theme="dark"] .alert-light { --bs-alert-color: var(--bs-body-color); --bs-alert-bg: #1b1f24; --bs-alert-border-color: #2b3035; }
[data-bs-theme="dark"] .text-bg-light { color: var(--bs-body-color) !important; background-color: #2b3035 !important; }
[data-bs-theme="dark"] .text-bg-dark { color: #0b0f13 !important; background-color: #f8f9fa !important; }
[data-bs-theme="dark"] a.text-dark { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .btn-dark {
  --bs-btn-color: #0b0f13;
  --bs-btn-bg: #f8f9fa;
  --bs-btn-border-color: #f8f9fa;
  --bs-btn-hover-color: #0b0f13;
  --bs-btn-hover-bg: #e9ecef;
  --bs-btn-hover-border-color: #e9ecef;
  --bs-btn-active-color: #0b0f13;
  --bs-btn-active-bg: #e9ecef;
  --bs-btn-active-border-color: #e9ecef;
  --bs-btn-disabled-color: #0b0f13;
  --bs-btn-disabled-bg: #f8f9fa;
  --bs-btn-disabled-border-color: #f8f9fa;
}
[data-bs-theme="dark"] .btn-outline-dark {
  --bs-btn-color: #f8f9fa;
  --bs-btn-border-color: #adb5bd;
  --bs-btn-hover-color: #0b0f13;
  --bs-btn-hover-bg: #f8f9fa;
  --bs-btn-hover-border-color: #f8f9fa;
  --bs-btn-active-color: #0b0f13;
  --bs-btn-active-bg: #e9ecef;
  --bs-btn-active-border-color: #e9ecef;
  --bs-btn-disabled-color: #adb5bd;
  --bs-btn-disabled-border-color: #6c757d;
}
[data-bs-theme="dark"] .profile-avatar { border-color: #2b3035; }
[data-bs-theme="dark"] .profile-avatar-placeholder { background: #f8f9fa; color: #212529; }
[data-bs-theme="dark"] .post-body pre { background: #1b1f24; }
[data-bs-theme="dark"] .post-body th,
[data-bs-theme="dark"] .post-body td { border-color: #495057; }
[data-bs-theme="dark"] .form-check-input:checked { border-color: #adb5bd; }

/* Мобильные улучшения */
@media (max-width: 767.98px) {
  .form-control,
  .form-select,
  .form-control-sm,
  .form-select-sm { font-size: 1rem; }
  .form-control-sm,
  .form-select-sm { min-height: 2.75rem; }

  .btn-sm { min-height: 2.5rem; }
  .navbar-toggler,
  .theme-toggle { min-width: 2.75rem; min-height: 2.75rem; }
  .pagination .page-link { min-height: 2.75rem; display: inline-flex; align-items: center; }
  .markdown-toolbar .btn { min-width: 2.75rem; min-height: 2.75rem; }
  .dropdown-item { min-height: 2.75rem; display: flex; align-items: center; }
  .stat .display-6 { font-size: 2.25rem; }
}
