/* © 2026 DEVS.EXPERT. All rights reserved. */
/* IL-Accounting — интерфейс. Палитра «бухгалтерская книга»: чернила, бумага, зелёная линовка. Статусы — разные цвета, не оттенки. */
:root {
  --ink: #17233B;        /* текст, боковая панель */
  --ink-2: #2A3A5C;      /* активный пункт меню */
  --paper: #F3F5F2;      /* фон рабочей области */
  --surface: #FFFFFF;    /* формы и таблицы */
  --rule: #D8DDD6;       /* линии таблиц */
  --muted: #5B6472;      /* подписи */
  --primary: #0E6E64;    /* действия, «зелёная линовка» */
  --primary-ink: #FFFFFF;
  --ok: #1E8449;         /* выписан, сходится */
  --warn: #B9770E;       /* ждёт, проверить */
  --bad: #B03A2E;        /* ошибка, отрицательные суммы */
  --info: #2563A8;       /* сведения, расходы на графике */
  --side: #17233B;       /* боковая панель и логотип — тёмные в обеих темах */
  --hover: #F7F9F6;
  --radius-s: 4px;
  --radius-m: 8px;
  font-family: "IBM Plex Sans Hebrew", "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.num, .amount { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.neg { color: var(--bad); }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 56px 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--rule); }
/* логотип <DEVS.EXPERT/>: белые прописные на тёмном, синие угловые скобки; блок продолжает тёмную боковую панель */
.brand { text-decoration: none; align-self: stretch; display: flex; align-items: center; width: 232px; margin-inline-start: -20px; padding: 0 18px; background: var(--side); }
.logo { direction: ltr; unicode-bidi: isolate; font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif; font-weight: 700; font-size: 19px; letter-spacing: 1.2px; color: #FFFFFF; white-space: nowrap; }
.logo b { color: #2F72D6; font-weight: 700; }
.login .logo { display: inline-block; background: var(--side); padding: 8px 14px; border-radius: var(--radius-s); margin-bottom: 18px; }
.org-switch { display: flex; align-items: center; gap: 8px; }
.org-switch select { max-width: 340px; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 6px 8px; background: var(--surface); font-weight: 600; }
.demo-tag { font-size: 12px; color: var(--warn); border: 1px solid var(--warn); border-radius: 999px; padding: 1px 8px; }
.topbar .spacer { flex: 1; }
.topbar select.lang { border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 6px; background: var(--surface); }

.sidebar { background: var(--side); color: #DCE3EF; padding: 14px 10px; overflow-y: auto; }
.nav-group { margin-bottom: 14px; }
.nav-title { font-size: 12px; color: #93A1B8; padding: 4px 10px; }
.nav a { display: block; padding: 8px 10px; border-radius: var(--radius-s); color: inherit; text-decoration: none; }
.nav a:hover { background: var(--ink-2); }
.nav a.active { background: var(--ink-2); color: #fff; box-shadow: inset 3px 0 0 #3FB59F; }
[dir="rtl"] .nav a.active { box-shadow: inset -3px 0 0 #3FB59F; }

.main { padding: 22px 28px 48px; overflow-x: auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- элементы ---------- */
.btn { text-decoration: none; display: inline-block; color: var(--ink); border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius-s); padding: 7px 14px; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.link { border: 0; background: none; color: var(--info); padding: 0; text-decoration: underline; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: default; }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 16px 18px; margin-bottom: 18px; }
.panel h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.grid-2 > .panel { margin-bottom: 0; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.field > span { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 7px 9px; background: var(--surface); min-height: 38px; }
.field textarea { min-height: 120px; resize: vertical; }
.field.wide { flex: 1 1 260px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 38px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }

table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th { text-align: start; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid var(--ink); padding: 8px 10px; white-space: nowrap; }
table.data td { border-bottom: 1px solid var(--rule); padding: 8px 10px; vertical-align: top; }
table.data td.amount, table.data th.amount { text-align: end; }
table.data tbody tr:hover { background: var(--hover); }
table.data tr.clickable { cursor: pointer; }
/* таблица «показатель — значение»: подписи слева без шапочной черты */
table.data tbody th { color: var(--muted); font-weight: 400; border-bottom: 1px solid var(--rule); white-space: normal; width: 55%; }
/* итог по-бухгалтерски: двойная черта под суммой */
table.data tfoot td { font-weight: 700; border-bottom: 3px double var(--ink); border-top: 1px solid var(--ink); }
.empty { color: var(--muted); padding: 24px 4px; }

.badge { display: inline-block; font-size: 12px; border-radius: 999px; padding: 1px 9px; border: 1px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); } .badge.info { color: var(--info); }

.msg { margin-top: 10px; min-height: 22px; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--bad); }
.toast { position: fixed; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--side); color: #fff; padding: 10px 18px; border-radius: var(--radius-m); z-index: 50; }
[dir="rtl"] .toast { transform: translateX(50%); }
.toast.err { background: var(--bad); }

/* ---------- главная ---------- */
.ledger-strip { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); margin-bottom: 18px; }
.ledger-strip > div { padding: 16px 18px; border-inline-start: 1px solid var(--rule); }
.ledger-strip > div:first-child { border-inline-start: 0; }
.ledger-strip .label { font-size: 13px; color: var(--muted); }
.ledger-strip .value { font-size: 26px; font-weight: 600; margin-top: 4px; }
.ledger-strip .value::after { content: ""; display: block; width: 56px; border-bottom: 3px double var(--ink); margin-top: 6px; }
.ledger-strip .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.deadlines { list-style: none; margin: 0; padding: 0; }
.deadlines li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.deadlines li:last-child { border-bottom: 0; }
.deadlines .date { min-width: 92px; font-weight: 600; }
.chart { width: 100%; height: 220px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-inline-end: 6px; vertical-align: -1px; }

/* ---------- форма документа ---------- */
.doc-types { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-types button { border: 1px solid var(--rule); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.doc-types button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.lines td input { width: 100%; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 6px 8px; }
.lines td.qty { width: 90px; } .lines td.price, .lines td.sum { width: 150px; } .lines td.x { width: 36px; }
.totals { margin-top: 14px; margin-inline-start: auto; width: min(340px, 100%); }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { font-weight: 700; font-size: 18px; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); margin-top: 4px; }

/* ---------- вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 28px; width: min(420px, 100%); }
.login h1 { margin: 0 0 6px; font-size: 22px; }
.login p { color: var(--muted); margin: 0 0 18px; }

/* ---------- помощник ---------- */
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(420px, 100%); background: var(--surface); border-inline-start: 1px solid var(--rule); display: flex; flex-direction: column; z-index: 40; box-shadow: 0 0 0 100vmax rgba(23, 35, 59, .18); }
.drawer header { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--rule); font-weight: 600; }
.drawer header .spacer { flex: 1; }
.drawer .log { flex: 1; overflow-y: auto; padding: 14px 16px; }
.drawer .q { font-weight: 600; margin-top: 12px; }
.drawer .a { white-space: pre-wrap; margin-top: 4px; }
.drawer form { border-top: 1px solid var(--rule); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.drawer textarea { border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 8px; min-height: 70px; }

/* ---------- справка ---------- */
.help details { border-bottom: 1px solid var(--rule); padding: 8px 0; }
.help summary { cursor: pointer; font-weight: 600; }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0; }
.help dt { font-weight: 600; }
.help dd { margin: 0; }
.steps { padding-inline-start: 20px; }
.steps li { margin-bottom: 6px; }

pre.file { direction: ltr; text-align: left; background: var(--hover); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 10px; overflow-x: auto; max-height: 360px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .sidebar { display: flex; overflow-x: auto; padding: 6px; }
  .nav-group { display: flex; margin: 0; }
  .nav-title { display: none; }
  .nav a { white-space: nowrap; }
  .grid-2 { grid-template-columns: 1fr; }
  .ledger-strip { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 16px; }
  .brand { width: auto; margin-inline-start: -20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#page:focus { outline: none; }

/* ---------- тёмная тема ---------- */
[data-theme="dark"] { color-scheme: dark; --ink: #E6EAF2; --ink-2: #22304D; --paper: #121929; --surface: #1B2437; --rule: #303B54; --muted: #9AA6BA;
  --primary: #1C9A8B; --ok: #4CC38A; --warn: #E0A53A; --bad: #F0796B; --info: #6AA8F0; --side: #0C1322; --hover: #222D45; }
[data-theme="dark"] .doc-types button { color: var(--ink); }
.copyright { font-size: 11px; color: #93A1B8; padding: 14px 10px 4px; line-height: 1.5; }
.login .copyright { color: var(--muted); padding: 14px 0 0; }
@media (max-width: 900px) { .sidebar .copyright { display: none; } }
.lines td select { width: 100%; border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 6px 8px; background: var(--surface); color: var(--ink); }
.panel a { color: var(--info); }
.btn.link.danger { color: var(--bad); font-weight: 600; }
@media print { .topbar, .sidebar, .filters, .btn, .toast, .assistant-fab { display: none !important; } .app { display: block; } .panel { border: 0; box-shadow: none; padding: 0; } body { background: #fff; } }
td.acts { white-space: nowrap; } tr.send-row td { background: var(--hover); }
