/* Дизайн-система BGD Mind, урезанная до того, что использует страница «Конкуренты».
   Источник: bgd-mind public/styles.css (HEAD). Имена классов и значения не менялись —
   правила, которых нет на этой странице (модалки, тур, графики, AI-панель), вырезаны. */
:root {
  --primary: #3B82F6; --primary-hover: #2563EB; --secondary: #EC4899;
  --success: #10B981; --warning: #F59E0B; --danger: #EF4444; --pending: #64748B;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
a { text-decoration: none; color: inherit; }
a:hover { text-decoration: none; }
body { font-family: 'Inter', sans-serif; height: 100vh; display: flex; overflow: hidden; transition: background-color 0.3s, color 0.3s; }
body > div { flex: 1; min-width: 0; }

/* ---- DARK ---- */
body.dark { background: #0F172A; color: #F8FAFC; --border: #1E293B; --bg-card: #1E293B; --text-muted-c: #94A3B8; --card-bg-alt: #1E293B; }
body.dark .sidebar { background: #0F172A; border-color: #1E293B; }
body.dark .sidebar-link { color: #94A3B8; }
body.dark .sidebar-link:hover { background: #1E293B; color: #F8FAFC; }
body.dark .sidebar-link.active { background: var(--primary); color: #fff; }
body.dark .sidebar .section-title { color: #475569; }
body.dark .topbar { background: #0F172A; border-color: #1E293B; }
body.dark .main-area { background: #0F172A; }
body.dark .user-area { border-color: #1E293B; }
body.dark .user-name { color: #F8FAFC; }
body.dark .user-role { color: #475569; }
body.dark .topbar-btn { color: #94A3B8; }
body.dark .topbar-btn:hover { color: #F8FAFC; }
body.dark .theme-sw { color: #94A3B8; }
body.dark ::-webkit-scrollbar-track { background: #0F172A; }
body.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* ---- LIGHT ---- */
body.light { background: #F1F5F9; color: #0F172A; --border: #E2E8F0; --bg-card: #FFFFFF; --text-muted-c: #64748B; --card-bg-alt: #E2E8F0; }
body.light .sidebar { background: #FFFFFF; border-color: #E2E8F0; }
body.light .sidebar-link { color: #64748B; }
body.light .sidebar-link:hover { background: #F1F5F9; color: #0F172A; }
body.light .sidebar-link.active { background: var(--primary); color: #fff; }
body.light .sidebar .section-title { color: #94A3B8; }
body.light .topbar { background: #FFFFFF; border-color: #E2E8F0; }
body.light .main-area { background: #F1F5F9; }
body.light .user-area { border-color: #E2E8F0; }
body.light .user-name { color: #0F172A; }
body.light .user-role { color: #94A3B8; }
body.light .topbar-btn { color: #64748B; }
body.light .topbar-btn:hover { color: #0F172A; }
body.light .theme-sw { color: #64748B; }
body.light ::-webkit-scrollbar-track { background: #F1F5F9; }
body.light ::-webkit-scrollbar-thumb { background: #CBD5E1; }

/* ---- Layout ---- */
.sidebar { width: 256px; border-right: 1px solid; display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; transition: width 0.22s ease; }
.sidebar-header { display: flex; align-items: stretch; flex-shrink: 0; }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; flex: 1; min-width: 0; overflow: hidden; padding: 1.5rem 0 1.5rem 1.25rem; }
.logo-icon { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #3B82F6, #EC4899); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.025em; white-space: nowrap; }
.sidebar-collapse-btn { display: flex; align-items: center; justify-content: center; padding: 0 0.5rem; border: none; cursor: pointer; background: transparent; flex-shrink: 0; transition: background 0.15s; }
.sidebar-collapse-btn .material-symbols-outlined { font-size: 18px; transition: color 0.15s; }
body.dark .sidebar-collapse-btn { color: #475569; }
body.dark .sidebar-collapse-btn:hover { background: #1E293B; color: #94A3B8; }
body.light .sidebar-collapse-btn { color: #CBD5E1; }
body.light .sidebar-collapse-btn:hover { background: #F1F5F9; color: #64748B; }
/* Sidebar tooltip (collapsed mode) */
.sidebar-tooltip { position: fixed; padding: 6px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 500; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 2000; transform: translateY(-50%); }
.sidebar-tooltip.visible { opacity: 1; }
body.dark .sidebar-tooltip { background: #1E293B; color: #F8FAFC; border: 1px solid #334155; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
body.light .sidebar-tooltip { background: #FFFFFF; color: #0F172A; border: 1px solid #E2E8F0; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
/* Collapsed sidebar */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-collapse-btn { padding: 1.5rem 0; width: 64px; }
.sidebar.collapsed .section-title { display: none; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 0.65rem 0; }
.sidebar.collapsed .sb-label { display: none; }
.sidebar.collapsed .user-area-link { justify-content: center; }
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed #userMenuArrow { display: none; }
.sidebar nav { flex: 1; padding: 0 0.75rem; overflow-y: auto; position: relative; }
/* Scroll shadows on nav — top when scrolled down, bottom when not at end */
.sidebar nav.scrolled { box-shadow: inset 0 8px 8px -8px rgba(0,0,0,0.1); }
.sidebar nav.scroll-bottom { box-shadow: inset 0 -8px 8px -8px rgba(0,0,0,0.1); }
.sidebar nav.scrolled.scroll-bottom { box-shadow: inset 0 8px 8px -8px rgba(0,0,0,0.1), inset 0 -8px 8px -8px rgba(0,0,0,0.1); }
body.dark .sidebar nav.scrolled { box-shadow: inset 0 8px 8px -8px rgba(0,0,0,0.3); }
body.dark .sidebar nav.scroll-bottom { box-shadow: inset 0 -8px 8px -8px rgba(0,0,0,0.3); }
body.dark .sidebar nav.scrolled.scroll-bottom { box-shadow: inset 0 8px 8px -8px rgba(0,0,0,0.3), inset 0 -8px 8px -8px rgba(0,0,0,0.3); }
.section-title { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 1rem; margin: 1.25rem 0 0.5rem; }
.sidebar-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1rem; font-size: 0.875rem; font-weight: 500; border-radius: 8px; text-decoration: none; transition: all 0.15s; margin-bottom: 2px; }
.sidebar-link .material-symbols-outlined { font-size: 20px; }
.user-area { padding: 1rem; border-top: 1px solid; display: flex; align-items: center; gap: 0.75rem; }
.user-area-link { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; text-decoration: none; color: inherit; border-radius: 8px; padding: 0.25rem; margin: -0.25rem; transition: background 0.15s; }
.user-area-link:hover { background: rgba(59, 130, 246, 0.08); }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 0.8rem; flex-shrink: 0; overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.875rem; font-weight: 500; }
.user-role { font-size: 0.7rem; }
.logout-btn { background: none; border: none; cursor: pointer; padding: 0.25rem; color: inherit; opacity: 0.5; transition: opacity 0.2s; }
.logout-btn:hover { opacity: 1; }

.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; width: 100%; }
.topbar { height: 60px; border-bottom: 1px solid; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; flex-shrink: 0; position: relative; z-index: 1; }
.topbar h2 { font-size: 1.25rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar-btn { background: none; border: none; cursor: pointer; padding: 0.5rem; position: relative; display: flex; }
.theme-sw { background: none; border: none; cursor: pointer; padding: 0.5rem; display: flex; transition: all 0.15s; }
.main-area { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; align-items: stretch; min-height: 0; gap: 0; overflow-anchor: none; }

/* ---- Folder Tabs (reusable tab-as-folder component) ---- */
.folder-wrap { margin-bottom: 1.5rem; }
.folder-tabs { display:flex; align-items:flex-end; gap:0; position:relative; z-index:2; }
.folder-tab { position:relative; padding:0.55rem 1.3rem 0.65rem; border-radius:10px 10px 0 0; border-top:3px solid transparent; border-left:1px solid transparent; border-right:1px solid transparent; border-bottom:none; margin-bottom:-1px; background:transparent; color:var(--text-muted-c,#64748B); font-size:0.82rem; font-weight:600; cursor:pointer; font-family:inherit; display:flex; align-items:center; gap:0.4rem; transition:background 0.2s, color 0.2s, border-color 0.2s; white-space:nowrap; z-index:1; }
.folder-tab:hover { color:inherit; background:var(--card-bg-alt,#E2E8F0); }
.folder-tab:first-child:hover { border-bottom-left-radius:0; }
.folder-tab.active { background:var(--bg-card,#fff); color:inherit; border-left-color:var(--border,#E2E8F0); border-right-color:var(--border,#E2E8F0); z-index:3; }
.folder-tab.active::after { content:''; position:absolute; bottom:-1px; left:0; right:0; height:2px; background:var(--bg-card,#fff); z-index:4; }
.folder-tab .ft-badge { font-size:0.62rem; padding:0.1rem 0.4rem; border-radius:10px; background:var(--border,#E2E8F0); color:var(--text-muted-c,#64748B); font-weight:600; min-width:20px; text-align:center; transition:all 0.2s; }
.folder-tab.active .ft-badge { color:#fff; }
.folder-tab .material-symbols-outlined { font-size:18px; transition:color 0.2s; }
.folder-content { background:var(--bg-card,#fff); border:1px solid var(--border,#E2E8F0); border-radius:12px; box-shadow:0 1px 3px rgba(0,0,0,0.04); position:relative; z-index:1; overflow:hidden; }
body.dark .folder-tab:hover { background:rgba(51,65,85,0.5); }
body.dark .folder-content { box-shadow:0 1px 3px rgba(0,0,0,0.15); }
/* Folder toolbar (inside folder-content) */
.folder-toolbar { padding:0.75rem 1.25rem; border-bottom:1px solid var(--border,#E2E8F0); display:flex; align-items:center; gap:0.75rem; flex-wrap:wrap; }
.folder-toolbar-section { display:flex; align-items:center; gap:0.35rem; flex-wrap:wrap; }
.folder-toolbar-label { font-size:0.68rem; font-weight:600; color:var(--text-muted-c,#64748B); text-transform:uppercase; letter-spacing:0.03em; margin-right:0.25rem; white-space:nowrap; }
.folder-toolbar-divider { width:1px; height:20px; background:var(--border,#E2E8F0); margin:0 0.25rem; }
/* Channel/filter pills (inside toolbar) */
.ch-pill { display:inline-flex; align-items:center; gap:0.3rem; padding:0.2rem 0.55rem; border-radius:6px; border:1px solid var(--border,#E2E8F0); background:transparent; color:var(--text-muted-c,#64748B); font-size:0.7rem; font-weight:500; cursor:pointer; transition:all 0.15s; font-family:inherit; white-space:nowrap; }
.ch-pill:hover { border-color:var(--primary); color:var(--primary); }
.ch-pill.active { background:rgba(59,130,246,0.08); border-color:rgba(59,130,246,0.3); color:var(--primary); font-weight:600; }
.ch-pill .material-symbols-outlined { font-size:14px; }
.ch-pill .dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
body.dark .ch-pill.active { background:rgba(59,130,246,0.12); }

/* ---- Animations ---- */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { border-radius: 3px; }
body.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }
body.light ::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ---- Metrika-style Period Picker (pf2) ---- */
.pf2-picker { display:flex; align-items:center; gap:0.5rem; width:fit-content; max-width:100%; align-self:flex-start; flex-shrink:0; flex-wrap:wrap; }
.pf2-main { display:flex; align-items:center; background:var(--bg-card,#fff); border:1px solid var(--border); border-radius:12px; position:relative; min-height:40px; padding:4px; gap:0; }
body.dark .pf2-main { background:var(--bg-card,#1E293B); }
.pf2-slider { position:absolute; top:4px; left:4px; height:calc(100% - 8px); border-radius:8px; background:var(--primary); z-index:0; pointer-events:none; transition:left 0.25s cubic-bezier(0.4,0,0.2,1), width 0.25s cubic-bezier(0.4,0,0.2,1); }
.pf2-btn { padding:0.4rem 0.85rem; font-size:0.78rem; font-weight:500; cursor:pointer; border:none; background:none; color:var(--text-muted-c,#64748B); font-family:inherit; transition:color 0.15s; white-space:nowrap; position:relative; z-index:1; line-height:1.4; }
.pf2-btn:hover { color:var(--primary); }
.pf2-btn.active { color:#fff; }
.pf2-range { display:flex; align-items:center; gap:0.25rem; padding:0.4rem 0.75rem; font-size:0.78rem; font-weight:500; cursor:pointer; border:none; background:none; color:var(--text-muted-c,#64748B); font-family:inherit; transition:color 0.15s; white-space:nowrap; position:relative; z-index:1; flex-shrink:0; }
.pf2-range.active { color:#fff; }
.pf2-range:hover { color:var(--primary); }
.pf2-range.open .material-symbols-outlined { transform:rotate(180deg); }
.pf2-range .material-symbols-outlined {
  font-size:16px;
  transition:transform 0.2s;
  flex-shrink:0;
}
/* Calendar popup (fixed, appended to body) */
.pf2-cal-wrap { position:fixed; z-index:1000; display:none; }
.pf2-cal-wrap.open { display:block; }
.pf2-cal { background:var(--bg-card,#fff); border:1px solid var(--border); border-radius:12px; box-shadow:0 12px 40px rgba(0,0,0,0.12),0 4px 12px rgba(0,0,0,0.06); padding:0; min-width:680px; overflow:hidden; }
body.dark .pf2-cal { background:var(--bg-card,#1E293B); border-color:var(--border,#334155); box-shadow:0 12px 40px rgba(0,0,0,0.35),0 4px 12px rgba(0,0,0,0.2); }
.pf2-cal-header { display:flex; align-items:center; justify-content:space-between; padding:0.85rem 1rem; border-bottom:1px solid var(--border); }
.pf2-cal-nav { width:28px; height:28px; border-radius:6px; border:1px solid var(--border); background:none; cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--text-muted-c,#64748B); transition:all 0.15s; flex-shrink:0; }
.pf2-cal-nav:hover { border-color:var(--primary); color:var(--primary); background:rgba(59,130,246,0.06); }
.pf2-cal-nav .material-symbols-outlined { font-size:18px; }
.pf2-cal-months-title { display:flex; gap:2rem; flex:1; justify-content:center; }
.pf2-cal-months-title span { font-size:0.85rem; font-weight:600; min-width:140px; text-align:center; }
.pf2-cal-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:0; }
.pf2-cal-month { padding:0.75rem 1rem; }
.pf2-cal-month:not(:last-child) { border-right:1px solid var(--border); }
.pf2-cal-weekdays { display:grid; grid-template-columns:repeat(7,1fr); gap:0; margin-bottom:0.25rem; }
.pf2-cal-wd { text-align:center; font-size:0.68rem; font-weight:600; text-transform:uppercase; color:var(--text-muted-c,#94A3B8); padding:0.2rem 0; letter-spacing:0.02em; }
.pf2-cal-wd.weekend { color:rgba(239,68,68,0.5); }
.pf2-cal-days { display:grid; grid-template-columns:repeat(7,1fr); gap:0; }
.pf2-cal-day { text-align:center; font-size:0.78rem; padding:0; height:30px; display:flex; align-items:center; justify-content:center; cursor:pointer; border-radius:0; transition:background 0.1s, color 0.1s; position:relative; color:var(--text-color,#0F172A); }
body.dark .pf2-cal-day { color:var(--text-color,#E2E8F0); }
.pf2-cal-day:hover:not(.disabled):not(.empty):not(.range-start):not(.range-end):not(.in-range) { background:var(--primary) !important; color:#fff !important; border-radius:6px; }
.pf2-cal-day.empty { cursor:default; }
.pf2-cal-day.today { font-weight:700; }
.pf2-cal-day.today::after { content:''; position:absolute; bottom:2px; left:50%; transform:translateX(-50%); width:4px; height:4px; border-radius:50%; background:var(--primary); }
.pf2-cal-day.weekend { color:var(--text-muted-c,#94A3B8); }
.pf2-cal-day.disabled { color:var(--text-muted-c,#94A3B8); opacity:0.35; cursor:not-allowed; }
.pf2-cal-day.in-range { background:rgba(59,130,246,0.10); transition:background 0.1s, border-radius 0.1s; }
.pf2-cal-day.in-range:hover { background:rgba(59,130,246,0.18); }
.pf2-cal-day.range-start { background:var(--primary); color:#fff; border-radius:6px 0 0 6px; }
.pf2-cal-day.range-end { background:var(--primary); color:#fff; border-radius:0 6px 6px 0; }
.pf2-cal-day.range-start.range-end { border-radius:6px; }
.pf2-cal-day.range-start.today::after, .pf2-cal-day.range-end.today::after { background:#fff; }
.pf2-cal-footer { display:flex; align-items:center; gap:0.75rem; padding:0.75rem 1rem; border-top:1px solid var(--border); }
.pf2-cal-input { width:95px; padding:0.35rem 0.5rem; border:1px solid var(--border); border-radius:6px; font-size:0.78rem; font-family:inherit; text-align:center; background:var(--bg-card,#fff); color:var(--text-color); outline:none; transition:border-color 0.15s; }
body.dark .pf2-cal-input { background:var(--bg-card,#1E293B); color:var(--text-color,#E2E8F0); }
.pf2-cal-input:focus { border-color:var(--primary); }
.pf2-cal-dash { color:var(--text-muted-c,#94A3B8); font-size:0.82rem; }
.pf2-cal-period { font-size:0.75rem; color:var(--text-muted-c,#64748B); margin-left:auto; }
.pf2-cal-apply { padding:0.35rem 1rem; border:none; border-radius:6px; background:var(--primary); color:#fff; font-size:0.78rem; font-weight:500; cursor:pointer; font-family:inherit; transition:background 0.15s; }
.pf2-cal-apply:hover { background:var(--primary-hover,#2563EB); }

/* ---- Loading Skeleton ---- */
@keyframes skeleton-pulse {
  0% { opacity: 0.6; }
  50% { opacity: 0.3; }
  100% { opacity: 0.6; }
}
.skeleton-loading { padding: 1rem; }
.skeleton-row { display: flex; gap: 1rem; margin-bottom: 0.85rem; align-items: center; }
.skeleton-bar { height: 14px; border-radius: 6px; animation: skeleton-pulse 1.4s ease-in-out infinite; }
body.dark .skeleton-bar { background: #334155; }
body.light .skeleton-bar { background: #E2E8F0; }
.skeleton-bar.w-full { width: 100%; }
.skeleton-bar.w-3-4 { width: 75%; }
.skeleton-bar.w-half { width: 50%; }
.skeleton-bar.w-1-4 { width: 25%; }
.skeleton-bar.w-1-5 { width: 20%; }
.skeleton-bar.h-sm { height: 10px; }
.skeleton-bar.h-lg { height: 18px; }
.skeleton-bar.circle { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }

/* ---- Error State ---- */
.state-error { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1.5rem; text-align: center; gap: 0.75rem; }
.state-error-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: rgba(239,68,68,0.1); color: var(--danger); }
.state-error-icon .material-symbols-outlined { font-size: 28px; }
.state-error-title { font-size: 0.95rem; font-weight: 700; }
.state-error-msg { font-size: 0.82rem; color: var(--text-muted-c, #64748B); max-width: 400px; line-height: 1.5; }
.state-error-btn { margin-top: 0.5rem; padding: 0.45rem 1.25rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.15s; display: inline-flex; align-items: center; gap: 0.35rem; }
.state-error-btn:hover { border-color: var(--primary); color: var(--primary); }
.state-error-btn .material-symbols-outlined { font-size: 16px; }

/* ---- Empty State ---- */
.state-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1.5rem; text-align: center; gap: 0.75rem; }
.state-empty-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
body.dark .state-empty-icon { background: rgba(51,65,85,0.5); color: #64748B; }
body.light .state-empty-icon { background: #F1F5F9; color: #94A3B8; }
.state-empty-icon .material-symbols-outlined { font-size: 28px; }
.state-empty-title { font-size: 0.95rem; font-weight: 700; }
.state-empty-msg { font-size: 0.82rem; color: var(--text-muted-c, #64748B); max-width: 400px; line-height: 1.5; }

/* ---- Mobile ---- */
@media (max-width: 768px) {
  .pf2-picker { align-items:stretch; }
  .pf2-main { min-height:44px; }
  .theme-sw, .pf2-btn, .pf2-range { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .sidebar-link { min-height: 44px; display: flex; }
  .topbar {
    overflow: hidden;
    gap: 0.5rem;
  }
  .topbar h2 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
  }
  .topbar-actions {
    flex-shrink: 0;
    gap: 0.35rem;
  }
}

/* ============================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================ */

/* Focus-visible outlines on interactive elements */
:focus-visible {
  outline: 2px solid var(--primary, #3B82F6);
  outline-offset: 2px;
}

/* Remove default outlines only when focus-visible is supported */
:focus:not(:focus-visible) {
  outline: none;
}

/* Specific focus styles for common interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary, #3B82F6);
  outline-offset: 2px;
  border-radius: 4px;
}

.sidebar-link:focus-visible {
  outline: 2px solid var(--primary, #3B82F6);
  outline-offset: -2px;
  border-radius: 8px;
}

/* Reduced motion: disable animations and transitions */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .sidebar { transition: none; }
}

/* Screen reader only utility class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* ---- Contextual Help Hints ---- */
.help-hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  font-size: 9px; font-weight: 600; font-style: normal;
  opacity: 0.35; cursor: help; position: relative;
  vertical-align: middle; margin-left: 4px; flex-shrink: 0;
  transition: opacity 0.2s;
  line-height: 1;
}
body.dark .help-hint { border: 1px solid #475569; color: #94A3B8; }
body.light .help-hint { border: 1px solid #CBD5E1; color: #94A3B8; }
.help-hint:hover { opacity: 0.85; }
body.dark .help-hint:hover { border-color: #60A5FA; color: #60A5FA; }
body.light .help-hint:hover { border-color: #3B82F6; color: #3B82F6; }

/* Floating tooltip (appended to body via JS, escapes overflow:hidden) */
.help-tip-float {
  position: fixed; z-index: 9999;
  padding: 8px 12px; border-radius: 8px;
  font-size: 0.72rem; font-weight: 400; line-height: 1.5; font-family: 'Inter', sans-serif;
  white-space: normal; width: max-content; max-width: 260px;
  text-align: left; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
}
.help-tip-float.visible { opacity: 1; }
.help-tip-float::after {
  content: ''; position: absolute; left: var(--arrow-x, 50%); transform: translateX(-50%);
  border: 5px solid transparent;
}
.help-tip-float.above::after { top: 100%; }
.help-tip-float.below::after { bottom: 100%; }
body.dark .help-tip-float { background: #0F172A; color: #E2E8F0; border: 1px solid #334155; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
body.dark .help-tip-float.above::after { border-top-color: #334155; }
body.dark .help-tip-float.below::after { border-bottom-color: #334155; }
body.light .help-tip-float { background: #FFFFFF; color: #334155; border: 1px solid #E2E8F0; box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
body.light .help-tip-float.above::after { border-top-color: #E2E8F0; }
body.light .help-tip-float.below::after { border-bottom-color: #E2E8F0; }
