/* =====================================================================
   Bauland · Учёт IT — дизайн по брендбуку Bauland
   Графит + бумага + один оранжевый акцент. Manrope / Noto Sans Georgian.
   Скругления по брендбуку: не больше 4px (переменные --r, --r-sm).
   ===================================================================== */
:root {
  --graphite: #1C2126;
  --signal: #F26B1D;        /* только маркеры и линии, не текст */
  --signal-ink: #B84A0E;    /* оранжевый для текста и кнопок */
  --concrete: #C9C6BF;
  --concrete-l: #E9E6DF;
  --paper: #F6F4EF;
  --surface: #FFFFFF;
  --ink: #1C2126;
  --muted: #5B636B;
  --rule: #E7E4DD;
  --field: #F3F1EC;
  --sidebar: rgba(240, 237, 231, .82);
  --hover: rgba(28, 33, 38, .05);
  --sel: #1C2126;
  --sel-ink: #FFFFFF;
  --green: #1E7F4F; --green-bg: #E5F2EA;
  --blue: #2F5D8A;  --blue-bg: #E7EEF5;
  --amber: #8F5300; --amber-bg: #FBEFDC;
  --red: #B42318;   --red-bg: #FBE8E6;
  --gray: #5B636B;  --gray-bg: #ECEAE5;

  --r: 4px;
  --r-sm: 2px;
  --sh-1: 0 0 0 1px rgba(28, 33, 38, .06);
  --sh-2: 0 0 0 1px rgba(28, 33, 38, .04), 0 1px 2px rgba(28, 33, 38, .04), 0 10px 30px rgba(28, 33, 38, .06);
  --sh-3: 0 24px 60px rgba(28, 33, 38, .18);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Manrope", "Noto Sans Georgian", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121518;
    --surface: #1B1F23;
    --ink: #F1EFEA;
    --muted: #9EA5AC;
    --rule: #2A3036;
    --field: #23282D;
    --concrete: #4A525A;
    --concrete-l: #2A3036;
    --signal-ink: #F8935A;
    --sidebar: rgba(22, 25, 29, .82);
    --hover: rgba(255, 255, 255, .06);
    --sel: #F1EFEA;
    --sel-ink: #1C2126;
    --green: #6FCF9C; --green-bg: rgba(111, 207, 156, .12);
    --blue: #8DB6DE;  --blue-bg: rgba(141, 182, 222, .12);
    --amber: #F2B35E; --amber-bg: rgba(242, 179, 94, .12);
    --red: #F2867B;   --red-bg: rgba(242, 134, 123, .12);
    --gray: #A3AAB1;  --gray-bg: rgba(163, 170, 177, .12);
    --sh-1: 0 0 0 1px rgba(255, 255, 255, .06);
    --sh-2: 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 30px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
  .logo-light { display: none !important; }
}
@media (prefers-color-scheme: light) { .logo-dark { display: none !important; } }

/* ---------- основа ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 500 14px/1.5 var(--font); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--signal-ink); }
p a, dd a, .link { color: var(--signal-ink); font-weight: 600; }
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; }
::selection { background: rgba(242, 107, 29, .22); }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; white-space: nowrap; }
.pad { padding: 20px 22px; margin: 0; }
.pad-l { padding: 20px 22px; }
.pad-l p { margin: 0; }
.warn-text { color: var(--signal-ink); font-weight: 700; }
.show-sm { display: none; }
@media (max-width: 900px) { .show-sm { display: inline; } }
kbd { font: 600 11px var(--font); padding: 1px 6px; border-radius: var(--r-sm); background: var(--hover); color: var(--muted); border: 1px solid var(--rule); }
.ic { width: 18px; height: 18px; flex: none; }
.count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; vertical-align: middle; letter-spacing: 0; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; padding: 22px 12px 14px;
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; padding: 2px 10px 14px; }
.brand img { height: 26px; width: auto; display: block; }
.search {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; padding: 0 10px; height: 34px;
  background: var(--hover); border-radius: var(--r); color: var(--muted); transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.search:focus-within { background: var(--surface); box-shadow: 0 0 0 1px var(--signal), 0 0 0 4px rgba(242, 107, 29, .15); }
.search .ic { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: 500 14px var(--font); color: var(--ink); padding: 0; }
.search input::placeholder { color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { padding: 16px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: var(--r);
  color: var(--ink); font-weight: 600; transition: background .15s var(--ease);
}
.nav a .ic { color: var(--muted); transition: color .15s var(--ease); }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.active { background: var(--sel); color: var(--sel-ink); }
.nav a.active .ic { color: var(--signal); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0 10px; border-top: 1px solid var(--rule); }
.me-name { flex: 1; min-width: 0; font-weight: 700; font-size: 13px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name small { display: block; color: var(--muted); font-weight: 500; }
.me form { margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--r); background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.mobile-bar { display: none; }

.main { padding: 44px 52px 72px; max-width: 1400px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.page-title { min-width: 0; }
.page-title h1 { font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: -0.032em; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub::first-letter { text-transform: uppercase; }
.crumbs { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { width: 14px; height: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.actions form { margin: 0; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); color: var(--ink);
  font: 700 14px var(--font); letter-spacing: -0.01em; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 1px rgba(28, 33, 38, .03);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease), color .15s var(--ease);
}
.btn .ic { width: 17px; height: 17px; }
.btn:hover { background: var(--field); color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(242, 107, 29, .35); }
.btn.primary { background: var(--sel); border-color: var(--sel); color: var(--sel-ink); }
.btn.primary:hover { background: var(--sel); opacity: .88; color: var(--sel-ink); }
.btn.accent { background: var(--signal-ink); border-color: var(--signal-ink); color: #FFFFFF; }
@media (prefers-color-scheme: dark) { .btn.accent { color: #1C2126; } }
.btn.accent:hover { filter: brightness(.94); color: inherit; }
.btn.ghost-danger { color: var(--red); }
.btn.ghost-danger:hover { background: var(--red-bg); border-color: transparent; color: var(--red); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.lg { height: 46px; font-size: 15px; width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn[hidden] { display: none; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* ---------- карточки ---------- */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--sh-2); }
.section { margin-top: 36px; }
.section.first { margin-top: 0; }
.section h2, .card-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head .link { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; }
.section-head .link .ic { width: 15px; height: 15px; }

/* ---------- обзор ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px 20px; display: block; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-2), 0 16px 40px rgba(28, 33, 38, .08); color: inherit; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-l { font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r); background: var(--hover); }
.kpi-ic .ic { width: 18px; height: 18px; color: var(--ink); }
.kpi:first-child .kpi-ic .ic { color: var(--signal); }
.kpi-v { margin-top: 14px; font-size: 38px; line-height: 1; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.kpi-v small { font-size: 20px; color: var(--muted); font-weight: 700; letter-spacing: -0.02em; }
.kpi-s { margin-top: 10px; font-size: 13px; color: var(--muted); }
.dash { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px; }
.dash-card { padding: 18px 0 6px; min-height: 220px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 0 22px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li a { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 22px; border-top: 1px solid var(--rule); transition: background .15s var(--ease); }
.rows li a:hover { background: var(--hover); color: inherit; }
.row-main { min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { color: var(--muted); font-size: 12.5px; }
.calm { display: flex; gap: 14px; align-items: center; padding: 20px 22px; }
.calm .ic { width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--green-bg); color: var(--green); }
.calm b { display: block; }
.calm small { color: var(--muted); font-size: 13px; }
.cats { list-style: none; margin: 0; padding: 4px 22px 14px; display: grid; gap: 12px; }
.cats li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-weight: 600; }
.cats .bar { grid-column: 1 / -1; }

/* ---------- полоски и метки ---------- */
.bar { height: 6px; border-radius: 999px; background: var(--concrete-l); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--ink); transition: width .6s var(--ease); }
.bar.warn i { background: var(--signal); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; letter-spacing: 0; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { color: var(--green); background: var(--green-bg); }
.pill-blue { color: var(--blue); background: var(--blue-bg); }
.pill-amber { color: var(--amber); background: var(--amber-bg); }
.pill-red { color: var(--red); background: var(--red-bg); }
.pill-gray { color: var(--gray); background: var(--gray-bg); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 3px 10px; border-radius: 999px; background: var(--hover); font-size: 12.5px; font-weight: 600; }

/* ---------- панель инструментов ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-end { margin-left: auto; display: flex; gap: 8px; }
.search-field {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; min-width: 300px;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--sh-1); color: var(--muted);
  transition: box-shadow .2s var(--ease);
}
.search-field:focus-within { box-shadow: 0 0 0 1px var(--signal), 0 0 0 4px rgba(242, 107, 29, .15); }
.search-field input { flex: 1; border: 0; outline: 0; background: none; font: 500 14px var(--font); color: var(--ink); min-width: 0; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: calc(var(--r) + 2px); background: var(--hover); }
.segmented a { display: inline-flex; align-items: center; gap: 6px; height: 30px; white-space: nowrap; flex: none; padding: 0 12px; border-radius: var(--r); font-size: 13px; font-weight: 700; color: var(--muted); transition: background .15s var(--ease), color .15s var(--ease); }
.segmented a:hover { color: var(--ink); }
.segmented a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(28, 33, 38, .1), 0 0 0 1px rgba(28, 33, 38, .04); }
.segmented .n { font-size: 12px; opacity: .55; font-variant-numeric: tabular-nums; }

/* ---------- таблицы ---------- */
.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s var(--ease); }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover { background: var(--hover); }
.table th.num, .table th.right { text-align: right; }
.table td.right form { display: inline; margin: 0; }
.table thead:empty, .table th:empty { padding: 0; }
.w-check { width: 40px; padding-right: 0 !important; }
.w-seats { width: 190px; }
.cell-title { font-weight: 700; }
.cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.seats { display: grid; gap: 6px; }
.who { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
a.who:hover { color: var(--signal-ink); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--graphite); cursor: pointer; }
@media (prefers-color-scheme: dark) { input[type="checkbox"] { accent-color: var(--ink); } }

/* ---------- аватары ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--graphite); color: #FFFFFF; font-size: 12.5px; font-weight: 800; letter-spacing: .02em;
}
@media (prefers-color-scheme: dark) { .avatar { background: #343C44; } }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; }

/* ---------- карточка записи ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.facts-card { padding: 6px 22px; }
.facts { display: grid; grid-template-columns: 190px minmax(0, 1fr); margin: 0; }
.facts dt, .facts dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { font-weight: 600; overflow-wrap: anywhere; }
.facts dt:nth-last-of-type(1), .facts dd:last-of-type { border-bottom: 0; }
.side { display: grid; gap: 16px; }
.holder, .stat, .person { padding: 20px 22px; }
.holder-k, .stat-k { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.holder-k + * + .holder-k, .holder .tags { margin-top: 0; }
.holder-v { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 800; margin-bottom: 16px; }
.holder > :last-child { margin-bottom: 0; }
.stat-v { font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.stat-v span { font-size: 16px; font-weight: 700; color: var(--muted); letter-spacing: -0.01em; margin-left: 6px; }
.stat-s { margin-top: 10px; color: var(--muted); font-size: 13px; }
.person { text-align: center; }
.person-n { margin-top: 12px; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.person-s { margin-top: 4px; color: var(--muted); font-size: 13px; }
.secret { letter-spacing: .1em; }

/* ---------- журнал ---------- */
.timeline { list-style: none; margin: 0; padding: 4px 22px; }
.timeline li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.timeline li:last-child { border-bottom: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.dot-blue { background: var(--blue); } .dot-green { background: var(--green); } .dot-red { background: var(--red); }
.dot-signal { background: var(--signal); } .dot-gray { background: var(--concrete); }
.tl-main b { font-weight: 800; }
.tl-main a { color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--rule); }
.tl-main a:hover { color: var(--signal-ink); border-color: currentColor; }
.tl-note { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tl-meta { text-align: right; color: var(--muted); font-size: 12.5px; white-space: nowrap; line-height: 1.4; }
.tl-meta span { font-weight: 600; }

/* ---------- формы ---------- */
.form { padding: 26px 28px 22px; }
.form.narrow { max-width: 560px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.field > span b { color: var(--signal-ink); }
.field small { color: var(--muted); font-size: 12px; }
input, select, textarea {
  width: 100%; font: 500 15px var(--font); color: var(--ink); background: var(--field);
  border: 1px solid transparent; border-radius: var(--r); padding: 10px 12px; outline: none; min-height: 42px;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type="checkbox"] { min-height: 0; width: 16px; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B636B' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
input:hover, select:hover, textarea:hover { border-color: var(--rule); }
input:focus, select:focus, textarea:focus { background-color: var(--surface); border-color: var(--signal); box-shadow: 0 0 0 4px rgba(242, 107, 29, .15); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--rule); }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.inline-form select { min-width: 260px; height: 36px; min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; background-color: var(--surface); box-shadow: var(--sh-1); }
.stack { display: grid; gap: 16px; }
.ops { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.op { padding: 20px 22px; display: grid; gap: 12px; margin: 0; align-content: start; }
.op h3 { font-size: 16px; font-weight: 800; }
.op-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.op-row:has(> :only-child) { grid-template-columns: 110px; }
.op .btn { justify-self: start; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two .section { margin-top: 36px; }

/* ---------- уведомления ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); font-weight: 600; margin-bottom: 18px; }
.notice .ic { margin-top: 1px; }
.notice-red { background: var(--red-bg); color: var(--red); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100;
  display: flex; align-items: center; gap: 10px; padding: 12px 18px 12px 14px; border-radius: var(--r);
  background: var(--graphite); color: #FFFFFF; font-weight: 700; box-shadow: var(--sh-3);
  animation: toast-in .35s var(--ease) both;
}
.toast .ic { color: var(--signal); }
.toast.hide { animation: toast-out .3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- пустое состояние ---------- */
.empty { padding: 64px 24px; text-align: center; }
.empty-ic { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--hover); margin-bottom: 16px; }
.empty-ic .ic { width: 26px; height: 26px; color: var(--signal); }
.empty h3 { font-size: 20px; font-weight: 800; }
.empty p { color: var(--muted); max-width: 440px; margin: 8px auto 20px; }

/* ---------- вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-wrap { width: min(400px, 100%); text-align: center; }
.auth-logo { width: 220px; height: auto; }
.auth-tag { margin: 12px 0 28px; color: var(--muted); font-size: 15px; }
.auth-card { padding: 32px 28px 28px; text-align: left; box-shadow: var(--sh-2), 0 30px 80px rgba(28, 33, 38, .1); }
.auth-card h1 { font-size: 26px; font-weight: 800; margin-bottom: 18px; text-align: center; }
.auth-card > p { text-align: center; margin: -10px 0 18px; }
.auth-foot { margin-top: 24px; color: var(--muted); font-size: 12px; }

/* ---------- этикетки ---------- */
.labels { display: flex; flex-wrap: wrap; gap: 4mm; margin-top: 16px; }
.label {
  width: 62mm; height: 29mm; display: flex; gap: 3mm; padding: 2.5mm; overflow: hidden;
  background: #FFFFFF; color: #1C2126; border-radius: var(--r-sm); box-shadow: var(--sh-1);
}
.label .qr { width: 24mm; height: 24mm; flex: none; }
.label .qr svg { width: 100%; height: 100%; display: block; }
.label-t { display: flex; flex-direction: column; min-width: 0; gap: 1mm; }
.label-t img { height: 3.6mm; width: auto; align-self: flex-start; margin-bottom: 1mm; }
.label-t b { font-size: 12pt; font-weight: 800; letter-spacing: -0.01em; }
.label-t span { font-size: 7.5pt; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.label-t small { font-size: 6.5pt; color: #5B636B; margin-top: auto; }
@media print {
  @page { margin: 8mm; }
  body { background: #FFFFFF; }
  .sidebar, .mobile-bar, .page-head, .no-print, .toast { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .labels { margin: 0; gap: 3mm; }
  .label { box-shadow: none; outline: 0.2mm dashed #C9C6BF; break-inside: avoid; }
  .label-t img.logo-light { display: block !important; }
}

/* ---------- адаптивность ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash, .detail, .two, .ops { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none !important; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--sh-3); }
  .sidebar.open { transform: none; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50;
    padding: 10px 16px; background: var(--sidebar); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
    border-bottom: 1px solid var(--rule);
  }
  .mobile-bar .brand { padding: 0; }
  .mobile-bar .brand img { height: 22px; }
  .mobile-bar > span { width: 32px; }
  .main { padding: 22px 16px 56px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
  .page-title h1 { font-size: 28px; }
  .actions { justify-content: flex-start; }
  .search-field { min-width: 0; width: 100%; }
  .toolbar-end { margin-left: 0; }
  .segmented { max-width: 100%; overflow-x: auto; }
  .form { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .facts dt { padding-bottom: 0; border-bottom: 0; font-size: 12.5px; }
  .facts dd { padding-top: 2px; }
  .inline-form { flex-direction: column; align-items: stretch; width: 100%; }
  .inline-form select { min-width: 0; }
  .timeline li { grid-template-columns: 10px 1fr; }
  .tl-meta { grid-column: 2; text-align: left; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
}

/* ================= Заявки и кабинет сотрудника ================= */
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--signal); color: #FFFFFF; font: 800 11px/20px var(--font); font-style: normal; text-align: center;
}
.nav a.active .nav-badge { background: var(--signal); color: #FFFFFF; }
.portal-tag { margin: -6px 10px 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* переписка */
.thread { display: grid; gap: 12px; }
.msg { background: var(--surface); border-radius: var(--r); box-shadow: var(--sh-2); padding: 14px 18px; max-width: 92%; }
.msg.it { justify-self: end; background: var(--field); box-shadow: var(--sh-1); }
.msg.mine { border-left: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.msg-head b { color: var(--ink); font-size: 13.5px; }
.msg-head span:last-child { margin-left: auto; white-space: nowrap; }
.msg-role { padding: 1px 7px; border-radius: 999px; background: var(--sel); color: var(--sel-ink); font-size: 10.5px; font-weight: 800; letter-spacing: .04em; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.55; }
.msg-status { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.reply { margin-top: 16px; padding: 14px; display: grid; gap: 10px; }
.reply textarea { min-height: 84px; }
.reply-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.inline-label select { width: auto; min-height: 36px; height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; }
.btn.wide { width: 100%; }
.side form { margin: 0; }

/* выбор типа заявки */
.form.narrow-l { max-width: 820px; }
.type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.type-opt { cursor: pointer; }
.type-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-opt span {
  display: flex; align-items: center; gap: 10px; height: 100%; padding: 14px 14px; border-radius: var(--r);
  background: var(--field); font-weight: 700; font-size: 13.5px; line-height: 1.3; border: 1px solid transparent;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.type-opt span .ic { color: var(--muted); }
.type-opt:hover span { border-color: var(--rule); }
.type-opt input:checked + span { background: var(--surface); border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.type-opt input:checked + span .ic { color: var(--signal); }
.type-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(242, 107, 29, .35); }

/* техника в кабинете */
.gear { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.gear-card { padding: 18px 20px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: start; }
.gear-ic { grid-row: span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r); background: var(--hover); }
.gear-ic .ic { width: 22px; height: 22px; color: var(--signal); }
.gear-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gear-t b { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.gear-t small { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gear-card .btn { grid-column: 2; justify-self: start; margin-top: 8px; }
.rows.plain li { padding: 11px 22px; border-top: 1px solid var(--rule); }
.rows.plain li:first-child { border-top: 0; }
.small-note { margin-top: 24px; font-size: 13px; }

/* доступ к кабинету */
.access { padding: 18px 20px; display: grid; gap: 12px; }
.access .holder-k { margin: 0; }
.access-note { margin: 0; font-size: 13px; }
.access-on { display: flex; gap: 10px; align-items: center; }
.access-on .ic { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--green-bg); color: var(--green); }
.access-on b { display: block; }
.access-on small { color: var(--muted); font-size: 12.5px; }
.stack-sm { display: grid; gap: 8px; margin: 0; }
.stack-sm input { min-height: 38px; padding: 8px 12px; font-size: 14px; }
.stack-sm .btn { justify-self: start; }

@media (max-width: 900px) {
  .type-grid { grid-template-columns: 1fr 1fr; }
  .msg { max-width: 100%; }
}

/* ================= Руководитель: только просмотр ================= */
.ro form[method="post"]:not(.ro-ok),
.ro a[href$="/new"],
.ro a[href$="/edit"],
.ro a[href*="/edit#"],
.ro a[href$="/checkout"],
.ro .access,
.ro .ro-hide { display: none !important; }
.msg.mgr { background: var(--surface); box-shadow: var(--sh-2), inset 3px 0 0 var(--signal); }
.msg.mgr .msg-role { background: var(--signal-ink); color: #FFFFFF; }
.ro-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 18px; border-radius: var(--r); background: var(--hover); color: var(--muted); font-size: 13px; font-weight: 600; }

/* разделитель внутри формы */
.form-section {
  grid-column: 1 / -1; margin-top: 10px; padding-top: 20px; border-top: 1px solid var(--rule);
  font-size: 17px; font-weight: 800; letter-spacing: -0.02em; scroll-margin-top: 24px;
}
.form-section small { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.access .btn { justify-self: start; }
