:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-alt: #f0f3f9;
  --border: #e3e8f0;
  --text: #1c2333;
  --text-muted: #64748b;
  --primary: #3b5bfd;
  --primary-dark: #2440d6;
  --primary-light: #eef1ff;
  --success: #16a34a;
  --danger: #e0333f;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(30, 41, 59, 0.06);
  --max-width: 1160px;
}

* { box-sizing: border-box; }

html {
  /* Always reserve space for the vertical scrollbar so centered content
     lines up identically on short pages (no scrollbar) and long pages
     (with scrollbar) — otherwise centered blocks visibly shift ~8px
     between pages. */
  overflow-y: scroll;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  width: 100%;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo {
  font-weight: 800;
  font-size: 20px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-badge {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7c5cff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px;
}
.main-nav {
  display: flex;
  gap: 28px;
}
.main-nav a {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 15px;
  transition: color .15s;
}
.main-nav a:hover, .main-nav a.active { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.balance-pill {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
}
.burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none; border: none; cursor: pointer; padding: 8px;
}
.burger span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px 16px;
}
.mobile-nav a { padding: 10px 0; font-weight: 500; border-bottom: 1px solid var(--surface-alt); color: var(--text); }
.mobile-nav.open { display: flex; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 11px 20px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: var(--surface-alt); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Banner ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  margin: 28px 0 40px;
  background: linear-gradient(120deg, #3b5bfd 0%, #6d5bff 45%, #9b6bff 100%);
  color: #fff;
  padding: 64px 40px;
  isolation: isolate;
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(6px);
  opacity: .35;
  animation: floaty 9s ease-in-out infinite;
  z-index: -1;
}
.hero::before { width: 260px; height: 260px; background: #fff; top: -80px; right: -60px; }
.hero::after { width: 180px; height: 180px; background: #ffe27a; bottom: -60px; left: 10%; animation-delay: 2.5s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-18px) scale(1.06); }
}
.hero-content { max-width: 620px; }
.hero h1 { font-size: 38px; margin: 0 0 14px; line-height: 1.15; }
.hero p { font-size: 17px; opacity: .92; margin: 0 0 26px; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-badge {
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.35);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  backdrop-filter: blur(4px);
}

/* ---------- Sections ---------- */
.section { margin: 48px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.section-head h2 { font-size: 24px; margin: 0; }
.section-head p { color: var(--text-muted); margin: 4px 0 0; font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* ---------- Product card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(30,41,59,.10); }
.card-image {
  aspect-ratio: 4 / 3;
  background: var(--surface-alt);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 18px;
}
.card-image img { max-height: 100%; object-fit: contain; border-radius: 10px; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-category { font-size: 12px; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.card-title { font-size: 16px; font-weight: 700; margin: 0; }
.card-desc { font-size: 13.5px; color: var(--text-muted); flex: 1; }
.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 10px; }
.card-price { font-size: 18px; font-weight: 800; color: var(--text); }
.badge-popular {
  position: absolute; margin: 10px; background: #ffb020; color: #3a2400;
  font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px;
}
.card-image-wrap { position: relative; }

/* ---------- Info blocks (home) ---------- */
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.info-box .icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
}
.info-box h3 { margin: 0 0 8px; font-size: 16px; }
.info-box p { margin: 0; font-size: 13.5px; color: var(--text-muted); }

/* ---------- Forms ---------- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 440px;
  margin: 40px auto;
  box-shadow: var(--shadow);
}
.form-card h1 { font-size: 22px; margin: 0 0 6px; }
.form-card .sub { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .12s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 110px; }
.form-note { font-size: 13px; color: var(--text-muted); margin-top: 16px; text-align: center; }
.form-note a { color: var(--primary); font-weight: 600; }
.alert {
  padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px;
}
.alert-error { background: #fdeceb; color: #b3261e; border: 1px solid #f6c6c2; }
.alert-success { background: #eafaf0; color: #146c33; border: 1px solid #bdeacb; }

/* ---------- Cabinet ---------- */
.cabinet-layout { display: grid; grid-template-columns: 240px 1fr; gap: 28px; margin: 32px 0 60px; }
.cabinet-side {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; height: fit-content; position: sticky; top: 88px;
}
.cabinet-side button {
  width: 100%; text-align: left; padding: 11px 14px; border-radius: 10px; border: none;
  background: transparent; font-weight: 600; font-size: 14.5px; color: var(--text-muted);
  cursor: pointer; margin-bottom: 3px;
}
.cabinet-side button.active, .cabinet-side button:hover { background: var(--primary-light); color: var(--primary-dark); }
.cabinet-main {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
}
.balance-card {
  background: linear-gradient(120deg, var(--primary), #7c5cff);
  color: #fff; border-radius: var(--radius); padding: 26px; margin-bottom: 28px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.balance-card .amount { font-size: 30px; font-weight: 800; }
.balance-card .label { font-size: 13px; opacity: .85; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th, table.data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data-table th { color: var(--text-muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; }
.status-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-completed, .status-approved { background: #eafaf0; color: #146c33; }
.status-pending, .status-new { background: #fff6e0; color: #8a5b00; }
.status-cancelled, .status-rejected { background: #fdeceb; color: #b3261e; }
.status-answered, .status-closed { background: #eef1ff; color: #3b5bfd; }
.empty-state { color: var(--text-muted); font-size: 14px; padding: 24px 0; text-align: center; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 40px 0 24px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; margin-bottom: 26px; }
.footer-col h4 { font-size: 14px; margin: 0 0 12px; }
.footer-col p, .footer-col a { display: block; font-size: 13.5px; color: var(--text-muted); margin-bottom: 8px; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 18px; font-size: 12.5px; color: var(--text-muted);
  display: flex; justify-content: center; text-align: center; flex-wrap: wrap; gap: 8px;
}

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; bottom: 16px; left: 16px; right: 16px; max-width: 640px; margin: 0 auto;
  background: var(--text); color: #fff; padding: 16px 20px; border-radius: 14px;
  display: flex; align-items: center; gap: 16px; z-index: 999; box-shadow: 0 12px 30px rgba(0,0,0,.25);
  flex-wrap: wrap;
}
.cookie-banner p { margin: 0; font-size: 13.5px; flex: 1; min-width: 200px; }
.cookie-banner .btn-primary { flex-shrink: 0; }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin: 28px 0 60px; }
.admin-tabs { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; height: fit-content; position: sticky; top: 88px; }
.admin-tabs button { text-align: left; padding: 11px 14px; border-radius: 10px; border: none; background: transparent; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.admin-tabs button.active, .admin-tabs button:hover { background: var(--primary-light); color: var(--primary-dark); }
.admin-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.admin-panel h2 { margin-top: 0; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,25,40,.45); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); padding: 26px; max-width: 480px; width: 100%; max-height: 88vh; overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.row-actions { display: flex; gap: 8px; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; background: var(--surface-alt); }

/* ---------- Page title ---------- */
.page-title { margin: 34px 0 10px; font-size: 30px; }
.page-sub { color: var(--text-muted); margin-bottom: 30px; max-width: 640px; }

/* ---------- Centered narrow content blocks (About, Support, legal pages) ---------- */
.page-narrow {
  max-width: 760px;
  margin: 0 auto;
}
.page-title.centered, .page-sub.centered { text-align: center; }
.page-sub.centered { margin-left: auto; margin-right: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .main-nav { display: none; }
  .burger { display: flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .cabinet-layout, .admin-layout { grid-template-columns: 1fr; }
  .cabinet-side, .admin-tabs { position: static; display: flex; flex-direction: row; overflow-x: auto; }
  .cabinet-side button, .admin-tabs button { white-space: nowrap; }
  .info-grid { grid-template-columns: 1fr; }
  .hero { padding: 44px 24px; }
  .hero h1 { font-size: 28px; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
  .header-inner { height: 60px; }
}
