diff --git a/ai_core/image_generator.py b/ai_core/image_generator.py index 78f18f9..d607e8c 100644 --- a/ai_core/image_generator.py +++ b/ai_core/image_generator.py @@ -3,6 +3,8 @@ import struct import requests +from ai_core.net_safety import public_url_error + from config import PIAPI_API_KEY, PIAPI_IMAGE_MODEL, get_proxies PIAPI_IMAGE_URL = "https://api.piapi.ai/v1/images/generations" @@ -253,7 +255,11 @@ class ImageGenerator: if item.get("b64_json"): return base64.b64decode(item["b64_json"]) if item.get("url"): - img_response = requests.get(item["url"], proxies=self.proxies, timeout=120) + # Ссылку прислал провайдер (возможно, «свой») — скачиваем только из публичного интернета, без редиректов + url_error = public_url_error(item["url"], allow_http=True) + if url_error: + raise RuntimeError(f"Провайдер вернул недопустимую ссылку на картинку: {url_error}") + img_response = requests.get(item["url"], proxies=self.proxies, timeout=120, allow_redirects=False) img_response.raise_for_status() return img_response.content diff --git a/ai_core/net_safety.py b/ai_core/net_safety.py new file mode 100644 index 0000000..f1bf095 --- /dev/null +++ b/ai_core/net_safety.py @@ -0,0 +1,32 @@ +"""Проверка адресов, к которым сервер ходит по указанию пользователя (свой ИИ-провайдер, ссылки на картинки). +Без неё через «свой провайдер» можно заставить сервер обратиться во внутреннюю сеть (SSRF).""" +import ipaddress +import socket +from urllib.parse import urlparse + + +def public_url_error(url: str, allow_http: bool = False): + """None — адрес публичный и допустимый, иначе текст ошибки для пользователя.""" + try: + parsed = urlparse((url or "").strip()) + except ValueError: + return "Некорректный адрес." + schemes = ("https", "http") if allow_http else ("https",) + if parsed.scheme not in schemes: + return "Адрес должен начинаться с https://." + host = parsed.hostname + if not host: + return "В адресе нет домена." + try: + infos = socket.getaddrinfo(host, parsed.port or 443, proto=socket.IPPROTO_TCP) + except (socket.gaierror, UnicodeError): + return f"Домен {host} не найден." + for info in infos: + ip = ipaddress.ip_address(info[4][0].split("%")[0]) + if not ip.is_global or ip.is_multicast: + return f"Адрес {host} ведёт во внутреннюю сеть — такие адреса запрещены." + return None + + +def is_public_url(url: str) -> bool: + return public_url_error(url) is None diff --git a/ai_core/neural_network.py b/ai_core/neural_network.py index b70c2a2..50531a8 100644 --- a/ai_core/neural_network.py +++ b/ai_core/neural_network.py @@ -44,7 +44,7 @@ class ContentGenerator: self.chat_url = PIAPI_URL self.model = PIAPI_MODEL self.provider_type = "piapi" - self.proxies = get_proxies() + self.proxies = get_proxies() # Шаблоны для запасного варианта (если PiAPI не работает) self.templates = { 'instagram': [ @@ -161,7 +161,7 @@ class ContentGenerator: 'linkedin': 'LinkedIn', 'telegram': 'Telegram', 'twitter': 'Twitter/X', - 'ad': 'рекламный пост', + 'ad': 'рекламный пост', 'tenchat': 'TenChat' } @@ -218,7 +218,7 @@ class ContentGenerator: 'linkedin': 'LinkedIn', 'telegram': 'Telegram', 'twitter': 'Twitter/X', - 'ad': 'рекламный пост', + 'ad': 'рекламный пост', 'tenchat': 'TenChat' } @@ -312,7 +312,7 @@ class ContentGenerator: 'linkedin': 'LinkedIn', 'telegram': 'Telegram', 'twitter': 'Twitter/X', - 'ad': 'рекламный пост', + 'ad': 'рекламный пост', 'tenchat': 'TenChat' } @@ -494,8 +494,8 @@ class ContentGenerator: except Exception as e: print(f"⚠️ Ошибка API при модификации: {e}") - # Если ИИ не сработал — возвращаем оригинал с пометкой - return f"{original_post}\n\n💬 [ИИ не смог изменить пост: {instruction}]" + # ИИ не ответил — пост не трогаем: ошибка уходит в задачу, интерфейс покажет её и предложит повторить + raise RuntimeError("ИИ не смог изменить пост. Проверьте настройки провайдера в разделе «ИИ» и повторите.") def _generate_template_brand_post(self, brand_data, platform, wishes): """Простой пост из медиа-образа без обращения к ИИ (запасной вариант).""" diff --git a/ai_core/telegram_publisher.py b/ai_core/telegram_publisher.py index eb18827..1a0976e 100644 --- a/ai_core/telegram_publisher.py +++ b/ai_core/telegram_publisher.py @@ -48,6 +48,12 @@ def _md_to_html(text: str) -> str: return text +def _scrub(err) -> str: + """Текст ошибки без токена бота: requests кладёт полный URL запроса (с токеном) в исключение.""" + text = str(err) + return text.replace(TOKEN, "") if TOKEN else text + + def _api_call(method, params): """Вызывает Telegram Bot API метод. Возвращает (ok, result_or_error).""" try: @@ -62,7 +68,7 @@ def _api_call(method, params): return True, data.get("result", {}) return False, data.get("description", "Неизвестная ошибка") except Exception as e: - return False, str(e) + return False, _scrub(e) def resolve_chat(username_or_id): @@ -83,12 +89,14 @@ def resolve_chat(username_or_id): chat_type = result.get("type", "unknown") title = result.get("title") or result.get("first_name", "") or result.get("username", "") username = result.get("username", "") + description = result.get("description", "") or "" return { "chat_id": chat_id, "title": title, "username": username, "type": chat_type, + "description": description, } @@ -183,4 +191,4 @@ def _api_call_send_photo(chat_id, image_bytes, caption): return True, data.get("result", {}) except Exception as e: - return False, str(e) + return False, _scrub(e) diff --git a/cabinet_service/app.py b/cabinet_service/app.py index caa472f..9c611cc 100644 --- a/cabinet_service/app.py +++ b/cabinet_service/app.py @@ -2,8 +2,8 @@ from pathlib import Path import json import os import re -import threading import uuid +from concurrent.futures import ThreadPoolExecutor import bcrypt from fastapi import Depends, FastAPI, Form, HTTPException, Query, Request @@ -13,6 +13,7 @@ from fastapi.templating import Jinja2Templates from starlette.middleware.sessions import SessionMiddleware from ai_core.image_generator import IMAGE_SIZES, IMAGE_TEMPLATES, STYLE_PRESETS, ImageGenerator, detect_ext, get_sizes_for_model +from ai_core.net_safety import public_url_error from ai_core.neural_network import ContentGenerator from ai_core.social_analyzer import analyze_posts_with_ai, detect_platform, fetch_telegram_posts from ai_core.telegram_publisher import ( @@ -25,7 +26,9 @@ from cabinet_service.brand_doc_generator import generate_brand_docx from config import SECRET_KEY from database import ( add_post_revision, + count_user_tasks, create_task, + fail_unfinished_tasks, create_web_user, delete_brand_survey, delete_channel, @@ -79,14 +82,165 @@ MEDIA_DIR = BASE_DIR / "media" MEDIA_DIR.mkdir(exist_ok=True) app = FastAPI(title="Личный кабинет") -app.add_middleware(SessionMiddleware, secret_key=SECRET_KEY) +# На сервере с https задайте SESSION_COOKIE_SECURE=1 в .env — cookie сессии не уйдёт по http +app.add_middleware(SessionMiddleware, secret_key=SECRET_KEY, same_site="lax", + https_only=os.getenv("SESSION_COOKIE_SECURE", "0") == "1", + max_age=14 * 24 * 3600) + +_UNSAFE_METHODS = {"POST", "PUT", "PATCH", "DELETE"} + + +@app.middleware("http") +async def security_middleware(request: Request, call_next): + # CSRF: изменяющий запрос браузера должен прийти с нашего же сайта. Браузер всегда шлёт Origin + # (или хотя бы Referer) у POST-форм и fetch, подделать их со стороннего сайта нельзя. + if request.method in _UNSAFE_METHODS: + source = request.headers.get("origin") or request.headers.get("referer") + if source: + from urllib.parse import urlparse + # Origin: null шлют песочницы iframe и file:// — тоже чужой источник + if source == "null" or urlparse(source).netloc != request.headers.get("host", ""): + return JSONResponse({"error": "Запрос отклонён: он пришёл с другого сайта."}, status_code=403) + response = await call_next(request) + response.headers.setdefault("X-Content-Type-Options", "nosniff") + response.headers.setdefault("X-Frame-Options", "DENY") + response.headers.setdefault("Referrer-Policy", "strict-origin-when-cross-origin") + if request.headers.get("x-forwarded-proto") == "https" or request.url.scheme == "https": + response.headers.setdefault("Strict-Transport-Security", "max-age=31536000") + return response app.mount("/static", StaticFiles(directory=str(BASE_DIR / "static")), name="static") app.mount("/media", StaticFiles(directory=str(MEDIA_DIR)), name="media") templates = Jinja2Templates(directory=str(BASE_DIR / "templates")) + +def plural(n, forms): + """Склонение по числу: plural(3, ['день', 'дня', 'дней']) -> 'дня'.""" + n = abs(int(n or 0)) + a, b = n % 100, n % 10 + if 10 < a < 20: + return forms[2] + if 1 < b < 5: + return forms[1] + if b == 1: + return forms[0] + return forms[2] + + +_PATRONYMIC_ENDINGS = ("вич", "вна", "чна", "ична", "инична", "оглы", "кызы") +_SURNAME_ENDINGS = ("ов", "ова", "ев", "ева", "ёв", "ёва", "ин", "ина", "ын", "ына", "ский", "ская", "цкий", "цкая", + "ской", "енко", "ук", "юк", "чук", "ых", "их", "ко") +# Частые имена: окончания вроде «-ина» есть и у имён (Ирина), и у фамилий (Котина), поэтому сначала — словарь +_FIRST_NAMES = set(""" +александр алексей анатолий андрей антон аркадий арсений артём артем артур богдан борис вадим валентин валерий василий +виктор виталий владимир владислав всеволод вячеслав геннадий георгий герман глеб григорий давид даниил данил денис +дмитрий евгений егор захар иван игнат игорь илья кирилл константин лев леонид максим марк матвей михаил назар никита +николай олег павел пётр петр платон роман ростислав руслан савелий семён семен сергей станислав степан тимофей тимур +фёдор федор филипп эдуард юрий ян ярослав рашид рустам тарас остап богдан мирон +александра алина алиса алла анастасия ангелина анна антонина арина валентина валерия варвара вера вероника виктория +галина дарья диана ева евгения екатерина елена елизавета жанна зарина зинаида злата инна ирина карина кира кристина +ксения лариса лидия лилия любовь людмила маргарита марина мария милана надежда наталья наталия нина оксана олеся ольга +полина раиса регина светлана софия софья стефания таисия тамара татьяна ульяна элина эльвира юлия яна ярослава +саша шура лёша леша дима женя ваня вова володя коля костя миша паша петя серёжа сережа слава толя юра +аня валя варя галя даша катя ксюша лена лиза люба люда маша надя наташа оля поля света соня таня юля +""".split()) + + +def first_name(full_name): + """Имя для обращения из поля «Имя»: «Котова Ирина Сергеевна» → «Ирина», «Анна Тестова» → «Анна». + В обращении имя стоит в именительном падеже, склонять его не нужно. В поле вписано название + организации (есть кавычки) — имени нет, обращение без имени.""" + raw = str(full_name or "") + if any(q in raw for q in "«»\"„“"): + return "" + words = [w for w in raw.replace(",", " ").split() if w.replace("-", "").isalpha()] + if not words: + return "" + low = [w.lower() for w in words] + + def cap(w): + return "-".join(p[:1].upper() + p[1:].lower() for p in w.split("-")) + # Слово из словаря имён — оно и есть имя + for i, w in enumerate(low): + if w in _FIRST_NAMES or w.split("-")[0] in _FIRST_NAMES: + return cap(words[i]) + # Есть отчество — имя стоит перед ним + for i, w in enumerate(low): + if i > 0 and w.endswith(_PATRONYMIC_ENDINGS): + return cap(words[i - 1]) + # Первое слово похоже на фамилию, второе — нет: «Котова Ирина» + if len(words) >= 2 and low[0].endswith(_SURNAME_ENDINGS) and not low[1].endswith(_SURNAME_ENDINGS): + return cap(words[1]) + return cap(words[0]) + + +def greeting_for_hour(hour=None): + """Приветствие по времени суток: утро 5–11, день 11–17, вечер 17–23, ночь 23–5. + Без аргумента — по часам сервера; на странице скрипт уточняет по часам пользователя.""" + if hour is None: + from datetime import datetime + hour = datetime.now().hour + if 5 <= hour < 11: + return "Доброе утро" + if 11 <= hour < 17: + return "Добрый день" + if 17 <= hour < 23: + return "Добрый вечер" + return "Доброй ночи" + + +# SQLite хранит CURRENT_TIMESTAMP в UTC; показываем по Москве (DISPLAY_TZ_OFFSET — смещение в часах) +DISPLAY_TZ_OFFSET = int(os.getenv("DISPLAY_TZ_OFFSET", "3")) + + +def local_dt(value, fmt="%d.%m.%Y %H:%M"): + """«2026-10-28 10:49:12» (UTC) → «28.10.2026 13:49». Непонятное значение возвращается как есть.""" + from datetime import datetime, timedelta + raw = str(value or "") + try: + dt = datetime.strptime(raw[:19], "%Y-%m-%d %H:%M:%S") + except ValueError: + return raw + return (dt + timedelta(hours=DISPLAY_TZ_OFFSET)).strftime(fmt) + + +templates.env.filters["local_dt"] = local_dt +templates.env.filters["first_name"] = first_name +templates.env.globals["greeting_for_hour"] = greeting_for_hour + +# Компоненты дизайн-системы (иконки, логотип) доступны во всех шаблонах как ui.* +templates.env.globals["plural"] = plural +# Числа с неразрывным пробелом между разрядами: 4096 -> «4 096» +templates.env.filters["num"] = lambda n: "{:,}".format(int(n or 0)).replace(",", " ") +templates.env.globals["ui"] = templates.env.get_template("_ui.html").module + content_gen = ContentGenerator() image_gen = ImageGenerator() +# Фоновые задачи (генерации через ИИ) — общий пул потоков вместо потока на каждый запрос: +# сколько бы задач ни пришло, одновременно к провайдеру идут не больше TASK_WORKERS. +TASK_WORKERS = int(os.getenv("TASK_WORKERS", "4")) +TASK_ACTIVE_LIMIT = int(os.getenv("TASK_ACTIVE_LIMIT", "2")) # незавершённых задач на пользователя +TASK_HOURLY_LIMIT = int(os.getenv("TASK_HOURLY_LIMIT", "60")) # задач на пользователя в час +task_pool = ThreadPoolExecutor(max_workers=TASK_WORKERS, thread_name_prefix="task") +fail_unfinished_tasks() + +# Загрузка картинок: только настоящие изображения и не больше 10 МБ +MAX_IMAGE_BYTES = 10 * 1024 * 1024 + + +def is_image(data: bytes) -> bool: + """PNG, JPEG, WebP или GIF по сигнатуре файла — расширению и MIME из браузера не доверяем.""" + return (data[:8] == b"\x89PNG\r\n\x1a\n" or data[:3] == b"\xff\xd8\xff" + or (data[:4] == b"RIFF" and data[8:12] == b"WEBP") or data[:4] == b"GIF8") + + +def to_int(value, default=None): + """int из поля формы или query; мусор — default, а не 500.""" + try: + return int(str(value).strip()) + except (TypeError, ValueError): + return default + def get_user_content_gen(user: dict) -> ContentGenerator: """Возвращает ContentGenerator с настройками text-провайдера пользователя.""" @@ -145,6 +299,9 @@ def flash(request: Request, message: str): def render(request: Request, template: str, status_code: int = 200, **context): context.setdefault("user", None) context["flash_message"] = request.session.pop("flash", None) + # Активный медиа-образ — для карточки внизу боковой навигации + if context["user"] and "active_persona" not in context: + context["active_persona"] = get_latest_brand_survey_for_user(context["user"]["id"]) return templates.TemplateResponse(request, template, context, status_code=status_code) @@ -161,14 +318,21 @@ def health(): @app.get("/") def root(request: Request): - # Посадочная страница с описанием сервиса - return render(request, "landing.html") + if request.session.get("user_id"): + return RedirectResponse("/dashboard", status_code=303) + return RedirectResponse("/login", status_code=303) -@app.get("/presentation-tz") -def presentation_tz(request: Request): - # Техническое задание на создание презентации сервиса - return render(request, "presentation_tz.html") +@app.get("/presentation.{ext}") +def presentation_file(ext: str): + # Готовая презентация лежит в корне проекта (её собирает deploy/generate_presentation.py) + if ext not in ("pdf", "pptx"): + raise HTTPException(status_code=404) + path = BASE_DIR.parent / f"ИИ_Пресс-секретарь_презентация.{ext}" + if not path.exists(): + raise HTTPException(status_code=404, detail="Презентация ещё не собрана") + from fastapi.responses import FileResponse + return FileResponse(path, filename=path.name) # === РЕГИСТРАЦИЯ === @@ -193,6 +357,8 @@ def register_submit( errors = [] if len(password) < 8: errors.append("Пароль должен быть не короче 8 символов.") + if len(password.encode("utf-8")) > 72: + errors.append("Пароль слишком длинный: не больше 72 байт (около 36 русских или 72 латинских символов).") if password != password_confirm: errors.append("Пароли не совпадают.") if "@" not in email or "." not in email.split("@")[-1]: @@ -210,8 +376,8 @@ def register_submit( password_hash = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt()).decode("utf-8") user_id = create_web_user(email, password_hash, name, phone) request.session["user_id"] = user_id - flash(request, "Регистрация завершена! Добро пожаловать.") - return RedirectResponse("/dashboard", status_code=303) + flash(request, "Регистрация завершена. Начните с медиа-образа — посты пишутся на его основе.") + return RedirectResponse("/survey", status_code=303) # === ВХОД / ВЫХОД === @@ -230,6 +396,7 @@ def login_submit(request: Request, email: str = Form(...), password: str = Form( valid = ( user is not None and user["password_hash"] + and len(password.encode("utf-8")) <= 72 and bcrypt.checkpw(password.encode("utf-8"), user["password_hash"].encode("utf-8")) ) if not valid: @@ -253,7 +420,19 @@ def logout(request: Request): @app.get("/dashboard") def dashboard(request: Request, user: dict = Depends(current_user)): latest_survey = get_latest_brand_survey_for_user(user["id"]) - return render(request, "dashboard.html", user=user, latest_survey=latest_survey) + recent_posts = get_posts_for_user(user["id"], limit=3) + for p in recent_posts: + p["images"] = get_post_images(p["id"], user["id"]) + all_posts = get_posts_for_user(user["id"], limit=10000) + counters = { + "posts": len(all_posts), + "images": len(get_media_for_user(user["id"], limit=10000)), + "published": sum(1 for p in all_posts if p.get("published")), + "surveys": len(get_brand_surveys_for_user(user["id"])), + } + return render(request, "dashboard.html", user=user, latest_survey=latest_survey, + active_persona=latest_survey, recent_posts=recent_posts, + counters=counters, platform_label=platform_label) @app.get("/profile/edit") @@ -321,6 +500,12 @@ def provider_submit( errors.append("Укажите API ключ для провайдера изображений или выберите «Использовать глобальные настройки».") if not image_use_global and image_provider_type == "custom" and not image_base_url.strip(): errors.append("Для кастомного image-провайдера укажите Base URL.") + # Свой адрес провайдера — только публичный https: сервер отправляет на него запросы и показывает ответ + for label, use_global, base in (("текстового", text_use_global, text_base_url), ("image-", image_use_global, image_base_url)): + if not use_global and base.strip(): + url_error = public_url_error(base) + if url_error: + errors.append(f"Base URL {label}провайдера: {url_error}") if not image_preset.get("supports_images", True) and not image_use_global: errors.append(f"Провайдер «{image_preset.get('name')}» не поддерживает генерацию изображений. Выберите другой.") @@ -571,12 +756,13 @@ async def post_image_upload(request: Request, post_id: int, user: dict = Depends flash(request, "Выберите файлы для загрузки.") return RedirectResponse(f"/posts/{post_id}", status_code=303) - uploaded = 0 + uploaded = skipped = 0 for upload in files: if not upload or not upload.filename: continue - raw = await upload.read() - if not raw: + raw = await upload.read(MAX_IMAGE_BYTES + 1) + if not raw or len(raw) > MAX_IMAGE_BYTES or not is_image(raw): + skipped += 1 continue ext = detect_ext(raw) filename = f"{uuid.uuid4().hex}{ext}" @@ -584,10 +770,11 @@ async def post_image_upload(request: Request, post_id: int, user: dict = Depends save_post_image(post_id, user["id"], filename, source="upload") uploaded += 1 + note = f" Пропущено файлов: {skipped} — нужны JPG, PNG, WebP или GIF до 10 МБ." if skipped else "" if uploaded: - flash(request, f"Загружено изображений: {uploaded}") + flash(request, f"Загружено изображений: {uploaded}.{note}") else: - flash(request, "Не удалось загрузить изображения.") + flash(request, "Не удалось загрузить изображения." + note) return RedirectResponse(f"/posts/{post_id}", status_code=303) @@ -642,8 +829,8 @@ def plan_form(request: Request, user: dict = Depends(current_user)): @app.post("/plan") -def plan_submit(request: Request, days: int = Form(7), user: dict = Depends(current_user)): - days = max(1, min(days, 14)) +def plan_submit(request: Request, days: str = Form("7"), user: dict = Depends(current_user)): + days = max(1, min(to_int(days, 7), 14)) user_gen = get_user_content_gen(user) latest = get_latest_brand_survey_for_user(user["id"]) if latest: @@ -664,8 +851,8 @@ def plan_status_submit( user: dict = Depends(current_user), ): try: - update_plan_status(user["id"], item_id, status) - flash(request, "Статус пункта обновлён.") + found = update_plan_status(user["id"], item_id, status) + flash(request, "Статус пункта обновлён." if found else "Пункт плана не найден.") except ValueError: flash(request, "Недопустимый статус.") return RedirectResponse("/plan", status_code=303) @@ -673,8 +860,8 @@ def plan_status_submit( @app.post("/plan/{item_id}/delete") def plan_item_delete(request: Request, item_id: int, user: dict = Depends(current_user)): - delete_plan_item(user["id"], item_id) - flash(request, "Пункт плана удалён.") + found = delete_plan_item(user["id"], item_id) + flash(request, "Пункт плана удалён." if found else "Пункт плана не найден.") return RedirectResponse("/plan", status_code=303) @@ -694,7 +881,10 @@ def delete_account_submit( ): if confirm != "yes": return RedirectResponse("/dashboard", status_code=303) - delete_user_by_id(user["id"]) + for filename in delete_user_by_id(user["id"]): + fp = MEDIA_DIR / filename + if fp.exists(): + fp.unlink() request.session.clear() return RedirectResponse("/login", status_code=303) @@ -740,9 +930,9 @@ def image_generate_submit( if not prompt: return render( request, "image_generate.html", status_code=400, - user=user, sizes=sizes, styles=STYLE_PRESETS, + user=user, sizes=sizes, styles=STYLE_PRESETS, templates=IMAGE_TEMPLATES, form={"prompt": prompt, "size": size, "style": style}, - errors=["Опиши, что нужно нарисовать."], + errors=["Опишите, что нужно нарисовать."], ) user_img_gen = get_user_image_gen(user) @@ -752,7 +942,7 @@ def image_generate_submit( except Exception as e: return render( request, "image_generate.html", status_code=502, - user=user, sizes=sizes, styles=STYLE_PRESETS, + user=user, sizes=sizes, styles=STYLE_PRESETS, templates=IMAGE_TEMPLATES, form={"prompt": prompt, "size": size, "style": style}, errors=[f"Ошибка генерации картинки: {e}"], ) @@ -824,10 +1014,10 @@ async def survey_import_submit(request: Request, user: dict = Depends(current_us ) # Поддерживаем два формата: {"data": {...}, "title": "..."} или просто {...} if isinstance(data, dict) and "data" in data and isinstance(data["data"], dict): - title = (data.get("title") or "Импортированный образ").strip()[:200] + title = str(data.get("title") or "Импортированный образ").strip()[:200] survey_data = data["data"] elif isinstance(data, dict): - title = (data.get("client_name") or data.get("title") or "Импортированный образ").strip()[:200] + title = str(data.get("client_name") or data.get("title") or "Импортированный образ").strip()[:200] survey_data = data else: return render( @@ -879,7 +1069,7 @@ async def survey_import_submit(request: Request, user: dict = Depends(current_us errors=["Не удалось разобрать документ. Проверьте, что PiAPI ключ настроен, и попробуйте снова."], ) - title = (survey_data.get("client_name") or "Импортированный образ").strip()[:200] + title = str(survey_data.get("client_name") or "Импортированный образ").strip()[:200] survey_id = save_brand_survey(user["id"], title, survey_data) flash(request, f"Медиа-образ «{title}» импортирован из .docx.") return RedirectResponse(f"/surveys/{survey_id}", status_code=303) @@ -892,8 +1082,13 @@ async def survey_import_submit(request: Request, user: dict = Depends(current_us @app.post("/survey/submit") async def survey_submit(request: Request, user: dict = Depends(current_user)): - body = await request.json() - title = (body.get("title") or "Без названия").strip()[:200] + try: + body = await request.json() + except ValueError: + body = None + if not isinstance(body, dict) or not isinstance(body.get("data") or {}, dict): + return JSONResponse({"ok": False, "error": "Некорректные данные анкеты."}, status_code=400) + title = str(body.get("title") or "Без названия").strip()[:200] or "Без названия" data = body.get("data") or {} survey_id = save_brand_survey(user["id"], title, data) return {"id": survey_id, "ok": True} @@ -993,9 +1188,37 @@ def channel_add_submit( form={"chat_input": chat_input}, ) - # 4. Сохраняем - save_channel(user["id"], chat_id, title, username, chat_type) - flash(request, f"Канал «{title}» добавлен.") + # 4. Бот общий, поэтому «бот — админ» не доказывает, что канал ваш. + # Владелец подтверждает канал кодом в его описании: менять описание могут только админы канала. + pending = {"chat_id": chat_id, "title": title, "username": username, "type": chat_type, + "code": "press-" + uuid.uuid4().hex[:8]} + request.session["channel_verify"] = pending + return render(request, "channel_add.html", user=user, verify=pending) + + +@app.post("/channels/verify") +def channel_verify_submit(request: Request, user: dict = Depends(current_user)): + pending = request.session.get("channel_verify") + if not pending: + flash(request, "Проверка устарела. Добавьте канал ещё раз.") + return RedirectResponse("/channels/add", status_code=303) + + info = resolve_chat(str(pending["chat_id"])) + if "error" in info: + return render(request, "channel_add.html", status_code=400, user=user, verify=pending, + errors=[f"Не удалось проверить канал: {info['error']}"]) + if pending["code"] not in (info.get("description") or ""): + return render(request, "channel_add.html", status_code=400, user=user, verify=pending, + errors=["Код не найден в описании канала. Сохраните описание в Telegram и проверьте ещё раз."]) + is_admin, admin_error = check_bot_is_admin(pending["chat_id"]) + if not is_admin: + return render(request, "channel_add.html", status_code=400, user=user, verify=pending, + errors=[admin_error or "Бот не админ в этом чате."]) + + request.session.pop("channel_verify", None) + if not is_channel_already_added(user["id"], pending["chat_id"]): + save_channel(user["id"], pending["chat_id"], info["title"], info["username"], info["type"]) + flash(request, f"Канал «{info['title']}» подключён. Код из описания можно удалить.") return RedirectResponse("/channels", status_code=303) @@ -1121,12 +1344,7 @@ def _run_post_generation(task_id, user_id, platform, style, wishes, survey_id, p gen = ContentGenerator(provider_settings=settings) if settings and settings.get("api_key") else content_gen content = gen.generate_post_from_brand_profile(brand_data, platform, style, wishes) post_id = save_post_for_user(user_id, platform, content, style, wishes) - # Если пост создан из плана — ставим статус «опубликовано» - if plan_id: - try: - update_plan_status(user_id, int(plan_id), "published") - except (ValueError, Exception) as e: - print(f"⚠️ Не удалось обновить статус плана {plan_id}: {e}") + # Пост из плана — пока только черновик: «Опубликовано» пункт получает вручную в плане update_task_status(task_id, 'done', result_json=json.dumps({"post_id": post_id, "content": content})) except Exception as e: update_task_status(task_id, 'error', error=str(e)) @@ -1204,7 +1422,7 @@ def _run_social_analysis(task_id, user_id, url, manual_posts): if not posts: update_task_status(task_id, 'error', - error="Не удалось загрузить посты. Для VK и Tenchat вставьте тексты постов вручную (по 2+ постов через пустую строку).") + error="Не удалось загрузить посты. Для VK и TenChat вставьте тексты постов вручную (по 2+ постов через пустую строку).") return # AI-анализ @@ -1320,86 +1538,80 @@ def _run_post_image_generation(task_id, user_id, post_id, template_key=None, cus update_task_status(task_id, 'error', error=str(e)) +TASK_TYPES = { + "generate_post", "generate_plan", "generate_image", "generate_post_image", "analyze_post_image", + "generate_post_image_with_concept", "analyze_social_profile", "modify_post", +} +POST_TASKS = {"generate_post_image", "analyze_post_image", "generate_post_image_with_concept", "modify_post"} + + +def _task_error(message, status_code=400): + return JSONResponse({"error": message}, status_code=status_code) + + @app.post("/api/tasks") async def api_start_task(request: Request, user: dict = Depends(current_user)): """Запускает фоновую задачу. Возвращает task_id.""" uid = user["id"] form = await request.form() task_type_val = form.get("task_type", "") - task_id = create_task(uid, task_type_val) + if task_type_val not in TASK_TYPES: + return _task_error("Неизвестный тип задачи.") + + # Лимиты: каждая задача — платный запрос к ИИ через общий ключ + if count_user_tasks(uid, 15, active_only=True) >= TASK_ACTIVE_LIMIT: + return _task_error("Дождитесь окончания текущих генераций и повторите.", 429) + if count_user_tasks(uid, 60) >= TASK_HOURLY_LIMIT: + return _task_error("Достигнут лимит генераций на этот час. Повторите позже.", 429) + + post_id = None + if task_type_val in POST_TASKS: + post_id = to_int(form.get("post_id")) + if not post_id or not get_post_by_id_for_user(post_id, uid): + return _task_error("Пост не найден.", 404) if task_type_val == "generate_post": - platform = form.get("platform", "telegram") - style = form.get("style", "") - wishes = form.get("wishes", "") - survey_id = form.get("survey_id", "") - plan_id = form.get("plan_id", "") or None - t = threading.Thread(target=_run_post_generation, args=(task_id, uid, platform, style, wishes, survey_id, plan_id), daemon=True) - t.start() + job = (_run_post_generation, form.get("platform", "telegram"), form.get("style", ""), + form.get("wishes", ""), to_int(form.get("survey_id")), form.get("plan_id", "") or None) elif task_type_val == "generate_plan": - days = int(form.get("days", 7)) - days = max(1, min(days, 14)) - t = threading.Thread(target=_run_plan_generation, args=(task_id, uid, days), daemon=True) - t.start() + days = max(1, min(to_int(form.get("days"), 7), 14)) + job = (_run_plan_generation, days) elif task_type_val == "generate_image": - prompt = form.get("prompt", "") - size = form.get("size", "square") - style = form.get("style", "none") ref_file = form.get("reference_image") ref_bytes = None if ref_file and hasattr(ref_file, "read"): - ref_bytes = await ref_file.read() + ref_bytes = await ref_file.read(MAX_IMAGE_BYTES + 1) if len(ref_bytes) < 100: - ref_bytes = None # слишком маленький, пропускаем - t = threading.Thread(target=_run_image_generation, args=(task_id, uid, prompt, size, style, ref_bytes), daemon=True) - t.start() + ref_bytes = None # пустой файл — генерируем без образца + elif len(ref_bytes) > MAX_IMAGE_BYTES or not is_image(ref_bytes): + return _task_error("Образец должен быть картинкой JPG, PNG, WebP или GIF до 10 МБ.") + job = (_run_image_generation, form.get("prompt", ""), form.get("size", "square"), + form.get("style", "none"), ref_bytes) elif task_type_val == "generate_post_image": - post_id = int(form.get("post_id", 0)) - template_key = form.get("template_key", "") or None - t = threading.Thread(target=_run_post_image_generation, args=(task_id, uid, post_id, template_key), daemon=True) - t.start() + job = (_run_post_image_generation, post_id, form.get("template_key", "") or None) elif task_type_val == "analyze_post_image": - post_id = int(form.get("post_id", 0)) - t = threading.Thread(target=_run_analyze_post_image, args=(task_id, uid, post_id), daemon=True) - t.start() + job = (_run_analyze_post_image, post_id) elif task_type_val == "generate_post_image_with_concept": - post_id = int(form.get("post_id", 0)) - concept_prompt = form.get("concept_prompt", "") - concept_style = form.get("concept_style", "none") - concept_size = form.get("concept_size", "square") - t = threading.Thread( - target=_run_post_image_generation, - args=(task_id, uid, post_id), - kwargs={"custom_prompt": concept_prompt, "custom_style": concept_style, "custom_size": concept_size}, - daemon=True, - ) - t.start() + job = (lambda task_id, uid_, pid: _run_post_image_generation( + task_id, uid_, pid, + custom_prompt=form.get("concept_prompt", ""), + custom_style=form.get("concept_style", "none"), + custom_size=form.get("concept_size", "square"), + ), post_id) elif task_type_val == "analyze_social_profile": - url = form.get("url", "") - manual_posts = form.get("manual_posts", "") - t = threading.Thread( - target=_run_social_analysis, - args=(task_id, uid, url, manual_posts), - daemon=True, - ) - t.start() + job = (_run_social_analysis, form.get("url", ""), form.get("manual_posts", "")) - elif task_type_val == "modify_post": - post_id = int(form.get("post_id", 0)) - instruction = form.get("instruction", "") - t = threading.Thread( - target=_run_modify_post, - args=(task_id, uid, post_id, instruction), - daemon=True, - ) - t.start() + else: # modify_post + job = (_run_modify_post, post_id, form.get("instruction", "")) + task_id = create_task(uid, task_type_val) + task_pool.submit(job[0], task_id, uid, *job[1:]) return {"task_id": task_id, "status": "pending"} diff --git a/cabinet_service/static/press/app-icon.svg b/cabinet_service/static/press/app-icon.svg new file mode 100644 index 0000000..5b925bc --- /dev/null +++ b/cabinet_service/static/press/app-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cabinet_service/static/press/components.css b/cabinet_service/static/press/components.css new file mode 100644 index 0000000..3564a5c --- /dev/null +++ b/cabinet_service/static/press/components.css @@ -0,0 +1,658 @@ +/* ИИ Пресс-секретарь — компоненты. Все значения из tokens.css. */ + +.ps-icon { display: block; flex: none; } + +:where(.ps-btn, .ps-iconbtn, .ps-chip, .ps-seg-opt, .ps-switch, .ps-tab, .ps-card-title button):focus-visible { + outline: 3px solid var(--focus); + outline-offset: 2px; +} + +/* ---------- Logo ---------- */ +.ps-logo { display: inline-flex; align-items: center; gap: calc(var(--ps-logo-size, 40px) * 0.28); color: var(--ink); } +.ps-logo-mark { display: block; flex: none; } +.ps-logo-mark svg { display: block; width: 100%; height: 100%; } +.ps-logo--mono .ps-logo-mark { color: var(--brand); } +.ps-logo--white, .ps-logo--white .ps-logo-mark { color: #ffffff; } +.ps-logo-word { + display: inline-flex; align-items: center; gap: 0.32em; white-space: nowrap; + font: 600 calc(var(--ps-logo-size, 40px) * 0.5)/1 var(--font-display); letter-spacing: -0.02em; +} +.ps-logo-ai { + font-size: max(12px, 0.6em); font-weight: 700; letter-spacing: 0.04em; line-height: 1; + padding: 0.24em 0.42em 0.2em; border-radius: 0.42em; + background: var(--indigo-tint); color: var(--indigo); +} +.ps-logo--mono .ps-logo-ai { background: var(--brand-tint); color: var(--brand); } +.ps-logo--white .ps-logo-ai { background: #ffffff; color: var(--logo-deep); } + +/* ---------- Button ---------- */ +.ps-btn { + --_h: var(--control-md); + position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); + min-height: var(--_h); padding: 0 var(--space-5); border: 0; border-radius: var(--radius-pill); + font: 500 15px/20px var(--font-text); letter-spacing: -0.005em; white-space: nowrap; text-decoration: none; + cursor: pointer; -webkit-tap-highlight-color: transparent; + transition: transform var(--dur-tap) var(--ease-standard), background-color var(--dur-tap) var(--ease-standard), box-shadow var(--dur-move) var(--ease-soft); +} +.ps-btn:active:not(:disabled) { transform: scale(0.97); } +.ps-btn:disabled { opacity: 0.45; cursor: not-allowed; } +.ps-btn.is-loading { opacity: 1; cursor: progress; } +.ps-btn--sm { --_h: var(--control-sm); padding: 0 var(--space-4); font-size: 13px; gap: var(--space-1); } +.ps-btn--sm::before { content: ""; position: absolute; inset: -4px 0; } +.ps-btn--lg { --_h: var(--control-lg); padding: 0 var(--space-6); font-size: 17px; font-weight: 600; } +.ps-btn--block { display: flex; width: 100%; } +.ps-btn--primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-1); } +.ps-btn--primary:hover:not(:disabled) { background: var(--brand-pressed); box-shadow: var(--shadow-2); } +.ps-btn--secondary { background: var(--surface-raised); color: var(--brand); box-shadow: inset 0 0 0 1px var(--border-strong); } +.ps-btn--secondary:hover:not(:disabled) { background: var(--brand-tint); } +.ps-btn--quiet { background: transparent; color: var(--brand); } +.ps-btn--quiet:hover:not(:disabled) { background: var(--brand-tint); } +.ps-btn--glass { + background: var(--surface-glass); color: var(--ink); + -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%); backdrop-filter: blur(var(--blur-glass)) saturate(180%); + box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-1); +} +.ps-btn--danger { background: var(--danger-tint); color: var(--danger); } +.ps-spinner { + width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; + animation: ps-spin 0.8s linear infinite; +} + +/* ---------- Icon button ---------- */ +.ps-iconbtn { + display: inline-grid; place-items: center; flex: none; + width: var(--target-min); height: var(--target-min); padding: 0; border: 0; border-radius: var(--radius-pill); + background: transparent; color: var(--ink-secondary); cursor: pointer; -webkit-tap-highlight-color: transparent; + transition: transform var(--dur-tap) var(--ease-standard), background-color var(--dur-tap) var(--ease-standard), color var(--dur-tap) var(--ease-standard); +} +.ps-iconbtn:hover:not(:disabled) { background: var(--surface-sunken); color: var(--ink); } +.ps-iconbtn:active:not(:disabled) { transform: scale(0.92); } +.ps-iconbtn:disabled { opacity: 0.4; cursor: not-allowed; } +.ps-iconbtn--tinted { background: var(--brand-tint); color: var(--brand); } +.ps-iconbtn--tinted:hover:not(:disabled) { background: var(--brand-tint); color: var(--brand-pressed); } +.ps-iconbtn--filled { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-1); } +.ps-iconbtn--filled:hover:not(:disabled) { background: var(--brand-pressed); color: var(--on-brand); } +.ps-iconbtn--filled:disabled { background: var(--surface-sunken); color: var(--ink-tertiary); box-shadow: none; opacity: 1; } +.ps-iconbtn--glass { + background: var(--surface-glass); color: var(--ink); + -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%); backdrop-filter: blur(var(--blur-glass)) saturate(180%); + box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-1); +} + +/* ---------- Suggestion chip ---------- */ +.ps-chip { + position: relative; display: inline-flex; align-items: center; gap: var(--space-2); + min-height: var(--control-sm); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-pill); + background: var(--surface-raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hairline); + font: 500 15px/20px var(--font-text); cursor: pointer; white-space: nowrap; + transition: background-color var(--dur-tap) var(--ease-standard), box-shadow var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); +} +.ps-chip::before { content: ""; position: absolute; inset: -4px 0; } +.ps-chip .ps-icon { color: var(--brand); } +.ps-chip:hover { background: var(--brand-tint); } +.ps-chip:active { transform: scale(0.96); } +.ps-chip.is-selected { background: var(--brand-tint); color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); } +.ps-chip--sm { font-size: 13px; line-height: 18px; padding: 0 var(--space-3); min-height: 32px; gap: var(--space-1); } +.ps-chip--sm::before { inset: -6px 0; } + +/* ---------- Text field ---------- */ +.ps-field { display: grid; gap: var(--space-2); min-width: 0; } +.ps-field-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); } +.ps-field-label { font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-field-count { font: 400 12px/16px var(--font-text); color: var(--ink-tertiary); font-variant-numeric: tabular-nums; } +.ps-field-control { + box-sizing: border-box; width: 100%; min-height: var(--control-md); padding: 11px var(--space-4); margin: 0; + border: 0; border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--ink); + box-shadow: inset 0 0 0 1px var(--border-strong); + font: 400 16px/22px var(--font-text); resize: vertical; outline: none; + transition: box-shadow var(--dur-tap) var(--ease-standard); +} +.ps-field-control::placeholder { color: var(--ink-tertiary); } +.ps-field-control:hover { box-shadow: inset 0 0 0 1px var(--ink-secondary); } +.ps-field-control:focus { box-shadow: inset 0 0 0 2px var(--brand), 0 0 0 4px var(--brand-tint); } +.ps-field-control:disabled { background: var(--surface-sunken); color: var(--ink-tertiary); box-shadow: none; } +.ps-field.is-error .ps-field-control { box-shadow: inset 0 0 0 2px var(--danger); } +.ps-field-hint { display: flex; gap: 6px; align-items: flex-start; margin: 0; font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-field-hint .ps-icon { margin-top: 1px; } +.ps-field.is-error .ps-field-hint { color: var(--danger); } + +/* ---------- Prompt composer ---------- */ +.ps-composer { + display: grid; gap: var(--space-1); padding: 6px; border-radius: var(--radius-xl); + background: var(--surface-raised); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); + transition: box-shadow var(--dur-move) var(--ease-soft); +} +.ps-composer:focus-within { box-shadow: var(--shadow-2), inset 0 0 0 1.5px var(--brand); } +.ps-composer-suggest { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2); } +.ps-composer-row { display: flex; align-items: flex-end; gap: var(--space-1); } +.ps-composer-input { + flex: 1; min-width: 0; min-height: var(--target-min); max-height: 200px; padding: 10px var(--space-3); margin: 0; + border: 0; background: transparent; color: var(--ink); resize: none; outline: none; + font: 400 16px/24px var(--font-text); +} +.ps-composer-input::placeholder { color: var(--ink-tertiary); } +.ps-composer-row > .ps-iconbtn--filled, .ps-composer-row > .ps-iconbtn--tinted { animation: ps-pop var(--dur-move) var(--ease-spring); } +.ps-composer-note { margin: 0; padding: 0 12px 4px; font: 400 12px/16px var(--font-text); color: var(--ink-tertiary); text-align: center; } + +/* ---------- Segmented control ---------- */ +.ps-seg { + position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; + padding: 4px; border-radius: var(--radius-md); background: var(--surface-sunken); min-height: var(--control-md); + box-sizing: border-box; +} +.ps-seg-thumb { + position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--ps-seg-n)); + border-radius: var(--radius-sm); background: var(--surface-raised); box-shadow: var(--shadow-1); + transform: translateX(calc(100% * var(--ps-seg-i))); + transition: transform var(--dur-snappy) var(--spring-snappy); +} +.ps-seg-opt { + position: relative; z-index: 1; min-height: 36px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); + background: transparent; color: var(--ink-secondary); font: 500 15px/20px var(--font-text); cursor: pointer; + transition: color var(--dur-tap) var(--ease-standard); +} +.ps-seg-opt[aria-checked="true"] { color: var(--ink); font-weight: 600; } + +/* ---------- Switch ---------- */ +.ps-switch { + display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); + width: 100%; min-height: var(--target-min); padding: 0; border: 0; background: none; color: var(--ink); + text-align: left; cursor: pointer; font: inherit; +} +.ps-switch:disabled { opacity: 0.45; cursor: not-allowed; } +.ps-switch-text { display: grid; gap: 2px; } +.ps-switch-label { font: 500 15px/20px var(--font-text); } +.ps-switch-desc { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-switch-track { + position: relative; flex: none; width: 51px; height: 31px; border-radius: var(--radius-pill); + background: var(--border-strong); transition: background-color var(--dur-move) var(--ease-standard); +} +.ps-switch-knob { + position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; + background: var(--surface-raised); box-shadow: var(--shadow-1); + transition: transform var(--dur-bouncy) var(--spring-bouncy), width var(--dur-snappy) var(--spring-snappy); +} +.ps-switch[aria-checked="true"] .ps-switch-track { background: var(--brand); } +.ps-switch[aria-checked="true"] .ps-switch-knob { transform: translateX(20px); } +.ps-switch:active .ps-switch-knob { width: 31px; } +.ps-switch[aria-checked="true"]:active .ps-switch-knob { transform: translateX(16px); } + +/* ---------- Message ---------- */ +.ps-msg { display: flex; gap: var(--space-3); align-items: flex-start; max-width: 640px; animation: ps-rise var(--dur-smooth) var(--spring-smooth); } +.ps-msg--user { flex-direction: row-reverse; margin-left: auto; } +.ps-msg-avatar { flex: none; margin-top: 2px; } +.ps-msg-body { display: grid; gap: var(--space-2); min-width: 0; } +.ps-msg--user .ps-msg-body { justify-items: end; } +.ps-msg-meta { display: flex; align-items: center; gap: 6px; font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-msg-author { color: var(--ink); font-weight: 600; } +.ps-msg-meta time { font-size: 12px; color: var(--ink-tertiary); } +.ps-ai-tag { + padding: 1px 8px; border-radius: 6px; background: var(--indigo-tint); color: var(--indigo); + font: 700 12px/16px var(--font-display); letter-spacing: 0.04em; +} +.ps-msg-bubble { + padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); + font: 400 16px/24px var(--font-text); color: var(--ink); overflow-wrap: anywhere; +} +.ps-msg--ai .ps-msg-bubble { background: var(--surface-raised); border-top-left-radius: 6px; box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } +.ps-msg--user .ps-msg-bubble { background: var(--brand-tint); border-top-right-radius: 6px; } +.ps-msg-bubble > p { margin: 0; } +.ps-msg-bubble > p + p { margin-top: var(--space-3); } +.ps-msg-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-left: -6px; } +.ps-caret { display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; border-radius: 1px; background: var(--brand); animation: ps-blink 1s steps(2, start) infinite; } + +/* ---------- Thinking — «Веер» ---------- */ +.ps-thinking { + display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: var(--radius-pill); + background: var(--indigo-tint); color: var(--indigo); font: 500 15px/20px var(--font-text); +} +.ps-fan { position: relative; display: block; width: 30px; height: 26px; flex: none; } +.ps-fan i { + position: absolute; left: 10.5px; top: 4px; width: 9px; height: 17px; border-radius: 3px 4px 3px 4px; + transform: rotate(calc(var(--r) * 0.3)); + background: currentColor; transform-origin: 50% 100%; + animation: ps-fan var(--dur-think) var(--ease-soft) infinite; +} +.ps-fan i:nth-child(1) { --r: -36deg; opacity: 0.45; } +.ps-fan i:nth-child(2) { --r: 0deg; opacity: 0.7; animation-delay: 80ms; } +.ps-fan i:nth-child(3) { --r: 36deg; animation-delay: 160ms; } + +/* ---------- Status badge ---------- */ +.ps-badge { + display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px 0 6px; border-radius: var(--radius-xs); + font: 500 13px/18px var(--font-text); white-space: nowrap; +} +.ps-badge--neutral { background: var(--surface-sunken); color: var(--ink-secondary); } +.ps-badge--ai { background: var(--indigo-tint); color: var(--indigo); } +.ps-badge--warning { background: var(--warning-tint); color: var(--warning); } +.ps-badge--success { background: var(--success-tint); color: var(--success); } +.ps-badge--danger { background: var(--danger-tint); color: var(--danger); } + +/* ---------- Draft card ---------- */ +.ps-card { + position: relative; display: grid; gap: var(--space-3); padding: var(--space-5); min-width: 0; + border-radius: var(--radius-lg); background: var(--surface-raised); + box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); + transition: transform var(--dur-move) var(--ease-soft), box-shadow var(--dur-move) var(--ease-soft); +} +.ps-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2), inset 0 0 0 1px var(--hairline); } +.ps-card:active { transform: scale(0.99); } +.ps-card:has(.ps-card-title button:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; } +.ps-card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); } +.ps-card-channels { font: 500 12px/16px var(--font-text); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-tertiary); } +.ps-card-title { margin: 0; font: 600 20px/26px var(--font-display); letter-spacing: -0.01em; color: var(--ink); text-wrap: balance; } +.ps-card-title button { all: unset; cursor: pointer; } +.ps-card-title button::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } +.ps-card-title button:focus-visible { outline: none; } +.ps-card-excerpt { + margin: 0; font: 400 15px/22px var(--font-text); color: var(--ink-secondary); + display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; +} +.ps-card-foot { display: flex; align-items: center; gap: var(--space-3); font: 500 13px/18px var(--font-text); color: var(--ink-tertiary); } +.ps-card-len { font-family: var(--font-text); font-weight: 400; font-variant-numeric: tabular-nums; } +.ps-card-chev { margin-left: auto; color: var(--ink-tertiary); transition: transform var(--dur-move) var(--ease-soft); } +.ps-card:hover .ps-card-chev { transform: translateX(3px); color: var(--brand); } + +/* ---------- Toast ---------- */ +.ps-toast { + display: flex; align-items: flex-start; gap: var(--space-3); max-width: 420px; padding: var(--space-3) var(--space-2) var(--space-3) var(--space-3); + border-radius: var(--radius-lg); background: var(--surface-glass); color: var(--ink); + -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%); backdrop-filter: blur(var(--blur-glass)) saturate(180%); + box-shadow: var(--shadow-float), inset 0 0 0 1px var(--hairline); + animation: ps-rise var(--dur-smooth) var(--spring-smooth); +} +.ps-toast-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; } +.ps-toast--info .ps-toast-icon { background: var(--brand-tint); color: var(--brand); } +.ps-toast--success .ps-toast-icon { background: var(--success-tint); color: var(--success); } +.ps-toast--warning .ps-toast-icon { background: var(--warning-tint); color: var(--warning); } +.ps-toast--danger .ps-toast-icon { background: var(--danger-tint); color: var(--danger); } +.ps-toast--ai .ps-toast-icon { background: var(--indigo-tint); color: var(--indigo); } +.ps-toast-text { flex: 1; min-width: 0; display: grid; gap: 2px; padding-top: 5px; } +.ps-toast-title { margin: 0; font: 600 15px/20px var(--font-text); } +.ps-toast-body { margin: 0; font: 400 15px/22px var(--font-text); color: var(--ink-secondary); } +.ps-toast-action { justify-self: start; margin: 4px 0 0 -12px; } +.ps-toast > .ps-iconbtn { margin-top: -6px; } + +/* ---------- Tab bar ---------- */ +.ps-tabbar { + display: inline-flex; gap: 2px; padding: 6px; border-radius: var(--radius-xl); + background: var(--surface-glass); + -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%); backdrop-filter: blur(var(--blur-glass)) saturate(180%); + box-shadow: var(--shadow-float), inset 0 0 0 1px var(--hairline); +} +.ps-tab { + display: grid; justify-items: center; gap: 2px; min-width: 72px; min-height: 52px; padding: 6px 10px 4px; + border: 0; border-radius: var(--radius-lg); background: transparent; color: var(--ink-tertiary); cursor: pointer; + transition: background-color var(--dur-move) var(--ease-soft), color var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); +} +.ps-tab:hover { color: var(--ink-secondary); } +.ps-tab:active { transform: scale(0.94); } +.ps-tab.is-active { background: var(--brand-tint); color: var(--brand); } +.ps-tab-icon { position: relative; } +.ps-tab-label { font: 600 12px/16px var(--font-text); } +.ps-tab-badge { + position: absolute; top: -4px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; + border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); + font: 700 12px/18px var(--font-text); text-align: center; box-shadow: 0 0 0 2px var(--surface-raised); +} + +.ps-badge--brand { background: var(--brand-tint); color: var(--brand); } +.ps-spinner--sm { width: 12px; height: 12px; border-width: 2px; } +.ps-card-img { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; } + +/* ---------- Side navigation ---------- */ +.ps-sidenav { + box-sizing: border-box; display: flex; flex-direction: column; gap: var(--space-4); width: 264px; min-height: 100%; flex: none; + padding: var(--space-5) var(--space-3); background: var(--surface-raised); box-shadow: inset -1px 0 0 var(--hairline); +} +.ps-sidenav-logo { padding: 0 var(--space-3) var(--space-2); } +.ps-sidenav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; } +.ps-sidenav-item { + display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: var(--target-min); padding: 0 var(--space-3); + border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-secondary); + font: 500 15px/20px var(--font-text); text-align: left; cursor: pointer; + transition: background-color var(--dur-tap) var(--ease-standard), color var(--dur-tap) var(--ease-standard); +} +.ps-sidenav-item:hover { background: var(--surface-sunken); color: var(--ink); } +.ps-sidenav-item.is-active { background: var(--brand-tint); color: var(--brand); font-weight: 600; } +.ps-sidenav-item:focus-visible, .ps-sidenav-persona:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; } +.ps-sidenav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); font: 600 12px/20px var(--font-text); text-align: center; } +.ps-sidenav-persona { + margin-top: auto; display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: var(--space-3); + border: 0; border-radius: var(--radius-md); background: var(--surface-sunken); color: var(--ink); text-align: left; cursor: pointer; font: inherit; +} +.ps-sidenav-persona-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--radius-sm); background: var(--indigo-tint); color: var(--indigo); } +.ps-sidenav-persona-text { flex: 1; min-width: 0; display: grid; gap: 2px; } +.ps-sidenav-persona-cap { font: 500 12px/16px var(--font-text); color: var(--ink-tertiary); } +.ps-sidenav-persona-name { font: 600 15px/20px var(--font-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +/* ---------- Stat card ---------- */ +.ps-stat { + display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: var(--space-3); row-gap: var(--space-2); + padding: var(--space-5); border-radius: var(--radius-lg); background: var(--surface-raised); + box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); min-width: 0; +} +.ps-stat-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--brand-tint); color: var(--brand); } +.ps-stat-label { font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-stat-value { grid-column: 1 / -1; font: 700 34px/40px var(--font-display); letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; } +.ps-stat-note { grid-column: 1 / -1; font: 400 13px/18px var(--font-text); color: var(--ink-tertiary); } + +/* ---------- Choice cards ---------- */ +.ps-choices { display: grid; gap: 8px; min-width: 0; } +.ps-choices-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--space-3); } +.ps-choices-grid.is-compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr)); gap: var(--space-2); } +.ps-choice { + container-type: inline-size; display: block; min-width: 0; min-height: var(--target-min); padding: var(--inset-card); border: 0; + border-radius: var(--radius-lg); background: var(--surface-raised); color: var(--ink); text-align: left; cursor: pointer; font: inherit; + box-shadow: inset 0 0 0 1px var(--hairline); + transition: box-shadow var(--dur-tap) var(--ease-standard), background-color var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); +} +.ps-choice:hover { box-shadow: inset 0 0 0 1px var(--border-strong); } +.ps-choice:active { transform: scale(0.98); } +.ps-choice:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; } +.ps-choice.is-selected { background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); } +.ps-choice:disabled { opacity: 0.45; cursor: not-allowed; } +/* Иконка, текст и галочка — три колонки сетки. Ничего не лежит поверх текста. */ +.ps-choice-body { + display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon text check"; + align-items: start; column-gap: var(--gap-row); row-gap: var(--space-3); +} +.ps-choice-body.no-icon { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text check"; } +.ps-choice-icon { grid-area: icon; display: grid; place-items: center; width: var(--tile-md); height: var(--tile-md); border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-secondary); } +.ps-choice.is-selected .ps-choice-icon { background: var(--surface-raised); color: var(--brand); } +.ps-choice-text { grid-area: text; display: grid; gap: 2px; min-width: 0; align-self: center; } +.ps-choice-kicker { font: 600 12px/16px var(--font-text); letter-spacing: 0.04em; text-transform: uppercase; color: var(--indigo); } +.ps-choice-title { font: 600 15px/20px var(--font-text); color: var(--ink); overflow-wrap: break-word; hyphens: manual; } +.ps-choice-desc { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-choice-check { + grid-area: check; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; + box-shadow: inset 0 0 0 1.5px var(--border-strong); color: transparent; + transition: background-color var(--dur-move) var(--ease-spring), transform var(--dur-move) var(--ease-spring); +} +.ps-choice.is-selected .ps-choice-check { background: var(--brand); color: var(--on-brand); box-shadow: none; } +/* Узкая карточка: иконка и галочка — верхний ряд, текст — на всю ширину ниже. */ +@container (max-width: 210px) { + .ps-choice-body { grid-template-columns: auto 1fr auto; grid-template-areas: "icon . check" "text text text"; } + .ps-choice-body.no-icon { grid-template-columns: 1fr auto; grid-template-areas: "text check"; } + .ps-choice-text { align-self: start; } +} +.ps-choices-grid.is-compact .ps-choice { padding: var(--inset-control); } +.ps-choices-grid.is-compact .ps-choice-body { align-items: center; column-gap: var(--gap-icon); } +.ps-choices-grid.is-compact .ps-choice-icon { width: var(--tile-sm); height: var(--tile-sm); } +.ps-choices-grid.is-compact .ps-choice-desc { font-size: 12px; line-height: 16px; } +.ps-choices-grid.is-compact .ps-choice-check { width: 18px; height: 18px; } +.ps-choices-grid.is-compact .ps-choice-check .ps-icon { width: 12px; height: 12px; } +.ps-choices-grid.is-compact .ps-choice.is-selected .ps-choice-title { font-weight: 700; } +/* Компактная карточка уже 160px: индикатор не помещается рядом с текстом — выбор показывают рамка 2px и жирный заголовок. */ +@container (max-width: 159px) { + .ps-choices-grid.is-compact .ps-choice-check { display: none; } + .ps-choices-grid.is-compact .ps-choice-body.no-icon { grid-template-columns: minmax(0, 1fr); grid-template-areas: "text"; } +} + +/* ---------- Pillar ---------- */ +.ps-pillar { + display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--radius-xs); + font: 500 13px/18px var(--font-text); white-space: nowrap; +} +.ps-pillar-mark { width: 8px; height: 8px; background: currentColor; flex: none; } +.ps-pillar--1 { background: var(--pillar-1-tint); color: var(--pillar-1); } +.ps-pillar--1 .ps-pillar-mark { border-radius: 50%; } +.ps-pillar--2 { background: var(--pillar-2-tint); color: var(--pillar-2); } +.ps-pillar--2 .ps-pillar-mark { border-radius: 2px; } +.ps-pillar--3 { background: var(--pillar-3-tint); color: var(--pillar-3); } +.ps-pillar--3 .ps-pillar-mark { width: 7px; height: 7px; border-radius: 1px; transform: rotate(45deg); } + +/* ---------- Post preview ---------- */ +.ps-post { + display: grid; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-xl); background: var(--surface-raised); + box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); min-width: 0; +} +.ps-post-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); } +.ps-post-head > .ps-btn, .ps-post-head > .ps-iconbtn { margin-left: auto; } +.ps-post-platform { display: inline-flex; align-items: center; gap: 6px; font: 600 15px/20px var(--font-text); color: var(--ink); } +.ps-post-platform .ps-icon { color: var(--brand); } +.ps-post-tag { padding: 2px 8px; border-radius: var(--radius-xs); background: var(--surface-sunken); font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-post-image { overflow: hidden; border-radius: var(--radius-lg); aspect-ratio: 16 / 9; max-width: 100%; } +.ps-post-image > * { width: 100%; height: 100%; } +.ps-post-text { font: 400 16px/25px var(--font-text); color: var(--ink); overflow-wrap: anywhere; } +.ps-post-text p { margin: 0; white-space: pre-line; } +.ps-post-text p + p { margin-top: 12px; } +.ps-post-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding-top: var(--space-3); box-shadow: inset 0 1px 0 var(--hairline); } +.ps-post-count { font: 500 13px/18px var(--font-text); color: var(--ink-tertiary); font-variant-numeric: tabular-nums; } +.ps-post-count.is-over { color: var(--danger); } +.ps-post-note { display: inline-flex; align-items: center; gap: 6px; font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-post-note.is-danger { color: var(--danger); } +.ps-post-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-left: auto; } + +/* ---------- Version history ---------- */ +.ps-history { list-style: none; margin: 0; padding: 0; display: grid; } +.ps-history-item { position: relative; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: var(--space-3); min-height: 52px; } +.ps-history-item::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; background: var(--hairline); } +.ps-history-item:first-child::before { top: 50%; } +.ps-history-item:last-child::before { bottom: 50%; } +.ps-history-item:only-child::before { display: none; } +.ps-history-dot { position: relative; width: 12px; height: 12px; margin-left: 4px; border-radius: 50%; background: var(--surface-raised); box-shadow: inset 0 0 0 2px var(--border-strong); } +.ps-history-item.is-active .ps-history-dot { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); } +.ps-history-text { display: grid; gap: 2px; min-width: 0; } +.ps-history-title { font: 500 15px/20px var(--font-text); color: var(--ink); } +.ps-history-meta { font: 400 12px/16px var(--font-text); color: var(--ink-tertiary); font-variant-numeric: tabular-nums; } +.ps-history-current { font: 600 13px/18px var(--font-text); color: var(--brand); padding: 0 var(--space-3); } + +/* ---------- Plan day ---------- */ +.ps-planday { + display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: var(--space-4); + padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3); border-radius: var(--radius-lg); background: var(--surface-raised); + box-shadow: inset 0 0 0 1px var(--hairline); +} +.ps-planday-date { display: grid; justify-items: center; padding: 6px 0; border-radius: var(--radius-md); background: var(--surface-sunken); } +.ps-planday-num { font: 700 22px/26px var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; } +.ps-planday-wd { font: 500 12px/16px var(--font-text); color: var(--ink-tertiary); } +.ps-planday-body { display: grid; gap: var(--space-2); min-width: 0; } +.ps-planday-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); } +.ps-planday-platform { display: inline-flex; align-items: center; gap: 4px; font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-planday-idea { margin: 0; font: 400 15px/22px var(--font-text); color: var(--ink); } +.ps-planday.is-done .ps-planday-date { background: var(--success-tint); } +@media (max-width: 560px) { + .ps-planday { grid-template-columns: 48px 1fr; } + .ps-planday-action { grid-column: 2; } +} + +/* ---------- Image presets ---------- */ +.ps-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--space-3); } +.ps-preset { + display: grid; gap: 6px; padding: 6px 6px 10px; border: 0; border-radius: var(--radius-md); background: var(--surface-raised); + box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink); cursor: pointer; font: inherit; + transition: box-shadow var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); +} +.ps-preset:hover { box-shadow: inset 0 0 0 1px var(--border-strong); } +.ps-preset:active { transform: scale(0.97); } +.ps-preset:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; } +.ps-preset.is-selected { background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); } +.ps-preset-art { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius-sm); } +.ps-preset-art svg { display: block; width: 100%; height: 100%; } +.ps-preset-art .t { fill: var(--brand-tint); } +.ps-preset-art .b { fill: var(--logo-deep); } +.ps-preset-art .a { fill: var(--brand-bright); } +.ps-preset-art .c { fill: var(--ink-tertiary); } +.ps-preset-art .s { fill: var(--surface-raised); } +.ps-preset.is-selected .ps-preset-art .t { fill: var(--surface-raised); } +.ps-preset-label { font: 500 13px/18px var(--font-text); text-align: center; } + +/* ---------- Drop zone ---------- */ +.ps-drop { + position: relative; display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); text-align: center; + border-radius: var(--radius-lg); background: var(--surface-sunken); box-shadow: inset 0 0 0 1.5px var(--border-strong); + cursor: pointer; transition: background-color var(--dur-tap) var(--ease-standard), box-shadow var(--dur-tap) var(--ease-standard); +} +.ps-drop:hover, .ps-drop.is-over { background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); } +.ps-drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; } +.ps-drop-input { position: absolute; width: 1px; height: 1px; opacity: 0; } +.ps-drop-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-raised); color: var(--brand); box-shadow: var(--shadow-1); } +.ps-drop-title { font: 600 15px/20px var(--font-text); color: var(--ink); } +.ps-drop-hint { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } + +/* ---------- Channel ---------- */ +.ps-channel { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--hairline); } +.ps-channel-avatar { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--brand-tint); color: var(--brand); font: 700 17px/1 var(--font-display); } +.ps-channel-text { flex: 1; min-width: 140px; display: grid; gap: 2px; } +.ps-channel-title { font: 600 15px/20px var(--font-text); color: var(--ink); } +.ps-channel-meta { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-channel-actions { display: flex; align-items: center; gap: var(--space-1); } + +/* ---------- Progress & stepper ---------- */ +.ps-progress { display: grid; gap: var(--space-2); } +.ps-progress-label { display: flex; justify-content: space-between; font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-progress-value { font-variant-numeric: tabular-nums; color: var(--ink); } +.ps-progress-track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; } +.ps-progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width var(--dur-sheet) var(--ease-soft); } +.ps-stepper { display: grid; gap: var(--space-3); } +.ps-stepper-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3); } +.ps-stepper-count { font: 600 13px/18px var(--font-text); color: var(--brand); font-variant-numeric: tabular-nums; } +.ps-stepper-title { font: 600 22px/28px var(--font-display); color: var(--ink); } +.ps-stepper-track { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; } +.ps-stepper-seg { height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunken); transition: background-color var(--dur-move) var(--ease-standard); } +.ps-stepper-seg.is-done { background: var(--brand); } +.ps-stepper-seg.is-current { background: var(--brand-bright); } + +/* ---------- Persona card ---------- */ +.ps-persona { + display: grid; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-lg); background: var(--surface-raised); + box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); min-width: 0; align-content: start; +} +.ps-persona.is-active { box-shadow: var(--shadow-2), inset 0 0 0 2px var(--brand); } +.ps-persona-top { display: flex; align-items: center; gap: var(--space-3); } +.ps-persona-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-sm); background: var(--indigo-tint); color: var(--indigo); } +.ps-persona-type { flex: 1; font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-persona-name { margin: 0; font: 600 20px/26px var(--font-display); color: var(--ink); } +.ps-persona-sum { margin: 0; font: 400 15px/22px var(--font-text); color: var(--ink-secondary); } +.ps-persona-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); } + +/* ---------- Select, secret, slider ---------- */ +.ps-select { position: relative; } +.ps-select-control { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; resize: none; } +.ps-select-chev { position: absolute; right: 12px; top: 50%; margin-top: -9px; color: var(--ink-secondary); pointer-events: none; } +.ps-secret { position: relative; } +.ps-secret-control { padding-right: 52px; letter-spacing: 0.02em; } +.ps-secret > .ps-iconbtn { position: absolute; right: 0; top: 0; } +.ps-slider-value { font: 600 15px/20px var(--font-text); color: var(--brand); font-variant-numeric: tabular-nums; } +.ps-slider { -webkit-appearance: none; appearance: none; width: 100%; height: var(--target-min); margin: 0; background: transparent; cursor: pointer; } +.ps-slider::-webkit-slider-runnable-track { height: 6px; border-radius: var(--radius-pill); background: linear-gradient(to right, var(--brand) var(--ps-pct), var(--surface-sunken) var(--ps-pct)); } +.ps-slider::-moz-range-track { height: 6px; border-radius: var(--radius-pill); background: linear-gradient(to right, var(--brand) var(--ps-pct), var(--surface-sunken) var(--ps-pct)); } +.ps-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--surface-raised); box-shadow: var(--shadow-2), inset 0 0 0 1px var(--hairline); transition: transform var(--dur-tap) var(--ease-spring); } +.ps-slider::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface-raised); box-shadow: var(--shadow-2); } +.ps-slider:active::-webkit-slider-thumb { transform: scale(1.12); } +.ps-slider:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); } +.ps-slider-scale { display: flex; justify-content: space-between; font: 400 12px/16px var(--font-text); color: var(--ink-tertiary); margin-top: -6px; } + +/* ---------- Empty state ---------- */ +.ps-empty { display: grid; justify-items: center; gap: var(--space-3); padding: var(--space-8) var(--space-4); text-align: center; } +.ps-empty-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: var(--radius-lg); background: var(--brand-tint); color: var(--brand); } +.ps-empty-title { margin: 0; font: 600 20px/26px var(--font-display); color: var(--ink); } +.ps-empty-text { margin: 0; max-width: 40ch; font: 400 15px/22px var(--font-text); color: var(--ink-secondary); } + +/* ---------- Provider card ---------- */ +.ps-provider { display: grid; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-xl); background: var(--surface-raised); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } +.ps-provider-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-3); } +.ps-provider-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: var(--radius-sm); background: var(--brand-tint); color: var(--brand); } +.ps-provider-text { flex: 1; display: grid; gap: 2px; min-width: 160px; } +.ps-provider-title { margin: 0; font: 600 20px/26px var(--font-display); color: var(--ink); } +.ps-provider-desc { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } +.ps-provider-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); } + +/* ---------- Экраны-образцы ---------- */ +.ps-shell { display: flex; min-height: 100%; background: var(--surface); } +.ps-main { flex: 1; min-width: 0; overflow-y: auto; display: grid; align-content: start; gap: var(--stack-section); padding: var(--page-gutter); } +.ps-main-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); } +.ps-h1 { margin: 0; font: 700 34px/40px var(--font-display); letter-spacing: -0.015em; color: var(--ink); text-wrap: balance; } +.ps-h2 { margin: 0; font: 600 22px/28px var(--font-display); color: var(--ink); } +.ps-lead { margin: var(--stack-text) 0 0; font: 400 15px/22px var(--font-text); color: var(--ink-secondary); } +.ps-panel { display: grid; gap: var(--stack-group); padding: var(--inset-panel); border-radius: var(--radius-xl); background: var(--surface-raised); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); align-content: start; min-width: 0; } + +/* ---------- Quick action tile ---------- */ +.ps-action { + display: grid; justify-items: start; align-content: start; gap: 4px; min-width: 0; padding: var(--inset-card); + border: 0; border-radius: var(--radius-lg); background: var(--surface-raised); color: var(--ink); text-align: left; cursor: pointer; font: inherit; + box-shadow: inset 0 0 0 1px var(--hairline); + transition: box-shadow var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); +} +.ps-action:hover { box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-1); } +.ps-action:active { transform: scale(0.98); } +.ps-action:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; } +.ps-action-icon { display: grid; place-items: center; width: var(--tile-md); height: var(--tile-md); margin-bottom: var(--space-2); border-radius: var(--radius-sm); background: var(--brand-tint); color: var(--brand); } +.ps-action-title { font: 600 15px/20px var(--font-text); } +.ps-action-desc { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } + +/* ---------- Адаптивные сетки экранов ---------- */ +.ps-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--space-6); align-items: stretch; } +.ps-grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--stack-group); } +.ps-grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--stack-group); } +.ps-grid-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: var(--space-3); } +.ps-split { display: grid; grid-template-columns: minmax(0, 1fr) var(--ps-aside, 320px); gap: var(--space-6); align-items: start; } +.ps-split.ps-split--start { grid-template-columns: var(--ps-aside, 320px) minmax(0, 1fr); } +@media (max-width: 1023px) { + .ps-sidenav { width: 76px; padding-inline: var(--space-3); } + .ps-sidenav-logo .ps-logo-word, .ps-sidenav-persona-text, .ps-sidenav-persona > .ps-icon { display: none; } + .ps-sidenav-logo { padding: 0 6px var(--space-2); } + .ps-sidenav-item { justify-content: center; padding: 0; } + .ps-sidenav-item > span:not(.ps-sidenav-badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } + .ps-sidenav-persona { justify-content: center; padding: var(--space-2); } + .ps-main { padding: var(--space-6); } +} +@media (max-width: 899px) { + .ps-split, .ps-split.ps-split--start { grid-template-columns: minmax(0, 1fr); } +} +@media (max-width: 599px) { + .ps-sidenav { display: none; } + .ps-main { padding: var(--space-4); gap: var(--space-6); } + .ps-h1 { font-size: 28px; line-height: 34px; } +} + +/* ---------- Отклик на нажатие ---------- + Состояние меняется в первый кадр. Вниз — за 90 мс, обратно — пружиной spring-bouncy. + Анимации — переходы (transition), а не ключевые кадры: любое движение можно прервать новым нажатием. */ +.ps-btn, .ps-iconbtn, .ps-chip, .ps-tab, .ps-choice, .ps-preset, .ps-action, .ps-sidenav-item, .ps-card, .ps-drop { + transition-property: transform, background-color, box-shadow, color, opacity; + transition-duration: var(--dur-bouncy), var(--dur-tap), var(--dur-smooth), var(--dur-tap), var(--dur-tap); + transition-timing-function: var(--spring-bouncy), var(--ease-standard), var(--spring-smooth), var(--ease-standard), var(--ease-standard); +} +.ps-btn:active, .ps-iconbtn:active, .ps-chip:active, .ps-tab:active, .ps-choice:active, .ps-preset:active, .ps-action:active, .ps-sidenav-item:active, .ps-card:active { + transition-duration: 90ms, var(--dur-tap), var(--dur-smooth), var(--dur-tap), var(--dur-tap); + transition-timing-function: cubic-bezier(0.2, 0, 0, 1), var(--ease-standard), var(--spring-smooth), var(--ease-standard), var(--ease-standard); +} +.ps-sidenav-item:active { transform: scale(0.97); } +.ps-action:hover, .ps-choice:hover:not(.is-selected) { transform: translateY(-1px); } + +/* ---------- Непрерывные углы (squircle) ---------- + Где браузер умеет corner-shape, углы становятся «яблочными» суперэллипсами. + Суперэллипс визуально острее круга, поэтому радиусы × 1,25 — концентричность сохраняется. */ +@supports (corner-shape: squircle) { + :root { --radius-sm: 15px; --radius-md: 20px; --radius-lg: 28px; --radius-xl: 35px; } + .ps-panel, .ps-card, .ps-post, .ps-persona, .ps-provider, .ps-stat, .ps-choice, .ps-action, .ps-channel, .ps-planday, + .ps-drop, .ps-toast, .ps-tabbar, .ps-composer, .ps-msg-bubble, .ps-preset, .ps-field-control, .ps-seg, .ps-seg-thumb, + .ps-sidenav-item, .ps-sidenav-persona, .ps-empty-icon, .ps-action-icon, .ps-stat-icon, .ps-choice-icon, .ps-persona-icon, .ps-provider-icon, .ps-tab { + corner-shape: squircle; + } +} + +/* ---------- Motion ---------- */ +@keyframes ps-spin { to { transform: rotate(360deg); } } +@keyframes ps-blink { to { visibility: hidden; } } +@keyframes ps-rise { from { transform: translateY(8px) scale(0.98); } } +@keyframes ps-pop { from { transform: scale(0.6); opacity: 0; } } +@keyframes ps-fan { + 0%, 100% { transform: rotate(calc(var(--r) * 0.3)) skewY(0deg); } + 35%, 70% { transform: rotate(var(--r)) skewY(-6deg); } +} +@keyframes ps-pulse { 50% { opacity: 0.35; } } + +@media (prefers-reduced-motion: reduce) { + .ps-msg, .ps-toast, .ps-composer-row > .ps-iconbtn { animation: none; } + .ps-btn, .ps-iconbtn, .ps-chip, .ps-tab, .ps-choice, .ps-preset, .ps-action, .ps-sidenav-item, .ps-card, .ps-drop { transition-duration: 1ms !important; } + .ps-action:hover, .ps-choice:hover:not(.is-selected) { transform: none; } + .ps-fan i { animation: ps-pulse 1.6s ease-in-out infinite; transform: rotate(var(--r)); } + .ps-card:hover, .ps-card:active, .ps-btn:active:not(:disabled), .ps-iconbtn:active:not(:disabled) { transform: none; } + .ps-seg-thumb, .ps-switch-knob { transition-duration: 1ms; } +} +@media (prefers-reduced-transparency: reduce) { + .ps-tabbar, .ps-toast, .ps-btn--glass, .ps-iconbtn--glass { background: var(--surface-raised); -webkit-backdrop-filter: none; backdrop-filter: none; } +} diff --git a/cabinet_service/static/press/fonts/Donbass-OFL.txt b/cabinet_service/static/press/fonts/Donbass-OFL.txt new file mode 100644 index 0000000..5f530f2 --- /dev/null +++ b/cabinet_service/static/press/fonts/Donbass-OFL.txt @@ -0,0 +1,97 @@ +Copyright 2026 The Donbass Project Authors. +Portions copyright 2021 The Onest Project Authors (https://github.com/simpals/onest). + +Donbass is a derivative of Onest, created under the terms of the SIL Open Font +License, Version 1.1. Modifications: renaming, weight-range selection, +per-weight tracking adjustments, and the addition of 10-degree oblique styles. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/cabinet_service/static/press/fonts/donbass-bold.woff2 b/cabinet_service/static/press/fonts/donbass-bold.woff2 new file mode 100644 index 0000000..82ccaf8 Binary files /dev/null and b/cabinet_service/static/press/fonts/donbass-bold.woff2 differ diff --git a/cabinet_service/static/press/fonts/donbass-medium.woff2 b/cabinet_service/static/press/fonts/donbass-medium.woff2 new file mode 100644 index 0000000..237598e Binary files /dev/null and b/cabinet_service/static/press/fonts/donbass-medium.woff2 differ diff --git a/cabinet_service/static/press/fonts/donbass-regular.woff2 b/cabinet_service/static/press/fonts/donbass-regular.woff2 new file mode 100644 index 0000000..95e6c75 Binary files /dev/null and b/cabinet_service/static/press/fonts/donbass-regular.woff2 differ diff --git a/cabinet_service/static/press/fonts/donbass-semibold.woff2 b/cabinet_service/static/press/fonts/donbass-semibold.woff2 new file mode 100644 index 0000000..cc60882 Binary files /dev/null and b/cabinet_service/static/press/fonts/donbass-semibold.woff2 differ diff --git a/cabinet_service/static/press/glass.js b/cabinet_service/static/press/glass.js new file mode 100644 index 0000000..b1a116e --- /dev/null +++ b/cabinet_service/static/press/glass.js @@ -0,0 +1,155 @@ +/* ИИ Пресс-секретарь — «жидкое стекло»: блик за курсором и смена темы кругом от кнопки. + Подключается в base.html и landing.html. Уважает «Уменьшить движение». */ +(function () { + var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + + function isDark() { + var t = document.documentElement.getAttribute('data-theme'); + if (t) return t === 'dark'; + return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; + } + function syncLabels() { + document.querySelectorAll('[data-theme-label]').forEach(function (el) { + el.textContent = isDark() ? 'Светлая тема' : 'Тёмная тема'; + }); + } + function applyTheme(next) { + document.documentElement.setAttribute('data-theme', next); + try { localStorage.setItem('theme', next); } catch (e) {} + syncLabels(); + } + + /* Смена темы: новая тема раскрывается кругом из точки нажатия */ + document.addEventListener('click', function (e) { + var btn = e.target.closest('[data-theme-toggle]'); + if (!btn) return; + var next = isDark() ? 'light' : 'dark'; + if (!document.startViewTransition || reduce) { applyTheme(next); return; } + var r = btn.getBoundingClientRect(); + var x = r.left + r.width / 2, y = r.top + r.height / 2; + var radius = Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y)); + document.documentElement.classList.add('is-theme-switch'); + var t = document.startViewTransition(function () { applyTheme(next); }); + t.ready.then(function () { + document.documentElement.animate( + { clipPath: ['circle(0 at ' + x + 'px ' + y + 'px)', 'circle(' + radius + 'px at ' + x + 'px ' + y + 'px)'] }, + { duration: 520, easing: 'cubic-bezier(0.32, 0.72, 0, 1)', pseudoElement: '::view-transition-new(root)' } + ); + }).catch(function () {}); + function done() { document.documentElement.classList.remove('is-theme-switch'); } + t.finished.then(done, done); + }); + document.addEventListener('DOMContentLoaded', syncLabels); + + /* Навигация: одна плашка на всё меню. При нажатии пункт становится активным в тот же кадр, + плашка едет к нему пружиной, а раздел тем временем загружается — ничего не ждёт анимацию. */ + function placeIndicator(nav, item, animate) { + var ind = nav.querySelector('.app-nav-indicator'); + if (!ind || !item) return; + var n = nav.getBoundingClientRect(), r = item.getBoundingClientRect(); + ind.classList.toggle('no-anim', !animate); + ind.style.setProperty('--nav-y', (r.top - n.top) + 'px'); + ind.style.height = r.height + 'px'; + ind.style.left = (r.left - n.left) + 'px'; + ind.style.width = r.width + 'px'; + ind.style.right = 'auto'; + ind.classList.add('is-ready'); + if (!animate) { void ind.offsetWidth; ind.classList.remove('no-anim'); } + } + function placeTab(bar, tab, animate) { + var ind = bar.querySelector('.app-tab-indicator'); + if (!ind || !tab) return; + var b = bar.getBoundingClientRect(), r = tab.getBoundingClientRect(); + ind.classList.toggle('no-anim', !animate); + ind.style.setProperty('--tab-x', (r.left - b.left) + 'px'); + ind.style.setProperty('--tab-w', r.width + 'px'); + ind.classList.add('is-ready'); + if (!animate) { void ind.offsetWidth; ind.classList.remove('no-anim'); } + } + function setActive(list, el) { + list.forEach(function (x) { x.classList.toggle('is-active', x === el); if (x === el) x.setAttribute('aria-current', 'page'); else x.removeAttribute('aria-current'); }); + } + function initNav() { + var nav = document.querySelector('[data-nav]'); + if (nav) { + var items = Array.prototype.slice.call(nav.querySelectorAll('a.ps-sidenav-item')); + placeIndicator(nav, nav.querySelector('.ps-sidenav-item.is-active'), false); + nav.addEventListener('pointerdown', function (e) { + var a = e.target.closest('a.ps-sidenav-item'); + if (!a || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey) return; + setActive(items, a); placeIndicator(nav, a, !reduce); + }); + nav.addEventListener('keydown', function (e) { + var a = e.target.closest('a.ps-sidenav-item'); + if (a && e.key === 'Enter') { setActive(items, a); placeIndicator(nav, a, !reduce); } + }); + window.addEventListener('resize', function () { placeIndicator(nav, nav.querySelector('.ps-sidenav-item.is-active'), false); }); + } + var bar = document.querySelector('[data-tabs]'); + if (bar) { + var tabs = Array.prototype.slice.call(bar.querySelectorAll('.ps-tab')); + placeTab(bar, bar.querySelector('.ps-tab.is-active'), false); + bar.addEventListener('pointerdown', function (e) { + var t = e.target.closest('a.ps-tab'); + if (!t || e.button !== 0) return; + setActive(tabs, t); placeTab(bar, t, !reduce); + }); + window.addEventListener('resize', function () { placeTab(bar, bar.querySelector('.ps-tab.is-active'), false); }); + } + /* Большой заголовок → компактная стеклянная панель, когда заголовок ушёл под край */ + var cb = document.querySelector('[data-compactbar]'); + var h1 = document.querySelector('.ps-main-head h1'); + if (cb && h1 && 'IntersectionObserver' in window) { + new IntersectionObserver(function (en) { + var stuck = !en[0].isIntersecting && en[0].boundingClientRect.top < 0; + cb.classList.toggle('is-stuck', stuck); + cb.setAttribute('aria-hidden', stuck ? 'false' : 'true'); + }, { rootMargin: '-52px 0px 0px 0px', threshold: 0 }).observe(h1); + } + } + if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initNav); else initNav(); + /* Возврат «Назад» из кэша страниц — плашку на место без анимации */ + window.addEventListener('pageshow', function (e) { + if (!e.persisted) return; + var nav = document.querySelector('[data-nav]'), bar = document.querySelector('[data-tabs]'); + var path = location.pathname; + if (nav) { + var cur = nav.querySelector('a.ps-sidenav-item[aria-current]'); + /* после «Назад» активен пункт текущего адреса, а не нажатый перед уходом */ + nav.querySelectorAll('a.ps-sidenav-item').forEach(function (a) { + (a.getAttribute('data-prefixes') || a.getAttribute('href')).split(' ').forEach(function (p) { + if (path === p || path.indexOf(p + '/') === 0) cur = a; + }); + }); + if (cur) { setActive(Array.prototype.slice.call(nav.querySelectorAll('a.ps-sidenav-item')), cur); placeIndicator(nav, cur, false); } + } + if (bar) { + var tabs = Array.prototype.slice.call(bar.querySelectorAll('a.ps-tab')), hit = null; + tabs.forEach(function (t) { + (t.getAttribute('data-prefixes') || '').split(' ').forEach(function (p) { if (p && (path === p || path.indexOf(p + '/') === 0)) hit = t; }); + }); + var more = bar.querySelector('button.ps-tab'); + var target = hit || more; + Array.prototype.slice.call(bar.querySelectorAll('.ps-tab')).forEach(function (t) { + t.classList.toggle('is-active', t === target); + if (t === target && t.tagName === 'A') t.setAttribute('aria-current', 'page'); else t.removeAttribute('aria-current'); + }); + placeTab(bar, target, false); + } + }); + + /* Блик на стекле: светлое пятно следует за курсором */ + if (reduce) return; + document.addEventListener('pointermove', function (e) { + var g = e.target.closest && e.target.closest('.app-glass'); + if (!g) return; + var r = g.getBoundingClientRect(); + g.style.setProperty('--glass-x', (e.clientX - r.left) + 'px'); + g.style.setProperty('--glass-y', (e.clientY - r.top) + 'px'); + g.classList.add('is-lit'); + }, { passive: true }); + document.addEventListener('pointerout', function (e) { + var g = e.target.closest && e.target.closest('.app-glass'); + if (g && !g.contains(e.relatedTarget)) g.classList.remove('is-lit'); + }); +})(); diff --git a/cabinet_service/static/press/hero-bg.js b/cabinet_service/static/press/hero-bg.js new file mode 100644 index 0000000..31a02ca --- /dev/null +++ b/cabinet_service/static/press/hero-bg.js @@ -0,0 +1,174 @@ +/* ИИ Пресс-секретарь — фон первого экрана лендинга. + Направление — сдержанность: один крупный целый знак справа, как одноцветная версия логотипа + (листы одного тона, тени приглушают лист, а не вырезают его). Знак покачивается ±2,5°, дышит масштабом ±2,5%, раз в цикл по нему проходит блик. + Фактура — сетка 12 колонок по контейнеру. Время суток (data-daypart у .lp-hero) меняет свет градиента + и раскрытие веера; ночью — редкие звёзды. Левая половина под текстом остаётся чистой. + Всё движение — синусы одной фазы цикла (24 с), поэтому цикл бесшовный. + ?t=N замораживает кадр (для проверки), «Уменьшить движение» — один статичный кадр, пауза вне экрана и на скрытой вкладке. */ +(function () { + var hero = document.querySelector('.lp-hero'); + var canvas = hero && hero.querySelector('.lp-bg'); + if (!canvas || !canvas.getContext) return; + var ctx = canvas.getContext('2d'); + var off = document.createElement('canvas'); // слой знака: собираем без нахлёста, кладём с одной прозрачностью + var PERIOD = 24; // секунд в цикле + var TAU = Math.PI * 2; + var reduce = window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches; + var freeze = new URLSearchParams(location.search).get('t'); + + /* Параметры суток: градиент (3 точки), раскрытие веера, свет, плотность постов */ + var DAY = { + morning: { g: ['#56c6f2', '#1d71b8', '#1b5fa6'], open: 0.62, breathe: 0.22, sun: 1, horizon: 0, posts: 3, laps: 1, stars: 0, windows: 0 }, + day: { g: ['#009fe3', '#1d71b8', '#1a63aa'], open: 0.92, breathe: 0.08, sun: 0, horizon: 0, posts: 6, laps: 2, stars: 0, windows: 0 }, + evening: { g: ['#1590d8', '#1d71b8', '#2b3f97'], open: 0.6, breathe: 0.12, sun: 2, horizon: 1, posts: 3, laps: 1, stars: 0, windows: 6 }, + night: { g: ['#1d71b8', '#22337e', '#312783'], open: 0.32, breathe: 0.06, sun: 0, horizon: 0, posts: 1, laps: 1, stars: 1, windows: 14 } + }; + var part = hero.getAttribute('data-daypart') || 'day'; + var P = DAY[part] || DAY.day; + + /* Знак — настоящие контуры логотипа (координаты исходника 5669×5669). + Три группы по порядку наложения: правый лист (задний), средний с тенью на правом, левый (передний) с тенью на среднем. */ + var GLYPH = [ + { side: 1, sheets: ["M3720.19,2839.18l-572.18,1154.71-60.86,122.81-329.71-882.38c-1.19-3.17-2.33-6.37-3.44-9.59l71.95-505.75c42.35-78.96,97.59-152.06,163.21-211.45l541.2-489.89,66.89,74.35,87.56,97.32c124.93,138.85,141.13,436.45,35.38,649.87Z", "M4723.87,3339.65l-1093.38,989.71c-87.45,79.16-182.61,115.97-254.55,98.46-48.02-11.69-83.39-47.1-105.12-105.25l-26.86-71.89c.21-.42.41-.83.62-1.25l654.81-1321.45c67.88-136.98,99.36-301.15,88.64-462.25-11.04-166.03-65.93-311.7-154.54-410.19l-87.97-97.77,404.13-365.81c87.45-79.16,182.61-115.97,254.55-98.46,48.02,11.69,83.39,47.1,105.11,105.25l419.71,1123.26c65.38,174.96-28.57,457.81-205.15,617.64Z"], shades: [] }, + { side: 0, sheets: ["M1926.21,3394.65c-124.93-138.85-141.13-436.46-35.38-649.87l353.54-713.47-86.91-49.82-356.23,718.89c-124.39,251.03-101.72,591.81,50.64,761.15l574.59,638.64,18.48-128.96-518.73-576.56ZM3684.81,2189.31l-87.56-97.32-66.89-74.35-66.89-74.34-580.67-645.4c-36.29-40.34-75.92-60.7-118.03-60.7-6.06,0-12.17.42-18.34,1.27-73.35,10.06-148.41,79.17-200.79,184.86l-212.3,428.44,153.87,88.2c114.94,65.89,212.58,187.13,274.93,341.4,33.16,82.06,54.57,168.96,63.58,255.66,6.36,61.34,6.52,122.59.23,181.95l-71.95,505.75-29.64,206.77-105.14,733.41,109,121.15c36.29,40.34,75.92,60.7,118.03,60.7,6.06,0,12.17-.42,18.34-1.27,55.4-7.6,111.78-48.89,158.62-114.18,15.18-21.15,29.35-44.82,42.17-70.68l21.77-43.93,60.86-122.81,572.18-1154.71c105.75-213.42,89.55-511.02-35.38-649.87Z"], shades: ["M3056.27,2581.67l540.98-489.68-66.89-74.35-66.89-74.34-541.42,490.09c-34.48,31.22-66.75,66.01-96.33,103.64,6.36,61.34,6.52,122.59.23,181.95l-71.95,505.75-29.64,206.77,298.85,799.81c15.18-21.15,29.35-44.82,42.17-70.68l21.77-43.93,60.86-122.81-296.9-794.57c-65.37-174.97,28.58-457.81,205.16-617.65Z"] }, + { side: -1, sheets: ["M2624.35,2719.79l-179.41,1251.42-18.48,128.96-11.4,79.49c-2.35,16.38-5.34,32.21-8.94,47.42-22.07,93.22-66.84,162.99-124.06,190.91-18.29,8.93-37.5,13.39-57.54,13.38-28.6,0-58.89-9.09-90.56-27.24l-1040.33-596.3c-162.04-92.88-270.39-370.53-236.59-606.3l209.28-1459.87c16.74-116.76,66.46-205.86,133-238.33,18.3-8.92,37.51-13.38,57.55-13.38,28.6,0,58.88,9.09,90.56,27.24l723.11,414.48,86.92,49.82,86.91,49.82,143.38,82.18c162.05,92.88,270.39,370.53,236.6,606.3Z"], shades: ["M1926.21,3394.65c-124.93-138.85-141.13-436.46-35.38-649.87l353.54-713.47-86.91-49.82-86.92-49.82-358.91,724.31c-67.88,136.98-99.36,301.15-88.64,462.25,11.04,166.02,65.93,311.7,154.54,410.19l628.59,698.66c3.6-15.21,6.59-31.04,8.94-47.42l11.4-79.49,18.48-128.96-518.73-576.56Z", "M2754,3224.73l68.32-476.56c1.39-9.67,2.6-19.4,3.63-29.19l-71.95,505.75Z"] } + ]; + var GLYPH_PIVOT = { x: 2900, y: 4450 }, GLYPH_TOP = 1237, GLYPH_H = 4431 - 1237; + var GPATH = (typeof Path2D === 'function') ? GLYPH.map(function (g) { + return { side: g.side, sheets: g.sheets.map(function (p) { return new Path2D(p); }), shades: g.shades.map(function (p) { return new Path2D(p); }) }; + }) : null; + + /* Детерминированный генератор — звёзды и окна одинаковы между кадрами и заморозками */ + function rng(seed) { return function () { seed = (seed * 16807) % 2147483647; return (seed - 1) / 2147483646; }; } + + var W = 0, H = 0, dpr = 1, stars = [], wins = [], cols = [], cardX = 0, cardW = 0; + + function layout() { + var r = hero.getBoundingClientRect(); + dpr = Math.min(window.devicePixelRatio || 1, 2); + W = Math.max(1, Math.round(r.width)); H = Math.max(1, Math.round(r.height)); + canvas.width = Math.round(W * dpr); canvas.height = Math.round(H * dpr); + off.width = canvas.width; off.height = canvas.height; + canvas.style.width = W + 'px'; canvas.style.height = H + 'px'; + ctx.setTransform(dpr, 0, 0, dpr, 0, 0); + /* Колонки сетки — ровно по контейнеру страницы (1200, поля 32/16) */ + var container = hero.querySelector('.lp-container'); + var cr = container.getBoundingClientRect(); + var pad = parseFloat(getComputedStyle(container).paddingLeft) || 0; + var left = cr.left - r.left + pad, width = cr.width - pad * 2; + cols = []; + for (var i = 0; i <= 12; i++) cols.push(left + width * i / 12); + /* Центр карточки примера — ось веера: карточка «вырастает» из знака */ + var card = hero.querySelector('.lp-demo .ps-post') || hero.querySelector('.lp-demo'); + if (card) { var k = card.getBoundingClientRect(); cardX = k.left - r.left + k.width / 2; cardW = k.width; } + else { cardX = W * 0.72; cardW = W * 0.3; } + var R = rng(part.length * 97 + 13); + stars = []; + for (var s = 0; s < 46; s++) stars.push({ x: R() * W, y: R() * H * 0.8, r: 0.6 + R() * 1.4, k: 1 + Math.floor(R() * 3), o: R() }); + wins = []; + var row = H / 6; + for (var w = 0; w < P.windows; w++) wins.push({ c: 6 + Math.floor(R() * 6), y: Math.round(1 + R() * 4) * row, o: R(), k: 1 + Math.floor(R() * 2) }); + } + + function roundRect(x, y, w, h, rad) { + ctx.beginPath(); + ctx.moveTo(x + rad, y); ctx.lineTo(x + w - rad, y); ctx.quadraticCurveTo(x + w, y, x + w, y + rad); + ctx.lineTo(x + w, y + h - rad); ctx.quadraticCurveTo(x + w, y + h, x + w - rad, y + h); + ctx.lineTo(x + rad, y + h); ctx.quadraticCurveTo(x, y + h, x, y + h - rad); + ctx.lineTo(x, y + rad); ctx.quadraticCurveTo(x, y, x + rad, y); ctx.closePath(); + } + + function draw(t) { + var ph = (t % PERIOD) / PERIOD * TAU; // фаза цикла 0..2π + ctx.clearRect(0, 0, W, H); + + /* 1. Свет: градиент 200° — светлая сторона справа сверху, глубокая слева снизу (под текстом) */ + var a = 245 * Math.PI / 180, cx = W / 2, cy = H / 2, len = Math.abs(W * Math.sin(a)) + Math.abs(H * Math.cos(a)); + var gx = Math.sin(a) * len / 2, gy = -Math.cos(a) * len / 2; + var g = ctx.createLinearGradient(cx - gx, cy - gy, cx + gx, cy + gy); + g.addColorStop(0, P.g[0]); g.addColorStop(0.62, P.g[1]); g.addColorStop(1, P.g[2]); + ctx.fillStyle = g; ctx.fillRect(0, 0, W, H); + + /* 2. Фактура: колонки сетки по контейнеру, едва заметно */ + ctx.strokeStyle = 'rgba(255,255,255,0.05)'; ctx.lineWidth = 1; + for (var i = 0; i < cols.length; i++) { var x = Math.round(cols[i]) + 0.5; ctx.beginPath(); ctx.moveTo(x, 0); ctx.lineTo(x, H); ctx.stroke(); } + + /* Ночь: редкие звёзды в правой половине, мерцание на кратных частотах фазы */ + if (P.stars) { + for (var s = 0; s < stars.length; s++) { + var st = stars[s]; + if (st.x < W * 0.5) continue; + var tw = 0.4 + 0.6 * (0.5 + 0.5 * Math.sin(ph * st.k + st.o * TAU)); + ctx.fillStyle = 'rgba(255,255,255,' + (0.5 * tw).toFixed(3) + ')'; + ctx.beginPath(); ctx.arc(st.x, st.y, st.r * 0.8, 0, TAU); ctx.fill(); + } + } + + /* 3. Знак — одноцветная версия логотипа целиком: белые листы, тени вырезаны (зазоры между листами). + Знак не разбирается на части — в исходнике листы хранятся видимыми кусками, и при раздельном повороте + вылезают рваные края. Движение — у знака целиком: покачивание вокруг оси ±2,5°, дыхание масштаба ±2,5%, + раз в цикл по знаку проходит мягкий блик. Слой собирается отдельно и кладётся с одной прозрачностью. */ + if (!GPATH) return; + var narrow = W < 960; + var base = (narrow ? Math.min(H * 0.5, W * 0.8) : H * 1.15) / GLYPH_H; + var breathe = 1 + 0.025 * Math.sin(ph); + var gScale = base * breathe; + var gw = 4100 * base; // ширина знака в исходнике ≈ 4100 + var px = narrow ? W - gw * 0.34 : Math.min(W - gw * 0.24, cardX + cardW * 0.34); + var py = H + GLYPH_H * base * 0.04; + var sway = Math.sin(ph + Math.PI / 3) * 2.5 * Math.PI / 180; + var oc = off.getContext('2d'); + oc.setTransform(1, 0, 0, 1, 0, 0); oc.clearRect(0, 0, off.width, off.height); + oc.setTransform(dpr, 0, 0, dpr, 0, 0); + oc.save(); + oc.translate(px, py); oc.rotate(sway); oc.scale(gScale, gScale); + oc.translate(-GLYPH_PIVOT.x, -GLYPH_PIVOT.y); + oc.fillStyle = '#ffffff'; + for (var gi = 0; gi < GPATH.length; gi++) for (var si = 0; si < GPATH[gi].sheets.length; si++) oc.fill(GPATH[gi].sheets[si]); + /* Тени не вырезают лист, а приглушают его на 45% — как в цветном логотипе: листы целые, глубина видна */ + oc.globalCompositeOperation = 'destination-out'; + oc.globalAlpha = 0.45; + for (var gj = 0; gj < GPATH.length; gj++) for (var sk = 0; sk < GPATH[gj].shades.length; sk++) oc.fill(GPATH[gj].shades[sk]); + oc.globalAlpha = 1; + oc.restore(); + /* Блик: полоса идёт слева направо один раз за цикл, начинается и заканчивается за пределами знака */ + var u = (ph / TAU); + var left = px - gw * 0.9, right = px + gw * 0.9; + var bx = left + (right - left) * u; + var band = gw * 0.35; + var sg = oc.createLinearGradient(bx - band, py - band * 0.6, bx + band, py + band * 0.6); // наклон от ширины полосы, не от высоты экрана + sg.addColorStop(0, 'rgba(255,255,255,0)'); sg.addColorStop(0.5, 'rgba(255,255,255,1)'); sg.addColorStop(1, 'rgba(255,255,255,0)'); + oc.save(); + oc.globalCompositeOperation = 'source-atop'; + oc.globalAlpha = 0.9; + oc.fillStyle = sg; oc.fillRect(0, 0, W, H); + oc.restore(); + ctx.save(); + ctx.setTransform(1, 0, 0, 1, 0, 0); + /* основной тон знака; блик внутри слоя добавляет до +60% к яркости на своей полосе */ + ctx.globalAlpha = P.stars ? 0.1 : 0.12; + ctx.drawImage(off, 0, 0); + ctx.restore(); + } + + var running = !reduce && freeze === null, visible = true, start = performance.now(); + function loop(now) { + if (running && visible && !document.hidden) draw((now - start) / 1000); + requestAnimationFrame(loop); + } + function init() { + layout(); + if (freeze !== null) { draw(parseFloat(freeze) || 0); window.__ready = true; return; } + if (reduce) { draw(PERIOD * 0.25); return; } // статичный кадр + requestAnimationFrame(loop); + } + function relayout() { layout(); if (!running) draw(freeze !== null ? parseFloat(freeze) || 0 : PERIOD * 0.25); } + window.addEventListener('resize', relayout); + /* Высота первого экрана меняется вместе с примером поста — холст следует за ней */ + if ('ResizeObserver' in window) { + var lastH = 0; + new ResizeObserver(function (en) { var h = Math.round(en[0].contentRect.height); if (h !== lastH) { lastH = h; relayout(); } }).observe(hero); + } + if ('IntersectionObserver' in window) new IntersectionObserver(function (e) { visible = e[0].isIntersecting; }).observe(hero); + if (document.fonts && document.fonts.ready) document.fonts.ready.then(init); else init(); +})(); diff --git a/cabinet_service/static/press/tokens.css b/cabinet_service/static/press/tokens.css new file mode 100644 index 0000000..40dc633 --- /dev/null +++ b/cabinet_service/static/press/tokens.css @@ -0,0 +1,215 @@ +/* ИИ Пресс-секретарь — токены дизайн-системы. Сгенерировано из tokens.json. */ + +@font-face { + font-family: "Donbass"; + src: url("fonts/donbass-regular.woff2") format("woff2"); + font-weight: 400; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: "Donbass"; + src: url("fonts/donbass-medium.woff2") format("woff2"); + font-weight: 500; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: "Donbass"; + src: url("fonts/donbass-semibold.woff2") format("woff2"); + font-weight: 600; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: "Donbass"; + src: url("fonts/donbass-bold.woff2") format("woff2"); + font-weight: 700; + font-style: normal; + font-display: swap; +} + +:root { + --surface: #f4f7fb; + --surface-raised: #ffffff; + --surface-sunken: #e9eff6; + --surface-glass: rgba(255, 255, 255, 0.72); + --hairline: #d6e0ec; + --border-strong: #7d8fa8; + --ink: #0e1b2e; + --ink-secondary: #46566c; + --ink-tertiary: #5d6d84; + --brand: #1d71b8; + --brand-pressed: #175e9a; + --brand-bright: #009fe3; + --logo-deep: #1d71b8; + --logo-shade: #312783; + --brand-tint: #e9f4fc; + --on-brand: #ffffff; + --indigo: #312783; + --indigo-tint: #ecebfa; + --pillar-1: var(--brand); + --pillar-1-tint: var(--brand-tint); + --pillar-2: #0b6b78; + --pillar-2-tint: #e0f2f4; + --pillar-3: #a12a6c; + --pillar-3-tint: #fbe8f2; + --success: #0b7552; + --success-tint: #e1f3eb; + --warning: #8f5300; + --warning-tint: #fcf0dc; + --danger: #b83710; + --danger-tint: #fce8e1; + --focus: var(--brand); + --scrim: rgba(14, 27, 46, 0.36); + --glass-edge: rgba(255, 255, 255, 0.75); + --glass-sheen: rgba(255, 255, 255, 0.55); + --ambient-1: rgba(0, 159, 227, 0.22); + --ambient-2: rgba(49, 39, 131, 0.12); + --ambient-3: rgba(29, 113, 184, 0.16); + --space-1: 4px; + --space-2: 8px; + --space-3: 12px; + --space-4: 16px; + --space-5: 20px; + --space-6: 24px; + --space-8: 32px; + --space-12: 48px; + --space-16: 64px; + --inset-badge: 8px; + --inset-control: 12px; + --inset-card: 20px; + --inset-panel: 24px; + --gap-icon: 8px; + --gap-row: 12px; + --stack-text: 4px; + --stack-group: 16px; + --stack-section: 32px; + --page-gutter: 32px; + --radius-xs: 8px; + --radius-sm: 12px; + --radius-md: 16px; + --radius-lg: 22px; + --radius-xl: 28px; + --radius-pill: 999px; + --target-min: 44px; + --control-sm: 36px; + --control-md: 44px; + --control-lg: 52px; + --icon-sm: 16px; + --icon-md: 20px; + --icon-lg: 24px; + --tile-sm: 32px; + --tile-md: 40px; + --tile-lg: 44px; + --dur-tap: 120ms; + --dur-move: 240ms; + --dur-sheet: 380ms; + --dur-think: 1400ms; + --dur-snappy: 320ms; + --dur-smooth: 440ms; + --dur-bouncy: 520ms; + --ease-soft: cubic-bezier(0.32, 0.72, 0, 1); + --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1); + --ease-standard: cubic-bezier(0.2, 0, 0, 1); + --spring-snappy: linear(0, 0.0383, 0.1297, 0.2472, 0.3722, 0.493, 0.6027, 0.6978, 0.7773, 0.8416, 0.8921, 0.9306, 0.959, 0.9793, 0.9931, 1.0021, 1.0074, 1.0101, 1.0111, 1.0109, 1.01, 1.0087, 1.0073, 1.006, 1.0047, 1.0036, 1.0027, 1.0019, 1); + --spring-smooth: linear(0, 0.0435, 0.1411, 0.259, 0.3782, 0.4888, 0.5862, 0.6691, 0.7381, 0.7944, 0.8397, 0.8757, 0.9041, 0.9264, 0.9437, 0.9571, 0.9674, 0.9753, 0.9813, 0.9859, 0.9894, 0.992, 0.994, 0.9955, 0.9967, 0.9975, 0.9981, 0.9986, 1); + --spring-bouncy: linear(0, 0.0666, 0.2222, 0.413, 0.6018, 0.7662, 0.8954, 0.9872, 1.0448, 1.0745, 1.0835, 1.0787, 1.0661, 1.0502, 1.0344, 1.0205, 1.0094, 1.0015, 0.9965, 0.9939, 0.993, 0.9934, 0.9944, 0.9957, 0.997, 0.9982, 0.9992, 0.9998, 1); + --blur-glass: 24px; + --shadow-1: 0 0.5px 1px rgba(14, 27, 46, 0.06), 0 2px 8px rgba(14, 27, 46, 0.04); + --shadow-2: 0 1px 2px rgba(14, 27, 46, 0.06), 0 10px 28px -6px rgba(29, 113, 184, 0.18); + --shadow-float: 0 2px 6px rgba(14, 27, 46, 0.06), 0 24px 56px -12px rgba(14, 27, 46, 0.22); + --font-display: Donbass, "SF Pro Rounded", -apple-system, "Segoe UI", system-ui, sans-serif; + --font-text: Donbass, -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif; + color-scheme: light; +} + +:root[data-theme="dark"] { + --surface: #0a1322; + --surface-raised: #121e33; + --surface-sunken: #060c17; + --surface-glass: rgba(18, 30, 51, 0.72); + --hairline: #24344d; + --border-strong: #647a99; + --ink: #eaf1fa; + --ink-secondary: #a9b8cc; + --ink-tertiary: #8a9bb3; + --brand: #4cb3f0; + --brand-pressed: #7cc7f4; + --brand-bright: #009fe3; + --logo-deep: #1d71b8; + --logo-shade: #312783; + --brand-tint: #13304f; + --on-brand: #04182b; + --indigo: #a49df2; + --indigo-tint: #211c4a; + --pillar-1: var(--brand); + --pillar-1-tint: var(--brand-tint); + --pillar-2: #5fcfdc; + --pillar-2-tint: #0e2c31; + --pillar-3: #f390c6; + --pillar-3-tint: #371429; + --success: #4fd1a1; + --success-tint: #0f2e25; + --warning: #f2b765; + --warning-tint: #33240d; + --danger: #ff9370; + --danger-tint: #3a1a12; + --focus: var(--brand); + --scrim: rgba(0, 0, 0, 0.56); + --glass-edge: rgba(255, 255, 255, 0.12); + --glass-sheen: rgba(164, 210, 255, 0.16); + --ambient-1: rgba(0, 159, 227, 0.18); + --ambient-2: rgba(164, 157, 242, 0.12); + --ambient-3: rgba(29, 113, 184, 0.2); + --shadow-1: 0 0.5px 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3); + --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px -6px rgba(0, 0, 0, 0.55); + --shadow-float: 0 2px 6px rgba(0, 0, 0, 0.5), 0 24px 56px -12px rgba(0, 0, 0, 0.7); + color-scheme: dark; +} + +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + --surface: #0a1322; + --surface-raised: #121e33; + --surface-sunken: #060c17; + --surface-glass: rgba(18, 30, 51, 0.72); + --hairline: #24344d; + --border-strong: #647a99; + --ink: #eaf1fa; + --ink-secondary: #a9b8cc; + --ink-tertiary: #8a9bb3; + --brand: #4cb3f0; + --brand-pressed: #7cc7f4; + --brand-bright: #009fe3; + --logo-deep: #1d71b8; + --logo-shade: #312783; + --brand-tint: #13304f; + --on-brand: #04182b; + --indigo: #a49df2; + --indigo-tint: #211c4a; + --pillar-1: var(--brand); + --pillar-1-tint: var(--brand-tint); + --pillar-2: #5fcfdc; + --pillar-2-tint: #0e2c31; + --pillar-3: #f390c6; + --pillar-3-tint: #371429; + --success: #4fd1a1; + --success-tint: #0f2e25; + --warning: #f2b765; + --warning-tint: #33240d; + --danger: #ff9370; + --danger-tint: #3a1a12; + --focus: var(--brand); + --scrim: rgba(0, 0, 0, 0.56); + --glass-edge: rgba(255, 255, 255, 0.12); + --glass-sheen: rgba(164, 210, 255, 0.16); + --ambient-1: rgba(0, 159, 227, 0.18); + --ambient-2: rgba(164, 157, 242, 0.12); + --ambient-3: rgba(29, 113, 184, 0.2); + --shadow-1: 0 0.5px 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3); + --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px -6px rgba(0, 0, 0, 0.55); + --shadow-float: 0 2px 6px rgba(0, 0, 0, 0.5), 0 24px 56px -12px rgba(0, 0, 0, 0.7); + color-scheme: dark; + } +} diff --git a/cabinet_service/static/style.css b/cabinet_service/static/style.css index 176bddc..dd29592 100644 --- a/cabinet_service/static/style.css +++ b/cabinet_service/static/style.css @@ -1,1209 +1,726 @@ +/* ИИ Пресс-секретарь — стили кабинета. + Токены — static/press/tokens.css, компоненты ps-* — static/press/components.css. + Здесь: каркас страницы и старые классы шаблонов, переведённые на токены. */ + +/* Старые имена переменных → токены дизайн-системы (для inline-стилей в шаблонах) */ :root { - --bg: #f4f5f7; - --surface: #ffffff; - --border: #e2e5ea; - --border-strong: #d1d5db; - --text: #1f2328; - --text-muted: #4b5563; - --text-faint: #6b7280; - --accent: #2563eb; - --accent-hover: #1d4ed8; - --accent-soft: #eef2ff; - --accent-soft-border: #c7d2fe; - --accent-soft-hover: #e0e7ff; - --danger: #dc2626; - --danger-hover: #b91c1c; - --danger-text: #b91c1c; - --success-bg: #ecfdf3; - --success-border: #a7e3bb; - --success-text: #14532d; - --warn-bg: #fffbeb; - --warn-border: #fde68a; - --warn-text: #78350f; - --error-bg: #fef2f2; - --error-border: #f3b4b4; - --error-text: #7f1d1d; - --table-head: #f9fafb; - --badge-bg: #f3f4f6; - --badge-text: #374151; - --input-bg: #ffffff; - --published-surface: #fafefb; - color-scheme: light; + --bg: var(--surface); + --bg-secondary: var(--surface-sunken); + --border: var(--hairline); + --text: var(--ink); + --text-muted: var(--ink-secondary); + --text-faint: var(--ink-tertiary); + --accent: var(--brand); + --accent-hover: var(--brand-pressed); + --accent-soft: var(--brand-tint); + --accent-bg: var(--brand-tint); + --accent-soft-border: var(--brand); + --input-bg: var(--surface-raised); + --success-text: var(--success); } -:root[data-theme="dark"] { - --bg: #0f172a; - --surface: #1e293b; - --border: #334155; - --border-strong: #475569; - --text: #e2e8f0; - --text-muted: #94a3b8; - --text-faint: #94a3b8; - --accent: #60a5fa; - --accent-hover: #93c5fd; - --accent-soft: #172554; - --accent-soft-border: #1e40af; - --accent-soft-hover: #1e3a8a; - --danger: #ef4444; - --danger-hover: #f87171; - --danger-text: #f87171; - --success-bg: #064e3b; - --success-border: #059669; - --success-text: #a7f3d0; - --warn-bg: #451a03; - --warn-border: #b45309; - --warn-text: #fde68a; - --error-bg: #450a0a; - --error-border: #991b1b; - --error-text: #fecaca; - --table-head: #243244; - --badge-bg: #334155; - --badge-text: #e2e8f0; - --input-bg: #0f172a; - --published-surface: #0b2e22; - color-scheme: dark; -} +* { box-sizing: border-box; } -@media (prefers-color-scheme: dark) { - :root:not([data-theme]) { - --bg: #0f172a; - --surface: #1e293b; - --border: #334155; - --border-strong: #475569; - --text: #e2e8f0; - --text-muted: #94a3b8; - --text-faint: #94a3b8; - --accent: #60a5fa; - --accent-hover: #93c5fd; - --accent-soft: #172554; - --accent-soft-border: #1e40af; - --accent-soft-hover: #1e3a8a; - --danger: #ef4444; - --danger-hover: #f87171; - --danger-text: #f87171; - --success-bg: #064e3b; - --success-border: #059669; - --success-text: #a7f3d0; - --warn-bg: #451a03; - --warn-border: #b45309; - --warn-text: #fde68a; - --error-bg: #450a0a; - --error-border: #991b1b; - --error-text: #fecaca; - --table-head: #243244; - --badge-bg: #334155; - --badge-text: #e2e8f0; - --input-bg: #0f172a; - --published-surface: #0b2e22; - color-scheme: dark; - } -} - -* { - box-sizing: border-box; -} +html { -webkit-text-size-adjust: 100%; } body { margin: 0; - font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; - background: var(--bg); - color: var(--text); - transition: background-color 0.2s ease, color 0.2s ease; -} - -a { - color: var(--accent); - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -/* === Sidebar === */ - -.sidebar { - position: fixed; - top: 0; - left: 0; - width: 220px; - height: 100vh; + font: 400 15px/22px var(--font-text); background: var(--surface); - border-right: 1px solid var(--border); - display: flex; - flex-direction: column; - z-index: 100; - overflow-y: auto; - transition: transform 0.25s ease, background-color 0.2s ease; + color: var(--ink); + -webkit-font-smoothing: antialiased; + /* Без автоматических переносов: браузер переносит по своему словарю, не по правилам русской типографики. + Слово уходит на новую строку целиком; не помещающееся в ширину (ссылка) — переносится, чтобы не вылезти за край. */ + hyphens: manual; + overflow-wrap: break-word; } -.sidebar-brand { - display: flex; - align-items: center; - gap: 10px; - padding: 20px 18px 16px; - font-weight: 700; - font-size: 1.1rem; - color: var(--text); - text-decoration: none; - border-bottom: 1px solid var(--border); - flex-shrink: 0; +a { color: var(--brand); text-decoration: none; } +a:hover { text-decoration: underline; } +a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; } +img { max-width: 100%; } +[hidden] { display: none !important; } + +.inline-form { display: inline; margin: 0; } +.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } + +/* ================= Каркас кабинета ================= */ + +.app-shell { min-height: 100vh; min-height: 100dvh; } + +.app-sidenav { + position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; +} +.app-sidenav .ps-sidenav-item { text-decoration: none; } +.app-sidenav-foot { margin-top: auto; display: grid; gap: var(--space-3); } +.app-sidenav-foot .ps-sidenav-persona { margin-top: 0; text-decoration: none; } +.ps-sidenav-persona:hover { background: var(--brand-tint); text-decoration: none; } +.app-logo-link { display: inline-flex; text-decoration: none !important; } +a.ps-sidenav-item, a.ps-tab { text-decoration: none !important; } +.inline-form .ps-sidenav-item { width: 100%; } + +.app-body { flex: 1; min-width: 0; display: flex; flex-direction: column; } +.app-main { width: 100%; max-width: 1680px; padding-bottom: var(--space-16); } + +.app-topbar { display: none; } +.app-tabbar { display: none; } + +/* Лист «Ещё» на телефоне */ +.app-sheet { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-end; justify-content: center; } +.app-sheet-scrim { position: absolute; inset: 0; background: var(--scrim); } +.app-sheet-panel { + position: relative; width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto; + padding: var(--space-5) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom)); + border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--surface-raised); box-shadow: var(--shadow-float); + animation: ps-rise var(--dur-sheet) var(--ease-soft); +} +.app-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); } +/* В листе подписи пунктов видны всегда (узкая боковая навигация их прячет) */ +.app-sheet .ps-sidenav-item { justify-content: flex-start; padding: 0 var(--space-3); } +.app-sheet .ps-sidenav-item > span { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; } + +/* Тосты */ +.app-toasts { + position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: 400; + display: grid; gap: var(--space-3); justify-items: end; pointer-events: none; +} +.app-toasts .ps-toast { pointer-events: auto; } + +/* Ошибки формы */ +.app-alert { + display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); + border-radius: var(--radius-md); background: var(--danger-tint); color: var(--danger); font: 500 15px/22px var(--font-text); +} +.app-alert-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--surface-raised); } +.app-alert ul { margin: 5px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; } +.app-alert--info { background: var(--brand-tint); color: var(--ink); } +.app-alert--info .app-alert-icon { color: var(--brand); } +.app-alert--warning { background: var(--warning-tint); color: var(--ink); } +.app-alert--warning .app-alert-icon { color: var(--warning); } + +/* Рабочая область уже 900px из-за боковой навигации — две колонки собираются в одну */ +@media (max-width: 1199px) { + .app-main .ps-split, .app-main .ps-split.ps-split--start { grid-template-columns: minmax(0, 1fr); } + .app-survey-aside { position: static; } + .app-survey-layout > .app-survey-aside { order: 0; } } -.sidebar-brand:hover { - text-decoration: none; +@media (max-width: 1023px) { + .app-sidenav-foot .ps-sidenav-list .ps-sidenav-item { justify-content: center; padding: 0; } + .app-sidenav-foot .ps-sidenav-item > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } + .app-sidenav-foot .ps-sidenav-persona > .ps-icon { display: none; } } -.sidebar-brand-icon { - width: 22px; - height: 22px; - flex-shrink: 0; -} - -.sidebar-nav { - display: flex; - flex-direction: column; - gap: 2px; - padding: 12px 10px; - flex: 1; -} - -.sidebar-link { - display: flex; - align-items: center; - gap: 10px; - padding: 9px 12px; - border-radius: 8px; - font-size: 0.9rem; - color: var(--text-muted); - text-decoration: none; - transition: background-color 0.15s ease, color 0.15s ease; - border: none; - background: none; - font: inherit; - cursor: pointer; - width: 100%; - text-align: left; -} - -.sidebar-link svg { - width: 18px; - height: 18px; - flex-shrink: 0; - stroke-width: 1.8; -} - -.sidebar-link:hover { - background: var(--accent-soft); - color: var(--accent); - text-decoration: none; -} - -.sidebar-link.active { - background: var(--accent-soft); - color: var(--accent); - font-weight: 500; -} - -.sidebar-divider { - height: 1px; - background: var(--border); - margin: 6px 12px; -} - -.sidebar-footer { - padding: 10px; - border-top: 1px solid var(--border); - display: flex; - flex-direction: column; - gap: 2px; - flex-shrink: 0; -} - -.sidebar-form { - margin: 0; - padding: 0; -} - -.sidebar-toggle { - display: none; - position: fixed; - top: 14px; - left: 14px; - z-index: 200; - width: 40px; - height: 40px; - border-radius: 10px; - border: 1px solid var(--border); - background: var(--surface); - color: var(--text); - cursor: pointer; - align-items: center; - justify-content: center; - transition: background-color 0.2s ease; -} - -.sidebar-toggle svg { - width: 20px; - height: 20px; -} - -.sidebar-toggle:hover { - background: var(--accent-soft); -} - -.main-content { - margin-left: 220px; - max-width: 720px; - padding: 28px 24px 60px; -} - -@media (max-width: 820px) { - .sidebar { - transform: translateX(-100%); +@media (max-width: 599px) { + .app-topbar { + display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); + padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) var(--space-1); } - - .sidebar.open { - transform: translateX(0); - box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2); - } - - .sidebar-toggle { - display: flex; - } - - .main-content { - margin-left: 0; - padding: 60px 16px 40px; + .app-main { padding-bottom: calc(112px + env(safe-area-inset-bottom)); } + .app-tabbar { + display: flex; position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); + bottom: calc(var(--space-3) + env(safe-area-inset-bottom)); width: calc(100% - 24px); max-width: 420px; } + .app-tabbar .ps-tab { flex: 1; min-width: 0; } + .app-toasts { left: var(--space-3); right: var(--space-3); bottom: calc(96px + env(safe-area-inset-bottom)); justify-items: stretch; } + .app-toasts .ps-toast { max-width: none; } } -.inline-form { - display: inline; - margin: 0; -} +/* ================= Вход и регистрация ================= */ -h1 { - font-size: 1.5rem; - margin-bottom: 16px; +.app-auth { + min-height: 100vh; min-height: 100dvh; display: grid; justify-items: center; align-content: center; gap: var(--space-6); + padding: var(--space-12) var(--space-4); position: relative; + /* Под белым логотипом — глубокий синий (контраст ≥ 5:1); светлый край градиента внизу справа */ + background: linear-gradient(160deg, var(--logo-deep) 0%, #1b62a8 45%, var(--brand-bright) 100%); } +.app-auth-logo { display: inline-flex; text-decoration: none !important; } +.app-auth-card { + width: 100%; max-width: 440px; display: grid; gap: var(--space-5); padding: var(--space-8); + border-radius: var(--radius-xl); background: var(--surface-raised); box-shadow: var(--shadow-float); +} +.app-auth-theme { position: absolute; top: var(--space-4); right: var(--space-4); } +.app-auth-switch { margin: 0; text-align: center; color: var(--ink-secondary); } +@media (max-width: 599px) { .app-auth-card { padding: var(--space-6) var(--space-5); } } -h2 { - font-size: 1.15rem; - margin-top: 28px; +/* ================= Общие блоки экранов ================= */ + +.ps-main > * { min-width: 0; } +/* Ссылка «‹ Раздел» над заголовком экрана */ +.app-back { margin: 0 0 var(--space-3) -12px; } +/* Действия дня плана отделены от идеи */ +.ps-planday-body > .app-actions { margin-top: var(--space-2); } +/* Готовые команды не прилипают к полю ввода */ +.ps-composer-suggest { padding-bottom: var(--space-2); } +.ps-composer-note { margin-top: var(--space-2); } +/* На телефоне крупная кнопка формы — во всю ширину */ +@media (max-width: 599px) { .app-actions > .ps-btn--lg { flex: 1 1 100%; white-space: normal; text-align: center; } } +/* Шапка карточки поста: платформа и стиль — одной строкой, при нехватке места — под бейджем */ +.ps-card-top { flex-wrap: wrap; justify-content: flex-start; column-gap: var(--space-3); row-gap: var(--space-2); } +.ps-card-channels { white-space: nowrap; hyphens: none; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } +/* Четыре показателя: 4 в ряд или 2×2, без «сироты» 3+1 */ +.app-main .ps-grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); } +/* Карточки постов и медиа-образов: колонки добавляются, одиночная карточка не растягивается на весь экран */ +.app-main .ps-grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); } +@media (min-width: 1024px) and (max-width: 1279px) { .app-main .ps-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } } +.app-head-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); } +.app-section { display: grid; gap: var(--space-4); } +.app-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); } +.app-stack { display: grid; gap: var(--space-3); } +.app-stack-lg { display: grid; gap: var(--space-6); } +.app-form { display: grid; gap: var(--space-4); } +.app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); } +.app-actions--end { justify-content: flex-end; } +.app-muted { color: var(--ink-secondary); } +.app-caption { font: 500 12px/16px var(--font-text); color: var(--ink-tertiary); } +.app-legend { display: flex; flex-wrap: wrap; gap: var(--space-2); } +a.ps-btn, a.ps-btn:hover, a.ps-action, a.ps-action:hover, a.ps-chip, a.ps-chip:hover { text-decoration: none; } +a.ps-card-title-link { color: inherit; text-decoration: none; } +a.ps-card-title-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } +.ps-card:has(.ps-card-title-link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; } +.ps-card-title-link:focus-visible { outline: none; } +.ps-card-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 2px; margin-left: -6px; } +.ps-btn--danger:hover:not(:disabled) { background: var(--danger); color: var(--on-brand); } + +.app-preset-custom { display: grid; place-items: center; background: var(--surface-sunken); color: var(--ink-secondary); } +.ps-preset-art.app-preset-custom svg { width: 24px; height: 24px; } +.ps-preset.is-selected .app-preset-custom { background: var(--surface-raised); color: var(--brand); } +.app-check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--target-min); font: 400 15px/20px var(--font-text); color: var(--ink); cursor: pointer; } +.app-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); flex: none; } + +/* Таблица-список для данных */ +.app-list { display: grid; gap: var(--space-3); list-style: none; margin: 0; padding: 0; } + +/* Галерея картинок */ +.app-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--space-4); } +.app-gallery-item { + position: relative; display: grid; overflow: hidden; border-radius: var(--radius-lg); + background: var(--surface-raised); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } +.app-gallery-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--surface-sunken); } +.app-gallery-body { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-4); } +.app-gallery-prompt { margin: 0; font: 400 13px/18px var(--font-text); color: var(--ink-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } + +/* Горизонтальные столбцы статистики */ +.app-bars { display: grid; gap: var(--space-3); } +.app-bar { display: grid; grid-template-columns: minmax(96px, 160px) 1fr auto; align-items: center; gap: var(--space-3); } +.app-bar-label { font: 500 15px/20px var(--font-text); } +.app-bar-track { height: 12px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; } +.app-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--brand); } +.app-bar:first-child .app-bar-fill { background: var(--brand); } +.app-bar-value { font: 500 13px/18px var(--font-text); font-variant-numeric: tabular-nums; color: var(--ink-secondary); min-width: 2ch; text-align: right; } + +/* ================= Старые классы шаблонов → дизайн-система ================= */ + +h1 { margin: 0; font: 700 34px/40px var(--font-display); letter-spacing: -0.015em; color: var(--ink); text-wrap: balance; } +h2 { margin: 0; font: 600 22px/28px var(--font-display); color: var(--ink); text-wrap: balance; } +h3 { margin: 0; font: 600 20px/26px var(--font-display); color: var(--ink); } +.ps-main > h1 + p, .ps-main > h1 + .form-hint { margin-top: -16px; } +@media (max-width: 599px) { h1 { font-size: 28px; line-height: 34px; } } .card { - background: var(--surface); - border: 1px solid var(--border); - border-radius: 10px; - padding: 16px 18px; - margin-bottom: 16px; - transition: background-color 0.2s ease, border-color 0.2s ease; -} - -.card p { - margin: 6px 0; -} - -.result { - white-space: pre-wrap; + display: grid; gap: var(--space-3); padding: var(--inset-card); + border-radius: var(--radius-lg); background: var(--surface-raised); + box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } +.card > * { margin-top: 0; margin-bottom: 0; } +.card p { margin: 0; } +.result { white-space: pre-wrap; } .flash { - background: var(--success-bg); - border: 1px solid var(--success-border); - color: var(--success-text); - padding: 10px 14px; - border-radius: 8px; - margin-bottom: 16px; + padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); + background: var(--success-tint); color: var(--success); font-weight: 500; } - .errors { - background: var(--error-bg); - border: 1px solid var(--error-border); - color: var(--error-text); - padding: 10px 14px; - border-radius: 8px; - margin-bottom: 16px; -} - -.errors ul { - margin: 0; - padding-left: 18px; + padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); + background: var(--danger-tint); color: var(--danger); } +.errors ul { margin: 0; padding-left: 18px; } .form { - display: flex; - flex-direction: column; - gap: 14px; - background: var(--surface); - border: 1px solid var(--border); - border-radius: 10px; - padding: 20px; - transition: background-color 0.2s ease, border-color 0.2s ease; + display: grid; gap: var(--space-4); padding: var(--inset-panel); + border-radius: var(--radius-xl); background: var(--surface-raised); + box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } +.form > div:not([class]), .form > div[class^="brand-fields"], .form > div[id^="fields"] { display: grid; gap: var(--space-4); } +.form label { display: grid; gap: 6px; font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } -.form label { - display: flex; - flex-direction: column; - gap: 6px; - font-size: 0.9rem; - color: var(--text-muted); +.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), +.form select, .form textarea, +.status-select, .post-editor, .ai-chat-textarea, #channelsTable input { + box-sizing: border-box; width: 100%; min-height: var(--control-md); padding: 11px 14px; margin: 0; + border: 0; border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--ink); + box-shadow: inset 0 0 0 1px var(--border-strong); + font: 400 16px/22px var(--font-text); outline: none; + transition: box-shadow var(--dur-tap) var(--ease-standard); } - -.form input, -.form select, -.form textarea { - font: inherit; - padding: 9px 11px; - border: 1px solid var(--border-strong); - border-radius: 8px; - background: var(--input-bg); - color: var(--text); - transition: background-color 0.2s ease, border-color 0.2s ease; +.form select, .status-select { + appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237d8fa8' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E"); + background-repeat: no-repeat; background-position: right 12px center; } - -.form input:focus, -.form select:focus, -.form textarea:focus { - outline: 2px solid var(--accent); - outline-offset: 1px; +.form input:hover, .form select:hover, .form textarea:hover { box-shadow: inset 0 0 0 1px var(--ink-secondary); } +.form input:focus, .form select:focus, .form textarea:focus, +.status-select:focus, .post-editor:focus, .ai-chat-textarea:focus, #channelsTable input:focus { + box-shadow: inset 0 0 0 2px var(--brand), 0 0 0 4px var(--brand-tint); } +.form input::placeholder, .form textarea::placeholder { color: var(--ink-tertiary); } +.form input[type="file"] { font: inherit; color: var(--ink-secondary); } +.form input[type="checkbox"], .form input[type="radio"] { width: 20px; height: 20px; accent-color: var(--brand); } -.form button, -.button-danger { - align-self: flex-start; - background: var(--accent); - color: #fff; - border: none; - padding: 10px 18px; - border-radius: 8px; - font: inherit; - cursor: pointer; -} - -.form button:hover { - background: var(--accent-hover); -} - -.button-danger { - background: var(--danger); -} - -.button-danger:hover { - background: var(--danger-hover); -} - -.grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); - gap: 12px; -} - -.tile { - display: block; - background: var(--surface); - border: 1px solid var(--border); - border-radius: 10px; - padding: 18px; - font-weight: 500; - color: var(--text); - transition: background-color 0.2s ease, border-color 0.2s ease; -} - -.tile:hover { - border-color: var(--accent); - text-decoration: none; -} - -.tile-danger { - color: var(--danger-text); -} - -.post-list { - list-style: none; - margin: 0; - padding: 0; -} - -.post-meta { - font-size: 0.85rem; - color: var(--text-faint); - margin-bottom: 6px; -} - -.post-content { - white-space: pre-wrap; -} - -.table { - width: 100%; - border-collapse: collapse; - background: var(--surface); - border: 1px solid var(--border); - border-radius: 10px; - overflow: hidden; - transition: background-color 0.2s ease, border-color 0.2s ease; -} - -.table th, -.table td { - text-align: left; - padding: 10px 12px; - border-bottom: 1px solid var(--border); -} - -.table th { - background: var(--table-head); -} - -/* === Действия с постами / планом === */ - -.post-actions { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 10px; - margin-top: 12px; +/* Кнопки старых форм выглядят как Button primary */ +.form button[type="submit"], .form > button, .survey-nav button, .button-danger { + justify-self: start; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); + min-height: var(--control-md); padding: 0 var(--space-5); border: 0; border-radius: var(--radius-md); + background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-1); + font: 500 15px/20px var(--font-text); cursor: pointer; + transition: transform var(--dur-tap) var(--ease-standard), background-color var(--dur-tap) var(--ease-standard); } +.form button[type="submit"]:hover, .form > button:hover, .survey-nav button:hover { background: var(--brand-pressed); } +.form button:active:not(:disabled), .survey-nav button:active:not(:disabled), .copy-btn:active { transform: scale(0.97); } +.form button:disabled, .survey-nav button:disabled { opacity: 0.45; cursor: not-allowed; } +.button-danger { background: var(--danger-tint); color: var(--danger); box-shadow: none; } +.button-danger:hover { background: var(--danger); color: var(--on-brand); } +/* «copy-btn» — вторичная кнопка */ .copy-btn { - background: var(--accent-soft); - color: var(--accent); - border: 1px solid var(--accent-soft-border); - border-radius: 8px; - padding: 7px 12px; - font: inherit; - font-size: 0.9rem; - cursor: pointer; - transition: background-color 0.2s ease, border-color 0.2s ease; -} - -.copy-btn:hover { - background: var(--accent-soft-hover); + position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; + min-height: var(--control-sm); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); + background: var(--surface-raised); color: var(--brand); box-shadow: inset 0 0 0 1px var(--border-strong); + font: 500 13px/18px var(--font-text); cursor: pointer; text-decoration: none !important; white-space: nowrap; + transition: background-color var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); } +.copy-btn::before { content: ""; position: absolute; inset: -4px 0; } +.copy-btn:hover { background: var(--brand-tint); } +.copy-btn:disabled { opacity: 0.45; cursor: not-allowed; } .button-link { - background: none; - border: none; - padding: 0; - font: inherit; - font-size: 0.9rem; - color: var(--accent); - cursor: pointer; - text-decoration: none; + display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-sm); padding: 0 var(--space-3); + border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--brand); + font: 500 13px/18px var(--font-text); cursor: pointer; text-decoration: none !important; } +.button-link:hover { background: var(--brand-tint); } +.button-link-danger { color: var(--danger); } +.button-link-danger:hover { background: var(--danger-tint); } -.button-link:hover { - text-decoration: underline; +.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--space-3); } +.tile { + display: flex; align-items: center; gap: var(--gap-row); padding: var(--inset-card); + border-radius: var(--radius-lg); background: var(--surface-raised); color: var(--ink); + box-shadow: inset 0 0 0 1px var(--hairline); font: 600 15px/20px var(--font-text); + text-decoration: none !important; + transition: box-shadow var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); } +.tile:hover { box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-1); } +.tile:active { transform: scale(0.98); } +.tile-danger { color: var(--danger); } -.button-link-danger { - color: var(--danger-text); +.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); } +.post-meta { font: 500 13px/18px var(--font-text); color: var(--ink-tertiary); } +.post-content { white-space: pre-wrap; font: 400 16px/25px var(--font-text); } +.post-actions, .post-editor-actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); } +.post-notes { padding-top: var(--space-3); box-shadow: inset 0 1px 0 var(--hairline); font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } +.form-hint { margin: 0; font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } + +.table { + width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; + border-radius: var(--radius-lg); background: var(--surface-raised); + box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } +.table th, .table td { text-align: left; padding: var(--space-3) var(--space-4); box-shadow: inset 0 -1px 0 var(--hairline); vertical-align: middle; } +.table th { font: 500 12px/16px var(--font-text); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-tertiary); background: var(--surface-sunken); } +.table tr:last-child td { box-shadow: none; } -.post-notes { - margin-top: 10px; - padding-top: 10px; - border-top: 1px dashed var(--border); - font-size: 0.9rem; - color: var(--text-muted); +/* Чипы и статусы */ +.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); } +.chip, .status-badge, .concept-tag { + display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--radius-xs); + background: var(--surface-sunken); color: var(--ink-secondary); font: 500 13px/18px var(--font-text); white-space: nowrap; } +.chip-published, .status-badge.status-published { background: var(--success-tint); color: var(--success); } +.chip-postponed, .status-badge.status-postponed { background: var(--warning-tint); color: var(--warning); } -.form-actions { - display: flex; - align-items: center; - gap: 16px; -} - -/* === Контент-план === */ - -.chips { - display: flex; - flex-wrap: wrap; - gap: 8px; - margin-bottom: 16px; -} - -.chip { - padding: 6px 12px; - border-radius: 999px; - font-size: 0.85rem; - background: var(--surface); - border: 1px solid var(--border); - transition: background-color 0.2s ease, border-color 0.2s ease; -} - -.chip-published { - background: var(--success-bg); - border-color: var(--success-border); - color: var(--success-text); -} - -.chip-postponed { - background: var(--warn-bg); - border-color: var(--warn-border); - color: var(--warn-text); -} - -.plan-item-head { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 10px; - margin-bottom: 8px; -} - -.plan-day { - font-weight: 600; -} - -.plan-platform { - font-size: 0.9rem; - color: var(--text-faint); -} - -.plan-idea { - white-space: pre-wrap; -} - -.status-badge { - font-size: 0.8rem; - padding: 3px 10px; - border-radius: 999px; - background: var(--badge-bg); - color: var(--badge-text); -} - -.status-badge.status-published { - background: var(--success-bg); - color: var(--success-text); -} - -.status-badge.status-postponed { - background: var(--warn-bg); - color: var(--warn-text); -} - -.plan-item.status-published { - background: var(--published-surface); -} - -.status-select { - font: inherit; - font-size: 0.9rem; - padding: 6px 8px; - border: 1px solid var(--border-strong); - border-radius: 8px; - background: var(--input-bg); - color: var(--text); -} - -/* === Медиа-библиотека === */ - -.media-grid { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); - gap: 16px; - margin-bottom: 20px; -} - -.media-card { - background: var(--surface); - border: 1px solid var(--border); - border-radius: 10px; - overflow: hidden; - display: flex; - flex-direction: column; - transition: background-color 0.2s ease, border-color 0.2s ease; -} - -.media-card a.media-link { - display: block; - line-height: 0; -} - -.media-thumb { - width: 100%; - aspect-ratio: 1 / 1; - object-fit: cover; - background: var(--table-head); - display: block; -} - -.media-body { - padding: 10px 12px 12px; - display: flex; - flex-direction: column; - gap: 6px; -} - -.media-prompt { - font-size: 0.9rem; - line-height: 1.35; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.form-hint { - font-size: 0.85rem; - color: var(--text-faint); - margin: 0; -} - -/* === Опрос медиа-образа === */ - -.survey-wizard { - max-width: 760px; - margin: 0 auto; -} - -.survey-progress { - height: 6px; - background: var(--border); - border-radius: 999px; - overflow: hidden; - margin-bottom: 10px; -} - -.survey-progress-bar { - height: 100%; - background: var(--accent); - width: 0%; - transition: width 0.3s ease; - border-radius: 999px; -} - -.survey-steps-indicator { - display: flex; - flex-wrap: wrap; - gap: 6px; - margin-bottom: 20px; -} +/* Медиа-библиотека (старые классы) */ +.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--space-4); } +.media-card { display: grid; overflow: hidden; border-radius: var(--radius-lg); background: var(--surface-raised); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } +.media-card a.media-link { display: block; line-height: 0; } +.media-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-sunken); display: block; } +.media-body { padding: var(--space-3) var(--space-4) var(--space-4); display: grid; gap: var(--space-2); } +.media-prompt { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } +/* Анкета медиа-образа */ +.survey-wizard { display: grid; gap: var(--space-5); min-width: 0; } +.survey-progress { height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; } +.survey-progress-bar { height: 100%; width: 0%; border-radius: inherit; background: var(--brand); transition: width var(--dur-sheet) var(--ease-soft); } +.survey-steps-indicator { display: flex; flex-wrap: wrap; gap: 6px; } .step-dot { - display: inline-flex; - align-items: center; - justify-content: center; - width: 28px; - height: 28px; - border-radius: 50%; - font-size: 0.8rem; - background: var(--surface); - border: 1px solid var(--border); - color: var(--text-faint); - cursor: pointer; - transition: background-color 0.2s, border-color 0.2s, color 0.2s; + display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; + background: var(--surface-sunken); color: var(--ink-secondary); font: 500 13px/1 var(--font-text); + font-variant-numeric: tabular-nums; cursor: pointer; border: 0; + transition: background-color var(--dur-tap) var(--ease-standard), color var(--dur-tap) var(--ease-standard); } - -.step-dot.active { - background: var(--accent); - border-color: var(--accent); - color: #fff; -} - -.step-dot.done { - background: var(--success-bg); - border-color: var(--success-border); - color: var(--success-text); -} - -.survey-step h2 { - margin-top: 0; -} - -.survey-step h3 { - font-size: 1rem; - margin-top: 18px; - margin-bottom: 8px; - color: var(--text-muted); -} - -.survey-step .form { - gap: 10px; -} - -.funnel-stage { - border: 1px solid var(--border); - border-radius: 8px; - padding: 12px; - margin-bottom: 10px; - background: var(--bg); -} - -.funnel-stage label { - margin-bottom: 6px; -} - +.step-dot:hover { background: var(--brand-tint); color: var(--brand); } +.step-dot.active { background: var(--brand); color: var(--on-brand); } +.step-dot.done { background: var(--success-tint); color: var(--success); } +.survey-step { display: grid; gap: var(--space-4); } +.survey-step h3 { font: 600 17px/24px var(--font-text); color: var(--ink); margin-top: var(--space-2); } +.funnel-stage { display: grid; gap: var(--space-2); padding: var(--inset-control); border-radius: var(--radius-md); background: var(--surface-sunken); } +.survey-wizard > form { display: grid; gap: var(--space-6); } .survey-nav { - display: flex; - align-items: center; - justify-content: space-between; - gap: 12px; - margin-top: 20px; - padding: 16px 0; + display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); + padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); + background: var(--surface-raised); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } - -.survey-nav #stepCounter { - font-size: 0.9rem; - color: var(--text-faint); +.survey-nav #stepCounter { font: 600 13px/18px var(--font-text); color: var(--brand); font-variant-numeric: tabular-nums; } +.survey-nav button#btnPrev, .survey-nav button.secondary { + background: var(--surface-raised); color: var(--brand); box-shadow: inset 0 0 0 1px var(--border-strong); } - -.survey-nav button { - background: var(--accent); - color: #fff; - border: none; - padding: 10px 18px; - border-radius: 8px; - font: inherit; - cursor: pointer; +.survey-nav button#btnPrev:hover { background: var(--brand-tint); } +.survey-nav button#btnNext, .survey-nav button#btnSubmit { margin-left: auto; } +.survey-step > .ps-stepper-title { margin: 0; } +.app-survey-aside { position: sticky; top: var(--space-6); } +.app-survey-aside .form, .app-survey-aside #socialForm { display: grid; gap: var(--space-3); } +.app-survey-aside label { display: grid; gap: 6px; font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.app-survey-aside input, .app-survey-aside textarea { + box-sizing: border-box; width: 100%; min-height: var(--control-md); padding: 11px 14px; border: 0; border-radius: var(--radius-sm); + background: var(--surface-raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--border-strong); font: 400 16px/22px var(--font-text); outline: none; } +.app-survey-aside input:focus, .app-survey-aside textarea:focus { box-shadow: inset 0 0 0 2px var(--brand), 0 0 0 4px var(--brand-tint); } +@media (min-width: 900px) { .app-survey-layout > .app-survey-aside { order: 2; } } +@media (max-width: 899px) { .app-survey-aside { position: static; } } -.survey-nav button:hover { - background: var(--accent-hover); -} - -.survey-nav button:disabled { - opacity: 0.6; - cursor: default; -} - -#channelsTable input { - width: 100%; - padding: 6px 8px; - border: 1px solid var(--border-strong); - border-radius: 6px; - background: var(--input-bg); - color: var(--text); - font: inherit; - font-size: 0.9rem; -} - -/* === Изображения в списке постов === */ - -.post-images { - display: flex; - flex-wrap: wrap; - gap: 8px; - margin-top: 12px; -} - -.post-thumb { - width: 80px; - height: 80px; - object-fit: cover; - border-radius: 8px; - border: 1px solid var(--border); -} - -/* === Loader / Background Task === */ +/* Картинки в постах */ +.post-images { display: flex; flex-wrap: wrap; gap: var(--space-2); } +.post-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--hairline); } +/* Фоновая задача: индикатор «Веер» */ .task-loader { - display: none; - flex-direction: column; - align-items: center; - gap: 16px; - padding: 40px 20px; - text-align: center; + display: none; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: var(--space-3); + padding: var(--space-2) 0; } - -.spinner { - width: 44px; - height: 44px; - border: 4px solid var(--border); - border-top-color: var(--accent); - border-radius: 50%; - animation: spin 0.8s linear infinite; -} - -@keyframes spin { - to { transform: rotate(360deg); } -} - +.task-loader .spinner { display: none; } .task-loader-text { - font-size: 1rem; - color: var(--text-muted); + display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: var(--radius-pill); + background: var(--indigo-tint); color: var(--indigo); font: 500 15px/20px var(--font-text); } - -.task-loader-sub { - font-size: 0.85rem; - color: var(--text-faint); +.task-loader-text::before { + content: ""; display: block; width: 26px; height: 22px; flex: none; + background: currentColor; border-radius: 4px; + -webkit-mask: radial-gradient(circle at 50% 100%, #000 0 62%, transparent 63%); + mask: radial-gradient(circle at 50% 100%, #000 0 62%, transparent 63%); + animation: ps-pulse 1.4s var(--ease-soft) infinite; } +.task-loader .ps-fan + .task-loader-text::before, .task-loader-text.has-fan::before { display: none; } +.task-loader-sub { font: 400 13px/18px var(--font-text); color: var(--ink-tertiary); } +.spinner { width: 20px; height: 20px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ps-spin 0.8s linear infinite; } .task-error { - display: none; - background: var(--error-bg); - border: 1px solid var(--error-border); - color: var(--error-text); - padding: 12px 16px; - border-radius: 8px; - margin-bottom: 16px; -} - -.task-result { - display: none; -} - -/* === Image Templates === */ - -.template-grid { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); - gap: 10px; - margin-bottom: 20px; + display: none; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); + border-radius: var(--radius-md); background: var(--danger-tint); color: var(--danger); font: 500 15px/22px var(--font-text); } +.task-result { display: none; } +.task-success { padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); background: var(--success-tint); color: var(--success); font: 500 13px/18px var(--font-text); } +/* Шаблоны картинок (старые классы) → PresetPicker */ +.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 132px), 1fr)); gap: var(--space-3); } .template-card { - display: flex; - flex-direction: column; - align-items: center; - gap: 6px; - padding: 14px 10px 12px; - border: 2px solid var(--border); - border-radius: 12px; - background: var(--surface); - cursor: pointer; - text-align: center; - transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease; - font: inherit; -} - -.template-card:hover { - border-color: var(--accent); - background: var(--accent-soft); - transform: translateY(-1px); -} - -.template-card.selected { - border-color: var(--accent); - background: var(--accent-soft); - box-shadow: 0 0 0 3px var(--accent-soft-border); -} - -.template-icon { - font-size: 1.6rem; - line-height: 1; -} - -.template-name { - font-weight: 600; - font-size: 0.9rem; - color: var(--text); -} - -.template-hint { - font-size: 0.75rem; - color: var(--text-faint); - line-height: 1.3; -} - -.template-card-custom { - border-style: dashed; -} - -.selected-hint { - background: var(--accent-soft); - border: 1px solid var(--accent-soft-border); - border-radius: 8px; - padding: 10px 14px; - font-size: 0.9rem; - color: var(--accent); - margin-bottom: 16px; -} - -/* === Concept Cards === */ - -.concept-grid { - display: flex; - flex-direction: column; - gap: 10px; - margin-bottom: 12px; + display: grid; justify-items: center; gap: 4px; padding: var(--inset-control); border: 0; border-radius: var(--radius-md); + background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink); text-align: center; cursor: pointer; font: inherit; + transition: box-shadow var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); } +.template-card:hover { box-shadow: inset 0 0 0 1px var(--border-strong); } +.template-card:active { transform: scale(0.97); } +.template-card.selected { background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); } +.template-icon { display: block; width: 100%; line-height: 0; } +.template-icon svg { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); } +.template-icon .t { fill: var(--brand-tint); } +.template-icon .b { fill: var(--logo-deep); } +.template-icon .a { fill: var(--brand-bright); } +.template-icon .c { fill: var(--ink-tertiary); } +.template-icon .s { fill: var(--surface-raised); } +.template-card.selected .template-icon .t { fill: var(--surface-raised); } +.template-name { font: 600 13px/18px var(--font-text); } +.template-hint { font: 400 12px/16px var(--font-text); color: var(--ink-tertiary); } +.template-card-custom { box-shadow: inset 0 0 0 1.5px var(--border-strong); background: var(--surface-sunken); } +.selected-hint { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--brand-tint); color: var(--brand); font: 500 15px/20px var(--font-text); } +/* Концепции → карточки выбора */ +.concept-grid { display: grid; gap: var(--space-3); } .concept-card { - display: block; - width: 100%; - text-align: left; - padding: 14px 16px; - border: 2px solid var(--border); - border-radius: 12px; - background: var(--surface); - cursor: pointer; - font: inherit; - transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease; + display: grid; gap: 4px; width: 100%; padding: var(--inset-card); border: 0; border-radius: var(--radius-lg); + background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--hairline); color: var(--ink); text-align: left; cursor: pointer; font: inherit; + transition: box-shadow var(--dur-tap) var(--ease-standard), transform var(--dur-tap) var(--ease-standard); } +.concept-card:hover { box-shadow: inset 0 0 0 1px var(--border-strong); } +.concept-card:active { transform: scale(0.98); } +.concept-card.selected { background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); } +.concept-title { font: 600 15px/20px var(--font-text); } +.concept-desc { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); } +.concept-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; } -.concept-card:hover { - border-color: var(--accent); - background: var(--accent-soft); - transform: translateY(-1px); -} - -.concept-title { - font-weight: 600; - font-size: 1rem; - color: var(--text); - margin-bottom: 4px; -} - -.concept-desc { - font-size: 0.9rem; - color: var(--text-muted); - line-height: 1.4; - margin-bottom: 6px; -} - -.concept-meta { - display: flex; - gap: 6px; -} - -.concept-tag { - display: inline-block; - padding: 2px 8px; - border-radius: 999px; - font-size: 0.75rem; - background: var(--badge-bg); - color: var(--badge-text); -} - -/* === Provider Tabs === */ -.provider-tabs { - display: flex; - gap: 0; - border-bottom: 2px solid var(--border); - margin-bottom: 20px; -} +/* Вкладки провайдера → сегменты */ +.provider-tabs { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; padding: 4px; border-radius: var(--radius-md); background: var(--surface-sunken); } .provider-tab { - padding: 10px 20px; - background: none; - border: none; - border-bottom: 2px solid transparent; - margin-bottom: -2px; - font-size: 15px; - font-weight: 500; - color: var(--text-muted); - cursor: pointer; - transition: color 0.15s, border-color 0.15s; -} -.provider-tab:hover { - color: var(--text); -} -.provider-tab.active { - color: var(--accent); - border-bottom-color: var(--accent); -} -.provider-tab-content { - display: none; -} -.provider-tab-content.active { - display: block; + min-height: 36px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-sm); background: transparent; + color: var(--ink-secondary); font: 500 15px/20px var(--font-text); cursor: pointer; + transition: background-color var(--dur-move) var(--ease-soft), color var(--dur-tap) var(--ease-standard); } +.provider-tab:hover { color: var(--ink); } +.provider-tab.active { background: var(--surface-raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); } +.provider-tab-content { display: none; } +.provider-tab-content.active { display: grid; gap: var(--space-4); } -/* === Inline Post Editor === */ +/* Редактор поста */ +.post-editor { min-height: 220px; resize: vertical; font: 400 16px/25px var(--font-text); } -.post-editor { - width: 100%; - min-height: 200px; - padding: 14px 16px; - font-family: inherit; - font-size: 0.95rem; - line-height: 1.6; - color: var(--text); - background: var(--bg); - border: 1px solid var(--border); - border-radius: 8px; - resize: vertical; - transition: border-color 0.2s; -} -.post-editor:focus { - outline: none; - border-color: var(--accent); - box-shadow: 0 0 0 3px var(--accent-bg); -} -.post-editor-actions { - display: flex; - gap: 10px; - margin-top: 12px; - flex-wrap: wrap; -} - -.task-success { - background: var(--success-bg, #d4edda); - color: var(--success-text, #155724); - border: 1px solid var(--success-border, #c3e6cb); - border-radius: 8px; - padding: 8px 14px; - margin-bottom: 10px; - font-size: 0.9rem; -} - -/* === Revision Chat === */ - -.revision-chat { - display: flex; - flex-direction: column; - gap: 8px; -} +/* История версий (старые классы) */ +.revision-chat { display: grid; gap: var(--space-2); } .revision-msg { - background: var(--surface); - border: 1px solid var(--border); - border-radius: 10px; - padding: 12px 16px; - cursor: pointer; - transition: border-color 0.2s, background 0.15s; + display: grid; gap: 4px; padding: var(--inset-control) var(--space-4); border-radius: var(--radius-md); + background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--hairline); cursor: pointer; + transition: box-shadow var(--dur-tap) var(--ease-standard), background-color var(--dur-tap) var(--ease-standard); } -.revision-msg:hover { - border-color: var(--accent); - background: var(--accent-bg); -} -.revision-msg--current { - border-color: var(--accent); - border-width: 2px; -} -.revision-msg-header { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 6px; -} -.revision-msg-label { - font-weight: 600; - font-size: 0.85rem; - color: var(--accent); -} -.revision-msg-date { - font-size: 0.78rem; - color: var(--text-muted); -} -.revision-msg-preview { - font-size: 0.88rem; - color: var(--text-muted); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} -.revision-msg-full { - margin-top: 8px; -} -.revision-msg-content { - background: var(--bg); - border: 1px solid var(--border); - border-radius: 6px; - padding: 12px; - font-family: inherit; - font-size: 0.9rem; - line-height: 1.6; - white-space: pre-wrap; - word-wrap: break-word; - max-height: 400px; - overflow-y: auto; +.revision-msg:hover { box-shadow: inset 0 0 0 1px var(--border-strong); } +.revision-msg--current { background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); } +.revision-msg-header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); } +.revision-msg-label { font: 600 15px/20px var(--font-text); color: var(--ink); } +.revision-msg-date { font: 400 12px/16px var(--font-text); color: var(--ink-tertiary); font-variant-numeric: tabular-nums; } +.revision-msg-preview { font: 400 13px/18px var(--font-text); color: var(--ink-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.revision-msg-full { margin-top: var(--space-2); } +.revision-msg-content, .ai-chat-full pre { + margin: 0; padding: var(--inset-control); border-radius: var(--radius-sm); background: var(--surface-sunken); + font: 400 15px/22px var(--font-text); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 400px; overflow-y: auto; } -/* === AI Chat === */ - -.ai-chat { - max-height: 500px; - overflow-y: auto; - padding: 10px 0; - display: flex; - flex-direction: column; - gap: 12px; -} -.ai-chat-msg { - display: flex; - flex-direction: column; -} -.ai-chat-msg--user { - align-items: flex-end; -} -.ai-chat-msg--ai { - align-items: flex-start; -} -.ai-chat-msg--system { - align-items: center; -} +/* Чат с ИИ (старые классы) → Message */ +.ai-chat { display: grid; gap: var(--space-3); max-height: 520px; overflow-y: auto; padding: var(--space-1) 2px; } +.ai-chat-msg { display: flex; flex-direction: column; gap: 4px; animation: ps-rise var(--dur-sheet) var(--ease-soft); } +.ai-chat-msg--user { align-items: flex-end; } +.ai-chat-msg--ai { align-items: flex-start; } +.ai-chat-msg--system { align-items: center; } .ai-chat-bubble { - max-width: 85%; - padding: 10px 16px; - border-radius: 14px; - font-size: 0.9rem; - line-height: 1.5; - word-wrap: break-word; - white-space: pre-wrap; -} -.ai-chat-bubble--user { - background: var(--accent); - color: #fff; - border-bottom-right-radius: 4px; -} -.ai-chat-bubble--ai { - background: var(--surface); - border: 1px solid var(--border); - border-bottom-left-radius: 4px; -} -.ai-chat-bubble--system { - background: var(--bg); - color: var(--text-muted); - font-size: 0.85rem; - border: 1px dashed var(--border); -} -.ai-chat-time { - font-size: 0.72rem; - color: var(--text-faint); - margin-top: 3px; - padding: 0 4px; -} -.ai-chat-meta { - font-size: 0.8rem; - color: var(--text-muted); - margin-bottom: 4px; -} -.ai-chat-preview { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - max-width: 100%; -} -.ai-chat-full pre { - background: var(--bg); - border: 1px solid var(--border); - border-radius: 6px; - padding: 10px; - font-family: inherit; - font-size: 0.88rem; - line-height: 1.5; - white-space: pre-wrap; - word-wrap: break-word; - max-height: 300px; - overflow-y: auto; + max-width: min(85%, 640px); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); + font: 400 16px/24px var(--font-text); color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; } +.ai-chat-bubble--user { background: var(--brand-tint); border-top-right-radius: 6px; } +.ai-chat-bubble--ai { background: var(--surface-raised); border-top-left-radius: 6px; box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } +.ai-chat-bubble--system { background: var(--indigo-tint); color: var(--indigo); font: 500 13px/18px var(--font-text); border-radius: var(--radius-pill); padding: 6px 14px; } +.ai-chat-time { font: 400 12px/16px var(--font-text); color: var(--ink-tertiary); padding: 0 4px; } +.ai-chat-meta { font: 500 13px/18px var(--font-text); color: var(--ink-secondary); } +.ai-chat-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } .ai-chat-input { - display: flex; - gap: 8px; - align-items: flex-end; - margin-top: 12px; + display: flex; gap: var(--space-1); align-items: flex-end; margin-top: var(--space-3); padding: 6px; + border-radius: var(--radius-xl); background: var(--surface-raised); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--hairline); } -.ai-chat-textarea { - flex: 1; - padding: 10px 14px; - font-family: inherit; - font-size: 0.9rem; - line-height: 1.4; - color: var(--text); - background: var(--bg); - border: 1px solid var(--border); - border-radius: 10px; - resize: none; - transition: border-color 0.2s; +.ai-chat-input:focus-within { box-shadow: var(--shadow-2), inset 0 0 0 1.5px var(--brand); } +.ai-chat-input .ai-chat-textarea { flex: 1; min-height: var(--target-min); box-shadow: none; background: transparent; resize: none; padding: 10px; } +.ai-chat-input .ai-chat-textarea:focus { box-shadow: none; } +.ai-chat-input button { + flex: none; min-height: var(--target-min); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-pill); + background: var(--brand); color: var(--on-brand); font: 500 15px/20px var(--font-text); cursor: pointer; } -.ai-chat-textarea:focus { - outline: none; - border-color: var(--accent); +.ai-chat-input button:disabled { background: var(--surface-sunken); color: var(--ink-tertiary); cursor: not-allowed; } +.ai-chat-textarea:disabled { opacity: 0.5; } + +.app-survey-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: var(--space-6); align-items: start; } +.app-survey-section h3 { font: 600 17px/24px var(--font-text); margin-top: var(--space-2); } +.app-survey-section ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; } +.app-survey-section strong { font-weight: 600; color: var(--ink); } +.app-survey-section p { margin: 0; color: var(--ink-secondary); } + +details > summary { cursor: pointer; font: 600 15px/20px var(--font-text); color: var(--brand); } +code { font-size: inherit; padding: 1px 6px; border-radius: 6px; background: var(--surface-sunken); } +hr { border: 0; height: 1px; background: var(--hairline); margin: var(--space-2) 0; } + +/* ================= Жидкое стекло и движение (брендбук v2) ================= + Цвета стекла, пружины и ритм — в tokens.css. Правила: + 1. Стекло — только навигация и всё, что парит над контентом. Контент — на плотных подложках. + 2. Отклик на нажатие — в первый кадр. Контент страницы никогда не ждёт анимацию. + 3. Движение — пружины и переходы (transition): любое можно прервать. */ + +/* Фон: размытые пятна цветов знака — стеклу есть что преломлять */ +body.is-cabinet, body.lp-body { position: relative; isolation: isolate; } +body.is-cabinet::before, body.lp-body::before { + content: ""; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none; + background: + radial-gradient(38vmax 30vmax at 18% 12%, var(--ambient-1), transparent 70%), + radial-gradient(34vmax 30vmax at 88% 22%, var(--ambient-2), transparent 70%), + radial-gradient(44vmax 36vmax at 70% 92%, var(--ambient-3), transparent 70%); + animation: app-ambient 40s ease-in-out infinite alternate; } -.ai-chat-textarea:disabled { - opacity: 0.5; +.app-shell.ps-shell { background: transparent; } +@keyframes app-ambient { + 50% { transform: translate3d(3vmax, -2vmax, 0) scale(1.06); } + 100% { transform: translate3d(-2vmax, 2vmax, 0) scale(1.02); } +} + +/* Материал «стекло»: размытие + насыщенность, светлая кромка сверху, блик под курсором */ +.app-glass { + background: var(--surface-glass) !important; + -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%); + backdrop-filter: blur(var(--blur-glass)) saturate(180%); +} +.app-glass::after { + content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0; + background: radial-gradient(180px circle at var(--glass-x, 50%) var(--glass-y, -40%), var(--glass-sheen), transparent 70%); + opacity: 0; transition: opacity var(--dur-smooth) var(--spring-smooth); +} +.app-glass.is-lit::after { opacity: 1; } +.app-glass > * { position: relative; z-index: 1; } +.ps-toast.app-glass, .app-sheet-panel.app-glass { position: relative; } +.app-tabbar.app-glass, .ps-toast.app-glass, .app-sheet-panel.app-glass { + box-shadow: var(--shadow-float), inset 0 1px 0 var(--glass-edge), inset 0 0 0 1px var(--hairline); +} +.app-sidenav.app-glass { box-shadow: inset -1px 0 0 var(--hairline), inset 0 1px 0 var(--glass-edge); } +.app-sheet-scrim { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); } + +/* ---------- Боковая навигация в духе macOS: группы, одна плашка, которая едет ---------- */ +.app-nav { position: relative; display: grid; gap: var(--space-4); } +.app-nav-group { display: grid; gap: 2px; list-style: none; margin: 0; padding: 0; } +.app-nav-caption { + padding: 0 var(--space-3) var(--space-1); font: 600 12px/16px var(--font-text); color: var(--ink-tertiary); +} +.app-nav .ps-sidenav-item { position: relative; z-index: 1; min-height: var(--target-min); background: transparent !important; } +.app-nav .ps-sidenav-item.is-active { color: var(--brand); } +.app-nav .ps-sidenav-item:not(.is-active):hover { color: var(--ink); } +/* Плашка активного пункта — один элемент на всё меню; на клик едет к новому пункту сразу, до загрузки раздела */ +.app-nav-indicator { + position: absolute; left: 0; right: 0; top: 0; z-index: 0; height: var(--target-min); border-radius: var(--radius-sm); + background: var(--brand-tint); + box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-1); + transform: translateY(var(--nav-y, 0)); opacity: 0; + transition: transform var(--dur-snappy) var(--spring-snappy), height var(--dur-snappy) var(--spring-snappy), opacity var(--dur-tap) var(--ease-standard); + pointer-events: none; +} +.app-nav-indicator.is-ready { opacity: 1; } +.app-nav-indicator.no-anim { transition: none; } +.app-nav .ps-sidenav-item:not(.is-active):hover::before { + content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--surface-sunken); opacity: 0.7; +} +@supports (corner-shape: squircle) { .app-nav-indicator { corner-shape: squircle; } } +@media (max-width: 1023px) { + .app-nav-caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } + .app-nav { gap: var(--space-2); } +} + +/* Нижняя панель вкладок: та же плашка, едет между вкладками */ +.app-tabbar { position: fixed; } +.app-tabbar .ps-tab { position: relative; z-index: 1; background: transparent !important; } +.app-tab-indicator { + position: absolute; top: 6px; left: 0; z-index: 0; height: calc(100% - 12px); width: var(--tab-w, 0); + border-radius: var(--radius-lg); background: var(--brand-tint); + box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-1); + transform: translateX(var(--tab-x, 0)); opacity: 0; + transition: transform var(--dur-snappy) var(--spring-snappy), width var(--dur-snappy) var(--spring-snappy), opacity var(--dur-tap) var(--ease-standard); + pointer-events: none; +} +.app-tab-indicator.is-ready { opacity: 1; } +.app-tab-indicator.no-anim { transition: none; } +@media (min-width: 600px) { .app-tabbar { display: none !important; } } + +/* ---------- Большой заголовок и компактная стеклянная панель (как в iOS) ---------- + Пока виден большой заголовок, панель прозрачна. Когда он уходит под край — панель + становится стеклом и показывает название раздела. */ +.app-compactbar { + position: sticky; top: 0; z-index: 140; display: flex; align-items: center; gap: var(--space-3); + min-height: 52px; margin-bottom: -52px; padding: 0 var(--page-gutter); + pointer-events: none; + transition: background-color var(--dur-smooth) var(--spring-smooth), box-shadow var(--dur-smooth) var(--spring-smooth), + -webkit-backdrop-filter var(--dur-smooth) var(--spring-smooth), backdrop-filter var(--dur-smooth) var(--spring-smooth); +} +.app-compactbar-title { + font: 600 17px/22px var(--font-display); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + opacity: 0; transform: translateY(6px); + transition: opacity var(--dur-tap) var(--ease-standard), transform var(--dur-snappy) var(--spring-snappy); +} +.app-compactbar.is-stuck { + pointer-events: auto; + background: var(--surface-glass); + -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%); backdrop-filter: blur(var(--blur-glass)) saturate(180%); + box-shadow: inset 0 -1px 0 var(--hairline); +} +.app-compactbar.is-stuck .app-compactbar-title { opacity: 1; transform: none; } +.ps-main-head h1.ps-h1 { transition: opacity var(--dur-tap) var(--ease-standard); } +.app-is-collapsed .ps-main-head h1.ps-h1 { opacity: 0.0001; } +@media (max-width: 599px) { + .app-compactbar { display: none; } + .app-topbar.app-glass { + position: sticky; top: 0; z-index: 150; box-shadow: inset 0 -1px 0 var(--hairline), inset 0 1px 0 var(--glass-edge); + } +} + +/* Ритм заголовка экрана: большой заголовок → подпись (stack-text) → содержимое (stack-section) */ +.ps-main-head { align-items: flex-end; gap: var(--stack-group); } +.ps-main-head > div { display: grid; gap: var(--stack-text); } +.ps-main-head .ps-lead { margin: 0; } +.ps-main-head .app-back { justify-self: start; margin: 0 0 var(--space-3) -12px; } + +/* Мгновенное нажатие на ссылку раздела: подсветка в тот же кадр */ +.ps-sidenav-item:active, .ps-tab:active { transform: scale(0.96); } + +@media (prefers-reduced-motion: reduce) { + body.is-cabinet::before, body.lp-body::before { animation: none; } + .app-nav-indicator, .app-tab-indicator, .app-compactbar, .app-compactbar-title { transition-duration: 1ms !important; } + .app-glass::after { display: none; } +} +@media (prefers-reduced-transparency: reduce) { + .app-glass, .app-compactbar.is-stuck { background: var(--surface-raised) !important; -webkit-backdrop-filter: none; backdrop-filter: none; } + .app-glass::after, body.is-cabinet::before, body.lp-body::before { display: none; } +} + +/* Смена темы — раскрытие кругом от кнопки (glass.js); других переходов между страницами нет */ +.is-theme-switch::view-transition-old(root), .is-theme-switch::view-transition-new(root) { animation: none; mix-blend-mode: normal; } + +/* Ровные строки без переносов: последний перенос строки подбирается так, чтобы не оставлять одно слово */ +p, li, .ps-lead, .ps-card-excerpt, .ps-empty-text, .ps-action-desc, .ps-choice-desc, .lp-step p, .lp-feature p, .lp-lead, .lp-hero-lead { text-wrap: pretty; } + +/* ================= Исправления по итогам проверки ================= */ + +/* Зоны нажатия не меньше target-min (44px) */ +.step-dot { position: relative; width: 36px; height: 36px; font: 500 13px/1 var(--font-text); } +.step-dot::before { content: ""; position: absolute; inset: -4px; } +.survey-steps-indicator { gap: var(--space-2); } +details > summary { display: flex; align-items: center; min-height: var(--target-min); } +.app-logo-link { min-height: var(--target-min); align-items: center; } +.app-status-select { width: auto; min-width: 180px; } + +/* Старые кнопки форм — капсулы, как все кнопки */ +.form button[type="submit"], .form > button, .survey-nav button, .button-danger, .copy-btn, .button-link { border-radius: var(--radius-pill); } +.copy-btn, .button-link { padding: 0 var(--space-4); } + +/* Сетка 4pt в старых классах */ +.form label, .app-survey-aside label { gap: var(--space-2); } +.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), .form select, .form textarea { padding: 11px var(--space-4); } +.errors ul { padding-left: var(--space-5); } + +/* Лист подтверждения удаления */ +.app-confirm { display: grid; justify-items: center; gap: var(--space-3); text-align: center; max-width: 440px; margin: 0 var(--space-4); } +.app-sheet:has(.app-confirm) { align-items: center; } +.app-confirm { border-radius: var(--radius-xl); } +.app-confirm-icon { background: var(--danger-tint); color: var(--danger); } +.app-confirm p { margin: 0; } +.app-confirm-actions { justify-content: center; margin-top: var(--space-2); } +.app-confirm-actions .ps-btn { min-width: 140px; } + +/* Главная: «Быстрый старт» — три плитки в ряд или столбиком, без 2+1 */ +.app-main .ps-grid-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } +@media (max-width: 1279px) and (min-width: 1024px), (max-width: 599px) { .app-main .ps-grid-tiles { grid-template-columns: minmax(0, 1fr); } } +.app-main .ps-grid-2 { align-items: start; } +.ps-stat { align-content: start; } +/* Четыре показателя на телефоне — 2×2 */ +@media (max-width: 599px) { .app-main .ps-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } } +@media (max-width: 599px) { .ps-stat-value { font-size: 28px; line-height: 34px; } } +.app-grid-fields { gap: var(--stack-group); } + +/* План: на узком экране параметры — первыми */ +@media (max-width: 1199px) { .app-plan-params { order: -1; } } + +/* Шеврон селекта в тёмной теме */ +:root[data-theme="dark"] .form select, :root[data-theme="dark"] .status-select { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a9b8cc' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E"); +} +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) .form select, :root:not([data-theme="light"]) .status-select { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23a9b8cc' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E"); + } } diff --git a/cabinet_service/templates/_post_card.html b/cabinet_service/templates/_post_card.html new file mode 100644 index 0000000..a150172 --- /dev/null +++ b/cabinet_service/templates/_post_card.html @@ -0,0 +1,26 @@ +{# Карточка поста (PostCard). Ожидает переменные post и platform_label. #} +{#- Заголовок — первая строка, где есть хотя бы 4 знака (строка из одного эмодзи не годится) -#} +{%- set lines = (post.content or '').strip().split('\n') | map('trim') | reject('equalto', '') | list -%} +{%- set ns = namespace(idx=0) -%} +{%- for l in lines %}{% if ns.idx == 0 and l|length > 3 %}{% set ns.idx = loop.index %}{% endif %}{% endfor -%} +{%- set head_i = (ns.idx or 1) - 1 -%} +{%- set title = (lines[head_i] if lines else 'Пост') | truncate(90, True, '…') -%} +{%- set rest = lines[head_i + 1:] | join(' ') -%} +
+
+ {% if post.published %} + {{ ui.icon('megaphone', 14) }}Опубликован + {% else %} + {{ ui.icon('sparkle', 14) }}Сгенерирован ИИ + {% endif %} + {{ platform_label(post.platform) }}{% if post.style %} · {{ post.style | truncate(24, True, '…') }}{% endif %} +
+

{{ title }}

+ {% if rest %}

{{ rest }}

{% endif %} +
+ {{ post.created_at|local_dt }} + {{ (post.content or '')|length|num }} зн. + {% if post.images %}{{ ui.icon('image', 16) }}{{ post.images|length }}{% endif %} + {{ ui.icon('chevron-right', 18, 'ps-card-chev') }} +
+
diff --git a/cabinet_service/templates/_ui.html b/cabinet_service/templates/_ui.html new file mode 100644 index 0000000..46acc68 --- /dev/null +++ b/cabinet_service/templates/_ui.html @@ -0,0 +1,21 @@ +{# Компоненты дизайн-системы «ИИ Пресс-секретарь» для Jinja. Сгенерировано из дизайн-системы. #} +{% set ICONS = {"send": "M12 19V5M5.5 11.5L12 5l6.5 6.5", "mic": "M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3zM19 11a7 7 0 0 1-14 0M12 18v3", "attach": "M20 11.5l-8.2 8.2a5 5 0 0 1-7.1-7.1l8.6-8.6a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-2.8-2.8l7.8-7.8", "sparkle": "M12 3.5l1.9 5.1 5.1 1.9-5.1 1.9L12 17.5l-1.9-5.1L5 10.5l5.1-1.9zM18.5 16.5l.8 1.7 1.7.8-1.7.8-.8 1.7-.8-1.7-1.7-.8 1.7-.8z", "stop": "M9 7h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2z", "copy": "M10 8h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2zM16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2", "edit": "M4 20h4L19 9a2.83 2.83 0 0 0-4-4L4 16zM13.5 6.5l4 4", "refresh": "M20 12a8 8 0 1 1-2.34-5.66M20 4v5h-5", "check": "M5 12.5l4.5 4.5L19 7.5", "close": "M6.5 6.5l11 11M17.5 6.5l-11 11", "plus": "M12 5v14M5 12h14", "chevron-right": "M9.5 6l6 6-6 6", "news": "M7 3h7l5 5v11a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM14 3v5h5M8.5 13h7M8.5 17h5", "megaphone": "M4 10v4a1 1 0 0 0 1 1h2l8 4V5L7 9H5a1 1 0 0 0-1 1zM18.5 9a4 4 0 0 1 0 6M8 15.5l1 4.5", "chat": "M20 12a8 8 0 0 1-11.6 7.1L4 20l1-4.2A8 8 0 1 1 20 12z", "calendar": "M6 5h12a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM4 10h16M8.5 3v4M15.5 3v4", "clock": "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 7.5V12l3 2", "home": "M4 11l8-7 8 7v8a2 2 0 0 1-2 2h-3v-6H9v6H6a2 2 0 0 1-2-2z", "user": "M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4.5 20a7.5 7.5 0 0 1 15 0", "settings": "M4 7h9M19 7h1M4 17h1M11 17h9M16 4.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5zM8 14.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5z", "alert": "M12 4.5l8.5 14.5h-17zM12 10v4M12 16.8v.2", "info": "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 11v5.5M12 7.8v.2", "search": "M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM20 20l-4-4", "image": "M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM4 16l5-5 4 4 3-3 4 4M15.5 8.5v.01", "chart": "M4 20h16M7 16v-5M12 16V7M17 16V9", "cpu": "M7 5h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM10 10h4v4h-4zM9.5 2.5V5M14.5 2.5V5M9.5 19v2.5M14.5 19v2.5M2.5 9.5H5M2.5 14.5H5M19 9.5h2.5M19 14.5h2.5", "persona": "M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM9 12a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM6 16a3 3 0 0 1 6 0M14.5 10h3.5M14.5 13.5h3.5", "history": "M3.5 12a8.5 8.5 0 1 0 2.5-6M3.5 4v4h4M12 8v4.5l3 1.5", "download": "M12 4v11M7.5 10.5L12 15l4.5-4.5M5 20h14", "upload": "M12 15V4M7.5 8.5L12 4l4.5 4.5M5 20h14", "trash": "M5 7h14M10 7V5h4v2M7 7l1 12a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1l1-12M10.5 11v5M13.5 11v5", "link": "M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1", "key": "M8 7a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM12 11h9M18 11v3.5M15.5 11v2.5", "users": "M9 11a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7zM3 20a6 6 0 0 1 12 0M16 4.5a3.5 3.5 0 0 1 0 6.5M17.5 14.5A6 6 0 0 1 21 20", "building": "M5 21V5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v16M15 9h3a1 1 0 0 1 1 1v11M3 21h18M8.5 8h3M8.5 12h3M8.5 16h3", "landmark": "M4 21h16M6 21V11M10 21V11M14 21V11M18 21V11M12 3l8 6H4z", "grid": "M6 4h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM15 4h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM6 13h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2zM15 13h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2z", "eye": "M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z", "eye-off": "M4 4l16 16M9.9 5.8A9.6 9.6 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a16 16 0 0 1-2.6 3.4M6.3 7.6C3.9 9.3 2.5 12 2.5 12S6 18.5 12 18.5c1.7 0 3.2-.5 4.5-1.2M9.9 9.9a3 3 0 0 0 4.2 4.2", "chevron-down": "M6 9.5l6 6 6-6", "chevron-left": "M14.5 6l-6 6 6 6", "logout": "M10 5H6a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h4M15 8l4 4-4 4M19 12H9", "theme": "M20 14.5A8.5 8.5 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z"} %} +{% set PRESET_ART = {"cover": "", "quote": "", "announce": "", "mockup": "", "collage": "", "background": "", "portrait": "", "product": "", "landscape": "", "abstract": "", "meme": "", "minimal": ""} %} + +{% macro icon(name, size=20, cls='', label='') -%} + +{%- endmacro %} +{% macro mark(uid='pl', tone='color', size=40) -%} + +{%- endmacro %} + +{% macro logo(uid='pl', tone='color', size=40, variant='lockup') -%} + +{%- endmacro %} diff --git a/cabinet_service/templates/base.html b/cabinet_service/templates/base.html index b588824..e17446d 100644 --- a/cabinet_service/templates/base.html +++ b/cabinet_service/templates/base.html @@ -1,261 +1,456 @@ +{%- set path = request.url.path -%} +{%- set nav = [ + ('/dashboard', 'Главная', 'home', ['/dashboard']), + ('/generate', 'Создать пост', 'sparkle', ['/generate']), + ('/plan', 'Контент-план', 'calendar', ['/plan']), + ('/history', 'Мои посты', 'news', ['/history', '/posts']), + ('/images', 'Картинки', 'image', ['/images']), + ('/channels', 'Каналы', 'megaphone', ['/channels']), + ('/surveys', 'Медиа-образы', 'persona', ['/surveys', '/survey']), + ('/stats', 'Статистика', 'chart', ['/stats']), + ('/provider', 'ИИ-провайдеры', 'cpu', ['/provider', '/tenchat']), + ('/profile/edit', 'Профиль', 'user', ['/profile', '/delete-account']), +] -%} +{%- set nav_groups = [ + ('', [nav[0]]), + ('Контент', [nav[1], nav[2], nav[3], nav[4]]), + ('Бренд и каналы', [nav[6], nav[5], nav[7]]), + ('Настройки', [nav[8], nav[9]]), +] -%} +{%- macro is_active(prefixes) -%}{% for p in prefixes %}{% if path == p or path.startswith(p ~ '/') %}1{% endif %}{% endfor %}{%- endmacro -%} - - {% block title %}Личный кабинет{% endblock %} - + + {% block title %}Личный кабинет{% endblock %} · ИИ Пресс-секретарь + + + + + + + {% block head %}{% endblock %} - - + - +
+
+ {{ ui.logo('toplogo', 'color', 28) }} + +
-
- {% if flash_message %} -
{{ flash_message }}
- {% endif %} - {% if errors %} -
-
    - {% for error in errors %} -
  • {{ error }}
  • + +
    + {% if errors %} + + {% endif %} + {% block content %}{% endblock %} +
    +
+ + {%- set tab_more_active = not (is_active(['/dashboard']) or is_active(['/generate']) or is_active(['/plan']) or is_active(['/history', '/posts'])) %} + + + +
+{% else %} +
+ +
+ {% if errors %} + {% endif %} - {% block content %}{% endblock %} + {{ self.content() }}
+ +
+{% endif %} - + }) + .catch(function(err) { if (err.message !== Press.SESSION) TaskEngine.fail(opts, err.message); else opts._busy = false; }); + }, + fail: function(opts, message) { + opts._busy = false; + var loaderEl = document.getElementById(opts.loaderId || 'taskLoader'); + var formContainer = document.getElementById(opts.formId || 'taskForm'); + var errEl = document.getElementById(opts.errorId || 'taskError'); + if (loaderEl) loaderEl.style.display = 'none'; + if (formContainer) formContainer.style.display = ''; + if (errEl) { errEl.style.display = 'flex'; errEl.textContent = Press.humanError(message); errEl.title = message; } + if (opts.onEnd) opts.onEnd(false); + } + }; + +{% block scripts %}{% endblock %} diff --git a/cabinet_service/templates/channel_add.html b/cabinet_service/templates/channel_add.html index 32c001d..6b53a65 100644 --- a/cabinet_service/templates/channel_add.html +++ b/cabinet_service/templates/channel_add.html @@ -1,19 +1,48 @@ {% extends "base.html" %} -{% block title %}Добавить канал — Личный кабинет{% endblock %} +{% block title %}Добавить канал{% endblock %} {% block content %} -

Добавить канал

-
-

- Введите @username канала/чата или числовой ID.
- Бот должен быть добавлен в админы канала, иначе публикация не сработает. -

+
+
+ {{ ui.icon('chevron-left', 16) }}Каналы +

Добавить канал

+
+
+ +
+ {% if verify %} +
+

Подтвердите, что канал ваш

+

Бот — администратор в «{{ verify.title }}». Осталось подтвердить, что канал принадлежит вам: добавьте код в описание канала в Telegram и сохраните.

+
+ + +

После проверки код можно удалить из описания.

+
+
+ + Другой канал +
+
+ {% else %} +
+
+ + +

{% if errors %}{{ ui.icon('alert', 16) }}{% endif %}Например: @teplyhleb_dn или -1001234567890

+
+ +
+ {% endif %} + +
-
- - -
-

← Назад к каналам

{% endblock %} diff --git a/cabinet_service/templates/channels.html b/cabinet_service/templates/channels.html index 4fcae41..4bcb672 100644 --- a/cabinet_service/templates/channels.html +++ b/cabinet_service/templates/channels.html @@ -1,37 +1,42 @@ {% extends "base.html" %} -{% block title %}Каналы публикации — Личный кабинет{% endblock %} +{% block title %}Каналы{% endblock %} {% block content %} -

Каналы публикации

-

Добавьте Telegram-каналы и чаты, куда бот будет публиковать посты. Бот должен быть админом в канале.

- -
- ➕ Добавить канал +{%- set chat_types = {'channel': 'Канал', 'group': 'Группа', 'supergroup': 'Супергруппа', 'private': 'Личный чат'} -%} +
+
+

Каналы

+

Telegram-каналы и чаты, куда публикуются посты. Бот должен быть в них администратором.

+
+ {{ ui.icon('plus', 20) }}Добавить канал
{% if channels %} - - - - - +
{% for ch in channels %} -
- - - - - - + {%- set name = (ch.title or ch.username or '?') | replace('@', '') -%} +
+ + + {{ ch.title or ('@' ~ ch.username) }} + {% if ch.username %}@{{ ch.username }}{% else %}ID {{ ch.chat_id }}{% endif %} · {{ chat_types.get(ch.chat_type, ch.chat_type) }} + + {{ ui.icon('check', 14) }}Подключён {{ ch.created_at|local_dt('%d.%m.%Y') }} + +
+ + +
+
{% endfor %} - -
НазваниеТипUsernameДобавлен
{{ ch.title }}{{ ch.chat_type }}{% if ch.username %}@{{ ch.username }}{% else %}—{% endif %}{{ ch.created_at }} -
- -
-
-{% else %} -
-

Нет добавленных каналов. Добавьте первый →

+{% else %} +
+
+ +

Каналов пока нет

+

Добавьте Telegram-канал или чат — и публикуйте посты в один клик.

+ {{ ui.icon('plus', 20) }}Добавить канал +
+
{% endif %} {% endblock %} diff --git a/cabinet_service/templates/dashboard.html b/cabinet_service/templates/dashboard.html index f45062e..4be6d21 100644 --- a/cabinet_service/templates/dashboard.html +++ b/cabinet_service/templates/dashboard.html @@ -1,41 +1,122 @@ {% extends "base.html" %} -{% block title %}Главная — Личный кабинет{% endblock %} +{% block title %}Главная{% endblock %} {% block content %} -

Привет, {{ user.name }}!

-
-

Телефон: {{ user.phone }}

-

Email: {{ user.email }}

-

В кабинете с: {{ user.created_at }}

+{%- set first_name = user.name | first_name -%} +
+
+

{{ greeting_for_hour() }}{% if first_name %}, {{ first_name }}{% endif %}

+

+ {% if counters.posts %}Всего {{ counters.posts }} {{ plural(counters.posts, ['пост', 'поста', 'постов']) }} и {{ counters.published }} {{ plural(counters.published, ['публикация', 'публикации', 'публикаций']) }}. + {% else %}Здесь появятся ваши посты, картинки и публикации.{% endif %} +

+
+ {{ ui.icon('sparkle', 20) }}Создать пост
-
-

Медиа-образ

- {% if latest_survey %} -

Активный: {{ latest_survey.title }}

-

Посты генерируются на основе этого медиа-образа.

-
- Открыть - ➕ Создать новый - 📤 Загрузить из файла +{% if not latest_survey %} +
+
+ +

Начните с медиа-образа

+

Опишите бренд, личность или сообщество один раз — и посты будут звучать вашим голосом. Это 5 минут.

+ +
+
+{% else %} +
+
+ + Постов создано + {{ counters.posts|num }} +
+
+ + Картинок + {{ counters.images|num }} +
+
+ + Опубликовано + {{ counters.published|num }} +
+
+ + Медиа-образов + {{ counters.surveys|num }} + Активный — {{ latest_survey.title | truncate(28, True, '…') }} +
+
+ +
+ +
+

Быстрый старт

+ +
+
+{% endif %} + +
+
+

Последние посты

+ {% if recent_posts %}Все посты{{ ui.icon('chevron-right', 16) }}{% endif %} +
+ {% if recent_posts %} +
+ {% for post in recent_posts %}{% include "_post_card.html" %}{% endfor %}
{% else %} -

Медиа-образ ещё не создан. Создайте его — посты будут генерироваться на его основе.

-
- ➕ Создать медиа-образ - 📤 Загрузить из файла +
+
+ +

Постов пока нет

+

Выберите платформу и стиль — первый пост появится здесь.

+ {% if latest_survey %}{{ ui.icon('sparkle', 20) }}Создать пост{% endif %} +
{% endif %} -
- - +
+{% endblock %} + +{% block scripts %} + {% endblock %} diff --git a/cabinet_service/templates/delete_confirm.html b/cabinet_service/templates/delete_confirm.html index 2fbd0cf..18a668f 100644 --- a/cabinet_service/templates/delete_confirm.html +++ b/cabinet_service/templates/delete_confirm.html @@ -1,11 +1,29 @@ {% extends "base.html" %} -{% block title %}Удаление аккаунта — Личный кабинет{% endblock %} +{% block title %}Удаление аккаунта{% endblock %} {% block content %} -

Удалить аккаунт?

-

Это безвозвратно удалит твой профиль и всю историю постов.

-
- - -
-

Отмена, вернуться в кабинет

+
+
+ +

Удалить аккаунт?

+

Удалятся профиль, все посты, картинки, медиа-образы и контент-план. Вернуть их будет нельзя.

+
+
+ +
+ + +
+
+ + Оставить +
+
+
+{% endblock %} +{% block scripts %} + {% endblock %} diff --git a/cabinet_service/templates/generate.html b/cabinet_service/templates/generate.html index 6675ac1..a09aa09 100644 --- a/cabinet_service/templates/generate.html +++ b/cabinet_service/templates/generate.html @@ -1,100 +1,200 @@ {% extends "base.html" %} -{% block title %}Сгенерировать пост — Личный кабинет{% endblock %} +{% block title %}Создать пост{% endblock %} {% block content %} -

Пост в своём стиле

+{%- set platform_meta = { + 'telegram': ('send', 'До 4 096 знаков', 4096), + 'instagram': ('image', 'Подпись до 2 200 знаков', 2200), + 'linkedin': ('building', 'До 3 000 знаков', 3000), + 'twitter': ('chat', 'До 280 знаков', 280), + 'tenchat': ('users', 'Деловая соцсеть', 4096), + 'ad': ('megaphone', 'Короткий продающий текст', 4096), +} -%} +{%- set styles = [('экспертный', 'Экспертный'), ('вовлекающий', 'Вовлекающий'), ('личный', 'Личный'), ('продающий', 'Продающий')] -%} +{%- set cur_platform = (prefill.platform if prefill and prefill.platform else (form.platform if form else 'telegram')) -%} +{%- if cur_platform not in (platforms | map('first') | list) %}{% set cur_platform = 'telegram' %}{% endif -%} +{%- set cur_style = form.style if form and form.style else 'экспертный' -%} +{%- set style_known = cur_style in styles | map('first') | list -%} -{% if latest_survey %} -
-

Медиа-образ: {{ latest_survey.title }}

-

Пост сгенерируется на основе этого медиа-образа (личность, УТП, Tone of Voice, структура мысли).

+
+
+

Создать пост

+

{% if latest_survey %}Медиа-образ: {{ latest_survey.title }}.{% else %}Посты пишутся по медиа-образу — сначала создайте его.{% endif %}

+
-{% else %} -
-

⚠️ Медиа-образ не найден. Посты генерируются на основе медиа-образа.

- ➕ Создать медиа-образ + +{% if prefill and prefill.idea %} +
+ {{ ui.icon('calendar', 18) }} +
  • Идея и платформа из контент-плана уже подставлены.
{% endif %} -
+
+
+

Параметры

+
+ {% if surveys and surveys|length > 1 %} +
+ +
+ + {{ ui.icon('chevron-down', 18, 'ps-select-chev') }} +
+
+ {% endif %} -
-
-
Генерирую пост...
-
Это может занять 15–60 секунд
-
+
+ Платформа + +
+ {% for key, label in platforms %} + {%- set m = platform_meta.get(key, ('news', '', 4096)) -%} + {%- set sel = key == cur_platform -%} + + {% endfor %} +
+
-
+
+ Стиль + +
+ {% for value, label in styles %} + {%- set sel = value == cur_style or (not style_known and loop.first) -%} + + {% endfor %} +
+
-
- - {% if surveys and surveys|length > 1 %} - +
+
+ + необязательно +
+ +
+ + + {% if prefill %}{% endif %} + + {% if not latest_survey %} + {{ ui.icon('plus', 20) }}Создать медиа-образ + {% endif %} + +
+ +
+ +
+
Пишу пост по медиа-образу…
+ Обычно 15–60 секунд +
+ +
+ +
+ {% if result %} + {%- set m = platform_meta.get(form.platform, ('news', '', 4096)) -%} +
+
+ {{ ui.icon(m[0], 16) }}{% for k, l in platforms if k == form.platform %}{{ l }}{% endfor %} + {% if form.style %}{% endif %} +
+

{{ result }}

+ +
+ + {% else %} +
+
+ +

Здесь появится пост

+

Выберите платформу и стиль, при желании добавьте пожелания и нажмите «Сгенерировать пост».

+
+
{% endif %} - - - - - {% if prefill %}{% endif %} - - +
+
-{% if result %} -

Готовый пост

-
{{ result }}
-
- -
- -{% endif %} -

← Назад в кабинет

+ +{% endblock %} +{% block scripts %} {% endblock %} diff --git a/cabinet_service/templates/history.html b/cabinet_service/templates/history.html index e53c538..f220a3f 100644 --- a/cabinet_service/templates/history.html +++ b/cabinet_service/templates/history.html @@ -1,39 +1,26 @@ {% extends "base.html" %} -{% block title %}Мои посты — Личный кабинет{% endblock %} +{% block title %}Мои посты{% endblock %} {% block content %} -

Мои посты

-{% if posts %} -
    - {% for post in posts %} -
  • - -
    {{ post.content }}
    - {% if post.images %} -
    - {% for img in post.images %} - - {% endfor %} -
    - {% endif %} -
    - - 👁 Открыть - ✏️ Изменить -
    - -
    -
    -
  • - {% endfor %} -
-{% else %} -
-

Постов пока нет.

-

💡 Сгенерировать первый пост

+
+
+

Мои посты

+ {% if posts %}

{{ posts|length }} {{ plural(posts|length, ['пост', 'поста', 'постов']) }}. Откройте пост, чтобы доработать его в чате с ИИ, добавить картинки и опубликовать.

{% endif %} +
+ {{ ui.icon('sparkle', 20) }}Создать пост
+ +{% if posts %} +
+ {% for post in posts %}{% include "_post_card.html" %}{% endfor %} +
+{% else %} +
+
+ +

Постов пока нет

+

Выберите платформу и стиль — первый пост появится здесь.

+ {{ ui.icon('sparkle', 20) }}Создать пост +
+
{% endif %} -

← Назад в кабинет

{% endblock %} diff --git a/cabinet_service/templates/image_generate.html b/cabinet_service/templates/image_generate.html index 13f3784..c7a1a5b 100644 --- a/cabinet_service/templates/image_generate.html +++ b/cabinet_service/templates/image_generate.html @@ -1,74 +1,95 @@ {% extends "base.html" %} -{% block title %}Сгенерировать картинку — Личный кабинет{% endblock %} +{% block title %}Сгенерировать картинку{% endblock %} {% block content %} -

Генерация картинки

- -
- -
-
-
Генерирую картинку...
-
Это может занять 15–60 секунд
+{#- Шаблоны бэкенда → миниатюры PresetPicker из дизайн-системы -#} +{%- set art_for = {'product': 'product', 'lifestyle': 'portrait', 'food': 'product', 'business': 'mockup', 'abstract': 'abstract', + 'portrait': 'portrait', 'infographic': 'announce', 'banner': 'cover', 'nature': 'landscape', 'minimal': 'minimal', + 'story': 'collage', 'before_after': 'collage'} -%} +
+
+ {{ ui.icon('chevron-left', 16) }}Картинки +

Новая картинка

+

Выберите шаблон или опишите идею своими словами.

+
+ +
+
Рисую картинку…
+ Обычно 15–60 секунд +
-
- -

Выбери шаблон

-
- {% for t in templates %} - - {% endfor %} - -
- - - - -
- - -