/* =========================================================
   Bianki Office — UI
   ========================================================= */

@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/onest-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/onest-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/onest-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --font: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --bg:            #f5f3ef;
  --surface:       #ffffff;
  --surface-2:     #faf9f6;
  --surface-sunk:  #eeebe5;
  --border:        #e4e0d8;
  --border-strong: #d3cec4;
  --text:          #1b1a18;
  --text-2:        #5d5a54;
  --text-3:        #8f8b83;
  --ink:           #161513;
  --ink-text:      #f3efe7;

  --accent:        #9a4f2a;   /* коняк / кожа */
  --accent-hover:  #83411f;
  --accent-soft:   #f4e9e1;
  --accent-text:   #ffffff;

  --success:       #2f7a4b;  --success-soft: #e6f2ea;
  --danger:        #b3372e;  --danger-soft:  #f9e7e5;
  --warning:       #a86a0c;  --warning-soft: #fbf0dc;
  --info:          #2f5f9a;  --info-soft:    #e6eef8;

  --radius-sm: 6px;  --radius: 10px;  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgb(27 26 24 / .06);
  --shadow:    0 1px 2px rgb(27 26 24 / .05), 0 4px 16px rgb(27 26 24 / .06);
  --shadow-lg: 0 8px 24px rgb(27 26 24 / .10), 0 24px 64px rgb(27 26 24 / .14);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);

  --ease: cubic-bezier(.2, .8, .2, 1);

  --text-xs: .75rem; --text-sm: .8125rem; --text-base: .9375rem; --text-lg: 1.125rem; --text-xl: 1.5rem;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg:            #121110;
  --surface:       #1a1918;
  --surface-2:     #1f1e1c;
  --surface-sunk:  #0d0c0b;
  --border:        #2b2926;
  --border-strong: #3a3733;
  --text:          #ece8e1;
  --text-2:        #a9a49b;
  --text-3:        #77736b;
  --ink:           #0b0a09;
  --ink-text:      #ece8e1;

  --accent:        #d08a5c;
  --accent-hover:  #e09b6d;
  --accent-soft:   #2e211a;
  --accent-text:   #1a1009;

  --success: #5fb57f; --success-soft: #16261c;
  --danger:  #e5736a; --danger-soft:  #2c1715;
  --warning: #dba44a; --warning-soft: #2a2010;
  --info:    #7aa6dc; --info-soft:    #15202e;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow:    0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
  --shadow-lg: 0 8px 24px rgb(0 0 0 / .45), 0 24px 64px rgb(0 0 0 / .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--text-base); line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
.icon { flex-shrink: 0; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.tabular { font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--ring); }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

kbd {
  font-family: var(--font); font-size: 11px; font-weight: 500; line-height: 1;
  padding: 3px 6px; border-radius: 5px; color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--border); box-shadow: 0 1px 0 var(--border);
}

/* ---------- Бутони ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-size: var(--text-sm); font-weight: 550; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s, transform .1s, box-shadow .15s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--ink-text); }
[data-theme="dark"] .btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--accent)); }
[data-theme="dark"] .btn-primary:hover { background: #fff; }
.btn-accent { background: var(--accent); color: var(--accent-text); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-sunk); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-lg { height: 48px; font-size: var(--text-base); border-radius: var(--radius); padding: 0 20px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); }
.btn[disabled], .btn.is-loading { pointer-events: none; opacity: .75; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: block; }
.btn.is-loading .btn-label-icon { display: none; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Полета ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-size: var(--text-sm); font-weight: 550; color: var(--text); display: flex; justify-content: space-between; align-items: baseline; }
.label .hint { font-weight: 400; color: var(--text-3); font-size: var(--text-xs); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 13px; color: var(--text-3); pointer-events: none; transition: color .15s; }
.input, .select {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: var(--text-3); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input-wrap:focus-within > .icon { color: var(--accent); }
.input-wrap > .icon + .input { padding-left: 40px; }
.input-wrap .input-action {
  position: absolute; right: 6px; width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: grid; place-items: center; background: none; border: 0; color: var(--text-3);
}
.input-wrap .input-action:hover { color: var(--text); background: var(--surface-sunk); }
.input-wrap .input-action + .input, .input-wrap .input:has(+ .input-action) { padding-right: 44px; }
.select { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f8b83' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.field.has-error .input, .field.has-error .select { border-color: var(--danger); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.field-error { font-size: var(--text-xs); color: var(--danger); display: flex; gap: 5px; align-items: center; }
.field-help { font-size: var(--text-xs); color: var(--text-3); }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: var(--text-sm); color: var(--text-2); cursor: pointer; user-select: none; }
.check input { appearance: none; width: 18px; height: 18px; margin: 0; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; transition: all .15s; cursor: pointer; }
.check input::after { content: ''; width: 10px; height: 10px; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: var(--ink-text); transform: scale(0); transition: transform .15s var(--ease); }
.check input:checked { background: var(--ink); border-color: var(--ink); }
[data-theme="dark"] .check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { transform: scale(1); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--text-sm); }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; margin: 0; cursor: pointer; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--success); }
.switch input:checked::after { transform: translateX(16px); }

/* ---------- Известия ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); font-size: var(--text-sm); line-height: 1.45; }
.alert .icon { margin-top: 1px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px;
  padding: 12px 14px 12px 12px; border-radius: var(--radius); background: var(--ink); color: var(--ink-text);
  box-shadow: var(--shadow-lg); font-size: var(--text-sm); animation: toast-in .35s var(--ease);
}
[data-theme="dark"] .toast { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.toast .toast-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast-success .toast-icon { background: var(--success); color: #fff; }
.toast-error .toast-icon { background: var(--danger); color: #fff; }
.toast.is-leaving { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* =========================================================
   ВХОД
   ========================================================= */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(420px, 560px); background: var(--bg); }
.auth-brand {
  position: relative; overflow: hidden; background: var(--ink); color: var(--ink-text);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px;
}
.auth-brand::before { /* шев */
  content: ''; position: absolute; inset: 18px; border: 1.5px dashed rgb(243 239 231 / .14); border-radius: 22px; pointer-events: none;
}
.auth-brand .logo { width: 132px; height: auto; color: var(--ink-text); position: relative; }
.auth-brand-mid { position: relative; max-width: 520px; margin-top: -12vh; }
.auth-eyebrow { font-size: var(--text-xs); letter-spacing: .18em; text-transform: uppercase; color: #c9926c; font-weight: 600; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.auth-eyebrow::before { content: ''; width: 28px; height: 1.5px; background: currentColor; }
.auth-headline { font-size: clamp(2.25rem, 1.2rem + 2.8vw, 3.75rem); font-weight: 500; letter-spacing: -.035em; line-height: 1.02; }
.auth-headline em { font-style: normal; color: #c9926c; }
.auth-sub { margin-top: 20px; color: rgb(243 239 231 / .62); font-size: var(--text-base); max-width: 40ch; line-height: 1.6; }
.auth-brand-foot { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; font-size: var(--text-xs); color: rgb(243 239 231 / .45); }
.auth-clock { font-size: 1.75rem; font-weight: 500; letter-spacing: -.02em; color: var(--ink-text); line-height: 1; font-variant-numeric: tabular-nums; }
.auth-clock-date { margin-top: 6px; }
.auth-clock-date::first-letter { text-transform: uppercase; }

/* Анимиран контур на обувка */
.auth-art { position: absolute; right: 56px; bottom: 96px; width: min(48%, 440px); pointer-events: none; }
.auth-art path { fill: none; stroke: rgb(243 239 231 / .22); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.auth-art .stitch { stroke: #c9926c; stroke-opacity: .55; stroke-dasharray: 3 6; }
.auth-art .draw { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.4s var(--ease) .2s forwards; }
.auth-art .stitch.draw-s { opacity: 0; animation: fade-in 1s ease 1.8s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(28px, 6vw, 72px); position: relative; }
.auth-panel-top { position: absolute; top: 24px; right: 24px; left: 24px; display: flex; justify-content: space-between; align-items: center; }
.auth-panel-top .logo-mobile { display: none; width: 92px; color: var(--text); }
.auth-form-wrap { width: 100%; max-width: 380px; margin: 0 auto; animation: rise .6s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.auth-title { font-size: 1.75rem; font-weight: 600; letter-spacing: -.025em; }
.auth-desc { color: var(--text-2); margin-top: 8px; margin-bottom: 32px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 24px; }
.auth-form .btn-lg { width: 100%; }
.auth-form .btn-lg .btn-label-icon { transition: transform .2s var(--ease); }
.auth-form .btn-lg:hover .btn-label-icon { transform: translateX(3px); }
.auth-form .btn.is-success { background: var(--success); color: #fff; }
.auth-foot { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--text-3); }
.capslock { display: none; font-size: var(--text-xs); color: var(--warning); align-items: center; gap: 5px; }
.capslock.is-on { display: inline-flex; }
.shake { animation: shake .4s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-alert { margin-bottom: 20px; }

/* =========================================================
   ПРИЛОЖЕНИЕ
   ========================================================= */

.avatar {
  --h: 28; width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 650; letter-spacing: .02em;
  background: hsl(var(--h) 45% 90%); color: hsl(var(--h) 45% 30%);
}
[data-theme="dark"] .avatar { background: hsl(var(--h) 25% 22%); color: hsl(var(--h) 55% 78%); }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

.menu {
  position: absolute; z-index: 40; min-width: 220px; padding: 6px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(4px) scale(.98); pointer-events: none; transition: opacity .14s, transform .14s var(--ease);
}
.menu.is-open { opacity: 1; transform: none; pointer-events: auto; }
.menu-up { bottom: calc(100% + 6px); left: 0; right: 0; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); color: var(--text-2); background: none; border: 0; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--surface-sunk); color: var(--text); }
.menu .danger { color: var(--danger); }
.menu .danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.menu kbd { margin-left: auto; }

/* ---------- Горна лента ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50; height: 52px; display: flex; align-items: center; gap: 16px;
  padding: 0 12px 0 20px; background: var(--ink); color: var(--ink-text);
}
.appbar-brand { display: flex; align-items: center; gap: 10px; width: 292px; flex-shrink: 0; }
.appbar-brand .logo { width: 92px; color: var(--ink-text); }
.appbar-brand .tag { font-size: 10px; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; color: #c9926c; border: 1px solid rgb(201 146 108 / .4); padding: 2px 6px; border-radius: 4px; }
.appbar-search {
  display: flex; align-items: center; gap: 9px; width: min(380px, 100%); height: 34px; padding: 0 8px 0 12px;
  border-radius: var(--radius-sm); border: 1px solid rgb(243 239 231 / .1); background: rgb(243 239 231 / .06);
  color: rgb(243 239 231 / .5); font-size: var(--text-sm); text-align: left; transition: background .15s, border-color .15s;
}
.appbar-search:hover { background: rgb(243 239 231 / .1); border-color: rgb(243 239 231 / .18); color: rgb(243 239 231 / .75); }
.appbar-search span { flex: 1; }
.appbar-search kbd { background: transparent; border-color: rgb(243 239 231 / .18); color: rgb(243 239 231 / .5); box-shadow: none; }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.bar-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; min-width: 36px; padding: 0 10px;
  border-radius: var(--radius-sm); border: 0; background: none; color: rgb(243 239 231 / .72); font-size: var(--text-sm); font-weight: 500;
  transition: background .12s, color .12s; position: relative;
}
.bar-btn:hover, .bar-btn[aria-expanded="true"] { background: rgb(243 239 231 / .09); color: var(--ink-text); }
.bar-btn .avatar { width: 28px; height: 28px; font-size: 11px; }
.bar-user { padding: 0 6px 0 4px; margin-left: 6px; }
.bar-user .bar-user-name { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-sep { width: 1px; height: 20px; background: rgb(243 239 231 / .14); margin: 0 6px; }
.bar-menu { position: relative; }
.bar-menu .menu { right: 0; top: calc(100% + 8px); }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.menu-head strong { display: block; font-size: var(--text-sm); color: var(--text); }
.menu-head span { font-size: var(--text-xs); color: var(--text-3); }
.nav-toggle { display: none; }

/* ---------- Обвивка ---------- */
.shell { display: grid; grid-template-columns: 64px 256px minmax(0, 1fr); min-height: calc(100dvh - 52px); transition: grid-template-columns .25s var(--ease); }
[data-subnav="collapsed"] .shell { grid-template-columns: 64px 0 minmax(0, 1fr); }

/* Лента с модули */
.rail {
  position: sticky; top: 52px; height: calc(100dvh - 52px); z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0;
  background: var(--surface-sunk); border-right: 1px solid var(--border);
}
.rail-link {
  position: relative; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  color: var(--text-2); transition: background .12s, color .12s;
}
.rail-link:hover { background: var(--surface); color: var(--text); }
.rail-link.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.rail-link.is-active::before { content: ''; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-link.is-muted { color: var(--text-3); }
.rail-link.is-muted .icon { opacity: .6; }
.rail-link.is-muted.is-active .icon { opacity: 1; }
.rail-link[data-tip]::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translate(-4px, -50%);
  white-space: nowrap; padding: 5px 9px; border-radius: 6px; font-size: var(--text-xs); font-weight: 550;
  background: var(--ink); color: var(--ink-text); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s;
}
[data-theme="dark"] .rail-link[data-tip]::after { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.rail-link[data-tip]:hover::after { opacity: 1; transform: translate(0, -50%); }
.rail-sep { width: 24px; height: 1px; background: var(--border-strong); margin: 6px 0; }
.rail-foot { margin-top: auto; }
.rail-collapse { border: 0; background: none; cursor: pointer; }
.rail-collapse .icon { transition: transform .25s var(--ease); }
[data-subnav="collapsed"] .rail-collapse .icon { transform: rotate(180deg); }

/* Меню на модула */
.subnav {
  position: sticky; top: 52px; height: calc(100dvh - 52px); overflow: hidden auto; z-index: 20;
  background: var(--surface); border-right: 1px solid var(--border); scrollbar-width: thin;
}
[data-subnav="collapsed"] .subnav { visibility: hidden; border-right: 0; }
.subnav-inner { width: 256px; padding-bottom: 24px; }
.subnav-head { padding: 22px 22px 16px; }
.subnav-head h2 { font-size: 1.0625rem; font-weight: 650; letter-spacing: -.015em; }
.subnav-head p { font-size: var(--text-xs); color: var(--text-3); margin-top: 3px; }
.subnav-group { padding: 8px 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1px; }
.subnav-link {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); line-height: 1.35; color: var(--text); font-weight: 500; transition: background .12s, color .12s;
}
.subnav-link:hover { background: var(--surface-sunk); }
.subnav-link.is-muted { color: var(--text-3); font-weight: 450; }
.subnav-link.is-muted:hover { color: var(--text-2); }
.subnav-link.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.subnav-link.is-active::after { content: ''; position: absolute; right: -10px; top: 6px; bottom: 6px; width: 3px; border-radius: 3px 0 0 3px; background: var(--accent); }

.nav-overlay { display: none; }

/* Съдържание */
.main { min-width: 0; }
.content { padding: 28px 40px 64px; max-width: 1320px; width: 100%; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-3); margin-bottom: 6px; }
.crumb a:hover { color: var(--text); }
.page-title-lg { font-size: 1.875rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }

/* Страница в разработка */
.wip { padding: 56px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.wip-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-sunk); color: var(--text-3); margin-bottom: 18px; border: 1px dashed var(--border-strong); }
.wip h2 { font-size: var(--text-lg); }
.wip p { color: var(--text-2); font-size: var(--text-sm); margin-top: 6px; max-width: 46ch; }
.wip .badge { margin-top: 18px; }

/* Плочки с модули / страници */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  font-size: var(--text-sm); color: var(--text); transition: border-color .15s, transform .15s var(--ease), box-shadow .15s;
}
.tile:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.tile .tile-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.tile strong { display: block; font-weight: 600; line-height: 1.3; }
.tile small { display: block; font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }
.tile.is-muted { background: var(--surface-2); border-style: dashed; box-shadow: none; color: var(--text-3); }
.tile.is-muted strong { color: var(--text-2); font-weight: 550; }
.tile.is-muted .tile-icon { background: var(--surface-sunk); color: var(--text-3); }
.section-title { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 28px 0 12px; }
.section-title:first-child { margin-top: 0; }

@media (max-width: 1100px) {
  .appbar-brand { width: auto; }
}
@media (max-width: 860px) {
  .appbar { padding: 0 8px 0 6px; gap: 6px; }
  .appbar-brand .logo { width: 78px; }
  .appbar-brand .tag, .appbar-search, .bar-user-name, .bar-help-label, .bar-sep { display: none; }
  .nav-toggle { display: inline-flex; }
  .shell, [data-subnav="collapsed"] .shell { grid-template-columns: minmax(0, 1fr); }
  .rail, .subnav { position: fixed; top: 52px; bottom: 0; height: auto; transform: translateX(calc(-100% - 80px)); visibility: hidden; transition: transform .28s var(--ease), visibility 0s .28s; }
  .rail { left: 0; z-index: 71; }
  .subnav, [data-subnav="collapsed"] .subnav { left: 64px; width: min(272px, calc(100vw - 64px)); z-index: 70; border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .subnav-inner { width: auto; }
  .rail-foot { display: none; }
  [data-nav-open] .rail, [data-nav-open] .subnav { transform: none; visibility: visible; transition: transform .28s var(--ease); }
  .nav-overlay { display: block; position: fixed; inset: 52px 0 0 0; z-index: 60; background: rgb(15 14 12 / .38); opacity: 0; pointer-events: none; transition: opacity .2s; }
  [data-nav-open] .nav-overlay { opacity: 1; pointer-events: auto; }
  .content { padding: 20px 16px 48px; }
  .page-title-lg { font-size: 1.5rem; }
}


.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 12px 0 28px; flex-wrap: wrap; }
.page-title { font-size: var(--text-xl); font-weight: 600; letter-spacing: -.025em; }
.page-sub { color: var(--text-2); margin-top: 4px; font-size: var(--text-sm); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: var(--text-base); font-weight: 600; }
.card-body { padding: 20px; }

/* Табло */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-size: var(--text-sm); font-weight: 500; }
.stat-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-sunk); color: var(--text-2); }
.stat-value { font-size: 1.875rem; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: var(--text-sm); color: var(--text-3); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.stat.is-warn .stat-icon { background: var(--danger-soft); color: var(--danger); }

.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.hero-card { position: relative; overflow: hidden; padding: 26px 28px; background: var(--ink); color: var(--ink-text); border: 0; margin-bottom: 20px; }
.hero-card::after { content: ''; position: absolute; inset: 10px; border: 1.5px dashed rgb(243 239 231 / .12); border-radius: 12px; pointer-events: none; }
.hero-card h2 { font-size: 1.5rem; font-weight: 500; letter-spacing: -.025em; }
.hero-card p { color: rgb(243 239 231 / .62); margin-top: 6px; font-size: var(--text-sm); }
.hero-card .hero-meta { display: flex; gap: 24px; margin-top: 20px; font-size: var(--text-xs); color: rgb(243 239 231 / .5); flex-wrap: wrap; }
.hero-card .hero-meta strong { display: block; color: var(--ink-text); font-size: var(--text-sm); font-weight: 500; margin-top: 2px; }

.feed { list-style: none; margin: 0; padding: 6px 0; }
.feed li { display: flex; gap: 12px; padding: 10px 20px; align-items: center; }
.feed .avatar { width: 30px; height: 30px; font-size: 11px; }
.feed .feed-text { flex: 1; min-width: 0; font-size: var(--text-sm); color: var(--text-2); }
.feed .feed-text strong { color: var(--text); font-weight: 600; }
.feed time { font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; }

.modules { display: grid; gap: 10px; padding: 16px; }
.module { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); border: 1px dashed var(--border-strong); color: var(--text-2); font-size: var(--text-sm); }
.module .stat-icon { width: 34px; height: 34px; }
.module strong { display: block; color: var(--text); font-weight: 600; }
.module.is-ready { border-style: solid; background: var(--surface-2); }
.module.is-ready:hover { border-color: var(--text-3); }

/* Таблица потребители */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .input-wrap { flex: 1; min-width: 220px; max-width: 360px; }
.toolbar .input { height: 36px; }
.toolbar .input-wrap kbd { position: absolute; right: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: var(--text-xs); font-weight: 550; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; transition: all .12s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
[data-theme="dark"] .chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .count { opacity: .6; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-inactive .person, .table tr.is-inactive td:not(:last-child) { opacity: .55; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .name { font-weight: 600; color: var(--text); white-space: nowrap; }
.person .sub { font-size: var(--text-xs); color: var(--text-3); }
.you { font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; margin-left: 6px; vertical-align: 1px; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: var(--text-xs); font-weight: 550; white-space: nowrap; background: var(--surface-sunk); color: var(--text-2); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-green { background: var(--success-soft); color: var(--success); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-sm); color: var(--text-2); white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status.off::before { background: var(--text-3); box-shadow: 0 0 0 3px var(--surface-sunk); }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; position: relative; }
.row-actions .menu { right: 0; top: calc(100% + 4px); }
.empty { padding: 56px 20px; text-align: center; color: var(--text-3); }
.empty .icon { margin: 0 auto 12px; color: var(--text-3); }
.empty strong { display: block; color: var(--text); font-size: var(--text-base); margin-bottom: 4px; }

/* Чекмедже (drawer) */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgb(15 14 12 / .38); opacity: 0; pointer-events: none; transition: opacity .2s; }
.overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(480px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(104%); transition: transform .3s var(--ease);
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: var(--text-lg); }
.drawer-head p { font-size: var(--text-sm); color: var(--text-3); margin-top: 2px; }
.drawer-head .btn-icon { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }
.form-section + .form-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.form-section-title { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2 .field + .field { margin-top: 0; }
.role-options { display: grid; gap: 8px; }
.role-option { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; }
.role-option:hover { border-color: var(--border-strong); }
.role-option input { position: absolute; opacity: 0; }
.role-option .radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex-shrink: 0; margin-top: 1px; display: grid; place-items: center; transition: all .15s; }
.role-option .radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .15s var(--ease); }
.role-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.role-option:has(input:checked) .radio { border-color: var(--accent); }
.role-option:has(input:checked) .radio::after { transform: scale(1); }
.role-option:has(input:focus-visible) { box-shadow: var(--ring); }
.role-option strong { display: block; font-size: var(--text-sm); }
.role-option span.desc { font-size: var(--text-xs); color: var(--text-3); }
.role-option .lvl { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.pw-meter i { height: 3px; border-radius: 2px; background: var(--border); transition: background .2s; }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: var(--warning); }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: #7a9a3a; }
.pw-meter[data-score="4"] i { background: var(--success); }

/* Диалог */
dialog.confirm { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(420px, calc(100vw - 32px)); }
dialog.confirm::backdrop { background: rgb(15 14 12 / .45); }
dialog.confirm[open] { animation: pop .2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.confirm-body { padding: 24px; display: flex; gap: 16px; }
.confirm-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); display: grid; place-items: center; flex-shrink: 0; }
.confirm-body h3 { font-size: var(--text-base); margin-bottom: 6px; }
.confirm-body p { font-size: var(--text-sm); color: var(--text-2); }
.confirm-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; background: var(--surface-2); border-top: 1px solid var(--border); }

/* Команди (Ctrl+K) */
.palette { position: fixed; inset: 0; z-index: 90; display: none; align-items: flex-start; justify-content: center; padding-top: 14vh; background: rgb(15 14 12 / .38); }
.palette.is-open { display: flex; animation: fade-in-fast .12s ease; }
@keyframes fade-in-fast { from { opacity: 0; } }
.palette-box { width: min(560px, calc(100vw - 32px)); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); animation: pop .18s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-input input:focus-visible { box-shadow: none; }
.palette-input input { flex: 1; height: 54px; border: 0; background: none; font-size: var(--text-lg); outline: none; color: var(--text); }
.palette-list { list-style: none; margin: 0; padding: 8px; max-height: 340px; overflow-y: auto; }
.palette-list .group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 4px; }
.palette-list a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--text-2); }
.palette-list a.is-active { background: var(--surface-sunk); color: var(--text); }
.palette-list a .icon { color: var(--text-3); }
.palette-list a span.hint { margin-left: auto; font-size: var(--text-xs); color: var(--text-3); }
.palette-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-3); background: var(--surface-2); }
.palette-foot span { display: inline-flex; gap: 6px; align-items: center; }

/* Профил */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.session-list { list-style: none; margin: 0; padding: 0; }
.session-list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); font-size: var(--text-sm); }
.session-list li:first-child { border-top: 0; }
.session-list .ok { color: var(--success); } .session-list .bad { color: var(--danger); }
.session-list .meta { flex: 1; min-width: 0; }
.session-list .meta small { display: block; color: var(--text-3); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { display: flex; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.error-page { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.error-page .code { font-size: 4.5rem; font-weight: 600; letter-spacing: -.05em; line-height: 1; color: var(--border-strong); }
.error-page h1 { font-size: var(--text-xl); margin: 12px 0 8px; }
.error-page p { color: var(--text-2); margin-bottom: 24px; }

/* ---------- Адаптивност ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .profile-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel-top .logo-mobile { display: block; }
  .auth-panel { padding-top: 96px; }
}
@media (max-width: 860px) {
  .hide-sm { display: none !important; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 .field + .field { margin-top: 16px; }
  .toolbar .input-wrap { max-width: none; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 1.5rem; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .auth-art .draw { stroke-dashoffset: 0; }
  .auth-art .stitch.draw-s { opacity: 1; }
}

/* Иконки за тема */
[data-theme="dark"] [data-theme-icon="light"], [data-theme="light"] [data-theme-icon="dark"] { display: none; }
[data-theme-icon] { display: contents; }
@media (max-width: 520px) {
  .table td, .table th { padding-left: 10px; padding-right: 10px; }
  .person .sub { display: none; }
}
[data-mobile-search] { display: none; }
@media (max-width: 860px) { [data-mobile-search] { display: inline-flex; } }

/* ---------- Номенклатури ---------- */
.lk { max-width: 760px; }
.lk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-2); }
.lk-count strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.lk-keys { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-3); }
.lk-keys kbd + * { margin-right: 6px; }
.lk-keys kbd { margin-left: 6px; }
.lk-add { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lk-add .input-wrap { flex: 1; min-width: 0; }
.lk-add .input { height: 40px; }
.lk-add .btn { height: 40px; }
.lk-add .field-error { flex-basis: 100%; margin-top: 0; }
.lk-add.has-error .input { border-color: var(--danger); }
.lk-list { list-style: none; margin: 0; padding: 0; }
.lk-row {
  display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 12px 8px 16px;
  transition: background .15s;
}
.lk-row + .lk-row { border-top: 1px solid var(--border); }
.lk-row:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.lk-row:hover { background: var(--surface-2); }
.lk-num {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-sunk); color: var(--text-2); font-size: var(--text-xs); font-weight: 650; font-variant-numeric: tabular-nums;
}
.lk-name { flex: 1; min-width: 0; font-size: var(--text-sm); font-weight: 550; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.lk-name[data-lk-edit] { cursor: text; }
.lk-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .15s; }
.lk-row:hover .lk-actions, .lk-row:focus-within .lk-actions { opacity: 1; }
.lk-actions .btn-icon { width: 32px; height: 32px; }
.lk-actions .btn[disabled] { opacity: .3; }
.lk-move { display: flex; gap: 2px; margin-right: 4px; padding-right: 6px; border-right: 1px solid var(--border); }
.lk-del:hover { color: var(--danger); background: var(--danger-soft); }
.lk-edit { display: none; flex: 1; align-items: center; gap: 6px; }
.lk-edit .input { height: 36px; flex: 1; min-width: 0; }
.lk-row.is-editing { background: var(--accent-soft); }
.lk-row.is-editing .lk-name, .lk-row.is-editing .lk-actions { display: none; }
.lk-row.is-editing .lk-edit { display: flex; }
.lk-row.is-editing .lk-num { background: var(--surface); color: var(--accent); }
.lk-row.is-new { animation: lk-flash 1.6s var(--ease); }
@keyframes lk-flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }

.flow { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.flow-step {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 5px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: var(--text-sm); font-weight: 550; box-shadow: var(--shadow-sm);
}
.flow-step span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--ink-text); font-size: 11px; font-weight: 650; }
[data-theme="dark"] .flow-step span { background: var(--accent); color: var(--accent-text); }
.flow-step + .flow-step::before { content: ''; width: 14px; height: 1px; border-top: 1.5px dashed var(--border-strong); margin-left: -21px; margin-right: 1px; }
.flow-step + .flow-step { margin-left: 14px; }
.flow-step.is-new { border-color: var(--accent); }

@media (hover: none) { .lk-actions { opacity: 1; } }
@media (max-width: 860px) {
  .lk-move { display: none; }
  .flow-step + .flow-step { margin-left: 0; }
  .flow-step + .flow-step::before { display: none; }
  .lk-row { padding-left: 8px; gap: 10px; }
}

/* ---------- Табове ---------- */
.kbd-on-dark { background: transparent; border-color: rgb(255 255 255 / .2); color: inherit; opacity: .7; box-shadow: none; }
.tabs { display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--border-strong); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 0; background: none;
  font-size: var(--text-sm); font-weight: 550; color: var(--text-2); white-space: nowrap; cursor: pointer; transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); transform: scaleX(0); transition: transform .2s var(--ease); }
.tab[aria-selected="true"] { color: var(--text); font-weight: 650; }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tabs:not(.is-ready) .tab::after { transition: none; }
.tab-num { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 650; background: var(--surface-sunk); color: var(--text-2); }
.tab[aria-selected="true"] .tab-num { background: var(--accent); color: var(--accent-text); }
.tab-count { font-size: 11px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tabs-link { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 10px; font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; }
.tabs-link:hover { color: var(--accent); }

/* ---------- Процеси ---------- */
.proc-panel .toolbar { gap: 14px; }
.proc-title { font-size: var(--text-base); font-weight: 650; order: -1; margin-right: auto; white-space: nowrap; }
.proc-title span { color: var(--accent); }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; transition: color .2s; }
.save-state.is-saving { color: var(--text-2); }
.save-state.is-saved { color: var(--success, #2f7d4f); }
.save-state.is-error { color: var(--danger); }
.ptable tbody tr { cursor: default; }
.ptable td, .ptable th { padding-top: 0; padding-bottom: 0; }
.ptable th { height: 44px; }
.ptable td { height: 46px; }
.ptable .c-grip { width: 36px; padding: 0 0 0 8px; }
.ptable .c-ord { width: 56px; color: var(--text-3); }
.ptable .c-code { width: 84px; font-weight: 600; color: var(--text-2); }
.ptable .c-name { font-weight: 550; min-width: 200px; }
.ptable .c-cat { width: 104px; text-align: center; }
.ptable th.c-cat { color: var(--text-2); }
.ptable th.c-cat small { display: block; font-size: 10.5px; font-weight: 550; letter-spacing: 0; text-transform: none; color: var(--text-3); margin-top: 1px; font-variant-numeric: tabular-nums; }
.ptable .c-act { width: 92px; text-align: right; padding-right: 10px; }
.ptable tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.ptable tbody tr:hover { background: var(--surface-2); }
.ptable tbody tr.is-editing { background: var(--accent-soft); }
.ptable tbody tr.is-new { animation: lk-flash 1.6s var(--ease); }
.ptable tbody tr.is-dragging { opacity: .45; }
.ptable tbody tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
.ptable tbody tr.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
.ptable tbody tr[hidden] { display: none; }
.grip { width: 26px; height: 30px; border: 0; background: none; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); cursor: grab; opacity: .5; transition: opacity .15s, background .15s; }
.ptable tr:hover .grip, .grip:focus-visible { opacity: 1; }
.grip:hover { background: var(--surface-sunk); color: var(--text); }
.grip:active { cursor: grabbing; }
.row-tools { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.ptable tr:hover .row-tools, .ptable tr:focus-within .row-tools { opacity: 1; }
.row-tools .btn-icon { width: 30px; height: 30px; }
.ptable tr.is-editing .row-tools { opacity: 1; }
.c-name[data-name-cell] { cursor: text; }
.input-sm { height: 32px; font-size: var(--text-sm); padding: 0 10px; border-radius: 7px; }
.ptable .c-code .input-sm { width: 70px; }
.ptable .c-name .input-sm { width: 100%; max-width: 420px; }

/* Отметка */
.tick { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; vertical-align: middle; }
.tick:hover { background: var(--surface-sunk); }
.tick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: inherit; }
.tick span {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; transition: background .12s, border-color .12s, transform .12s var(--ease);
}
.tick span::after { content: ''; width: 10px; height: 6px; border: solid var(--accent-text); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform .15s var(--ease); }
.tick input:checked + span { background: var(--accent); border-color: var(--accent); }
.tick input:checked + span::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.tick input:focus-visible + span { box-shadow: var(--ring); }
.tick input:active + span { transform: scale(.88); }
.tick input:disabled { cursor: default; }
.tick input:disabled + span { opacity: .75; }
.tick:has(input:disabled):hover { background: none; }
.tick.is-saving span { animation: tick-pulse .6s ease infinite alternate; }
@keyframes tick-pulse { to { opacity: .55; } }

.add-row td { background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; height: 54px; }
.add-plus { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.add-row .input.is-invalid, .ptable .input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

@media (max-width: 860px) {
  .proc-title { display: none; }
  .ptable .c-ord { display: none; }
  .ptable .c-cat { width: 72px; }
  .row-tools { opacity: 1; }
}

@media (max-width: 560px) {
  .ptable .c-grip { display: none; }
  .ptable th, .ptable td { padding-left: 6px; padding-right: 6px; }
  .ptable .c-code { width: 40px; padding-left: 12px; font-size: 12.5px; }
  .ptable .c-code .input-sm { width: 46px; padding-left: 6px; padding-right: 4px; }
  .ptable .c-name { min-width: 0; font-size: 13px; line-height: 1.25; }
  .ptable .c-cat { width: 46px; padding-left: 1px; padding-right: 1px; }
  .ptable th.c-cat { font-size: 9px; letter-spacing: 0; white-space: normal; }
  .ptable th.c-cat small { font-size: 9px; white-space: nowrap; }
  .ptable .c-act { width: 40px; padding: 0 6px 0 2px; }
  .ptable .row-tools { flex-direction: column; gap: 2px; }
  .ptable .c-act .btn-icon { width: 30px; height: 22px; }
  .ptable [data-add-submit] { width: 30px; height: 30px; padding: 0; justify-content: center; }
  .ptable [data-add-submit] span { display: none; }
}

/* ---------- Детайли: клетки за редакция ---------- */
.dtable .c-name { min-width: 220px; }
.dtable .c-qty { width: 110px; }
.dtable .c-knife { width: 200px; }
.dtable .c-unit { width: 150px; }
.dtable .c-act { width: 56px; }
.no-knife .c-knife, .no-unit .c-unit { display: none; }
.cell {
  width: 100%; height: 34px; padding: 0 10px; margin-left: -10px; border: 1px solid transparent; border-radius: 7px; background: transparent;
  font: inherit; color: inherit; transition: background .12s, border-color .12s, box-shadow .12s;
}
.c-name .cell { font-weight: 550; }
.cell-num { width: 72px; }
.cell::placeholder { color: var(--text-3); opacity: .6; }
.cell:hover { background: var(--surface); border-color: var(--border); }
.cell:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cell.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.cell.is-saving { background: var(--surface-sunk); }
.cell.is-saved { border-color: var(--success, #2f7d4f); }
.cell-select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 26px; width: 110px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a857d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.cell-select option { color: var(--text); background: var(--surface); }
.dtable .add-row .c-qty .input { width: 72px; }
.dtable .add-row .c-knife .input, .dtable .add-row .c-unit .input { width: 100%; max-width: 140px; }
.dtable td.muted, .dtable .muted { color: var(--text-3); }
.col-toggles { display: inline-flex; align-items: center; gap: 6px; }
.col-toggles-label { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: var(--text-3); margin-right: 2px; }
.chip-toggle {
  height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  font-size: var(--text-xs); font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .15s;
}
.chip-toggle:hover { border-color: var(--accent); color: var(--text); }
.chip-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip-toggle[aria-pressed="true"]::before { content: '✓ '; }
@media (max-width: 860px) {
  .dtable .c-knife { width: 120px; }
  .dtable .c-unit { width: 100px; }
  .cell-select { width: 86px; }
}
@media (max-width: 560px) {
  .dtable .c-name { min-width: 0; }
  .dtable .c-qty { width: 54px; }
  .cell-num, .dtable .add-row .c-qty .input { width: 46px; }
  .cell { padding: 0 6px; margin-left: -6px; font-size: 13px; }
  .dtable .c-knife { width: 80px; }
  .dtable .c-unit { width: 74px; }
  .cell-select { width: 70px; padding-right: 18px; background-position: right 4px center; }
  .col-toggles .chip-toggle { padding: 0 8px; }
}

/* ================= Модели ================= */
.mtable .num { text-align: right; }
.mtable .m-code { font-weight: 650; color: var(--text); letter-spacing: -.01em; }
.mtable .m-code:hover { color: var(--accent); }
.mtable .m-notes { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtable td.muted, .muted { color: var(--text-3); }
.mtable tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Стъпки */
.stepper { display: flex; gap: 10px; list-style: none; margin: 0 0 18px; padding: 0; counter-reset: s; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text-3); position: relative; }
.stepper li strong { display: block; font-size: var(--text-sm); color: var(--text-2); font-weight: 600; }
.stepper li small { display: block; font-size: var(--text-xs); }
.step-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 650; background: var(--surface-sunk); color: var(--text-2); flex-shrink: 0; }
.stepper li.is-current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stepper li.is-current strong { color: var(--text); }
.stepper li.is-current .step-dot { background: var(--accent); color: var(--accent-text); }
.stepper li.is-done .step-dot { background: var(--success-soft); color: var(--success); }
.stepper li.is-done strong { color: var(--text); }
.stepper.is-compact li { padding: 9px 14px; }
.stepper.is-compact .step-dot { width: 24px; height: 24px; font-size: 12px; }

/* Форма стъпка 1 */
.model-form { max-width: 680px; }
.model-form-body { padding: 24px; }
.model-form-body .field + .field { margin-top: 22px; }
.model-form-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.input-lg { height: 48px; font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
.textarea { height: auto; min-height: 96px; padding: 10px 13px; resize: vertical; line-height: 1.5; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.cat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.cat-card { position: relative; cursor: pointer; }
.cat-card input { position: absolute; opacity: 0; pointer-events: none; }
.cat-card-box { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, background .15s, transform .1s; }
.cat-card:hover .cat-card-box { border-color: var(--text-3); }
.cat-card:active .cat-card-box { transform: scale(.98); }
.cat-card-key { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 650; background: var(--surface-sunk); color: var(--text-3); }
.cat-card-name { font-weight: 600; font-size: var(--text-base); }
.cat-card-check { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); transform: scale(0); transition: transform .18s var(--ease); }
.cat-card input:checked + .cat-card-box { border-color: var(--accent); background: var(--accent-soft); }
.cat-card input:checked + .cat-card-box .cat-card-check { transform: scale(1); }
.cat-card input:checked + .cat-card-box .cat-card-key { background: var(--accent); color: var(--accent-text); }
.cat-card input:focus-visible + .cat-card-box { box-shadow: var(--ring); }
.field.has-error .cat-card-box { border-color: var(--danger); }
.cat-cards.is-compact .cat-card-box { height: 42px; }
.cat-cards.is-compact .cat-card-name { font-size: var(--text-sm); }
.btn.is-loading { opacity: .7; pointer-events: none; }

/* Глава на модел */
.model-head { align-items: flex-start; }
.model-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.model-title .muted-word { color: var(--text-3); font-weight: 500; }
.model-notes { white-space: pre-line; max-width: 720px; }
.model-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.confirm-switch { height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-weight: 550; }
.lock-banner { margin-bottom: 14px; }
.m-panel.is-locked .dopt { cursor: default; }

/* Детайли на модел */
.total-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; }
.total-field { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: 600; }
.total-field .input { width: 72px; text-align: center; font-weight: 650; }
.total-hint { font-size: var(--text-xs); color: var(--text-3); }
.total-hint strong { color: var(--text); font-variant-numeric: tabular-nums; }
.total-search { margin-left: auto; width: 280px; }
.total-search > .icon + .input { padding-left: 34px; }
.total-search > .icon { left: 11px; }
.total-search kbd { position: absolute; right: 8px; }
.dgroups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.dgroup { display: flex; flex-direction: column; min-width: 0; }
.dgroup-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.dgroup-head h2 { font-size: var(--text-base); font-weight: 650; }
.dgroup-count { font-size: var(--text-xs); color: var(--text-3); font-variant-numeric: tabular-nums; margin-right: auto; }
.dgroup-count strong { color: var(--accent); font-weight: 700; }
.dgroup-search { padding: 0 14px 8px; }
.dgroup-search > .icon { left: 25px; }
.dgroup-search > .icon + .input { padding-left: 32px; width: 100%; }
.dlist { list-style: none; margin: 0; padding: 4px 6px 8px; max-height: 380px; overflow-y: auto; border-top: 1px solid var(--border); }
.dopt { display: flex; align-items: center; gap: 6px; padding: 1px 8px 1px 2px; border-radius: 8px; cursor: pointer; font-size: var(--text-sm); transition: background .1s; }
.dopt:hover { background: var(--surface-2); }
.dopt .tick:hover { background: none; }
.dopt.is-on { background: var(--accent-soft); }
.dopt.is-on .dopt-name { font-weight: 600; }
.dopt-name { flex: 1; min-width: 0; }
.dopt-meta { font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; }
.dgroup-empty { padding: 18px; text-align: center; font-size: var(--text-sm); color: var(--text-3); border-top: 1px solid var(--border); }
.dgroup.is-filtered { opacity: .6; }

/* Процеси на модел */
.mstats { display: flex; align-items: stretch; flex-wrap: wrap; margin-bottom: 14px; }
.mstat { padding: 12px 20px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--border); min-width: 130px; }
.mstat span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.mstat strong { font-size: 1.375rem; font-weight: 650; letter-spacing: -.02em; }
.mstat-help { margin-left: auto; align-self: center; padding: 10px 16px; font-size: var(--text-xs); color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mstat-help kbd { font-size: 11px; }
.ptype { margin-bottom: 14px; }
.ptype-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ptype-head .tab-num { background: var(--accent); color: var(--accent-text); }
.ptype-head h2 { font-size: var(--text-base); font-weight: 650; }
.ptype-meta { font-size: var(--text-xs); color: var(--text-3); margin-right: auto; font-variant-numeric: tabular-nums; }
.proctable th, .proctable td { padding-top: 6px; padding-bottom: 6px; }
.proctable th small { display: block; font-size: 10.5px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.proctable tbody tr { cursor: default; }
.proctable .c-proc { width: 100%; min-width: 220px; }
.proctable .c-t, .proctable .c-n { text-align: right; white-space: nowrap; width: 1%; }
.proctable .c-x { width: 1%; padding-left: 4px; padding-right: 8px; }
.proctable .strong { font-weight: 650; }
.proctable tfoot td { padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border); font-size: var(--text-sm); }
.proctable tr.is-removing { opacity: .4; }
.pcode { display: inline-block; min-width: 34px; font-size: var(--text-xs); font-weight: 650; color: var(--text-3); }
.pname { font-weight: 550; }
.tcell { width: 72px; height: 32px; text-align: right; padding: 0 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); font-weight: 600; transition: border-color .15s, box-shadow .15s, background .15s; }
.tcell::placeholder { color: var(--text-3); opacity: .55; font-weight: 500; }
.tcell:hover { border-color: var(--text-3); }
.tcell:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tcell.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.tcell.is-saving { background: var(--surface-sunk); }
.tcell.is-saved { border-color: var(--success); }
.tcell:disabled { background: transparent; border-color: transparent; color: var(--text); }
.ptype-empty { padding: 22px; text-align: center; font-size: var(--text-sm); color: var(--text-3); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* Диалог за процеси / редакция */
dialog.pdlg { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(640px, calc(100vw - 24px)); max-height: min(760px, calc(100vh - 32px)); display: none; flex-direction: column; overflow: hidden; }
dialog.pdlg[open] { display: flex; animation: pop .2s var(--ease); }
dialog.pdlg::backdrop { background: rgb(15 14 12 / .45); }
dialog.pdlg-sm { width: min(480px, calc(100vw - 24px)); }
dialog.pdlg form { display: flex; flex-direction: column; min-height: 0; }
.pdlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; }
.pdlg-head h3 { font-size: var(--text-lg); }
.pdlg-head p { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }
.pdlg-head .btn-icon { margin-left: auto; }
.pdlg-tools { display: flex; align-items: center; gap: 6px; padding: 0 20px 12px; border-bottom: 1px solid var(--border); }
.pdlg-tools .input-wrap { flex: 1; }
.pdlg-tools .input-wrap > .icon { left: 11px; }
.pdlg-tools .input-wrap > .icon + .input { padding-left: 34px; width: 100%; }
.pdlg-list { overflow-y: auto; padding: 6px 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 6px; align-content: start; flex: 1; min-height: 120px; }
.pdlg-body { padding: 4px 20px 18px; overflow-y: auto; }
.popt { display: flex; align-items: center; gap: 4px; padding-right: 8px; border-radius: 8px; cursor: pointer; font-size: var(--text-sm); min-width: 0; }
.popt:hover { background: var(--surface-2); }
.popt .tick:hover { background: none; }
.popt.is-on { background: var(--accent-soft); }
.popt .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.popt.is-on .pname { font-weight: 600; }
.std-mark { color: var(--accent); font-size: 12px; }
.pdlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; background: var(--surface-2); border-top: 1px solid var(--border); }
.pdlg-sum { margin-right: auto; font-size: var(--text-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.pdlg-sum.is-warn { color: var(--warning); font-weight: 600; }

@media (max-width: 860px) {
  .dgroups { grid-template-columns: 1fr; }
  .total-search { margin-left: 0; width: 100%; }
  .mstat-help { margin-left: 0; width: 100%; border-top: 1px solid var(--border); }
  .model-head { flex-direction: column; }
}
@media (max-width: 560px) {
  .stepper li small { display: none; }
  .stepper li { padding: 10px 12px; gap: 8px; }
  .mstat { min-width: 50%; border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .mstat:nth-child(2n) { border-right: 0; }
  .mstat strong { font-size: 1.125rem; }
  .pdlg-list { grid-template-columns: 1fr; }
  .pdlg-tools { flex-wrap: wrap; }
  .pdlg-tools .input-wrap { flex-basis: 100%; }
  .proctable .c-proc { min-width: 150px; }
  .proctable .pcode { display: block; min-width: 0; }
  .tcell { width: 62px; }
  .model-actions { width: 100%; }
  .confirm-switch { flex: 1; }
  .model-form-body { padding: 18px; }
}
