/* ===== Mari Boek — dashboard ===== */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2733;
  --ink-soft: #6b7684;
  --line: #e6eaf1;
  --brand: #5b6ef5;
  --brand-soft: #eef0ff;
  --green: #1f9d63;
  --green-soft: #e5f6ee;
  --red: #d9534f;
  --red-soft: #fbeceb;
  --amber: #c98a1a;
  --shadow: 0 6px 24px rgba(31,39,51,.06);
  --radius: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Inter", "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }
.err { color: var(--red); font-size: .88rem; }
.hint { color: var(--ink-soft); font-size: .84rem; margin-top: .7rem; }

.btn { border: none; border-radius: 10px; padding: .6rem 1.1rem; font: inherit; font-size: .92rem; cursor: pointer; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.linklike { background: none; border: none; color: var(--brand); cursor: pointer; font: inherit; text-decoration: underline; }

.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: .8rem; font-weight: 700; }

/* вход */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2.2rem; width: min(360px, 92vw); display: flex; flex-direction: column; gap: .8rem; text-align: center; }
.login-card .brand { justify-content: center; margin-bottom: .3rem; }
.login-card input { padding: .7rem .9rem; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; }
.or-sep { display: flex; align-items: center; gap: .6rem; color: var(--ink-soft); font-size: .78rem; margin: .2rem 0; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* модалка предложения passkey */
.modal-wrap { position: fixed; inset: 0; background: rgba(31,39,51,.45); display: grid; place-items: center; z-index: 100; padding: 1.2rem; }
.modal-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem 1.8rem;
  width: min(360px, 94vw); text-align: center; display: flex; flex-direction: column; gap: .7rem; }
.modal-ico { font-size: 2.6rem; }
.modal-card h2 { font-size: 1.25rem; }
.modal-card .btn { margin-top: .4rem; }

/* каркас приложения */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 1.2rem 1rem; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 .4rem 1.2rem; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item { text-align: left; background: none; border: none; font: inherit; font-size: .93rem; color: var(--ink-soft);
  padding: .6rem .7rem; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: .1rem; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.badge { margin-left: auto; background: var(--red); color: #fff; font-size: .72rem; border-radius: 999px; padding: 0 .4rem; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: .9rem; display: flex; flex-direction: column; gap: .3rem; }

.main { flex: 1; padding: 1.6rem clamp(1rem, 3vw, 2.4rem); max-width: 1100px; }
.main h1 { font-size: 1.5rem; margin-bottom: 1.2rem; }
.burger { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; margin-bottom: .6rem; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-head h2 { font-size: 1.02rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }
.kpi .label { color: var(--ink-soft); font-size: .82rem; margin-bottom: .4rem; }
.kpi .value { font-size: 1.6rem; font-weight: 700; }
.kpi .sub { font-size: .78rem; color: var(--ink-soft); margin-top: .3rem; }
.kpi.green .value { color: var(--green); }
.kpi.red .value { color: var(--red); }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: .6rem; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* таблицы */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; font-size: .8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
.del { background: var(--red-soft); color: var(--red); border: none; border-radius: 8px; padding: .25rem .6rem; cursor: pointer; font-size: .8rem; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .76rem; background: var(--bg); color: var(--ink-soft); }

/* формы-строки */
.row-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row-form input, .row-form select { padding: .55rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; font-size: .9rem; }

/* документы */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.doc { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.doc .thumb { height: 120px; display: grid; place-items: center; font-size: 2.4rem; background: #fff; }
.doc .thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc .meta { padding: .6rem .7rem; font-size: .8rem; }
.doc .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc .actions { display: flex; gap: .4rem; padding: 0 .7rem .7rem; }

/* график */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 1rem; }
.bars .m { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.bars .m .b-in { background: var(--green); border-radius: 3px 3px 0 0; }
.bars .m .b-out { background: var(--red); border-radius: 3px 3px 0 0; }
.bars .m .lbl { text-align: center; font-size: .68rem; color: var(--ink-soft); margin-top: .3rem; }
.legend { display: flex; gap: 1.2rem; font-size: .8rem; color: var(--ink-soft); margin-top: .6rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }

.deadline { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.deadline:last-child { border-bottom: none; }
.deadline .date { color: var(--ink-soft); white-space: nowrap; }
.cat-row { display: flex; align-items: center; gap: .7rem; padding: .4rem 0; font-size: .88rem; }
.cat-row .bar { flex: 1; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.cat-row .bar > i { display: block; height: 100%; background: var(--brand); }
.cat-row .amt { width: 90px; text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .burger { display: block; }
  .two-col { grid-template-columns: 1fr; }
}
