/* ============================================================
   Klasix — дизайн-токены, mobile-first, 360–1920
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f7fc;
  --card: #ffffff;
  --text: #1b2430;
  --text-2: #5b6675;
  --border: #e2e8f0;
  --primary: #2f6fed;
  --primary-2: #1d54c8;
  --accent: #ffb020;
  --danger: #e23b3b;
  --ok: #1fa971;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(20, 40, 80, .08);
  --shadow-sm: 0 3px 12px rgba(20, 40, 80, .07);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --nav-h: 60px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0e1420;
  --bg-soft: #131c2c;
  --card: #151f31;
  --text: #e8edf5;
  --text-2: #9aa7b8;
  --border: #263449;
  --primary: #4d86ff;
  --primary-2: #6b9aff;
  --accent: #ffc24d;
  --danger: #ff5c5c;
  --ok: #37d188;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background .25s, color .25s;
}
img { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
button { font-family: inherit; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--primary); color: #fff; padding: 8px 14px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ------------------------------------------------------------ Навбар */
.navbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: 1180px; margin: 0 auto; padding: 0 18px; height: 100%;
  display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--primary);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { color: var(--text-2); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 9px; width: 36px; height: 36px; cursor: pointer; font-size: 1rem;
}
.nav-burger { display: none; border: none; background: none; font-size: 1.4rem; color: var(--text); cursor: pointer; }
/* Кнопка-иконка (тема/прочее) в шапке */
.file-tile[draggable="true"] { cursor: grab; }
.file-tile.dragging { opacity: .45; }
.file-tile.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; }
.icon-btn {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--card); color: var(--text-2);
  font-size: 1rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, transform .2s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); transform: rotate(20deg); }
.nav-user { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
}

@media (max-width: 820px) {
  .nav-burger { display: block; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 10px 18px; box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-user span.name { display: none; }
}

/* ------------------------------------------------------------ Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: .95rem; font-weight: 600; cursor: pointer;
  transition: transform .12s, box-shadow .2s, background .2s; color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-2); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ------------------------------------------------------------ Формы */
.field { display: block; width: 100%; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: .88rem; color: var(--text-2); }
/* Значок «ⓘ» — подсказка при наведении (native title) */
.hint-ico {
  display: inline-block; width: 15px; height: 15px; line-height: 15px;
  text-align: center; font-size: .78rem; cursor: help;
  border-radius: 50%; color: var(--text-2); background: var(--bg-soft);
  border: 1px solid var(--border); margin-left: 4px;
}
.hint-ico:hover { color: var(--primary); border-color: var(--primary); }
/* Кастомный тултип подсказок ⓘ */
.hint-tip {
  position: fixed; z-index: 999;
  box-sizing: border-box;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .25);
  padding: 9px 12px; font-size: .8rem; line-height: 1.45;
  max-width: 240px; min-width: 140px;
  pointer-events: auto;
}
.input, .textarea, select.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font-size: .98rem; outline: none; font-family: inherit;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.textarea { min-height: 90px; resize: vertical; }

/* ------------------------------------------------------------ Карточки, секции */
.container { max-width: 1180px; margin: 0 auto; padding: 24px 18px 64px; }
.section { padding: 56px 18px; }
.section-title { text-align: center; font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: .4em; }
.section-sub { text-align: center; color: var(--text-2); max-width: 640px; margin: 0 auto 36px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.center { text-align: center; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700;
}
.badge-free { background: color-mix(in srgb, var(--text-2) 14%, transparent); color: var(--text-2); }
.badge-pro { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #b07d00; }
[data-theme="dark"] .badge-pro { color: var(--accent); }
.badge-start { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
[data-theme="dark"] .badge-start { color: #7ea8ff; }
/* Строка «купить тариф» на вкладке Тариф */
.plan-buy-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.plan-buy-name { font-size: .9rem; font-weight: 600; }
.badge-vis { padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: color-mix(in srgb, var(--text-2) 12%, transparent); }
.vis-public { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.vis-link { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.vis-private { background: color-mix(in srgb, var(--text-2) 14%, transparent); }

/* ------------------------------------------------------------ Лендинг */
.hero {
  position: relative; text-align: center; padding: 72px 18px 56px;
  background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--primary) 14%, transparent), transparent);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.02em; }
.hero .lead { color: var(--text-2); font-size: 1.15rem; max-width: 640px; margin: 0 auto 26px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; margin-top: 34px; color: var(--text-2); font-size: .9rem; }

.feature-ico { width: 46px; height: 46px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 12%, transparent);
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 12px; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 12px; }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; max-width: 1024px; margin: 0 auto; }
.plan-card { position: relative; display: flex; flex-direction: column; }
/* Плашки «Start»/«Популярный» — в правый верхний край карточки */
.plan-card .badge { position: absolute; top: 14px; right: 16px; margin: 0; }
.plan-card h3 { margin-right: 104px; }
/* Кнопка «Оформить …» прижата к низу карточки */
.plan-card .plan-features { flex: 1 0 auto; }
.plan-card .btn-block { margin-top: auto; }
.plan-card.pro { border-color: var(--accent); box-shadow: 0 12px 40px color-mix(in srgb, var(--accent) 25%, transparent); }
.plan-price { font-size: 2.1rem; font-weight: 800; }
.plan-price small { font-size: .9rem; color: var(--text-2); font-weight: 400; }
.plan-features { list-style: none; padding: 0; margin: 18px 0; }
.plan-features li { padding: 6px 0; border-bottom: 1px dashed var(--border); color: var(--text-2); }
.plan-features li b { color: var(--text); }
.plan-features li.no { opacity: .45; text-decoration: line-through; }

.demo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; max-width: 760px; margin: 0 auto; }
.demo-tile { aspect-ratio: 4/3; border-radius: var(--radius-sm); object-fit: cover; cursor: pointer;
  width: 100%; border: 1px solid var(--border); background: var(--bg-soft); }

.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--card); }
.faq-q { width: 100%; text-align: left; padding: 14px 16px; background: none; border: none; font-size: 1rem;
  font-weight: 600; color: var(--text); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.faq-a { padding: 0 16px 14px; color: var(--text-2); display: none; }
.faq-item.open .faq-a { display: block; }
.faq-item.open .faq-q::after { content: '−'; }
.faq-q::after { content: '+'; font-weight: 700; }

.contact-form { max-width: 520px; margin: 0 auto; }

/* ------------------------------------------------------------ Кабинет */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab { padding: 9px 16px; border-radius: var(--radius-sm); background: none; border: none; color: var(--text-2);
  font-weight: 600; font-size: .95rem; cursor: pointer; }
.tab:hover { background: var(--bg-soft); }
.tab.active { background: var(--primary); color: #fff; }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.album-card { overflow: hidden; display: flex; flex-direction: column; }
.album-cover { aspect-ratio: 16/10; width: 100%; object-fit: cover; border-radius: 10px; background: var(--bg-soft); cursor: pointer; }
.album-title { font-weight: 700; margin: 12px 0 4px; }
.album-meta { color: var(--text-2); font-size: .85rem; }
.album-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.file-tile { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-soft); }
.file-tile img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.file-tile .ft-actions { position: absolute; inset: auto 6px 6px 6px; display: flex; gap: 6px; justify-content: flex-end; }
.file-tile .ft-actions .btn { padding: 5px 10px; font-size: .8rem; box-shadow: var(--shadow-sm);
  background: rgba(12, 16, 32, .6); border: 1px solid rgba(255, 255, 255, .28); color: #fff; }
.file-tile .ft-actions .btn:hover { filter: brightness(1.3); }
.file-tile .ft-actions .btn-danger { background: rgba(180, 44, 60, .75); border-color: rgba(255, 96, 96, .55); color: #fff; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--text-2); cursor: pointer; transition: border-color .2s, background .2s; margin-bottom: 16px;
  background: color-mix(in srgb, var(--bg-soft) 60%, transparent);
}
.dropzone.drag { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.progress { height: 8px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin-top: 12px; display: none; }
.progress .bar { height: 100%; width: 0; background: var(--primary); transition: width .2s; }

/* ------------------------------------------------------------ Тариф-бар кабинета */
.plan-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px; }
.plan-bar .meter { flex: 1; min-width: 180px; }
.meter .track { height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--primary); border-radius: 99px; }
.meter .fill.warn { background: var(--accent); }
.meter .fill.full { background: var(--danger); }

/* ------------------------------------------------------------ Лайтбокс */
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .9); z-index: 200; display: flex;
  align-items: center; justify-content: center; flex-direction: column; }
.lightbox[hidden] { display: none; }
.lb-img { max-width: 92vw; max-height: 82vh; border-radius: 8px; box-shadow: 0 20px 80px rgba(0,0,0,.6); }
.lb-close, .lb-prev, .lb-next { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: none;
  border-radius: 50%; width: 44px; height: 44px; font-size: 1.4rem; cursor: pointer; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; }
.lb-next { right: 16px; top: 50%; }
.lb-caption { color: #fff; margin-top: 12px; font-size: .9rem; }

/* ------------------------------------------------------------ Админка */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { text-align: center; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--text-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }

/* ------------------------------------------------------------ Разное */
.toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 10px;
  box-shadow: var(--shadow); font-size: .92rem; animation: fadeUp .25s; max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.empty-state { text-align: center; color: var(--text-2); padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state .big { font-size: 2rem; margin-bottom: 8px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; margin: 30px auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.footer { border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 34px 18px; display: grid; gap: 22px; grid-template-columns: 2fr 1fr 1fr 1fr; }
@media (max-width: 720px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
.footer-col { display: flex; flex-direction: column; gap: 6px; }
.footer-col a { color: var(--text-2); }
.footer-col a:hover { color: var(--text); }

.fade-in { animation: fadeUp .4s ease both; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }