:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #6b7280;
  --accent: #175cd3;
  --line: #dce2ea;
  --ok: #067647;
  --warn: #b54708;
  --danger: #b42318;
}
* { box-sizing: border-box; }
/* Любое авторское правило display перебивает [hidden] браузера, поэтому скрытие задаём явно */
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
button,input { font: inherit; }
button { border: 0; border-radius: 9px; padding: 10px 14px; color: white; background: var(--accent); cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
label { display: grid; gap: 6px; color: #344054; font-size: 13px; }
input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: white; }
h1,h2,h3,p { margin-top: 0; }
.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: 0 10px 30px rgba(16,24,40,.06); }
.login-card { width: min(390px,100%); display: grid; gap: 14px; }
.brand { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.muted { color: var(--muted); }
.error { min-height: 20px; color: var(--danger); font-size: 13px; }
#appView { min-height: 100vh; grid-template-columns: 230px 1fr; }
#appView:not([hidden]) { display: grid; }
aside { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 24px 16px; color: white; background: #101828; }
aside h2 { margin-bottom: 24px; }
nav { display: grid; gap: 6px; }
nav button,.ghost { text-align: left; color: #d0d5dd; background: transparent; }
nav button:hover,.nav-active { color: white !important; background: #344054 !important; }
#logoutBtn { margin-top: auto; }
main { min-width: 0; padding: 28px; }
header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(270px,1fr)); gap: 16px; }
.integration-card { display: grid; align-content: start; gap: 12px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tag { border-radius: 999px; padding: 4px 9px; color: var(--muted); background: #f2f4f7; font-size: 12px; }
.tag.ok { color: var(--ok); background: #ecfdf3; }
.tag.warn { color: var(--warn); background: #fff6ed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .secondary { color: var(--accent); background: #eff4ff; }
.actions .danger { color: var(--danger); background: #fef3f2; }
.placeholder { min-height: 180px; display: grid; place-items: center; text-align: center; }
.stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
table { width: 100%; border-collapse: collapse; }
th,td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
select,textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: white; font: inherit; }
textarea { min-height: 80px; resize: vertical; }
.suggestions { display: grid; gap: 6px; }
.suggestion { text-align: left; color: var(--ink); background: #f8fafc; border: 1px solid var(--line); }
.invoice-line { display: grid; grid-template-columns: 1.5fr 2fr .7fr .7fr 1fr auto; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.deal-results { display: flex; flex-wrap: wrap; gap: 8px; }
.deal-results button { width: auto; }
.kpi { min-height: 110px; }
.kpi strong { display: block; margin-top: 10px; font-size: 26px; }
.danger-text { color: var(--danger); }
.chart-list { display: grid; gap: 8px; }
.chart-row { display: grid; grid-template-columns: 84px 1fr 110px; gap: 10px; align-items: center; }
progress { width: 100%; accent-color: var(--accent); }
.bank-actions { min-width: 310px; }
#documentList td { min-width: 110px; }
#documentList td:nth-child(2),#documentList td:nth-child(3) { min-width: 180px; }
dialog { width: min(440px,calc(100% - 32px)); border: 0; padding: 0; background: transparent; }
.wide-dialog { width: min(760px,calc(100% - 32px)); }
dialog::backdrop { background: rgba(16,24,40,.65); }
dialog form { display: grid; gap: 14px; }
.ghost-dialog { color: var(--accent); background: #eff4ff; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; }
.preview-grid div { display: grid; gap: 4px; }
.compact-card { padding: 14px; box-shadow: none; }
.compact-card p { margin: 6px 0 0; }
.warning,.notice { border-radius: 10px; padding: 12px; color: var(--warn); background: #fff6ed; border: 1px solid #fedf89; }
.notice { color: #344054; background: #f8fafc; border-color: var(--line); }
.approval-check { grid-template-columns: auto 1fr; align-items: start; font-size: 14px; }
.approval-check input { width: auto; margin-top: 3px; }
#toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; border-radius: 10px; padding: 12px 15px; color: white; background: #101828; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }
@media (max-width: 760px) {
  #appView:not([hidden]) { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  nav { grid-template-columns: 1fr 1fr; }
  #logoutBtn { margin-top: 8px; }
  main { padding: 18px; }
  .invoice-line { grid-template-columns: 1fr 1fr; }
}
