@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSansRegular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSansMedium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSansSemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSansBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --color-brand: #457be7;
  --color-brand-hover: #3a6ad4;
  --color-brand-soft: #f0f5ff;
  --color-text: #2d2d2d;
  --color-text-strong: #111827;
  --color-text-soft: #6d6b6b;
  --color-label: #4b5563;
  --color-border: #e5e7eb;
  --color-canvas: #f1f1f3;
  --color-card: #ffffff;
  --color-error: #ef4444;
  --color-error-soft: #fef2f2;
  --color-warning: #8a5d00;
  --color-warning-soft: #fff5dd;
  --color-success: #138144;
  --radius-input: 10px;
  --radius-card: 14px;
  --shadow-card: 0 2px 12px rgba(0,0,0,0.06);
  --header-h: 56px;
  --sidebar-w: 260px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-canvas);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: var(--color-brand); }
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Логотип */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--color-text-strong); text-decoration: none; letter-spacing: -0.01em; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--color-brand); display: grid; place-items: center; }
.logo-mark svg { width: 16px; height: 16px; }

/* ---------- Вход ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--color-card);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 32px 28px 28px;
}
.login-card .logo { margin-bottom: 24px; }
.login h1 { font-size: 22px; line-height: 1.3; color: var(--color-text-strong); font-weight: 700; }
.login .lead { margin-top: 6px; color: var(--color-text-soft); font-size: 14px; }
.field { margin-top: 18px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--color-label); margin-bottom: 6px; }
.field input {
  width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--color-border);
  border-radius: var(--radius-input); background: #fff; color: var(--color-text-strong);
}
.field input:focus { outline: none; border-color: var(--color-brand); box-shadow: 0 0 0 3px var(--color-brand-soft); }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; }
.pass-toggle { position: absolute; right: 6px; top: 6px; width: 34px; height: 34px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--color-text-soft); display: grid; place-items: center; }
.pass-toggle:hover { background: var(--color-canvas); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: var(--radius-input); border: 0;
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--color-brand); color: #fff; }
.btn-primary:hover { background: var(--color-brand-hover); }
.btn-primary[disabled] { opacity: .55; cursor: default; }
.btn-ghost { background: none; border: 1px solid var(--color-border); color: var(--color-text); height: 38px; padding: 0 14px; font-weight: 500; }
.btn-ghost:hover { border-color: var(--color-brand); color: var(--color-brand); }
.login .btn-primary { width: 100%; margin-top: 22px; }
.form-error { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--color-error-soft); color: #b91c1c; font-size: 14px; }
.login-help { margin-top: 18px; font-size: 13px; color: var(--color-text-soft); text-align: center; }

/* ---------- Оболочка ---------- */
.shell { display: none; }
.shell.is-active { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.topbar {
  position: relative; flex: none; z-index: 20; height: var(--header-h);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: #fff; border-bottom: 1px solid var(--color-border);
}
.topbar .divider { width: 1px; height: 20px; background: var(--color-border); }
.topbar .title { font-size: 14px; font-weight: 600; color: var(--color-label); }
.topbar .spacer { flex: 1; }
.agent-name { font-size: 14px; color: var(--color-text-strong); font-weight: 500; }
.burger { display: none; width: 38px; height: 38px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.burger:hover { background: var(--color-canvas); }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: minmax(0, 1fr); }
.sidebar { background: #fff; border-right: 1px solid var(--color-border); padding: 14px 10px; overflow-y: auto; }
.nav-group { margin-top: 10px; padding: 0 12px 4px; font-size: 12px; color: var(--color-text-soft); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--color-text); text-decoration: none; font-size: 14px;
}
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--color-text-soft); }
.nav a:hover { background: var(--color-canvas); }
.nav a[aria-current="page"] { background: var(--color-brand-soft); color: var(--color-brand); font-weight: 600; }
.nav a[aria-current="page"] svg { color: var(--color-brand); }
.nav .sub a { padding-left: 40px; }
.nav hr { border: 0; border-top: 1px solid var(--color-border); margin: 10px 4px; }

.content { position: relative; min-width: 0; min-height: 0; overflow-y: auto; }
.scrim { display: none; }

/* Гостевой режим: поддержка без входа */
.shell.is-guest .burger,
.shell.is-guest .sidebar,
.shell.is-guest .agent-name { display: none; }
.shell.is-guest .layout { grid-template-columns: 1fr; }

/* Фрейм раздела */
.frame-view { display: none; height: 100%; }
.frame-view.is-active { display: block; }
.frame-view iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
/* ---------- Главная ---------- */
.home { display: none; padding: 24px 28px 48px; }
.home.is-active { display: block; }
.home-inner { max-width: 1040px; }
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: 12px; background: var(--color-warning-soft); color: var(--color-warning); font-size: 14px;
}
.notice svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.notice a { color: inherit; font-weight: 600; }
.home h2 { font-size: 18px; color: var(--color-text-strong); margin: 28px 0 12px; }
.home h1 { font-size: 24px; line-height: 1.25; color: var(--color-text-strong); margin-top: 24px; }
.home .hello-sub { color: var(--color-text-soft); margin-top: 4px; }

.products { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 14px; }
.product {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  min-height: 168px; padding: 20px; border-radius: var(--radius-card);
  background: #fff; border: 1px solid var(--color-border); text-decoration: none; color: var(--color-text);
  transition: border-color .15s, box-shadow .15s;
}
.product:hover { border-color: var(--color-brand); box-shadow: 0 4px 18px rgba(69,123,231,.12); }
.product .pic { width: 44px; height: 44px; border-radius: 12px; background: var(--color-brand-soft); display: grid; place-items: center; color: var(--color-brand); }
.product .pic svg { width: 26px; height: 26px; }
.product .name { font-size: 20px; font-weight: 700; color: var(--color-text-strong); margin-top: 14px; }
.product .desc { font-size: 13px; color: var(--color-text-soft); margin-top: 2px; }
.product .go { margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--color-brand); }
.product--main { background: var(--color-brand); border-color: var(--color-brand); color: #fff; }
.product--main:hover { background: var(--color-brand-hover); border-color: var(--color-brand-hover); }
.product--main .pic { background: rgba(255,255,255,.16); color: #fff; }
.product--main .name, .product--main .go { color: #fff; }
.product--main .desc { color: rgba(255,255,255,.82); }

.card { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 20px; }
.ref-row { display: flex; gap: 10px; }
.ref-row input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: var(--radius-input);
  border: 1px solid var(--color-border); background: #f9fafb; color: var(--color-text-strong);
}
.ref-row .btn { height: 44px; }
.ref-hint { margin-top: 8px; font-size: 13px; color: var(--color-text-soft); }


/* Поддержка */
.support-view { display: none; padding: 24px 28px 48px; }
.support-view.is-active { display: block; }
.support-view .card { max-width: 640px; margin: 0 auto; }
.support-view h2 { font-size: 20px; color: var(--color-text-strong); margin-bottom: 12px; }
.support-view p + p, .support-view ul, .support-view ul + p { margin-top: 10px; }
.support-view ul { padding-left: 20px; }

/* ---------- Мобильная версия ---------- */
@media (max-width: 900px) {
  .products { grid-template-columns: 1fr 1fr; }
  .product--main { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .burger { display: grid; place-items: center; }
  .topbar .title, .topbar .divider { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; width: min(82vw, 300px); z-index: 30;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 8px 0 24px rgba(0,0,0,.08); overflow-y: auto;
  }
  .sidebar.is-open { transform: none; }
  .scrim { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(17,24,39,.32); z-index: 25; display: none; }
  .scrim.is-open { display: block; }
  .home, .support-view { padding: 16px 16px 40px; }
  .products { grid-template-columns: 1fr; }
  .product { min-height: 0; }
  .ref-row { flex-direction: column; }
  .ref-row input { flex: none; }
  .agent-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
