/* --------------------------------------------------------------------------
   1) Переменные темы
   -------------------------------------------------------------------------- */
:root{
  --bg-page: #ffffff;
  --bg-card: #f8f9fa;
  --text-main: #3c4043;
  --text-muted: #70757a;
  --primary: #1e983a;
  --primary-hover: #1e983a;
  --border: #dadce0;

  --input-bg: var(--bg-card);
  --modal-bg: var(--bg-page);

  --shadow-sm: 0 1px 6px #3c404333;
  --shadow-md: 0 4px 12px #3c40434d;
  --overlay-bg: #3c404399;
  --accent-light: #1e983a1a;

  --header-height: 64px;
  --container-width: 1200px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-round: 50px;
}

body.dark{
  --bg-page: #1a1a1a;
  --bg-card: #202124;
  --text-main: #e8eaed;
  --text-muted: #9aa0a6;
  --primary: #1e983a;
  --primary-hover: #4ade80;
  --border: #5f6368;

  --input-bg: var(--bg-card);
  --modal-bg: var(--bg-card);

  --shadow-sm: none;
  --shadow-md: 0 4px 12px #00000080;
  --overlay-bg: #000000b3;
  --accent-light: #4ade801a;
}

/* --------------------------------------------------------------------------
   2) База и утилиты
   -------------------------------------------------------------------------- */
*, *::before, *::after{ box-sizing: border-box; margin: 0; padding: 0; }
html{ scroll-behavior: smooth; }

body{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  transition: background 0.2s ease, color 0.2s ease;
}

.material-icons-round{
  font-family: "Material Icons Round";
  font-weight: normal;
  font-style: normal;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  font-size: 24px;
  vertical-align: middle;
}

.container{
  width: min(90%, var(--container-width));
  margin: 0 auto;
  padding: 0 20px;
}

.width-100{ width: 100%; }

.primary-btn{
  background: var(--primary);
  color: var(--bg-page);
  border: none;
  padding: 8px 24px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.2s;
}
body.dark .primary-btn{ color: #202124; }
.primary-btn:hover{ opacity: 0.9; }

.secondary-btn{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 24px;
  border-radius: 20px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   3) Иконки
   -------------------------------------------------------------------------- */
.ui-icon{
  width: 40px;
  height: 40px;
  object-fit: contain;
  transition: filter 0.2s ease;
  filter: brightness(0);
  display: block;
}
body.dark .ui-icon{ filter: brightness(0) invert(1); }

.search-actions .ui-icon{ width: 24px; height: 24px; }

.close-sidebar-btn .ui-icon,
.close-auth-btn .ui-icon,
.close-btn .ui-icon{ width: 24px; height: 24px; }

.service-icon{ width: 28px; height: 28px; object-fit: contain; }

.toggle-icon-img{
  width: 40px;
  height: 40px;
  transition: filter 0.2s ease;
  filter: brightness(0);
  display: block;
}
body.dark .toggle-icon-img{ filter: brightness(0) invert(1); }

/* --------------------------------------------------------------------------
   4) Хедер
   -------------------------------------------------------------------------- */
.top-bar{
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-page);
  backdrop-filter: saturate(180%) blur(12px);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.top-container{
  height: var(--header-height);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 20px;
}

.right-icons{ display: flex; align-items: center; gap: 16px; }

.icon-btn{
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s ease;
}
.icon-btn:hover{ background: transparent; transform: scale(1.15); }

/* Кнопка меню чуть компактнее */
#menu-btn{ width: 40px; height: 40px; }
#menu-btn .ui-icon{ width: 28px; height: 28px; }

/* --------------------------------------------------------------------------
   5) Логотип
   -------------------------------------------------------------------------- */
.logo{
  text-align: center;
  margin: 100px auto 50px;
  padding: 0 20px;
}
.main-logo{
  max-width: 300px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   6) Поиск
   -------------------------------------------------------------------------- */
.search-form{ position: relative; max-width: 700px; margin: 0 auto; }

.search-bar{
  display: flex;
  align-items: center;
  height: 52px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 0 6px 0 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
body.dark .search-bar{ background: var(--bg-card); border-color: transparent; }

.search-bar:hover,
.search-bar:focus-within{
  box-shadow: var(--shadow-md);
  border-color: transparent;
  background: var(--bg-page);
}
body.dark .search-bar:hover,
body.dark .search-bar:focus-within{
  background: var(--bg-card);
  border-color: var(--border);
}

.search-logo-btn{
  background: none;
  border: none;
  padding: 0;
  margin-right: 12px;
  cursor: pointer;
  display: flex;
}
.search-w-logo{ height: 24px; width: auto; }

.search-bar input{
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  background: transparent;
  color: inherit;
  height: 100%;
}
.search-bar input::placeholder{ color: var(--text-muted); }

.search-actions{
  display: flex;
  align-items: center;
  gap: 2px;
}
.search-actions .icon-btn{ width: 40px; height: 40px; }

.search-submit-btn{
  background: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-main);
  padding: 0 20px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  margin-left: 8px;
}
.search-submit-btn:hover{
  background: var(--primary);
  border-color: var(--primary);
  color: var(--bg-page);
}
body.dark .search-submit-btn:hover{ color: #202124; }

/* --------------------------------------------------------------------------
   7) Быстрые теги 
   -------------------------------------------------------------------------- */
.quick-access-line{
  max-width: 700px;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 40px;
}

.quick-panel-inline{
  display: none;
  align-items: center;
  gap: 12px;
  margin-right: 12px;
  max-width: 700px;
  overflow: hidden;
  animation: slideLeft 0.3s ease forwards;
}
.quick-panel-inline.active{ display: flex; }

@keyframes slideLeft{
  from{ opacity: 0; transform: translateX(20px); }
  to{ opacity: 1; transform: translateX(0); }
}

.quick-tags{
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  max-width: 100%;
}

.quick-tags a{
  flex: 0 0 auto;
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
  transition: all 0.2s;
}
.quick-tags a:hover{
  border-color: var(--primary);
  color: var(--primary);
  background: var(--accent-light);
}

.aux-icon-btn{
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: transform 0.2s ease;
}
.aux-icon-btn:hover{ background: transparent; transform: scale(1.15); }
.aux-icon-btn .material-icons-round{ font-size: 28px; line-height: 1; display: block; }

/* --------------------------------------------------------------------------
   8) Избранное 
   -------------------------------------------------------------------------- */
.favorites-services{
  max-width: 700px;
  margin: 40px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
  padding: 10px;
  min-height: 120px;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.favorites-services.edit-mode{
  border: 2px dashed var(--primary);
  background: var(--accent-light);
  opacity: 0.8;
}

.favorites-placeholder{
  width: 100%;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 40px;
}

.favorite-service{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 80px;
  padding: 10px 5px;
  border-radius: 12px;
  cursor: pointer;
  color: inherit;
  transition: background 0.2s;
  text-decoration: none;
}
.favorite-service:hover{ background: var(--bg-card); }

.favorite-service .service-icon-box{
  width: 76px;
  height: 76px;
  background-color: var(--primary);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px var(--accent-light);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.favorite-service .service-icon-img{
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.favorite-service .label{
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dragging{ opacity: 0.5; }

/* --------------------------------------------------------------------------
   9) Слайдер
   -------------------------------------------------------------------------- */
.slider-carousel{
  position: relative;
  max-width: 900px;
  margin: 0 auto 40px;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.slides-container{ display: flex; transition: transform 0.2s ease; }

.slide-card{
  min-width: 100%;
  height: 280px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  text-align: center;
}
.slide-card::before{
  content: "";
  position: absolute;
  inset: 0;
  background: #00000099;
  backdrop-filter: blur(2px);
}

.slide-content{
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.close-slider-btn{
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.close-slider-btn:hover{ transform: scale(1.1); }

.nav-icon{
  width: 40px;
  height: 40px;
  filter: brightness(0) invert(1);
  display: block;
}
.small-cross{
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
  display: block;
}

.show-slider-btn{
  display: none;
  margin: 0 auto 20px;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.show-slider-btn:hover{ transform: scale(1.1); }

.slider-nav{
  position: absolute;
  bottom: 10px;
  background: transparent;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 100%;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s ease;
}


.slider-nav:hover{ background: transparent; transform: scale(1.1); }
.slider-nav.next .nav-icon {
  transform: scaleX(-1);
}

.prev{ left: 10px; }
.next{ right: 5px; }

/* --------------------------------------------------------------------------
   10) Сайдбар
   -------------------------------------------------------------------------- */
.sidebar{
  position: fixed;
  right: -360px;
  top: 20px;
  bottom: 20px;
  width: 320px;
  height: calc(100vh - 40px);
  background: var(--bg-card);
  z-index: 1000;
  padding: 24px;
  transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: -10px 0 30px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  border-radius: 24px;
}
.sidebar.active{ right: 20px; }

.sidebar-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.sidebar-header h3{
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text-main);
}

.close-sidebar-btn{
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  cursor: pointer;
  padding: 0;
  opacity: 0.6;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-sidebar-btn:hover{ opacity: 1; transform: scale(1.1); }

.services-list{
  padding-top: 10px;
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start;
  row-gap: 20px;
  column-gap: 12px;
  scrollbar-width: none;
}
.services-list::-webkit-scrollbar{ display: none; }
.services-list li{ padding: 0; margin: 0; background: transparent; }

.sidebar-link{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  gap: 6px;
  text-align: center;
  width: 100%;
}

.service-icon-box{
  width: 60px;
  height: 60px;
  background-color: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s;
  box-shadow: 0 4px 10px var(--accent-light);
}
.sidebar-link:hover .service-icon-box{
  transform: translateY(-3px);
  background-color: var(--primary-hover);
}

.service-icon-img{
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}

.service-title{
  font-size: 12px;
  line-height: 1.15;
  color: var(--text-main);
  opacity: 0.95;
}

.sidebar-footer{
  margin-top: auto;
  text-align: center;
  padding-top: 20px;
}

.edit-services-bottom{
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  margin: 0 auto;
  width: 100%;
  transition: transform 0.2s ease;
}
.edit-services-bottom:hover{ transform: scale(1.2); }

#save-services{
  background: var(--primary);
  color: var(--bg-page);
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  margin-top: 10px;
  cursor: pointer;
}
body.dark #save-services{ color: #202124; }

.overlay{
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.overlay.active{ opacity: 1; pointer-events: auto; }

/* --------------------------------------------------------------------------
   11) Модальные окна 
   -------------------------------------------------------------------------- */
.modal-backdrop{
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
.modal-backdrop.active{ display: flex; }

.modal-content{
  background: var(--modal-bg);
  padding: 24px;
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
}

.modal-header{
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.close-btn{
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}
.close-btn:hover{ transform: scale(1.1); }

.modal-tags{ display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }

.tag-toggle{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.tag-toggle.active{
  background: var(--accent-light);
  color: var(--primary);
  border-color: transparent;
}
.tag-toggle:hover{ transform: scale(1.1); }
body.dark .tag-toggle.active{ background: var(--primary); color: #202124; }

.modal-actions{ display: flex; justify-content: flex-end; gap: 12px; }

/* --------------------------------------------------------------------------
   12) Авторизация
   -------------------------------------------------------------------------- */
.auth-modal{
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 3000;
  justify-content: flex-end;
  align-items: flex-start;
  padding-top: 70px;
  padding-right: 20px;
}
.auth-modal.active{ display: flex; }

.auth-content{
  background: var(--modal-bg);
  color: var(--text-main);
  width: 320px;
  border-radius: 12px;
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-md);
}

.close-auth-btn{
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.auth-form h2{
  text-align: center;
  margin-bottom: 20px;
  font-size: 18px;
}

.input-group{ position: relative; margin-bottom: 12px; }

.input-icon-img{
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  filter: brightness(0);
  opacity: 0.75;
  display: block;
}
body.dark .input-icon-img{ filter: brightness(0) invert(1); opacity: 0.85; }

.auth-form input{
  width: 100%;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 12px 12px 40px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}
.auth-form input:focus{
  border-color: var(--primary);
  background: var(--modal-bg);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.auth-form input::placeholder{ color: var(--text-muted); opacity: 0.9; }

.auth-actions{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  margin-bottom: 15px;
}
.auth-actions.full-width{
  flex-direction: column;
  gap: 15px;
  align-items: stretch;
}

.checkbox-label{
  display: flex;
  align-items: center;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  padding-left: 24px;
  user-select: none;
  color: var(--text-muted);
}
.privacy-label{ align-items: flex-start; font-size: 11px; line-height: 1.3; }

.checkbox-label input{ position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }

.checkmark{
  position: absolute;
  top: 0;
  left: 0;
  height: 16px;
  width: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.checkbox-label input:checked ~ .checkmark{
  background-color: var(--primary);
  border-color: var(--primary);
}
.checkmark:after{
  content: "";
  position: absolute;
  display: none;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox-label input:checked ~ .checkmark:after{ display: block; }

.auth-submit-btn{
  background: var(--primary);
  color: var(--bg-page);
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: opacity 0.2s;
}
body.dark .auth-submit-btn{ color: #202124; }
.auth-submit-btn:hover{ opacity: 0.9; }

.green-full{ width: 100%; padding: 10px; }

.auth-footer{ text-align: center; font-size: 12px; color: var(--text-muted); }
.auth-footer a{ color: var(--primary); text-decoration: none; }
.auth-footer a:hover{ text-decoration: underline; }



/* --------------------------------------------------------------------------
   13) Пользовательские сайты 
   -------------------------------------------------------------------------- */
.add-user-site-btn{
  width: 100%;
  margin: 6px 0 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.add-user-site-btn:hover{
  border-color: var(--primary);
  background: var(--accent-light);
  transform: scale(1.01);
}
.add-user-site-icon{ width: 18px; height: 18px; }

.user-site-modal{ max-width: 420px; }
.user-site-form{ display: flex; flex-direction: column; gap: 14px; }

.user-site-label{
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.user-site-label input{
  width: 100%;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 12px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.user-site-label input:focus{ border-color: var(--primary); }

.user-site-actions{
  display:none;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}
.sidebar.edit-mode .user-site-actions{ display: flex; }

.mini-action-btn{
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-main);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.mini-action-btn:hover{
  transform: scale(1.08);
  border-color: var(--primary);
  background: var(--accent-light);
}
.mini-action-btn.danger{
  color: #ef4444;
}
.mini-action-btn.danger:hover{ background: #ef44441a; }
.mini-action-icon{
  width: 30px;  
  height: 30px;
  display: block;
  filter: brightness(0);
}

body.dark .mini-action-btn .mini-action-icon{
  filter: brightness(0) invert(1);
}

.mini-action-btn.danger .mini-action-icon{
  filter: brightness(0) saturate(100%) invert(24%) sepia(86%) 
          saturate(4547%) hue-rotate(346deg) brightness(97%) contrast(96%);
}

/* --------------------------------------------------------------------------
   14) Страница результатов (SERP)
   -------------------------------------------------------------------------- */
.results-page{
  padding-top: 10px;
  padding-bottom: 60px;
}

.results-page.container{
  width: 100%;
  max-width: none;
}

.results-header{
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 16px;
  margin: 0 0 12px 0;
}

.results-left-stack{
  width: min(700px, 100%);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.search-tabs{
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 4px 4px 0;
}

.search-tab{
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0 2px;
}

.search-tab:hover{ color: var(--primary); }

.search-tab.active{
  color: var(--text-main);
  font-weight: 600;
}

.search-tab.active::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}


.results-search{ margin: 0; }
.results-search .search-bar{ width: 100%; margin: 0; }

.results-icons{ margin-left: auto; flex-shrink: 0; }

.quick-access-right{
  justify-content: flex-end;
  max-width: none;
  margin: 0;
}

.results-quickline{
  max-width: 700px;
  margin: 12px 0 18px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-chip{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  background: transparent;
}
.quick-chip:hover{
  border-color: var(--primary);
  background: var(--accent-light);
  color: var(--primary);
}

.serp{
  max-width: 900px;
  margin: 0; 
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.serp-item{
  display: block;
  text-decoration: none;
  color: var(--text-main);
  padding: 8px 0;
}

.serp-top{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.serp-favicon{
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: block;
}

.serp-url{
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.serp-title{
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--primary);
}
.serp-item:hover .serp-title{ text-decoration: underline; }

.serp-snippet{
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-main);
  opacity: 0.92;
}

/* group (несколько результатов с одного домена) */
.serp-group-card{
  margin-top: 2px;
  margin-bottom: 2px;
}

.serp-item--group-head{
  padding-bottom: 2px;
}

.serp-group-toggle{
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  padding: 6px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.serp-group-toggle:hover{ text-decoration: underline; }

#serp-group-first{
  padding-left: 22px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.serp-group-items{
  margin-top: 6px;
  padding-left: 22px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.serp-group-items[hidden]{
  display: none !important;
}

.serp-item--compact{
  padding: 6px 0;
}

.serp-item--compact .serp-title{
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.serp-item--compact .serp-top{
  margin-bottom: 4px;
  gap: 8px;
}

.serp-item--compact .serp-url{
  font-size: 12px;
}

.serp-item--compact .serp-snippet{
  font-size: 13px;
}

.serp-hl{
  background: rgba(255, 235, 59, 0.35);
  color: inherit;
  padding: 0 2px;
  border-radius: 4px;
}

/*
  Подсветка совпадений теперь приходит с бэкенда через <b>...</b>.
  Стили делаем 1-в-1 как раньше у .serp-hl (mark).
*/

/*
.serp-title b,
.serp-snippet b{
  background: rgba(255, 235, 59, 0.35);
  color: inherit;
  padding: 0 2px;
  border-radius: 4px;
  font-weight: inherit;
}
*/

/* --------------------------------------------------------------------------
   15) Адаптивность (mobile & small screens)
   -------------------------------------------------------------------------- */


@media (hover: none) and (pointer: coarse) {
  .icon-btn:hover,
  .aux-icon-btn:hover,
  .tag-toggle:hover,
  .edit-services-bottom:hover {
    transform: none;
    background: transparent;
  }
  .icon-btn:active,
  .aux-icon-btn:active {
    transform: scale(0.96);
  }
}

@media (max-width: 900px){   .sidebar{
    top: 0;
    bottom: 0;
    right: -100%;
    width: 60vw;
    height: 80vh;
    border-radius: 20px;
    padding: 18px;
  }
  :root{ --header-height: 58px; }
  .container{ width: 100%; padding: 0 16px; }
  .logo{ margin: 70px auto 36px; }
  .main-logo{ max-width: 240px; }
  .slider-carousel{ max-width: 100%; border-radius: 14px; }
  .slide-card{ height: 240px; }
  .favorites-services{ max-width: 100%; }
  .serp{ max-width: 100%; }
}

@media (max-width: 600px){
    .results-header {
    position: relative;
    padding-top: 56px; 
  }
  .auth-modal{
    justify-content: center;
    align-items: center;
    padding: 0;
    background: var(--overlay-bg);
  }
  .results-icons {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: var(--header-height);
    background: var(--bg-page);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 12px;
    z-index: 1100;
  }
  .sidebar{
    top: 10px;
    bottom: 10px;
    height: calc(100vh - 20px);
    right: -100%;
    width: min(92vw, 360px);
    border-radius: 24px;     
    padding: 14px;
  }
  .sidebar.active{ right: 10px; }
  .services-list{
    grid-template-columns: repeat(2, 1fr);
    row-gap: 14px;
    column-gap: 10px;
  }

  .service-icon-box{
    width: 50px;  
    height: 50px;
    border-radius: 12px;
  }

  .service-icon-img{
    width: 26px;  
    height: 26px;
  }

  .service-title{
    font-size: 10px; 
    line-height: 1.1;
  }
  :root{ --header-height: 56px; }

  .top-container{ padding: 0 12px; }
  .right-icons{ gap: 10px; }
  .icon-btn{ width: 42px; height: 42px; }
  .ui-icon{ width: 34px; height: 34px; }
  .logo{ margin: 46px auto 24px; }
  .main-logo{ max-width: 200px; }
  .search-form{ max-width: 100%; }
  .search-bar{
    height: 48px;
    padding: 0 6px 0 14px;
    border-radius: 24px;
  }
  .search-logo-btn{ margin-right: 8px; }
  .search-w-logo{ height: 22px; }
  .search-bar input{ font-size: 16px; min-width: 0; }
  .search-actions .icon-btn{ width: 38px; height: 38px; }
  .search-actions .ui-icon{ width: 22px; height: 22px; }
  .quick-access-line{ max-width: 100%; padding: 0 2px; }
  .quick-panel-inline{ max-width: 100%; margin-right: 8px; gap: 8px; }
  .quick-tags a{ height: 34px; padding: 0 12px; font-size: 13px; }
  .favorites-services{
    max-width: 100%;
    margin-top: 22px;
    justify-content: flex-start;
    gap: 10px;
    padding: 6px;
  }
  .favorite-service{ width: 72px; padding: 8px 4px; }
  .favorite-service .service-icon-box{ width: 64px; height: 64px; border-radius: 16px; }
  .favorite-service .service-icon-img{ width: 36px; height: 36px; }
  .favorite-service .label{ font-size: 10px; }
  .slider-carousel{ margin: 0 auto 22px; }
  .slide-card{ height: 210px; }
  .slider-nav{ width: 44px; height: 44px; }
  .nav-icon{ width: 34px; height: 34px; }
  .sidebar{
    top: 0;
    bottom: 0;
    right: -100%;
    width: 60vw;
    height: 60vh;
    border-radius: 20px;
    padding: 18px;
  }
  .sidebar.active{ right: 0; }
  .services-list{ grid-template-columns: repeat(3, 1fr); row-gap: 16px; column-gap: 10px; }
  .service-icon-box{ width: 56px; height: 56px; border-radius: 14px; }
  .service-icon-img{ width: 30px; height: 30px; }
  .service-title{ font-size: 11px; }
  .modal-content{ width: min(92vw, 520px); padding: 18px; }
  .auth-content{ width: min(92vw, 420px); }
  .results-header{
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .results-icons{ margin-left: 0; justify-content: flex-end; }
  .search-tabs{
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    gap: 14px;
    white-space: nowrap;
  }
  .search-tab{ flex: 0 0 auto; }
  .serp{ gap: 16px; }
  .serp-title{ font-size: 16px; }
}
@media (max-width: 420px){
  .sidebar{
    top: 12px;
    bottom: 12px;
    right: -100%;
    width: 70vw;
    height: 60vh;
    border-radius: 22px;   
    padding: 14px;
  }
  .sidebar.active{
    right: 12px;
  }
  .services-list{
    grid-template-columns: repeat(2, 1fr);
    row-gap: 12px;
    column-gap: 10px;
  }
  .service-icon-box{
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }
  .service-icon-img{
    width: 26px;
    height: 26px;
  }
  .service-title{
    font-size: 10px;
    line-height: 1.1;
  }
}
@media (max-width: 600px){
  .sidebar{ bottom: auto; overflow: hidden; }
  .sidebar .services-list{ overflow: auto; }
}


:root{ --dock-width: 170px; --dock-left: var(--dock-left); --dock-gap: 0px; }

#dock-services.dock-services{
  position: static;
  width: 100%;
  max-width: 700px;       
  margin: 16px auto 0;      
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

#dock-services.dock-services.dock-fixed{
  position: fixed;
  left: 16px;
  top: calc(var(--header-height) + 16px);
  width: var(--dock-width);
  max-width: var(--dock-width);
  margin: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  z-index: 900;
}

#dock-services.dock-services.dock-fixed .favorite-service{ width: auto; padding: 6px 0; margin: 0; }
#dock-services.dock-services.dock-fixed .service-icon-box{ width: 56px; height: 56px; border-radius: 14px; }
#dock-services.dock-services.dock-fixed .service-icon-img{ width: 28px; height: 28px; }
#dock-services.dock-services.dock-fixed .label{ font-size: 10px; line-height: 1.1; }

