/* Cabinet layout (Пакет 29.0) — premium business CRM on the shared quiet-luxury system.
   Monochrome + warm taupe accent, glassmorphism active nav, large stat cards, generous spacing.
   Class names are STABLE (cabinet.js builds against them) — only the visual layer is elevated. */
.cab { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.cab-side { background: var(--surface); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 3px; }
.cab-brand { display: flex; align-items: center; gap: 11px; font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: .01em; padding: 6px 12px 24px; }
.cab-brand .mark { width: 24px; height: 24px; border-radius: 6px; background: var(--ink); position: relative; }
.cab-brand .mark::after { content: ""; position: absolute; inset: 6px; border: 1px solid var(--accent-2); border-radius: 2px; }
.cab-nav button { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: var(--ink-soft); padding: 13px 15px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; letter-spacing: -.01em; transition: all .16s var(--ease); }
.cab-nav button:hover { background: var(--surface-2); color: var(--ink); }
/* active = glassmorphism panel + hairline + left accent bar (no loud color) */
.cab-nav button.active { background: rgba(255,255,255,.7); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm); backdrop-filter: blur(8px); }
.cab-nav button.active::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 3px; background: var(--accent-2); }
.cab-side .side-foot { margin-top: auto; padding: 10px 12px; font-size: 12px; color: var(--muted); }
.cab-main { display: flex; flex-direction: column; min-width: 0; background: transparent; }
.cab-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 16px 32px; border-bottom: 1px solid rgba(26,26,26,.06); gap: 16px; background: rgba(250,249,246,.8); backdrop-filter: saturate(150%) blur(16px); -webkit-backdrop-filter: saturate(150%) blur(16px); }
.cab-scope { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; }
.cab-scope select { width: auto; min-width: 180px; padding: 9px 12px; }
.cab-scope .scope-one { font-weight: 600; color: var(--ink); }
.cab-profile { display: flex; align-items: center; gap: 12px; }
.cab-profile .pn { font-size: 14px; font-weight: 600; line-height: 1.1; }
.cab-profile .pe { font-size: 12px; color: var(--muted); }
.cab-body { padding: 28px 32px; max-width: 1080px; animation: rise .34s var(--ease) both; }
.cab-body h2 { font-family: var(--serif); margin: 0 0 5px; font-size: 27px; font-weight: 600; letter-spacing: -.015em; }
.cab-body .lead { color: var(--ink-soft); margin: 0 0 20px; font-size: 14px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.row-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px 18px; box-shadow: var(--shadow-sm); transition: transform .16s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.row-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.row-item .ri-main { min-width: 0; }
.row-item .ri-title { font-weight: 600; font-size: 15.5px; letter-spacing: -.01em; }
.row-item .ri-sub { color: var(--ink-soft); font-size: 13px; margin-top: 5px; word-break: break-word; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-item .ri-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.btn-sm { font-size: 13px; padding: 9px 15px; border-radius: var(--radius-sm); }
.btn-sm.primary { background: var(--cta); border: 1px solid var(--cta); color: #fff; }
.btn-sm.primary:hover { background: var(--cta-hover); }
.btn-sm:not(.primary):not(.danger) { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); cursor: pointer; }
.btn-sm:not(.primary):not(.danger):hover { border-color: var(--ink); }
.btn-sm.danger { background: var(--surface); border: 1px solid var(--line-strong); color: var(--err); cursor: pointer; }
.btn-sm.danger:hover { border-color: var(--err); background: var(--err-soft); }

.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.form-card > .ri-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
/* optional section divider inside a form-card (proposed for long forms) */
.form-section { padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.form-section:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.form-section-title { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid .full { grid-column: 1 / -1; }
/* labels always stack ABOVE their field (text node + control as flex column) */
.form-card label, .cab-body .form-grid label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-soft); font-weight: 600; margin: 0; }
.form-card label > input, .form-card label > select, .form-card label > textarea { margin-top: 0; }
.note { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.55; }
.kv { display: inline-flex; gap: 5px; font-size: 13px; color: var(--ink-soft); }
.kv b { color: var(--ink); font-weight: 600; }
.kv-rows { display: flex; flex-direction: column; gap: 10px; }
.kv-rows .kv { display: flex; font-size: 14px; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--accent-2); opacity: 0; transition: opacity .2s var(--ease); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat:hover::before { opacity: 1; }
.stat .n { font-family: var(--serif); font-size: 36px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; }
.stat .l { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-top: 8px; }

/* dedicated admin login (secondary entrypoint) */
.login-wrap { max-width: 410px; margin: 9vh auto; padding: 0 20px; }
.login-wrap .card { padding: 34px; }
.field { display: block; margin-bottom: 16px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.field > input { margin-top: 7px; }

/* ---- Пакет 27.6: product-grade UI layer ---- */
.cab-body input, .cab-body select, .cab-body textarea, .login-wrap input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 13px 15px;
  min-height: 48px; outline: none; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.cab-body select { -webkit-appearance: auto; appearance: auto; }
.cab-body input:focus, .cab-body select:focus, .cab-body textarea:focus, .login-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cab-body input::placeholder, .cab-body textarea::placeholder { color: var(--muted); }
.cab-body textarea { min-height: 96px; resize: vertical; }
.helper { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.55; }
.field-error { font-size: 12.5px; color: var(--err); margin-top: 6px; font-weight: 500; }
/* Inline action result (Пакет 28.15) — shown in-place under the button, not just a corner toast. */
.result-ok { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--ok); border-radius: var(--radius-sm); background: var(--ok-soft); font-size: 13px; animation: rise .26s var(--ease) both; }
.result-ok .ro-title { font-weight: 700; color: var(--ok); }
.result-ok .ro-ids { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--ink-soft); }
.cab-body .field-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin: 0; }

/* button loading state */
.btn-sm.loading, .btn.loading { color: transparent !important; pointer-events: none; position: relative; }
.btn-sm.loading::after, .btn.loading::after { content: ''; position: absolute; width: 15px; height: 15px; top: 50%; left: 50%; margin: -8px 0 0 -8px; border: 2px solid rgba(255,255,255,.55); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-sm:not(.primary):not(.danger).loading::after { border-color: var(--line-strong); border-top-color: var(--ink); }

/* premium confirm dialog (replaces native window.confirm) */
.modal-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(26,24,20,.42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 24px; animation: modalfade .15s ease; }
.modal-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; padding: 30px 30px 24px; animation: modalpop .18s cubic-bezier(.2,.9,.3,1.1); }
.modal-title { font-family: var(--serif); font-size: 23px; font-weight: 600; margin-bottom: 12px; letter-spacing: -.01em; }
.modal-text { color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; }
.modal-card input, .modal-card select { width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 13px 15px; min-height: 48px; outline: none; transition: border-color .15s, box-shadow .15s; }
.modal-card input:focus, .modal-card select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-card .field-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.modal-actions .btn-sm { padding: 11px 20px; }
.btn-sm.danger-solid { background: var(--err); border: 1px solid var(--err); color: #fff; cursor: pointer; }
.btn-sm.danger-solid:hover { background: #93291f; }
@keyframes modalfade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalpop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* toasts (success/error), bottom-right */
/* Toasts — top-centre so they're actually seen, not tucked in a corner (Пакет 29.3). */
#toasts { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 1200; display: flex; flex-direction: column; align-items: center; gap: 10px; width: calc(100% - 40px); max-width: 460px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); border: 0; border-radius: var(--radius-sm); padding: 14px 20px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; color: #fff; text-align: center; min-width: 260px; animation: toastin .2s var(--ease); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
.toast.warn { background: #b9802a; }
@keyframes toastin { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* VK status card */
.status-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.status-card .sc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.status-card .sc-title { font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: -.01em; }
.status-card .sc-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.status-card .sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px 24px; }
.sc-item { min-width: 0; }
.sc-item.wide { grid-column: 1 / -1; }
.sc-item .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.sc-item .v { font-size: 14px; color: var(--ink); margin-top: 5px; font-weight: 500; overflow-wrap: anywhere; }
.sc-item .v.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-item .v.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; color: var(--ink-soft); word-break: break-all; font-weight: 400; }
.status-card .sc-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* product live preview */
.preview-wrap { margin-top: 20px; }
.preview-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 9px; }
.pp-card { display: flex; gap: 16px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; max-width: 460px; }
.pp-img { width: 92px; height: 92px; border-radius: var(--radius-sm); background-size: cover; background-position: center; background-color: var(--line); flex-shrink: 0; }
.pp-img.empty { display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); background-color: var(--surface); border: 1px dashed var(--line-strong); }
.pp-body { min-width: 0; }
.pp-title { font-family: var(--serif); font-weight: 500; font-size: 16px; color: var(--ink); overflow-wrap: anywhere; }
.pp-meta { color: var(--ink-soft); font-size: 13px; margin-top: 6px; }

/* danger zone (shop deletion) */
.form-card.danger-zone { border-color: var(--err); }
.form-card.danger-zone .ri-title { color: var(--err); }

/* checkboxes/radios keep native look */
.cab-body input[type=checkbox], .cab-body input[type=radio] {
  -webkit-appearance: auto; appearance: auto; width: 18px; height: 18px; min-height: 0;
  padding: 0; border: 0; border-radius: 0; box-shadow: none; flex-shrink: 0; accent-color: var(--ink); cursor: pointer;
}
.ck { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; font-size: 14px; color: var(--ink); cursor: pointer; }
.ck input[type=checkbox] { margin-top: 1px; }
/* A checkbox label inside a form-card must stay a ROW (checkbox + text side by side); the generic
   `.form-card label` rule above forces column layout and out-specifies `.ck`, which otherwise puts
   the label under the box. */
.form-card label.ck, .cab-body .form-grid label.ck { flex-direction: row; align-items: center; font-weight: 500; }

/* richer empty states + CTA */
.empty p { max-width: 440px; margin: 0 auto; line-height: 1.55; }
.empty .cta { margin-top: 20px; }

/* readiness checklist (overview) */
.checklist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.checklist li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink); }
.checklist .ci { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.checklist .ci.done { background: var(--ok-soft); color: var(--ok); }
.checklist .ci.todo { background: var(--warn-soft); color: var(--warn); }

@media (max-width: 760px) {
  .cab { grid-template-columns: 1fr; }
  .cab-side { flex-direction: row; overflow-x: auto; }
  .cab-side .side-foot { display: none; }
  .cab-body { padding: 28px 20px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Skeleton loaders + spinner (Пакет 32, Задача 1) — show structure while data loads; never flash
   empty/zero states. Used as the section placeholder until the API fetch resolves. */
.skel { position: relative; overflow: hidden; background: var(--bg-2); border-radius: var(--radius-sm); }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: skel-shimmer 1.3s infinite; }
@keyframes skel-shimmer { 100% { transform: translateX(100%); } }
.skel-line { height: 12px; margin: 9px 0; }
.skel-title { height: 24px; width: 38%; margin: 0 0 18px; }
.skel-stat { height: 64px; }
.skel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.cab-loading { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 14px; padding: 6px 0; }
.cab-spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--ink); border-radius: 50%; animation: cab-spin .7s linear infinite; }
@keyframes cab-spin { 100% { transform: rotate(360deg); } }

/* Chat-style dialog thread (Пакет 32) — messenger-like bubbles: client on the left, assistant/manager
   on the right. Manager can edit/delete per bubble; deleted bubbles vanish here but stay in the logs. */
.chat-thread { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.chat-row { display: flex; }
.chat-row.in { justify-content: flex-start; }
.chat-row.out { justify-content: flex-end; }
.chat-bubble { max-width: 76%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow-sm); }
.chat-bubble.in { border-bottom-left-radius: 4px; }
.chat-bubble.out { background: #f3efe7; border-bottom-right-radius: 4px; }
.chat-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.chat-text { font-size: 14px; color: var(--ink); white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.chat-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.chat-actions .btn-sm { padding: 4px 11px; font-size: 12px; }
.chat-reply { position: sticky; bottom: 0; margin-top: 8px; }

/* Unified messenger window (Пакет 32): header (client name) + scrollable thread + input in one panel. */
.chat-panel { display: flex; flex-direction: column; max-height: 68vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head a { font-weight: 700; color: var(--ink); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); }
.chat-scroll .chat-thread { margin: 0; }
.chat-input { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-input textarea { flex: 1; }

/* Two-pane messenger «единое окно» (Пакет 32): dialog list left, conversation right. */
.dlg-layout { display: flex; height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.dlg-list { width: 300px; flex: 0 0 300px; border-right: 1px solid var(--line); overflow-y: auto; }
.dlg-item { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.dlg-item:hover, .dlg-item.active { background: var(--bg-2); }
.dlg-item .avatar { width: 38px; height: 38px; flex: 0 0 38px; }
.dlg-name { font-weight: 600; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-snip { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dlg-chat .chat-scroll { flex: 1; }
.dlg-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); padding: 30px; }
.chat-row { gap: 8px; align-items: flex-end; }
.chat-row .avatar { width: 30px; height: 30px; flex: 0 0 30px; font-size: 12px; }
.chat-head .avatar { width: 34px; height: 34px; flex: 0 0 34px; }
@media (max-width: 720px) { .dlg-layout { flex-direction: column; height: auto; } .dlg-list { width: auto; flex: none; max-height: 230px; border-right: 0; border-bottom: 1px solid var(--line); } .dlg-chat { height: 60vh; } }

/* Attach (paperclip) button in the chat input — clear, square, easy to hit (Пакет 32). */
.chat-input .btn-sm { align-self: flex-end; }
.chat-input button[title="Прикрепить файл"] { font-size: 17px; line-height: 1; padding: 8px 11px; }

/* Staged attachment chip in the chat input (Пакет 32). */
.chat-input { flex-wrap: wrap; }
.chat-attach-chip { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.chat-attach-chip .btn-text { color: var(--err); }

/* Attachment preview in the staging chip (Пакет 32): image thumbnail / doc icon so it's clear what's attached. */
.chat-attach-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.chat-attach-ico { font-size: 22px; line-height: 1; }
.chat-attach-chip { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }

/* Super-admin god-mode banner (Пакет 30.2) — visible context when operating any shop for support. */
.godmode-bar { padding: 8px 32px; font-size: 12.5px; font-weight: 600; color: #7a5b00; background: #fdf6e3; border-bottom: 1px solid #efe4c2; }
