/* Финансы Nino Nana — светлая тема, как на data.ninonana.com: белые карточки на сером поле, KPI-плитки. */

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f2f4f7; color: #1c2430;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.muted { color: #6b7686; font-size: 12.5px; }
.good { color: #178a4c; }
.bad { color: #c0392b; }

/* ---------- шапка ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: #fff; border-bottom: 1px solid #e4e8ee;
  padding: 0 20px; height: 52px;
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand span { color: #6b7686; font-weight: 500; }
.topbar nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.topbar nav a { padding: 15px 12px; color: #4a5568; border-bottom: 2px solid transparent; white-space: nowrap; }
.topbar nav a:hover { color: #1c2430; }
.topbar nav a[aria-current="page"] { color: #1c2430; font-weight: 600; border-bottom-color: #ee7144; }
.topbar-right { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.asof { color: #6b7686; font-size: 12.5px; }
.logout { border: 0; background: none; color: #6b7686; font-size: 13px; }
.logout:hover { color: #c0392b; }

.page { padding: 16px 24px 48px; max-width: 1760px; margin: 0 auto; }

/* ---------- фильтры ---------- */
.filterbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 14px; }
.filterbar .spacer { flex: 1; }
.flabel { color: #6b7686; font-size: 12.5px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pills button {
  padding: 5px 14px; border-radius: 99px; background: #fff;
  border: 1px solid #dbe1e9; color: #4a5568; font-size: 13px;
}
.pills button:hover { border-color: #9fb2c8; }
.pills button[aria-pressed="true"] { background: #1c2430; border-color: #1c2430; color: #fff; }
.switcher { display: flex; gap: 4px; flex-wrap: wrap; }
.switcher button {
  border: 1px solid #dbe1e9; background: #fff; color: #4a5568;
  padding: 4px 12px; border-radius: 7px; font-size: 12.5px;
}
.switcher button:hover { border-color: #9fb2c8; }
.switcher button[aria-pressed="true"] { background: #1c2430; border-color: #1c2430; color: #fff; }

/* ---------- плитки и карточки ---------- */
.kpi-row { display: grid; gap: 12px; margin-bottom: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpi { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(16, 30, 54, .06); }
.kpi-label { color: #6b7686; font-size: 12.5px; margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12.5px; font-weight: 500; color: #6b7686; letter-spacing: 0; }
.kpi-delta { font-size: 12.5px; margin-top: 5px; color: #6b7686; }

.verdict {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; font-size: 14px;
  background: #e3f5ea; color: #14633a;
}
.verdict b { font-size: 15px; }
.verdict.bad { background: #fde3e1; color: #a02a1e; }
.verdict.warn { background: #fff3d6; color: #8a5a12; }

.card {
  background: #fff; border-radius: 12px; padding: 16px 18px 14px;
  box-shadow: 0 1px 2px rgba(16, 30, 54, .06); margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-head h2 span { color: #6b7686; font-weight: 500; }
.card-note { color: #6b7686; font-size: 12.5px; line-height: 1.5; margin-top: 10px; max-width: 1100px; }

/* ---------- графики ---------- */
.chart-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart-grid .card { margin-bottom: 16px; }
@media (max-width: 1200px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; }
.chart .grid { stroke: #eef1f5; stroke-width: 1; }
.chart .zero { stroke: #98a3b3; stroke-width: 1; }
.chart .axis { fill: #98a3b3; font-size: 10.5px; }
.chart .line-fact { fill: none; stroke: #1c2430; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-plan { fill: none; stroke: #2f7cf6; stroke-width: 2; stroke-dasharray: 5 4; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt-fact { fill: #1c2430; }
.chart .pt-plan { fill: #fff; stroke: #2f7cf6; stroke-width: 1.6; }
.chart .gap-zone { fill: #c0392b; opacity: .07; }
.chart .bar-plan { fill: #b9d3fb; }
.chart .bar-fact { fill: #1c2430; }
.chart .bar-good { fill: #2fa866; }
.chart .bar-bad { fill: #d9574a; }
.chart .hover-col { fill: #1c2430; opacity: 0; }
.chart .hover-col:hover { opacity: .05; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: #4a5568; font-size: 12.5px; }
.legend i { display: inline-block; margin-right: 6px; }
.legend .dot { width: 9px; height: 9px; border-radius: 2px; }
.legend .dot.plan { background: #b9d3fb; }
.legend .dot.fact { background: #1c2430; }
.legend .dot.good { background: #2fa866; }
.legend .dot.bad { background: #d9574a; }
.legend .dot-line { width: 16px; height: 0; vertical-align: 4px; border-top: 2px solid #1c2430; }
.legend .dot-line.plan { border-top: 2px dashed #2f7cf6; }
.chart-tip {
  position: fixed; background: #1c2430; color: #f2f4f7;
  padding: 8px 11px; border-radius: 8px; font-size: 12.5px;
  pointer-events: none; z-index: 60; max-width: 260px; line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.chart-tip b { display: block; margin-bottom: 2px; }
.chart-tip .tip-line { border-top: 1px solid #3c4a5e; margin-top: 4px; padding-top: 4px; }

/* ---------- таблицы ---------- */
.tablewrap { overflow-x: auto; }
.scrollbar-top { overflow-x: auto; overflow-y: hidden; height: 12px; }
.scrollbar-top > div { height: 1px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid #eef1f5; white-space: nowrap; }
th { color: #6b7686; font-weight: 600; font-size: 12px; background: #fff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: #f7f9fb; }
td small { color: #98a3b3; }

/* широкие отчётные таблицы: первая колонка закреплена, периоды читаются блоками */
table.wide { width: auto; min-width: 100%; }
table.wide thead tr:first-child th:first-child, table.wide td:first-child {
  position: sticky; left: 0; z-index: 2; background: #fff;
  min-width: 250px; max-width: 340px; overflow: hidden; text-overflow: ellipsis;
  border-right: 1px solid #e4e8ee;
}
table.wide thead th { text-align: right; }
table.wide thead tr:first-child th:first-child { z-index: 4; text-align: left; }
table.wide thead th.period { text-align: center; font-size: 12.5px; color: #1c2430; border-left: 2px solid #dbe1e9; }
table.wide thead th.period small { display: block; font-weight: 400; font-size: 10.5px; color: #98a3b3; }
table.wide thead th.sub { font-weight: 500; font-size: 11px; padding-top: 3px; padding-bottom: 5px; }
table.wide .pstart { border-left: 2px solid #dbe1e9; }
table.wide td.alt, table.wide th.alt { background: #f8fafd; }
table.wide td.planv { color: #6b7686; }
table.wide td.factv { color: #1c2430; font-weight: 500; }
table.wide td.future, table.wide th.future { color: #98a3b3; }
table.wide th.now { color: #b45309; }
table.wide td.tot, table.wide th.tot { font-weight: 600; background: #f7f9fc; border-left: 1px solid #e4e8ee; }
table.wide td.worse { background: #fdf1f0; color: #c0392b; font-weight: 600; }
table.wide td.neg { color: #c0392b; font-weight: 600; }

tr.row-head td { background: #f7f9fc; font-weight: 600; }
tr.row-head td:first-child { background: #f7f9fc; }
tr.row-head td.alt { background: #f1f5fa; }
tr.row-total td { background: #eef3fb; font-weight: 700; border-top: 2px solid #c8d5ea; }
tr.row-total td:first-child { background: #eef3fb; }
tr.row-total td.alt { background: #e8effa; }
td.sub1 { padding-left: 24px !important; color: #2c3a4e; }
td.sub2 { padding-left: 42px !important; color: #6b7686; }
tr.deep td { color: #6b7686; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td:first-child { color: #2f7cf6; }
.caret { display: inline-block; width: 14px; color: #98a3b3; }
table.wide tbody tr:hover td { background: #f3f6fa; }
table.wide tbody tr:hover td.worse { background: #fbe5e3; }

/* ---------- значки ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.new { background: #e3f5ea; color: #178a4c; }
.badge.dup { background: #eef1f5; color: #6b7686; }
.badge.similar { background: #fff3d6; color: #b7791f; }
.badge.none { background: #fde3e1; color: #c0392b; }

/* ---------- сообщения и кнопки ---------- */
.msg { border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 10px 0; background: #eef1f5; color: #4a5568; }
.msg.err { background: #fdf1f0; color: #c0392b; }
.msg.ok { background: #e3f5ea; color: #14633a; }
.btn {
  padding: 8px 16px; border: 0; border-radius: 8px; background: #1c2430; color: #fff;
  font-size: 13.5px; font-weight: 600;
}
.btn:hover { background: #2c3a4e; }
.btn[disabled] { background: #b8c0cc; cursor: default; }
.btn.ghost { background: #fff; color: #4a5568; border: 1px solid #dbe1e9; font-weight: 500; }
.btn.ghost:hover { border-color: #9fb2c8; background: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger:hover { color: #c0392b; border-color: #e3b2ac; }

/* ---------- загрузка выписок ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  border: 2px dashed #c9d1dc; border-radius: 12px; padding: 30px 20px; cursor: pointer; color: #4a5568;
  background: #fafbfd;
}
.dropzone b { font-size: 15px; color: #1c2430; }
.dropzone span { font-size: 12.5px; color: #6b7686; max-width: 640px; }
.dropzone:hover, .dropzone.over { border-color: #ee7144; background: #fff8f4; }
.file-stats { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 13px; color: #4a5568; margin-bottom: 10px; }
.file-stats b { color: #1c2430; font-variant-numeric: tabular-nums; }
.file-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.file-actions label { font-size: 13px; color: #4a5568; display: flex; gap: 6px; align-items: center; }
table.txs td { white-space: normal; vertical-align: top; }
table.txs td.nw { white-space: nowrap; }
table.txs td.desc { max-width: 460px; color: #4a5568; font-size: 12.5px; overflow-wrap: anywhere; }
table.txs td.cp { max-width: 220px; overflow-wrap: anywhere; }
table.txs tr.is-dup td { color: #98a3b3; }
table.txs select, table.txs input {
  font: inherit; font-size: 12.5px; padding: 3px 6px; border: 1px solid #dbe1e9; border-radius: 6px; background: #fff;
  color: #1c2430; max-width: 170px;
}
table.txs select.empty { border-color: #e3b2ac; background: #fff8f7; }
.tx-scroll { max-height: 520px; overflow: auto; border: 1px solid #eef1f5; border-radius: 8px; }
.tx-scroll thead th { position: sticky; top: 0; z-index: 2; }

/* ---------- вход ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: #fff; border-radius: 14px; padding: 32px 34px;
  box-shadow: 0 4px 20px rgba(16, 30, 54, .10); width: 360px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { font-size: 19px; }
.login-card h1 span { color: #6b7686; font-weight: 500; }
.login-card label { display: flex; flex-direction: column; gap: 5px; color: #4a5568; font-size: 13px; }
.login-card input { padding: 9px 11px; border: 1px solid #dbe1e9; border-radius: 8px; font-size: 14px; }
.login-card input:focus { outline: 2px solid #2f7cf6; border-color: transparent; }
.login-card button { padding: 10px; border: 0; border-radius: 8px; background: #1c2430; color: #fff; font-size: 14px; font-weight: 600; }
.login-card button:hover { background: #2c3a4e; }
.login-card button.link { background: none; color: #6b7686; font-weight: 500; font-size: 13px; padding: 0; }
.login-card button.link:hover { background: none; color: #1c2430; }
#pass-block { display: flex; flex-direction: column; gap: 12px; }
.login-card .msg { margin: 0; }

@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .topbar nav a { padding: 8px 9px; }
  .page { padding: 12px 12px 40px; }
  table.wide thead tr:first-child th:first-child, table.wide td:first-child { min-width: 160px; max-width: 200px; }
}

/* ---------- операции: правка в строке, разбиение ---------- */
.navbadge {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 99px; background: #c0392b; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 17px; vertical-align: 1px;
}
.sel { font: inherit; font-size: 13px; padding: 5px 9px; border: 1px solid #dbe1e9; border-radius: 8px; background: #fff; color: #1c2430; }
input.sel { min-width: 240px; }
.verdict a { text-decoration: underline; font-weight: 600; }
#tbl-ops td { vertical-align: top; }
#tbl-ops tr.blank td { background: #fff8f7; }
#tbl-ops tr.blank td:first-child { box-shadow: inset 3px 0 0 #c0392b; }
#tbl-ops tr.part td:first-child { box-shadow: inset 3px 0 0 #2f7cf6; }
#tbl-ops td.cp b { display: block; font-weight: 600; color: #1c2430; }
#tbl-ops td.cp span { display: block; color: #6b7686; font-size: 12px; overflow-wrap: anywhere; max-width: 420px; }
#tbl-ops td.cp { max-width: 440px; }
#tbl-ops input[type="month"] { max-width: 140px; }
#tbl-ops .moved { border-color: #f0c36d; background: #fffaf0; }
.hint-chip {
  display: block; margin-top: 4px; padding: 2px 8px; border-radius: 10px; border: 1px dashed #9fb2c8; background: #f4f8ff;
  color: #2c5fb3; font-size: 11.5px; text-align: left; white-space: normal; max-width: 200px;
}
.hint-chip:hover { background: #e6efff; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 600; background: #eef1f5; color: #6b7686; margin-top: 3px; }
.tag.edited, .tag.part { background: #e6efff; color: #2c5fb3; }
.row-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
tr.saved-flash td { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: #cdeed9; } }

.dlg { border: 0; border-radius: 14px; padding: 22px 24px; box-shadow: 0 10px 40px rgba(16, 30, 54, .25); width: min(780px, 94vw); margin: auto; color: #1c2430; }
.dlg::backdrop { background: rgba(20, 28, 40, .45); }
.dlg h3 { font-size: 16px; margin-bottom: 4px; }
.dlg table { margin-top: 12px; }
.dlg table input.amt { width: 120px; max-width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.dlg table input.auto { background: #f2f4f7; color: #6b7686; }
.file-actions .spacer { flex: 1; }

/* ---------- сверка переводов ---------- */
#screen-transfers td.ok { color: #178a4c; }
#screen-transfers td.diff { background: #fdf1f0; color: #c0392b; font-weight: 600; }
#screen-transfers td.sub1 { color: #4a5568; }
tr.unclass td, tr.unclass td:first-child { background: #fdf1f0 !important; color: #c0392b; }

/* ---------- план ---------- */
#tbl-pl td[data-m] { cursor: pointer; }
#tbl-pl td[data-m]:hover { outline: 1px solid #9fb2c8; outline-offset: -1px; }
#tbl-pl td.picked { outline: 2px solid #ee7144; outline-offset: -2px; background: #fff8f4 !important; }
#pl-filter { color: #6b7686; font-weight: 500; }
