/* Shared semantic surfaces. Legacy colors use light-only overrides below. */
:root {
  --surface: #151f30;
  --surface-soft: #101929;
  --surface-inset: #0c1422;
  --link: #93c5fd;
  --shadow-soft: 0 4px 18px rgb(0 0 0 / .12);
  --accent-solid: #2563eb;
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fa;
  --card: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-inset: #e8eef5;
  --border: #bac7d7;
  --field-border: #7c8ea5;
  --text: #17263c;
  --muted: #526176;
  --accent: #1d4ed8;
  --green: #15803d;
  --red: #b91c1c;
  --yellow: #854d0e;
  --link: #1d4ed8;
  --ink-rgb: 15, 23, 42;
  --legacy-surface: #f1f5f9;
  --legacy-blue: #1d4ed8;
  --legacy-sky: #0369a1;
  --legacy-green: #166534;
  --legacy-red: #b91c1c;
  --legacy-yellow: #854d0e;
  --legacy-purple: #7e22ce;
  --legacy-muted: #526176;
  --shadow-soft: 0 4px 18px rgb(24 45 75 / .05);
}
body { background: var(--bg); }
button, input, textarea, select { font-family: inherit; }
.card { box-shadow: var(--shadow-soft); }
input:not([type='radio']):not([type='checkbox']), textarea, select {
  background: var(--surface-soft);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.guest-browse { margin: 0 0 24px; }
.guest-browse > a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; text-decoration: none; }
[data-theme="light"] input:not([type='radio']):not([type='checkbox']),
[data-theme="light"] textarea, [data-theme="light"] select {
  border: 1px solid var(--field-border);
  background-color: #fff;
}
[data-theme="light"] :is(input, textarea, select):hover { border-color: #526176; }
[data-theme="light"] :is(input, textarea, select):focus { border-color: var(--accent); }
[data-theme="light"] :is(.real-estate-composer, .real-estate-form-section) { border-color: var(--border); }
[data-theme="light"] .real-estate-form-section { background: #f8fafc; }
.legal-page h1 { margin: 24px 0 10px; font-size: clamp(26px, 4vw, 36px); line-height: 1.2; }
.legal-version { color: var(--muted); margin-bottom: 20px; font-size: 14px; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.legal-nav a { padding: 10px 14px; border: 1px solid var(--border); border-radius: 9px; color: var(--link); text-decoration: none; font-size: 14px; }
.legal-content { padding: clamp(20px, 4vw, 32px); line-height: 1.75; font-size: 16px; overflow-wrap: anywhere; }
.legal-content section + section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.legal-content :is(h2, h3) { line-height: 1.35; margin: 0 0 14px; }
.legal-content h3 { font-size: 19px; }
.legal-content > h2 { margin-bottom: 24px; }
.legal-content p + p { margin-top: 12px; }
.legal-content ul { margin: 12px 0; padding-left: 22px; }
.legal-content li + li { margin-top: 10px; }
.legal-content a, .real-estate-legal-note a { color: var(--link); text-underline-offset: 3px; }
.legal-content section, #privatnost { scroll-margin-top: 20px; }
.real-estate-legal-note { margin: 18px 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: 14px; line-height: 1.6; }
:where(button, a, input, textarea, select):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.btn-primary { background: var(--accent-solid); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 4px 10px; margin: 0; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 600; line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle-track {
  display: flex; position: relative; align-items: center; gap: 4px;
  padding: 4px; border-radius: 999px; background: var(--surface-inset);
}
.theme-toggle-track::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--card); box-shadow: 0 1px 4px #0002;
  transition: transform .18s ease;
}
.theme-toggle svg { position: relative; width: 20px; height: 20px; padding: 2px; }
.theme-toggle[aria-checked="true"] .theme-toggle-track::before { transform: translateX(24px); }
.theme-toggle[aria-checked="true"] .theme-moon,
.theme-toggle[aria-checked="false"] .theme-sun { color: var(--accent); }
.theme-toolbar { display: flex; justify-content: flex-end; width: 100%; margin-bottom: 16px; }
.topbar-right, .profile-topbar-right { flex-wrap: wrap; }
.topbar-right > .btn-primary { width: auto; min-width: 110px; margin: 0; }
.footer-link:link, .footer-link:visited { color: var(--link); }
.footer-copy { color: var(--muted); }
.footer-link:hover, .footer-link:focus-visible { color: var(--text); }
.site-header { flex-wrap: wrap; }
.site-nav { align-items: center; }
.guest-auth-dialog { background: var(--card); color: var(--text); border-color: var(--border); }
.guest-auth-dialog p, .guest-auth-close { color: var(--muted); }
.notification-modal-backdrop, .real-estate-lightbox::backdrop, .real-estate-delete-dialog::backdrop { background: rgb(2 6 23 / .65); }
.real-estate-lightbox-frame { background: var(--card); }
.real-estate-lightbox button { background: var(--surface); color: var(--text); }
.real-estate-lightbox button:hover { background: var(--surface-soft); }
[data-theme="light"] .admin-metric-card { background: var(--surface-soft); }
[data-theme="light"] .payment-option:has(input:checked) span { color: var(--accent); }
[data-theme="light"] :is(.superadmin-banner, .superadmin-banner small, .status-open) { color: var(--yellow); }
[data-theme="light"] :is(.btn-danger-soft, .btn-danger-soft:hover, .btn-danger-outline, .btn-danger-outline:hover) { color: var(--red); }
[data-theme="light"] #postEditorToolbar.ql-toolbar.ql-snow,
[data-theme="light"] #postEditor.ql-container.ql-snow { background: var(--surface-soft); }
[data-theme="light"] .form-group :is(input, textarea)::placeholder { color: var(--muted); }
[data-theme="light"] .form-message.success { color: var(--green); }
[data-theme="light"] .form-message.error { color: var(--red); }
[data-theme="light"] :is(.btn-ghost, .real-estate-author-name, .real-estate-card-secondary-action, .auth-link, .text-link):hover { color: var(--text); }
[data-theme="light"] :is(.real-estate-transaction-filter.active, .real-estate-transaction-filter:hover, .real-estate-dashboard-pages .active) { color: var(--accent); }
[data-theme="light"] :is(.real-estate-author-avatar, .real-estate-author-fallback, .real-estate-chat-avatar-fallback) { background: #dbeafe; color: #1e40af; }
[data-theme="light"] .ql-toolbar.ql-snow .ql-stroke { stroke: var(--muted); }
[data-theme="light"] .ql-toolbar.ql-snow .ql-fill { fill: var(--muted); }
[data-theme="light"] .ql-snow .ql-picker { color: var(--text); }
[data-theme="light"] .ql-editor.ql-blank::before { color: var(--muted); }
[data-theme="light"] .real-estate-card-action { color: #fff; }
[data-theme="light"] .category-nav a:hover,
[data-theme="light"] .button-link:hover { color: var(--accent); }
@media (max-width: 600px) {
  .topbar { display: flex; align-items: center; flex-wrap: wrap; }
  .topbar-right { gap: 8px; margin-left: auto; justify-content: flex-end; overflow: visible; }
  .notif-bell, .notification-settings-button { width: 44px; height: 44px; }
  .theme-toggle { padding: 4px 7px; }
  .topbar-right .theme-toggle [data-theme-label], .profile-topbar-right .theme-toggle [data-theme-label] { display: none; }
  input:not([type='radio']):not([type='checkbox']), textarea, select { font-size: 16px; min-height: 44px; }
  .btn-primary, .btn-ghost, .btn-secondary, .btn-chat, .btn-posts-toggle { min-height: 44px; font-size: 14px; }
  .item-meta, .notif-body, .notif-time { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle-track::before { transition: none; }
}
