/* Учёт ИТ-активов: светлая и тёмная темы на CSS-переменных */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dcdfe5; --text: #1c2230; --muted: #667085;
  --accent: #2456d6; --accent-text: #ffffff; --accent-soft: #e6edff; --danger: #c62f3b; --danger-soft: #fdecee;
  --ok: #1d7f4f; --ok-soft: #e3f5ea; --warn: #9a6200; --warn-soft: #fff3d6; --violet: #6b3fc4; --violet-soft: #efe8fc;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06); --radius: 8px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12151b; --surface: #1b1f27; --surface-2: #232833; --border: #323848; --text: #e6e9ef; --muted: #98a2b3;
  --accent: #7ba1ff; --accent-text: #0d1220; --accent-soft: #1f2b4d; --danger: #ff8189; --danger-soft: #3b1d22;
  --ok: #5fd39a; --ok-soft: #173326; --warn: #f0b849; --warn-soft: #3a2d10; --violet: #b79bf5; --violet-soft: #2a2145;
  --shadow: none; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #12151b; --surface: #1b1f27; --surface-2: #232833; --border: #323848; --text: #e6e9ef; --muted: #98a2b3;
    --accent: #7ba1ff; --accent-text: #0d1220; --accent-soft: #1f2b4d; --danger: #ff8189; --danger-soft: #3b1d22;
    --ok: #5fd39a; --ok-soft: #173326; --warn: #f0b849; --warn-soft: #3a2d10; --violet: #b79bf5; --violet-soft: #2a2145;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .75rem; font-weight: 650; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
.muted { color: var(--muted); } .small { font-size: .87rem; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .93em; }

/* каркас */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: .9rem .6rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-weight: 700; padding: .2rem .6rem .8rem; display: block; color: var(--text); }
.nav a { display: block; padding: .42rem .6rem; border-radius: 6px; color: var(--text); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .group { margin: .9rem .6rem .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.main { min-width: 0; }
.topbar { display: flex; gap: .6rem; align-items: center; padding: .6rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar form.search { flex: 1; max-width: 560px; display: flex; gap: .4rem; }
.topbar .spacer { flex: 1; }
.btn.menu-toggle { display: none; }
.content { padding: 1.2rem; max-width: 1500px; }
.crumbs { font-size: .87rem; color: var(--muted); margin-bottom: .5rem; }
.head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .9rem; }
.head h1 { margin: 0; } .head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; }

/* элементы */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; } .grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; color: var(--text); display: block; }
.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat b { display: block; font-size: 1.45rem; line-height: 1.25; white-space: nowrap; } .stat span { color: var(--muted); font-size: .87rem; }
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .42rem .8rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: .22rem .55rem; font-size: .87rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .42rem .55rem; max-width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 1.05rem; height: 1.05rem; padding: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; }
.badge { display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--ok-soft); color: var(--ok); } .badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-amber { background: var(--warn-soft); color: var(--warn); } .badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-violet { background: var(--violet-soft); color: var(--violet); } .badge-gray { background: var(--surface-2); color: var(--muted); }

/* таблицы */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.table th a { color: inherit; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .check { width: 1%; }
.pager { display: flex; gap: .5rem; align-items: center; margin: .8rem 0; color: var(--muted); }

/* формы */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: .8rem; }
.filters label { display: grid; gap: .15rem; font-size: .8rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem 1rem; }
.field { display: grid; gap: .2rem; align-content: start; }
.field > label { font-size: .87rem; font-weight: 600; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; }
.field.wide { grid-column: 1 / -1; }
.field.check { display: flex; gap: .5rem; align-items: center; align-self: end; padding-bottom: .4rem; }
.field .help { font-size: .8rem; color: var(--muted); }
.field .errorlist, .errorlist { color: var(--danger); margin: 0; padding: 0; list-style: none; font-size: .87rem; }
.field .req { color: var(--danger); }
.select-filter { margin-bottom: .2rem; font-size: .87rem; padding: .25rem .5rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem 1rem; margin: 0 0 1rem; background: var(--surface); }
legend { font-weight: 650; padding: 0 .4rem; }
.form-actions { display: flex; gap: .5rem; margin-top: 1rem; }

/* сообщения */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.messages li, .alert { padding: .6rem .9rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.messages .success { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.messages .error, .alert.error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.messages .warning, .alert.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert.info { background: var(--accent-soft); border-color: transparent; }

/* карточка актива */
.props { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: .35rem .8rem; margin: 0; }
.props dt { color: var(--muted); } .props dd { margin: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .5rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-color: var(--accent); font-weight: 600; text-decoration: none; }
.tab-pane { display: none; } .tab-pane.active { display: block; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 1rem .9rem; }
.timeline li::before { content: ""; position: absolute; left: -1.42rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.timeline li.reversed > .ev-title { text-decoration: line-through; color: var(--muted); }
.timeline li.reversed::before, .timeline li.storno::before { background: var(--muted); }
.timeline .ev-title { font-weight: 600; } .timeline .ev-meta { color: var(--muted); font-size: .87rem; }
.qr svg { width: 120px; height: 120px; background: #fff; border-radius: 6px; padding: 4px; }
.thumbs { display: flex; flex-wrap: wrap; gap: .6rem; }
.thumb { width: 150px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); font-size: .8rem; }
.thumb img { width: 100%; height: 110px; object-fit: cover; display: block; } .thumb div { padding: .3rem .4rem; overflow-wrap: anywhere; }
.bulkbar { position: sticky; bottom: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .7rem; display: none; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; box-shadow: 0 -2px 10px rgba(0, 0, 0, .12); }
.bulkbar.show { display: flex; }
.tree-indent { display: inline-block; }

/* вход */
.auth { max-width: 380px; margin: 9vh auto; padding: 0 1rem; }

/* этикетки */
.labels { display: grid; gap: 3mm; }
.label { border: 1px dashed var(--border); border-radius: 2mm; padding: 2mm; display: flex; gap: 2mm; align-items: center; break-inside: avoid; background: #fff; color: #000; }
.label .qr svg { width: 24mm; height: 24mm; padding: 0; }
.label .txt { min-width: 0; font-size: 8pt; line-height: 1.25; }
.label .num { font-weight: 700; font-size: 10pt; } .label .bar svg { height: 9mm; max-width: 100%; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 20; transform: translateX(-105%); transition: transform .15s; height: auto; }
  body.menu-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .btn.menu-toggle { display: inline-flex; }
  .content { padding: .8rem; } .topbar { padding: .5rem .8rem; }
  .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
}
@media print {
  .sidebar, .topbar, .no-print, .messages { display: none !important; }
  .layout { display: block; } .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card, .table-wrap { border: 0; box-shadow: none; }
  .label { border: 0; }
}
