/* ================================================================
   OKKAM Dashboard
   ================================================================ */
:root {
  --brand: #ff6f32;
  --brand-2: #e85a1e;
  --brand-3: #ff9a5c;
  --brand-soft: rgba(255, 111, 50, .12);
  --brand-glow: rgba(255, 111, 50, .35);

  --bg: #f3f4f8;
  --bg-2: #ebedf3;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: rgba(20, 24, 40, .08);
  --border-strong: rgba(20, 24, 40, .16);
  --text: #171a26;
  --text-2: #5d6377;
  --text-3: #8f95a8;

  --ok: #1fa971;
  --warn: #e39b11;
  --danger: #e5484d;
  --info: #3d7cf5;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 20, 40, .06);
  --shadow: 0 8px 24px rgba(16, 20, 40, .08);
  --shadow-lg: 0 24px 60px rgba(16, 20, 40, .18);

  --sidebar-w: 268px;
  --topbar-h: 64px;
  /* смайлики — цветными шрифтами системы (Windows, Apple, Android/Linux), иначе в жирном тексте они могут пропадать */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Symbol";
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1016;
  --bg-2: #13161e;
  --surface: #171a23;
  --surface-2: #1d212c;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #eef0f6;
  --text-2: #a4aabb;
  --text-3: #6e7488;
  --brand-soft: rgba(255, 111, 50, .16);
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* текст панели не выделяется и не перетаскивается (в полях ввода — как обычно) */
body { -webkit-user-select: none; user-select: none; }
input, textarea, select, [contenteditable=""], [contenteditable="true"] { -webkit-user-select: text; user-select: text; }
a, img, svg { -webkit-user-drag: none; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.ico { flex-shrink: 0; display: block; }
::selection { background: var(--brand-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); background-clip: content-box; }
[hidden] { display: none !important; }

/* ---------------- Boot ---------------- */
.boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); z-index: 100; transition: opacity .4s ease;
}
.boot.out { opacity: 0; pointer-events: none; }
.boot img { width: 180px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .55; transform: scale(.98); } 50% { opacity: 1; transform: scale(1); } }

/* ---------------- Buttons & inputs ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; transition: all .18s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-2), var(--brand) 55%, var(--brand-3));
  color: #fff; border-color: transparent; box-shadow: 0 6px 18px var(--brand-glow);
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--brand-2), var(--brand) 55%, var(--brand-3)); box-shadow: 0 10px 26px var(--brand-glow); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(229, 72, 77, .08); border-color: rgba(229, 72, 77, .35); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  height: 42px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 14px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ico:first-child { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.input-wrap > .input { padding-left: 42px; }
.input-wrap > .input-action { position: absolute; right: 6px; }

.switch { position: relative; width: 40px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 20px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(16px); }

.check { width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--surface-2);
  color: var(--text-2); border: 1px solid var(--border); white-space: nowrap;
}
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge-ok { background: rgba(31, 169, 113, .12); color: var(--ok); border-color: transparent; }
.badge-danger { background: rgba(229, 72, 77, .12); color: var(--danger); border-color: transparent; }
.badge-warn { background: rgba(227, 155, 17, .14); color: var(--warn); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------------- Login ---------------- */
.login {
  position: fixed; inset: 0; display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--bg); overflow: auto;
}
.login-hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(120% 90% at 10% 10%, #ff9a5c 0%, #ff6f32 38%, #d9480f 100%);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
}
.login-hero::before, .login-hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(10px); opacity: .55;
  animation: float 14s ease-in-out infinite;
}
.login-hero::before { width: 520px; height: 520px; right: -160px; top: -120px; background: radial-gradient(circle, rgba(255,255,255,.35), transparent 65%); }
.login-hero::after { width: 420px; height: 420px; left: -120px; bottom: -140px; background: radial-gradient(circle, rgba(255,220,190,.45), transparent 65%); animation-delay: -6s; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(30px,-20px) scale(1.08); } }
.login-hero .grid-bg {
  position: absolute; inset: 0; opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.6) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.6) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero .logo { width: 200px; filter: brightness(0) invert(1); }
.login-hero small { opacity: .75; font-size: 12.5px; }

/* ---------------- Персонаж ---------------- */
.mascot-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 20px 0; }
#mascot { width: min(380px, 80%); }
.mascot { width: 100%; height: auto; display: block; overflow: visible; }
.mascot-bubble {
  position: relative; margin-bottom: 4px; max-width: 280px; padding: 12px 18px; border-radius: 18px;
  background: #fff; color: #2a2230; font-weight: 600; font-size: 15px; text-align: center;
  box-shadow: 0 12px 30px rgba(120, 40, 0, .25); opacity: 0; transform: translateY(8px) scale(.96);
  transition: opacity .25s, transform .25s cubic-bezier(.2,.8,.2,1); min-height: 1em;
}
.mascot-bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 16px; height: 16px; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 3px; }
.mascot-bubble.show { opacity: 1; transform: none; }

.m-shadow { fill: rgba(80, 20, 0, .22); animation: m-shadow 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.m-body { animation: m-float 4s ease-in-out infinite; transform-box: view-box; transform-origin: 160px 300px; }
.m-box { fill: #f3c48b; }
.m-box-top { fill: #e5aa69; opacity: .55; }
.m-flap { fill: #e8ad6c; stroke: #d89652; stroke-width: 2; stroke-linejoin: round; transform-box: fill-box; }
.m-flap-l { transform-origin: right bottom; animation: m-flap 5s ease-in-out infinite; }
.m-flap-r { transform-origin: left bottom; animation: m-flap 5s ease-in-out infinite reverse; }
.m-tape { fill: #fbe2bd; opacity: .9; }
.m-label rect { fill: #fff; }
.m-label path { stroke: #2a2230; stroke-width: 1.8; }
.m-white { fill: #fff; }
.m-pupil { transition: transform .18s ease-out; }
.m-pupil circle:first-child { fill: #2a2230; }
.m-glint { fill: #fff; }
.m-lid { fill: #f3c48b; transform-box: fill-box; transform-origin: center top; transform: scaleY(0); transition: transform .12s ease; }
.m-brow { fill: none; stroke: #7a4a22; stroke-width: 4.5; stroke-linecap: round; transform-box: fill-box; transform-origin: center; transition: transform .25s; }
.m-cheek { fill: #ff6f4a; opacity: .3; }
.m-mouth { fill: none; stroke: #7a4a22; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; transition: d .2s; }
.m-hand { fill: #f0b87a; stroke: #d89652; stroke-width: 2; transform-box: fill-box; transform-origin: center; transition: transform .38s cubic-bezier(.3,1.4,.5,1); }

.mascot.blink .m-lid { transform: scaleY(1); }
.mascot.cover .m-lid { transform: scaleY(1); }
.mascot.cover .m-hand-l { transform: translate(68px, -50px) rotate(-8deg); }
.mascot.cover .m-hand-r { transform: translate(-68px, -50px) rotate(8deg); }
.mascot.peek .m-hand-r { transform: translate(-60px, -14px) rotate(20deg); }
.mascot.peek .m-eye-r .m-lid { transform: scaleY(0.25); }
.mascot.cover .m-brow { transform: translateY(-3px); }
.mascot.sad .m-brow-l { transform: rotate(14deg) translateY(2px); }
.mascot.sad .m-brow-r { transform: rotate(-14deg) translateY(2px); }
.mascot.jump .m-mouth { fill: #7a4a22; }
.mascot.jump .m-body { animation: m-jump .7s cubic-bezier(.3,1.5,.5,1) 2; }
.mascot.shake .m-body { animation: m-shake .55s ease-in-out; }

@keyframes m-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes m-shadow { 0%,100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.9); opacity: .75; } }
@keyframes m-flap { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }
@keyframes m-jump { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-26px) scale(1.02); } }
@keyframes m-shake { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-5deg); } 40% { transform: rotate(5deg); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .m-body, .m-shadow, .m-flap { animation: none !important; } }

/* ---------------- Вход в ПК-приложении: только карточка ---------------- */
.is-desktop .login { grid-template-columns: 1fr; }
.is-desktop .login-hero { display: none; }
.is-desktop .login-card { max-width: 360px; }
.is-desktop .login-card .logo-sm { display: block; margin: 0 auto 26px; width: 132px; }
.is-desktop .login-card h2, .is-desktop .login-card .sub { text-align: center; }
.is-desktop .login-card h2 { font-size: 24px; }
.is-desktop .login-panel { background: radial-gradient(70% 60% at 50% 0%, var(--brand-soft), transparent 70%), var(--bg); }
.login-foot .gear { color: var(--text-3); }
.login-foot .gear:hover { color: var(--brand); }
.login-foot .gear .ico { transition: transform .4s; }
.login-foot .gear:hover .ico { transform: rotate(60deg); }

.login-panel { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 400px; animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-card .logo-sm { width: 120px; margin-bottom: 28px; display: none; }
.login-card h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.login-card .sub { color: var(--text-2); margin: 6px 0 28px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card .btn-primary { height: 46px; font-size: 15px; margin-top: 6px; }
.form-error {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(229, 72, 77, .08); color: var(--danger); border: 1px solid rgba(229, 72, 77, .25); font-weight: 500;
  animation: shake .4s;
}
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.login-foot { margin-top: 26px; display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: 12.5px; }
.setup-note { padding: 16px; border-radius: var(--radius-sm); background: var(--brand-soft); border: 1px dashed var(--brand); color: var(--text); font-size: 13px; }
.setup-note code { background: var(--surface); padding: 1px 6px; border-radius: 4px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Shell ---------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; z-index: 20;
}
.sb-head { height: var(--topbar-h); display: flex; align-items: center; padding: 0 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sb-head img { height: 26px; }
/* котёнок живёт на отдельном слое поверх страницы (assets/js/critters.js); внизу меню — его домик:
   полоска «пола» (7 px, как FLOOR_H в critters.js) с плинтусом и досками, на ней миски, лежанка, когтеточка */
.sidebar .sb-foot { position: relative; padding-top: 26px; padding-bottom: 34px; }
.sidebar .sb-foot::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7px; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 10px, #ece0d1 10px 22px, transparent 22px 36px) 0 3px / 100% 1px no-repeat, #f6ede2;
  border-top: 1px solid #e3d3bf;
}
[data-theme="dark"] .sidebar .sb-foot::after {
  background: repeating-linear-gradient(90deg, transparent 0 10px, #28221e 10px 22px, transparent 22px 36px) 0 3px / 100% 1px no-repeat, #1d1916;
  border-top-color: #2e2824;
}
.kit-bowl.kit-bed { width: 34px; }
.kit-bowl.kit-find { width: 24px; height: 18px; } /* находка, которую принёс котёнок */
/* меню «чем покормить» над миской с кормом */
.kit-menu { position: fixed; z-index: 120; width: 264px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: kit-menu .16s ease-out; }
@keyframes kit-menu { from { opacity: 0; transform: translateY(6px); } }
.kit-menu-h { font-size: 12.5px; font-weight: 700; color: var(--text-2); margin: 0 2px 8px; }
.kit-menu-g { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.kit-menu button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 1px solid transparent; border-radius: 10px; background: none; cursor: pointer; color: var(--text); }
.kit-menu button:hover { background: var(--brand-soft); border-color: var(--brand); }
.kit-menu button span { font-size: 20px; line-height: 1.1; }
.kit-menu button small { font-size: 10px; color: var(--text-3); line-height: 1.15; text-align: center; }
.kit-menu button i { position: absolute; top: 2px; right: 6px; font-style: normal; font-size: 11px; color: #e85a8a; }
/* новогодний снег (snow.js): слой поверх страницы, клики проходят насквозь; котёнок — над снегом */
.snow-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 85; }
#snowBtn.on { color: var(--brand); }
/* уведомления (notify.js) */
.bell { position: relative; }
.bell.has { color: var(--text); }
.bell-n { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.ntf-pop { position: fixed; z-index: 250; max-height: min(560px, calc(100vh - 90px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2,.8,.2,1); overflow: hidden; }
.ntf-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.ntf-h b { font-size: 15px; flex: 1; }
.ntf-list { overflow: auto; padding: 6px; }
.ntf { display: flex; gap: 10px; padding: 10px; border-radius: 12px; }
.ntf + .ntf { margin-top: 2px; }
.ntf.new { background: var(--brand-soft); }
.ntf-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--text-2); }
.ntf.imp .ntf-ic { background: rgba(229,72,77,.12); color: var(--danger); }
.ntf-b { min-width: 0; flex: 1; }
.ntf-b b { display: block; font-size: 13.5px; }
.ntf-b p { font-size: 13px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; line-height: 1.45; }
.ntf-b p a, .ntf-alert p a { color: var(--brand); text-decoration: underline; }
.ntf-b small { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.ntf-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 10px; color: var(--text-3); }
.ntf-alert-bg { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 20px; background: rgba(10,12,20,.55); backdrop-filter: blur(6px); animation: fade .2s ease; }
.ntf-alert { width: 100%; max-width: 460px; background: var(--surface); border-radius: 22px; padding: 26px 26px 22px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 8px; border-top: 5px solid var(--danger); animation: pop .25s cubic-bezier(.2,.8,.2,1); }
.ntf-alert-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: rgba(229,72,77,.12); color: var(--danger); margin-bottom: 4px; }
.ntf-alert small { color: var(--text-3); font-size: 12px; }
.ntf-alert h3 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.ntf-alert p { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; max-height: 50vh; overflow: auto; }
.ntf-alert .btn { margin-top: 10px; height: 44px; align-self: flex-end; padding: 0 22px; }
.kit-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; image-rendering: pixelated; }
.kit-bowl { position: fixed; z-index: 91; width: 28px; height: 14px; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.kit-bowl:focus { outline: none; }
.avatar.kit-nudge { animation: kit-nudge .35s ease; }
@keyframes kit-nudge { 30% { transform: rotate(-7deg) translateY(1px); } 65% { transform: rotate(5deg); } }
.sb-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.sb-section { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 16px 12px 8px; display: flex; align-items: center; justify-content: space-between; }
.sb-link {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; cursor: pointer; transition: background .15s, color .15s; position: relative;
}
.sb-link span.t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-link.active { background: var(--brand-soft); color: var(--brand); }
.sb-link.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.sb-link .ico.hint { color: var(--text-3); width: 14px; height: 14px; }
.sb-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px; background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
}
.user-chip .meta { flex: 1; min-width: 0; }
.user-chip .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .role { font-size: 12px; color: var(--text-3); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); flex-shrink: 0;
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; min-width: 0; }
.topbar .crumbs .muted { color: var(--text-3); font-weight: 550; }
.topbar .spacer { flex: 1; }
.topbar .search { width: 320px; max-width: 40vw; }
.topbar .search .input { height: 38px; background: var(--surface); }
.kbd { position: absolute; right: 10px; font-size: 11px; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface-2); }
.menu-toggle { display: inline-flex; }
/* скрытие бокового меню на широком экране */
@media (min-width: 981px) {
  .shell { transition: grid-template-columns .32s cubic-bezier(.4,0,.2,1); }
  .sidebar { width: var(--sidebar-w); transition: transform .32s cubic-bezier(.4,0,.2,1); }
  .shell.sb-collapsed { grid-template-columns: 0 1fr; }
  .shell.sb-collapsed .sidebar { transform: translateX(-100%); }
  .shell.no-anim, .shell.no-anim .sidebar { transition: none; }
  .sidebar { overflow-x: hidden; transition: transform .32s cubic-bezier(.4,0,.2,1), width .32s cubic-bezier(.4,0,.2,1); }
  /* вариант «иконки»: меню сжимается до узкой полосы */
  .shell.sb-rail.sb-collapsed { grid-template-columns: 76px 1fr; }
  .shell.sb-rail.sb-collapsed .sidebar { transform: none; width: 76px; }
  .sb-rail.sb-collapsed .sb-head { padding: 0; justify-content: center; }
  .sb-rail.sb-collapsed .logo-full { display: none; }
  .sb-rail.sb-collapsed .logo-mark { display: block; }
  .sb-rail.sb-collapsed .sb-nav { padding: 12px 10px 20px; scrollbar-width: none; }
  .sb-rail.sb-collapsed .sb-link { justify-content: center; padding: 0; gap: 0; }
  .sb-rail.sb-collapsed .sb-link .t, .sb-rail.sb-collapsed .sb-link > span:not(.t) { display: none; }
  .sb-rail.sb-collapsed .sb-link.active::before { left: -10px; }
  .sb-rail.sb-collapsed .sb-section { font-size: 0; padding: 12px 8px 8px; }
  .sb-rail.sb-collapsed .sb-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  .sb-rail.sb-collapsed .sb-foot { padding-left: 6px; padding-right: 6px; }
  .sb-rail.sb-collapsed .user-chip { flex-direction: column; gap: 4px; padding: 4px 0; }
  .sb-rail.sb-collapsed .user-chip .meta { display: none; }
}
.logo-mark { display: none; width: 32px; height: 32px; border-radius: 9px; }
.sb-link .fav-mark { color: var(--brand); display: grid; place-items: center; opacity: .8; }

.content { flex: 1; overflow-y: auto; padding: 28px; min-height: 0; }
.content.flush { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.page { max-width: 1280px; margin: 0 auto; animation: rise .35s ease both; }

/* ---------------- Home ---------------- */
.welcome {
  border-radius: 22px; padding: 30px 32px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, #ff9a5c 0%, #ff6f32 45%, #e14f12 100%);
  box-shadow: 0 18px 40px rgba(232, 90, 30, .28); margin-bottom: 26px;
  display: flex; align-items: center; gap: 24px;
}
.welcome::after { content: ""; position: absolute; right: -80px; top: -120px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.28), transparent 65%); }
/* Пасхалка: «сломанная» бегущая строка и подпись внизу главной */
.ticker { position: relative; overflow: hidden; height: 38px; border-radius: 10px; background: #d8d9e4; box-shadow: inset 0 0 6px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.05); margin-bottom: 26px; user-select: none; }
:root[data-theme="dark"] .ticker { background: #1b1e29; box-shadow: inset 0 0 8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05); }
.ticker-run { display: flex; width: max-content; height: 100%; align-items: center; animation: tickerLoop 25s linear infinite; }
.ticker-track { display: flex; white-space: nowrap; font-family: "Courier New", monospace; font-size: 18px; font-weight: bold; }
.ticker-track span { color: #e85a1e; padding: 0 6px; display: inline-block; transition: opacity .05s ease; }
.ticker-track span.tk-dot { padding: 0 30px; }
.ticker-track span.flicker { animation: tickerFlicker .08s infinite alternate; }
.ticker-lines { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.ticker-lines i { position: absolute; top: 0; height: 100%; opacity: 0; animation: tickerLine 4s ease-in-out infinite; }
@keyframes tickerLoop { to { transform: translateX(-50%); } }
@keyframes tickerFlicker { 0% { opacity: 1; filter: drop-shadow(0 0 3px #e85a1e); } 40% { opacity: .15; filter: none; } 80% { opacity: .9; } 100% { opacity: .05; } }
@keyframes tickerLine { 0%, 75%, 100% { opacity: 0; background: transparent; box-shadow: none; } 77% { opacity: 1; background: #e85a1e; box-shadow: 0 0 6px #e85a1e; } 79% { opacity: .1; } }
.made-by { text-align: center; margin-top: 40px; font-size: 13px; color: var(--text-3); letter-spacing: .2px; }
.made-by .brain { display: inline-block; animation: brainPulse 2.5s ease-in-out infinite; }
@keyframes brainPulse { 0%, 100% { transform: scale(1) rotate(0); } 25% { transform: scale(1.1) rotate(5deg); } 50% { transform: scale(.95) rotate(-5deg); } 75% { transform: scale(1.05) rotate(3deg); } }
@media (max-width: 640px) { .ticker-track { font-size: 15px; } }
.welcome h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.welcome p { opacity: .92; margin-top: 6px; font-size: 15px; }
.welcome .stats { display: flex; gap: 12px; margin-left: auto; position: relative; z-index: 1; }
.welcome .stat { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(8px); padding: 12px 18px; border-radius: 14px; min-width: 110px; }
.welcome .stat b { font-size: 24px; display: block; }
.welcome .stat small { opacity: .85; font-size: 12px; }

.section-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; flex-wrap: wrap; }
.section-head h3 { font-size: 17px; font-weight: 750; }
.section-head .count { color: var(--text-3); font-weight: 600; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.chip { height: 32px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); transition: .15s; }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; min-height: 168px;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s;
  animation: rise .4s ease both;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(255, 111, 50, .35); }
.card .ib {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); transition: .25s;
}
.card:hover .ib { background: linear-gradient(135deg, var(--brand-2), var(--brand-3)); color: #fff; box-shadow: 0 8px 18px var(--brand-glow); transform: rotate(-6deg) scale(1.05); }
.card h4 { font-size: 16px; font-weight: 700; }
.card p { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.card .foot { margin-top: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card .go { position: absolute; right: 16px; top: 20px; color: var(--text-3); transition: .25s; }
.card:hover .go { color: var(--brand); transform: translateX(3px); }
.card .fav { position: absolute; right: 14px; bottom: 14px; color: var(--text-3); opacity: 0; transition: .2s; background: none; border: 0; cursor: pointer; padding: 4px; }
.card:hover .fav, .card .fav.on { opacity: 1; }
.card .fav.on { color: var(--warn); }
.card .fav.on svg { fill: currentColor; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .ico { margin: 0 auto 12px; width: 44px; height: 44px; color: var(--border-strong); }
.empty h4 { color: var(--text-2); font-size: 16px; margin-bottom: 4px; }

/* ---------------- Module frame ---------------- */
.frame-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.frame-bar .ttl { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.frame-bar .ttl .ib { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.frame-wrap { flex: 1; position: relative; background: #fff; }
.frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.frame-loader { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg); transition: opacity .3s; z-index: 2; }
.frame-loader.out { opacity: 0; pointer-events: none; }
.bar-loader { width: 160px; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; position: relative; }
.bar-loader::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--brand); border-radius: 4px; animation: slide 1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------------- Admin ---------------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: center; }
.kpi .ib { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi b { font-size: 24px; font-weight: 800; display: block; line-height: 1.1; }
.kpi small { color: var(--text-2); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h3 { font-size: 15px; font-weight: 700; }
.panel-head .input-wrap { width: 280px; max-width: 100%; }
.panel-head .input { height: 36px; }
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user .avatar { width: 34px; height: 34px; font-size: 13px; }
.cell-user .sub { color: var(--text-3); font-size: 12.5px; }
.muted { color: var(--text-3); }

.matrix th.rot { text-align: center; min-width: 120px; }
.matrix td.c { text-align: center; }
.matrix .mod { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.matrix .mod .ib { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }

/* ---------------- Modal ---------------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(10, 12, 20, .55); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px; z-index: 200; animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: pop .28s cubic-bezier(.2,.8,.2,1);
}
.modal.wide { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.modal-h h3 { font-size: 18px; font-weight: 750; flex: 1; }
.modal-b { padding: 14px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.toggle-row .t { flex: 1; }
.toggle-row .t b { display: block; font-weight: 650; }
.toggle-row .t small { color: var(--text-3); }
/* Страница входа: скачать приложения */
.downloads { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.dl-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.dl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dl-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s, transform .1s; min-width: 0; }
.dl-btn:hover { border-color: var(--brand); box-shadow: 0 6px 18px var(--brand-glow); }
.dl-btn:active { transform: translateY(1px); }
.dl-btn > .ico { color: var(--text-3); margin-left: auto; }
.dl-btn:hover > .ico { color: var(--brand); }
.dl-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.dl-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.dl-t b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-t small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
@media (max-width: 420px) { .dl-row { grid-template-columns: 1fr; } }

/* Админка → Обзор: загрузка данных */
#dataUpload { margin-bottom: 16px; }
.du-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; padding: 16px 18px 18px; }
.du-drop { position: relative; min-height: 132px; border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 16px 18px; cursor: pointer; transition: border-color .15s, background .15s; }
.du-drop:hover, .du-drop.drag { border-color: var(--brand); background: var(--brand-soft); }
.du-ph { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; color: var(--text-2); }
.du-ph .ico { color: var(--brand); margin-bottom: 4px; }
.du-ph small { color: var(--text-3); font-size: 12px; }
.du-file { display: flex; align-items: center; gap: 12px; }
.du-file > .ico { color: var(--excel); flex-shrink: 0; }
.du-file b { display: block; word-break: break-all; }
.du-file small { color: var(--text-2); font-size: 12.5px; }
.du-choice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.du-choice .seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.du-choice .seg button { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 7px; font-weight: 650; font-size: 13px; color: var(--text-2); cursor: pointer; }
.du-choice .seg button.on { background: var(--text); color: var(--bg); }
.du-bar { height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.du-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.du-msg { font-size: 13px; display: flex; align-items: center; gap: 8px; justify-content: center; text-align: center; }
.du-ok { color: var(--ok); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.du-err { color: var(--danger); font-weight: 600; }
.du-tiles { display: flex; flex-direction: column; gap: 10px; }
.du-tile { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.du-tile.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.du-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.du-t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.du-t small { color: var(--text-3); font-size: 12px; }
.du-dirs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.du-dirs i { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.du-dirs i.no { opacity: .55; border-style: dashed; }
.du-months i { display: inline-flex; align-items: center; gap: 2px; padding-right: 3px; }
.du-months button { border: 0; background: none; color: var(--text-3); width: 16px; height: 16px; border-radius: 4px; cursor: pointer; font-size: 13px; line-height: 1; opacity: 0; transition: opacity .15s; }
.du-months i:hover button { opacity: 1; }
.du-months button:hover { background: rgba(229, 72, 77, .12); color: var(--danger); }
@media (hover: none) { .du-months button { opacity: 1; } }
.du-legacy { margin-top: 8px; align-self: flex-start; }
.du-mlist { display: flex; flex-wrap: wrap; gap: 6px; }
.du-m { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 650; background: var(--surface); border: 1px solid var(--border); }
.du-m em { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.du-m.new em { background: rgba(31, 169, 113, .14); color: var(--ok); }
.du-m.upd em { background: rgba(61, 124, 245, .14); color: var(--info); }
@media (max-width: 900px) { .du-body { grid-template-columns: 1fr; } }

/* Админка → Настройки */
.set-card { max-width: 820px; }
.set-card + .set-card { margin-top: 16px; }
.sb-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sb-pick > button { text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: var(--text); }
.sb-pick > button:hover { border-color: var(--border-strong); }
.sb-pick > button.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.sb-pick > button > small { color: var(--text-3); font-size: 12px; }
.sbp { display: flex; gap: 4px; height: 54px; padding: 5px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 6px; }
.sbp i { display: block; border-radius: 4px; background: var(--brand-soft); border: 1px dashed var(--brand); }
.sbp b { display: block; flex: 1; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.sbp.full i { width: 0; border: 0; }
.sbp.icons i { width: 14px; background: repeating-linear-gradient(var(--brand) 0 3px, transparent 3px 8px) center / 6px 100% no-repeat, var(--brand-soft); }
@media (max-width: 700px) { .sb-pick { grid-template-columns: 1fr; } }
.set-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.set-body textarea.input { height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; line-height: 1.45; font: inherit; }
.set-body .ticker { margin-bottom: 0; }
.set-actions { display: flex; justify-content: flex-end; }
.tk-off { height: 38px; display: flex; align-items: center; padding: 0 14px; border-radius: 10px; border: 1px dashed var(--border-strong); font-size: 13px; }

/* Выбор вида страницы модуля (миниатюры-схемы) */
.view-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.view-pick button { text-align: left; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: var(--text); transition: border-color .15s, background .15s; }
.view-pick button:hover { border-color: var(--border-strong); }
.view-pick button.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.view-pick b { font-size: 13px; }
.view-pick small { font-size: 11.5px; color: var(--text-3); line-height: 1.35; }
.vp { height: 64px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); padding: 6px; display: flex; gap: 5px; margin-bottom: 6px; overflow: hidden; }
.vp i { display: flex; gap: 3px; }
.vp b { display: block; border-radius: 3px; background: var(--border-strong); }
.vp-hero { width: 34%; border-radius: 5px; background: linear-gradient(135deg, #f7b733, #f2a20f); }
.vp-list { flex: 1; flex-direction: column; } .vp-list b { flex: 1; }
.vp-cov { flex: 1; align-items: stretch; } .vp-cov b { flex: 1; background: linear-gradient(var(--c, #4a7ee0) 45%, var(--border-strong) 45%); }
.vp-cov b.on { --c: #f2a20f; box-shadow: 0 0 0 1.5px #f2a20f; }
.vp:has(.vp-tiles) { flex-direction: column; }
.vp-tiles { height: 40%; } .vp-tiles .t { width: 22%; background: none; } .vp-tiles .b { flex: 1; background: linear-gradient(135deg, #f7b733, #f2a20f); }
.vp-grid { flex: 1; flex-wrap: wrap; } .vp-grid b { width: calc(25% - 3px); height: calc(50% - 2px); }
/* миниатюры видов календаря табеля */
.vp-cal { flex: 1; display: grid !important; grid-template-columns: repeat(7, 1fr); gap: 3px; align-content: center; }
.vp-cal b { height: 15px; border-radius: 3px; }
.vp-cal .k0, .vp-cal .k3 { --c: #f5a623; } .vp-cal .k1, .vp-cal .k4 { --c: #5b5fd0; } .vp-cal .k2 { --c: transparent; }
.vp-cal.t b { background: var(--c); } .vp-cal.t .k2 { background: var(--border); }
.vp-cal.s b { background: linear-gradient(var(--c) 35%, var(--surface-2) 35%); border: 1px solid var(--border); } .vp-cal.s .k2 { background: transparent; border-style: dashed; }
/* мини-листы реестра */
.vp-sh { flex: 1; flex-direction: column; gap: 2px !important; background: #fff; border-radius: 4px; padding: 4px; }
.vp-sh b { background: none; border-radius: 0; }
.vp-sh .h { display: flex; gap: 3px; align-items: center; height: 13px; margin-bottom: 2px; }
.vp-sh .h.o { border-bottom: 2px solid #ff6f32; padding-bottom: 2px; height: 15px; }
.vp-sh em { display: block; height: 6px; width: 22%; background: #2a2a3a; border-radius: 2px; }
.vp-sh em.c { width: 26%; margin: 0 auto; height: 4px; } .vp-sh em.r { margin-left: auto; width: 16%; height: 4px; background: #8f95a8; }
.vp-sh em.dk { margin-left: auto; width: 20%; height: 10px; } .vp-sh em.n { width: 8%; height: 10px; background: none; border: 1px solid #2a2a3a; }
.vp-sh em.y { background: #fff3a6; } .vp-sh em.lg { width: 16%; background: #ff6f32; }
.vp-sh .th { height: 6px; } .vp-sh .th.g { background: #d5d5e3; border: 1px solid #7a7a8c; } .vp-sh .th.dk { background: #1d1f2b; border-radius: 2px; } .vp-sh .th.or { background: #fff1ea; border: 1px solid #e9b79c; }
.vp-sh .tr { height: 5px; border: 1px solid #b5b8c5; border-top: 0; } .vp-sh .tr.nl { border: 0; border-bottom: 1px solid #dcdee6; }
.vp-sh .tr.sep { border-bottom: 2px solid #2a2a3a; } .vp-sh .tr.sep.o { border-bottom-color: #ff6f32; }
@media (max-width: 640px) { .view-pick { grid-template-columns: 1fr; } }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.icon-pick button { height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-pick button.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.perm-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.perm-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.perm-item .t { flex: 1; min-width: 0; }
.perm-item .t b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-item .t small { color: var(--text-3); font-size: 11.5px; }
.perm-item select { height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); padding: 0 6px; font-size: 12.5px; }

/* ---------------- Toasts ---------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 300; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px; padding: 12px 16px;
  border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 550;
  animation: rise .3s ease both;
}
.toast.ok .ico { color: #4ade80; }
.toast.err .ico { color: #ff7a7f; }
.toast.out { opacity: 0; transform: translateY(10px); transition: .3s; }

/* ---------------- Desktop (Electron) ---------------- */
.is-desktop .topbar, .is-desktop .sb-head { -webkit-app-region: drag; }
.is-desktop .topbar > *, .is-desktop .sb-head > * { -webkit-app-region: no-drag; }
.is-desktop .topbar { padding-right: 150px; } /* место под кнопки окна Windows */
.is-desktop .login-panel { -webkit-app-region: drag; }
.is-desktop .login-card { -webkit-app-region: no-drag; }
.desktop-drag { position: fixed; top: 0; left: 0; right: 0; height: 36px; -webkit-app-region: drag; z-index: 1; }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-card .logo-sm { display: block; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .topbar .search { display: none; }
  .welcome { flex-direction: column; align-items: flex-start; }
  .welcome .stats { margin-left: 0; }
  .content { padding: 18px 16px; }
  .row2, .perm-list { grid-template-columns: 1fr; }
  .chips { margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chip { flex-shrink: 0; }
  .welcome h1 { font-size: 24px; }
}
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; }

/* ---------------- Режим терминала (ТСД / телефон / Android-приложение) ---------------- */
.compact .welcome { padding: 18px 18px; margin-bottom: 14px; border-radius: 16px; }
.compact .welcome h1 { font-size: 20px; }
.compact .welcome p { font-size: 13.5px; }
.compact .welcome .stats { display: none; }
.compact .section-head { margin: 16px 0 10px; }
.compact .section-head h3 { font-size: 15px; }
.compact .cards { grid-template-columns: 1fr; gap: 8px; }
.compact .card { flex-direction: row; align-items: center; min-height: 0; padding: 12px 14px; gap: 14px; border-radius: 14px; }
.compact .card .ib { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; }
.compact .card h4 { font-size: 15.5px; }
.compact .card p { font-size: 12.5px; margin-top: 2px; }
.compact .card .foot, .compact .card .fav { display: none; }
.compact .card .go { position: static; margin-left: auto; order: 3; }
.compact .card:hover { transform: none; }
.compact .content { padding: 12px; }
.compact .topbar { padding: 0 10px; height: 54px; }

/* устройство входа в «Пользователях» и «Журнале» */
.dev { white-space: nowrap; }
.sub.dev { display: flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 12px; }
.dev-ic { width: 13px; height: 13px; flex-shrink: 0; vertical-align: -2px; margin-right: 5px; opacity: .75; }
.sub.dev .dev-ic { margin-right: 0; }
.dev-q { margin-right: 3px; font-weight: 700; color: var(--warn); }
.dev-tag { font-family: ui-monospace, Consolas, monospace; font-size: 11px; padding: 0 5px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.dev-alt, .dev-ip { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.dev-alt { white-space: normal; max-width: 240px; }

/* журнал: что именно изменено */
.audit-tbl tbody tr[data-id] { cursor: pointer; }
.audit-tbl td.ad { min-width: 220px; max-width: 440px; }
.ad .ad-l { font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; color: var(--text); }
.ad .ad-l + .ad-l { margin-top: 2px; }
.ad .ad-l.muted { color: var(--text-3); }
.ad .ad-l.ad-warn, .ad .ad-l.ad-warn b { color: var(--danger); }
.ad .ad-l.mono { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; }
.ad-k { color: var(--text-2); }
.ad-o { color: var(--text-3); }
.ad-n { font-weight: 650; }
.audit-more { padding: 12px; text-align: center; }
.audit-more:empty { display: none; }
.ad-card { display: flex; flex-direction: column; gap: 10px; }
.ad-card > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.ad-card > div > span { font-size: 12.5px; color: var(--text-3); }
.ad-card .dev { white-space: normal; }
.ad-card .dev small { display: block; margin-top: 4px; line-height: 1.4; }
.ad-raw { margin-top: 14px; }
.ad-raw summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.ad-raw pre { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; overflow: auto; max-height: 40vh; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 640px) { .ad-card > div { grid-template-columns: 1fr; gap: 2px; } }

/* админка → уведомления */
.nt-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
@media (max-width: 1080px) { .nt-grid { grid-template-columns: 1fr; } }
.nt-form { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.nt-form textarea.input { height: auto; min-height: 110px; padding: 10px 14px; resize: vertical; line-height: 1.5; }
.nt-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nt-seg button { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.nt-seg button small { grid-column: 2; font-weight: 500; font-size: 11.5px; color: var(--text-3); }
.nt-seg button .ico { color: var(--text-3); }
.nt-seg button.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.nt-seg button.on .ico { color: var(--brand); }
#ntKind button[data-k="important"].on { border-color: var(--danger); background: rgba(229,72,77,.08); box-shadow: 0 0 0 1px var(--danger) inset; }
#ntKind button[data-k="important"].on .ico { color: var(--danger); }
.nt-pick { border: 1px solid var(--border); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.nt-pick-h { display: flex; gap: 8px; align-items: center; }
.nt-roles { display: flex; gap: 6px; flex-wrap: wrap; }
.nt-role { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 650; color: var(--text-2); cursor: pointer; }
.nt-role i { width: 8px; height: 8px; border-radius: 50%; } .nt-role span { color: var(--text-3); }
.nt-role.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.nt-users { max-height: 260px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px; }
.nt-u { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; background: var(--surface); }
.nt-u.on { border-color: var(--brand); background: var(--brand-soft); }
.nt-u input { accent-color: var(--brand); }
.nt-u-n { min-width: 0; display: flex; flex-direction: column; } .nt-u-n b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .nt-u-n small { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Права на действия в модуле */
.act-perm { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-top: 8px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.ap-h b { display: block; font-size: 14px; } .ap-h small { color: var(--text-3); font-size: 12px; }
.ap-users summary { cursor: pointer; font-weight: 650; font-size: 13px; color: var(--text-2); }
.ap-users .ap-n { font-weight: 500; color: var(--text-3); margin-left: 4px; }
.ap-users .nt-users { margin-top: 8px; max-height: 220px; }
.nt-send { display: flex; align-items: center; gap: 12px; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 14px; }
.nt-send .btn { height: 42px; padding: 0 20px; }
.nt-prev { position: sticky; top: 12px; }
.nt-demo { position: static !important; width: 100% !important; animation: none !important; max-width: none; box-shadow: var(--shadow) !important; }
.nt-demo .ntf-list { max-height: none; }
.nt-t { display: flex; align-items: center; gap: 8px; } .nt-snip { font-size: 12.5px; margin-top: 2px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-reads { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; color: var(--text-2); font-size: 13px; padding: 4px; border-radius: 8px; white-space: nowrap; }
.nt-reads:hover { background: var(--surface-2); } .nt-reads b { color: var(--text); }
.nt-bar { width: 70px; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; display: block; border: 1px solid var(--border); }
.nt-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand-3)); }
.nt-who { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.nt-who div { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.nt-who div.ok { color: var(--ok); } .nt-who b { color: var(--text); font-weight: 600; flex: 1; }
.nt-seg.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .nt-seg.three { grid-template-columns: 1fr; } }
.nt-ttl { display: inline-flex; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; align-self: flex-start; }
.nt-ttl button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font-weight: 700; font-size: 13px; color: var(--text-2); cursor: pointer; }
.nt-ttl button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(16,20,40,.1); }
#ntTtlHint { display: block; margin-top: 6px; font-size: 12px; }
.nt-av { position: relative; display: inline-flex; }
.nt-av.onl::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--surface); }
.badge.nt-onl { background: var(--ok-soft, rgba(31,169,113,.12)); color: var(--ok); border-color: transparent; }

/* админка → резервные копии */
.bk > .panel { margin-bottom: 16px; }
.bk-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
@media (max-width: 980px) { .bk-grid { grid-template-columns: 1fr; } }
.bk-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; border: 1px solid; font-size: 13.5px; line-height: 1.45; }
.bk-alert .ico { flex-shrink: 0; margin-top: 1px; }
.bk-alert.warn { background: rgba(227, 155, 17, .1); border-color: rgba(227, 155, 17, .35); }
.bk-alert.warn .ico { color: var(--warn); }
.bk-alert.danger { background: rgba(229, 72, 77, .08); border-color: rgba(229, 72, 77, .3); }
.bk-alert.danger .ico { color: var(--danger); }
.bk code, .bk-warn code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 6px; }
.bk-act { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 14px; margin-bottom: 12px; }
.bk-act b { display: block; }
.bk-act small { display: block; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.bk-spin { width: 20px; height: 20px; flex-shrink: 0; border: 2.5px solid rgba(255, 111, 50, .25); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.bk-log { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; color: var(--text-2); margin-top: 4px; overflow-wrap: anywhere; }
.bk-prog { height: 8px; border-radius: 6px; background: var(--surface); margin-top: 8px; overflow: hidden; }
.bk-prog i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand-2), var(--brand-3)); transition: width .3s; }
.bk-next { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.bk-next b { color: var(--text); }
.bk-sum { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.bk-kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bk-kv > span { color: var(--text-2); font-size: 13.5px; }
.bk-kv > b { text-align: right; }
.bk-disk { height: 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.bk-disk i { display: block; height: 100%; background: var(--brand); }
.bk-disk i.low, .bk-low { color: var(--danger); }
.bk-disk i.low { background: var(--danger); }
.bk-tbl td { vertical-align: middle; }
.bk-tbl .row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.bk-h { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 18px; }
.bk-h + .bk-h { border-top: 1px solid var(--border); }
.bk-h-ic { color: var(--ok); margin-top: 1px; }
.bk-h.failed .bk-h-ic, .bk-err { color: var(--danger); }
.bk-h-b small { display: block; color: var(--text-2); margin-top: 2px; }
.bk-h-t { font-size: 12.5px; white-space: nowrap; }
.bk-logs { margin-top: 6px; }
.bk-logs summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.bk-logs pre { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; }
.bk-warn { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(229, 72, 77, .08); border: 1px solid rgba(229, 72, 77, .25); line-height: 1.5; font-size: 13.5px; }
.bk-warn > .ico { color: var(--danger); flex-shrink: 0; margin-top: 2px; }
.bk-warn p + p { margin-top: 8px; }
@media (max-width: 640px) {
  /* копии на телефоне — карточками: кнопки не уезжают за край */
  .tbl.bk-tbl thead { display: none; }
  .tbl.bk-tbl, .tbl.bk-tbl tbody { display: block; }
  .tbl.bk-tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .tbl.bk-tbl td { display: block; padding: 0; border: 0; }
  .tbl.bk-tbl td:nth-child(2), .tbl.bk-tbl td:nth-child(4) { justify-self: end; }
  .tbl.bk-tbl td[colspan] { grid-column: 1 / -1; }
  .tbl.bk-tbl td:nth-child(5) { grid-column: 1 / -1; }
  .bk-tbl .row-actions { justify-content: flex-start; }
  .bk-h { grid-template-columns: 22px minmax(0, 1fr); }
  .bk-h-t { grid-column: 2; }
}
