:root {
  --bg-main: #f5f5f7;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.8);
  --text-main: #1d1d1f;
  --text-muted: #86868b;
  --accent-blue: #0071e3;
  --accent-blue-hover: #0077ed;
  --danger-red: #ff3b30;
  --radius-lg: 22px;
  --radius-sm: 12px;
}

/* --- ПОДКЛЮЧЕНИЕ ЛОКАЛЬНЫХ ШРИФТОВ LATO --- */
@font-face {
  font-family: 'Lato';
  src: url('../fonts/Lato-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Lato';
  src: url('../fonts/Lato-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
}

@font-face {
  font-family: 'Lato';
  src: url('../fonts/Lato-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: 'Lato';
  src: url('../fonts/Lato-Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
}

/* --- БАЗОВЫЕ СТИЛИ СТРАНИЦЫ --- */
body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* --- ЦВЕТОВЫЕ ПЯТНА НА ФОНЕ (APPLE STYLE BLOBS) --- */
.ambient-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, #ff9a9e 0%, #fecfef 100%);
}

.blob-2 {
  top: 20%;
  right: -15%;
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle, #a1c4fd 0%, #c2e9fb 100%);
}

.blob-3 {
  bottom: -20%;
  left: 20%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, #e0c3fc 0%, #8ec5fc 100%);
}

/* --- ШАПКА В СТИЛЕ СТЕКЛА --- */
header {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(210, 210, 215, 0.4);
  padding: 12px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* --- ЛОГОТИП В ШАПКЕ --- */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.brand-logo:hover {
  opacity: 0.85;
}

.brand-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  padding-left: 12px;
  line-height: 1.2;
}

/* --- КРУПНЫЙ ПОИСК В ШАПКЕ --- */
.search-container {
  flex: 1;
  max-width: 520px;
  margin: 0 32px;
}

.search-input {
  width: 100%;
  padding: 12px 20px 12px 48px;
  font-size: 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 16px center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  outline: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-main);
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.search-input:focus {
  background-color: #ffffff;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18), 0 8px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.search-input::placeholder {
  color: #a1a1a6;
  font-weight: 400;
}

/* --- ОСНОВНОЙ КОНТЕЙНЕР --- */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 20px;
}

.dashboard-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 30px;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 40px 0 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- КАРТОЧКИ СЕРВИСОВ --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.08);
  border-color: rgba(255, 255, 255, 1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.card-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card h4 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 20px 0;
  line-height: 1.45;
  flex-grow: 1;
}

.card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
}

/* ---УНИВЕРСАЛЬНЫЕ КНОПКИ ПОРТАЛА И АДМИНКИ (ПРИНУДИТЕЛЬНЫЙ СБРОС СИСТЕМНЫХ СТИЛЕЙ) --- */
.btn,
button,
input[type="submit"],
input[type="button"],
.btn-primary {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px 20px !important;
  border-radius: 980px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  border: none !important;
  outline: none !important;
  box-sizing: border-box !important;
  line-height: 1.2 !important;
  box-shadow: none !important;
}

/* Синие основные кнопки */
.btn-primary,
button.btn-primary,
input[type="submit"].btn-primary,
button[type="submit"] {
  background-color: var(--accent-blue) !important;
  color: #ffffff !important;
}

.btn-primary:hover,
button.btn-primary:hover,
input[type="submit"].btn-primary:hover,
button[type="submit"]:hover {
  background-color: var(--accent-blue-hover) !important;
  color: #ffffff !important;
}

.btn-primary:active,
button[type="submit"]:active {
  transform: scale(0.97) !important;
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.05) !important;
  color: var(--text-main) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.1) !important;
}

/* Кнопка «На главную» */
.btn-secondary-gray {
  background: var(--text-muted) !important;
  color: #ffffff !important;
  padding: 8px 16px !important;
}

.btn-secondary-gray:hover {
  background: #6e6e73 !important;
  color: #ffffff !important;
}

/* --- КРАСИВЫЕ КНОПКИ ВЫБОРА ФАЙЛОВ --- */
input[type="file"]::file-selector-button {
  -webkit-appearance: none;
  appearance: none;
  background: #e8e8ed;
  color: var(--text-main);
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  margin-right: 10px;
  transition: background 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
  background: #d2d2d7;
}

/* --- ПОЛЯ ВВОДА В ФОРМАХ (БЕЗ ЛУПЫ) --- */
.form-input-clean,
input.form-input-clean,
input[type="text"].form-input-clean,
input[type="password"].form-input-clean,
textarea.form-input-clean {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 100% !important;
  padding: 10px 14px !important;
  padding-left: 14px !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  background-color: #ffffff !important;
  background-image: none !important;
  font-size: 0.9rem !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
  outline: none !important;
  text-indent: 0 !important;
}

.form-input-clean:focus,
input.form-input-clean:focus,
input[type="text"].form-input-clean:focus,
input[type="password"].form-input-clean:focus,
textarea.form-input-clean:focus {
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15) !important;
}

/* --- ВЕБ-ЭЛЕМЕНТЫ ВАКЛАДОК --- */
.tab-btn {
  background: transparent !important;
  border: none !important;
  padding: 8px 18px !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-family: inherit !important;
}

.tab-btn:hover {
  color: var(--text-main) !important;
  background: rgba(0, 0, 0, 0.04) !important;
}

.tab-btn.active {
  background: var(--accent-blue) !important;
  color: #ffffff !important;
}