/* Личный кабинет — светлая и тёмная тема, сначала телефон */
:root {
  --bg: #f6f5f2; --card: #ffffff; --ink: #1d1d1b; --muted: #6b6a66; --line: #e6e3dc;
  --accent: #d97706; --accent-soft: #fef3c7; --good: #15803d; --good-soft: #dcfce7;
  --bad: #b91c1c; --bad-soft: #fee2e2; --info: #1d4ed8; --info-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412; --card: #1e1e1b; --ink: #f1efe9; --muted: #a3a19a; --line: #2f2e2a;
    --accent: #f59e0b; --accent-soft: #3a2a0b; --good: #4ade80; --good-soft: #12301d;
    --bad: #f87171; --bad-soft: #3a1414; --info: #93c5fd; --info-soft: #172554;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }

/* шапка */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 999px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.nav a.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.who select { font: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); max-width: 190px; }
.who a { color: var(--muted); }
@media (max-width: 640px) { .nav { order: 3; flex-basis: 100%; } .brand small { display: none; } }

h1 { font-size: 24px; margin: 22px 0 4px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.sub { color: var(--muted); margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* карточки и сетки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 460px) { .grid { grid-template-columns: 1fr 1fr; } .grid.wide { grid-template-columns: 1fr; } }

.tile { display: block; text-decoration: none; position: relative; }
.tile .k { font-size: 13px; color: var(--muted); }
.tile .v { font-size: 28px; font-weight: 700; letter-spacing: -.01em; margin: 2px 0; }
.tile .s { font-size: 13px; color: var(--muted); }
.tile.click { cursor: pointer; }
.tile.click:hover { border-color: var(--accent); }
.tile .conv { position: absolute; top: 12px; right: 12px; font-size: 12px; color: var(--muted); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.badge.up { background: var(--good-soft); color: var(--good); }
.badge.down { background: var(--bad-soft); color: var(--bad); }
.badge.flat { background: var(--line); color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pill.pre { background: var(--info-soft); color: var(--info); }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--accent-soft); color: var(--accent); }

/* главная */
.big3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); margin-top: 18px; }
@media (max-width: 720px) { .big3 { grid-template-columns: 1fr; } }
.big3 a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; padding: 22px 20px; min-height: 150px; }
.big3 .ico { font-size: 30px; }
.big3 .t { font-size: 19px; font-weight: 700; }
.big3 .d { color: var(--muted); font-size: 14px; }
.big3 a:hover { border-color: var(--accent); }
.hello-sum { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 10px; }
.hello-sum b { font-size: 20px; }

/* период */
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 14px 0 6px; }
.chips a, .chips button { font: inherit; font-size: 14px; text-decoration: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.chips a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips form { display: none; gap: 6px; align-items: center; flex-wrap: wrap; }
.chips form.open { display: flex; }
.chips input[type=date] { font: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }

/* план */
.bar { position: relative; height: 12px; background: var(--line); border-radius: 999px; margin: 12px 0 26px; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; max-width: 100%; }
.bar .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .35; }
.bar .tick span { position: absolute; top: 18px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }

/* таблицы */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.r, .tbl th.r { text-align: right; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .cmt { color: var(--muted); font-size: 13px; }
.scroll { overflow-x: auto; }
@media (max-width: 640px) {
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tbl.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; text-align: right; }
  .tbl.stack td::before { content: attr(data-l); color: var(--muted); text-align: left; }
  .tbl.stack td.cmt { display: block; text-align: left; }
  .tbl.stack td.cmt::before { content: none; }
}

/* зарплата */
.months { display: flex; gap: 6px; overflow-x: auto; margin: 14px 0; scrollbar-width: none; }
.months a { text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); white-space: nowrap; font-size: 14px; }
.months a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.total { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.total .v { font-size: 38px; font-weight: 800; letter-spacing: -.02em; }
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--accent); color: #fff; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.parts .row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.parts .row:last-child { border-bottom: 0; }
.parts .row .l small { display: block; color: var(--muted); font-size: 12px; }
.pay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay .card .v { font-size: 22px; font-weight: 700; }
.note { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.info { background: var(--info-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }

/* норматив квалификатора */
.cal { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cal div { border-radius: 8px; padding: 6px; font-size: 12px; text-align: center; border: 1px solid var(--line); background: var(--card); }
.cal div b { display: block; font-size: 14px; }
.cal .ok { background: var(--good-soft); border-color: transparent; }
.cal .low { background: var(--bad-soft); border-color: transparent; }
.cal .future, .cal .before, .cal .off { opacity: .45; }

/* окно со сделками */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(760px, 94vw); background: var(--card); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .hd { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
dialog .bd { padding: 6px 16px 16px; max-height: 70vh; overflow: auto; }
dialog .x { font-size: 22px; background: none; border: 0; color: var(--muted); cursor: pointer; }

.login { max-width: 420px; margin: 12vh auto; text-align: center; }
.login .card { padding: 28px 22px; }
.login .btn { display: inline-block; text-decoration: none; margin-top: 14px; }
