/* Штаб FRM — токены по мини-брендбуку: бумага, чернила, лайм; графики — по правилам Carbon Data Viz */
:root {
  --bg: #F4F3EE; --surface: #FFFFFF; --text: #15181C; --muted: #5E636B; --line: #DAD8D0; --line-2: #E8E6DF;
  --accent: #C8F048; --accent-ink: #4A6800;
  --s-mkt: #8A63F0; --s-sales: #1757A8; --s-service: #08756F; --s-fin: #A86A12; --s-hr: #D9579E; --s-mgmt: #2E3A4A;
  --good: #1F8A4C; --warn: #B8660B; --bad: #D13B2E;
  --good-t: #16703C; --warn-t: #8F4E00; --bad-t: #B0281E;
  --pop: 0 8px 24px rgb(21 24 28 / .10);
  --fill-a: .20;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101215; --surface: #181B20; --text: #EDECE6; --muted: #9BA0A8; --line: #2A2E35; --line-2: #22262C;
  --accent: #C8F048; --accent-ink: #C8F048;
  --s-mkt: #C4B3FF; --s-sales: #3C86E6; --s-service: #2FB3A8; --s-fin: #E0A64B; --s-hr: #FF9ACB; --s-mgmt: #D5DCE6;
  --good: #4CC77F; --warn: #F0A640; --bad: #FF6B5E;
  --good-t: #4CC77F; --warn-t: #F0A640; --bad-t: #FF6B5E;
  --pop: 0 8px 24px rgb(0 0 0 / .45);
  --fill-a: .26;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101215; --surface: #181B20; --text: #EDECE6; --muted: #9BA0A8; --line: #2A2E35; --line-2: #22262C;
    --accent: #C8F048; --accent-ink: #C8F048;
    --s-mkt: #C4B3FF; --s-sales: #3C86E6; --s-service: #2FB3A8; --s-fin: #E0A64B; --s-hr: #FF9ACB; --s-mgmt: #D5DCE6;
    --good: #4CC77F; --warn: #F0A640; --bad: #FF6B5E;
    --good-t: #4CC77F; --warn-t: #F0A640; --bad-t: #FF6B5E;
    --pop: 0 8px 24px rgb(0 0 0 / .45);
    --fill-a: .26;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.num { font-family: "Inter Tight", Manrope, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.cur { color: var(--muted); font-weight: 500; margin-left: .15em; font-size: .72em; }
.muted { color: var(--muted); }
h1, h2, h3 { font-family: "Inter Tight", Manrope, sans-serif; letter-spacing: -.02em; margin: 0; text-wrap: balance; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ── вход */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; }
.login .mark { width: 44px; height: 44px; margin-bottom: 20px; }
.login h1 { font-size: 28px; line-height: 1.1; }
.login p { margin: 6px 0 22px; color: var(--muted); }
.login label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.login input { width: 100%; height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 16px; }
.login .err { color: var(--bad-t); font-size: 13px; min-height: 20px; margin-top: 8px; }
.btn { height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.lime { background: var(--accent); color: #15181C; border-color: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: default; }
.login .btn { width: 100%; height: 48px; margin-top: 8px; justify-content: center; font-size: 15px; }

/* ── шапка */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Inter Tight"; font-weight: 700; font-size: 17px; letter-spacing: -.02em; margin-right: auto; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand small { font-family: Manrope; font-weight: 500; color: var(--muted); font-size: 13px; }
.month { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.month b { min-width: 138px; text-align: center; font-weight: 700; font-size: 14px; }
.month button { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 7px; font-size: 18px; line-height: 1; }
.month button:hover:not([disabled]) { background: var(--line-2); }
.month button[disabled] { opacity: .3; cursor: default; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; position: relative; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; box-shadow: 0 0 0 2px var(--surface); }

/* ── колесо */
.hero { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(0, 700px) minmax(230px, 1fr); gap: 24px; align-items: center; padding: 28px 0 8px; }
.wheel-box { position: relative; overflow: hidden; }
.wheel { width: 100%; height: auto; display: block; overflow: visible; }
.wheel .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.wheel .plan { fill: none; stroke: var(--text); stroke-opacity: .45; stroke-width: 1.5; stroke-dasharray: 5 5; }
.wheel .axis { stroke: var(--line); stroke-width: 1; }
.wheel .shape { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; }
.wheel .tick { font: 600 13px "Inter Tight"; fill: var(--muted); }
.wheel .slabel { font: 700 19px "Inter Tight"; fill: var(--text); letter-spacing: -.01em; cursor: pointer; }
.wheel .spct { font: 700 17px "Inter Tight"; font-variant-numeric: tabular-nums; }
.wheel .center-big { font: 700 48px "Inter Tight"; fill: var(--text); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.wheel .center-sm { font: 500 12px Manrope; fill: var(--muted); }
.wheel .hit { fill: transparent; cursor: pointer; }
.wheel .v { stroke: var(--surface); stroke-width: 1.5; pointer-events: none; transition: r .15s; }
.wheel .v.none { fill: var(--surface); stroke: var(--muted); stroke-dasharray: 2 2; }
.wheel .v.hl { r: 7; }
.good-t { color: var(--good-t); } .warn-t { color: var(--warn-t); } .bad-t { color: var(--bad-t); } .none-t { color: var(--muted); }
.fill-good { fill: var(--good-t); } .fill-warn { fill: var(--warn-t); } .fill-bad { fill: var(--bad-t); } .fill-none { fill: var(--muted); }

.side h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: Manrope; font-weight: 700; margin-bottom: 10px; }
.overall { margin-bottom: 26px; }
.overall .big { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: -.035em; }
.overall .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.slist { list-style: none; margin: 0; padding: 0; }
.slist li button { width: 100%; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 9px 4px; border: 0; background: none; border-bottom: 1px solid var(--line-2); text-align: left; font-weight: 600; font-size: 14px; }
.slist li button:hover { background: var(--line-2); }
.slist .bar { grid-column: 2 / 4; height: 3px; background: var(--line-2); border-radius: 2px; overflow: hidden; margin-top: -4px; }
.slist .bar i { display: block; height: 100%; border-radius: 2px; }
.fails { list-style: none; margin: 0; padding: 0; }
.fails li button { width: 100%; text-align: left; border: 0; background: none; padding: 9px 4px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.fails li button:hover { background: var(--line-2); }
.fails .n { font-weight: 600; font-size: 14px; }
.fails .s { font-size: 12px; color: var(--muted); grid-column: 1; }
.fails .p { grid-row: 1 / 3; grid-column: 2; align-self: center; font-weight: 700; }
.empty-note { font-size: 13px; color: var(--muted); padding: 10px 0; }
.wheel-mode { display: flex; justify-content: center; margin-top: 14px; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 22px; height: 12px; }

/* ── сферы и карточки */
.sphere { padding: 36px 0 4px; scroll-margin-top: 76px; }
.sphere-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sphere-head h2 { font-size: 26px; display: flex; align-items: center; gap: 10px; }
.sphere-head h2 i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sphere-head .pct { font-size: 20px; font-weight: 700; }
.sphere-head .meta { color: var(--muted); font-size: 13px; margin-right: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 14px; position: relative; display: flex; flex-direction: column; min-height: 176px; transition: border-color .2s, box-shadow .2s; }
.card::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sc); opacity: .9; }
.card.flash { border-color: var(--text); box-shadow: var(--pop); }
.card.is-hidden { opacity: .55; border-style: dashed; }
.card .head { display: flex; align-items: flex-start; gap: 8px; }
.card .name { font-weight: 600; font-size: 14px; line-height: 1.3; margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.auto { border-color: transparent; background: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); }
:root[data-theme="dark"] .tag.auto { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.auto { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); } }
.card .val { font-size: 34px; font-weight: 700; line-height: 1.05; letter-spacing: -.03em; margin: 14px 0 6px; }
.card .val.empty { color: var(--muted); font-weight: 600; font-size: 20px; letter-spacing: 0; margin-top: 20px; }
.card .plan-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.card .plan-row .st { margin-left: auto; font-weight: 700; font-size: 14px; white-space: nowrap; }
.card .meter { height: 4px; background: var(--line-2); border-radius: 2px; margin: 8px 0 0; position: relative; overflow: hidden; }
.card .meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; }
.card .detail { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.4; }
.card .actions { display: flex; gap: 4px; margin-top: auto; padding-top: 10px; }
.card .actions .btn { color: var(--muted); }
.card .actions .btn:hover { color: var(--text); }
.card .info { width: 24px; height: 24px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; margin: -2px -6px 0 0; }
.card .info:hover { background: var(--line-2); color: var(--text); }
.edit { margin-top: 12px; display: grid; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.edit label { font-size: 12px; font-weight: 600; color: var(--muted); display: grid; gap: 4px; }
.edit input, .edit select { height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); padding: 0 10px; width: 100%; font-variant-numeric: tabular-nums; font-size: 15px; }
.edit .row { display: flex; gap: 8px; }
.edit .row .btn { flex: 1; justify-content: center; }
.edit .note { font-size: 12px; color: var(--muted); line-height: 1.4; }
.add-card { border-style: dashed; background: transparent; align-items: stretch; justify-content: center; }
.add-card > .btn { align-self: center; }

/* ── финотчёт */
.report { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.rep { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rep h3 { font-size: 15px; padding: 14px 16px 10px; }
.rep table { width: 100%; border-collapse: collapse; }
.rep td { border-top: 1px solid var(--line-2); padding: 0 16px; height: 42px; font-size: 14px; }
.rep td:last-child { text-align: right; width: 48%; padding-right: 8px; }
.rep tr.sub td:first-child { padding-left: 30px; color: var(--muted); font-size: 13px; }
.rep tr.total td { font-weight: 700; background: color-mix(in srgb, var(--line-2) 60%, transparent); }
.rep tr.total td:last-child { padding-right: 16px; }
.rep input { width: 100%; height: 34px; border: 1px solid transparent; background: transparent; border-radius: 6px; text-align: right; padding: 0 8px; font: 600 15px "Inter Tight"; font-variant-numeric: tabular-nums; }
.rep input:hover { border-color: var(--line); }
.rep input:focus { border-color: var(--text); background: var(--bg); outline: none; }
.rep input::placeholder { color: var(--muted); font-weight: 500; opacity: .6; }
.saved { color: var(--good-t) !important; }

/* ── прочее */
.foot { margin: 48px 0 40px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; font-size: 13px; color: var(--muted); }
.foot b { color: var(--text); font-weight: 600; }
.src { display: flex; gap: 8px; align-items: baseline; }
.src .dot { transform: translateY(-1px); }
.banner { margin-top: 16px; padding: 10px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); font-size: 14px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--text); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4; max-width: 260px; box-shadow: var(--pop); }
.tip b { display: block; font-size: 13px; }
.pop { position: absolute; right: 0; top: 48px; width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--pop); padding: 8px 14px; z-index: 30; font-size: 13px; }
.pop .src { padding: 8px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.pop .src:last-of-type { border-bottom: 0; }
.pop .btn { width: 100%; justify-content: center; margin: 8px 0 6px; }
.rel { position: relative; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: var(--pop); }
.only-mobile { display: none; }

@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr 1fr; }
  .hero .wheel-box { grid-column: 1 / -1; grid-row: 1; max-width: 680px; margin: 0 auto; width: 100%; }
}
@media (max-width: 1100px) {
  .top .wrap { height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .top .seg { order: 5; }
  .top .month { order: 4; }
  .brand small { display: none; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .hide-m { display: none; }
  .card .head { flex-wrap: wrap; }
  .card .tag { order: 3; }
  .month b { min-width: 112px; font-size: 13px; }
  .top .month { order: 4; flex: 1 1 100%; justify-content: space-between; }
  .top .seg { order: 5; width: 100%; }
  .top .seg button { flex: 1; }
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 16px; }
  .overall { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
  .overall .big { font-size: 44px; }
  .wheel .slabel { font-size: 27px; }
  .wheel .spct { font-size: 24px; }
  .sphere-head h2 { font-size: 22px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { padding: 12px 12px 10px; min-height: 150px; }
  .card .val { font-size: 24px; margin-top: 10px; }
  .card .val.empty { font-size: 16px; }
  .card .plan-row { flex-wrap: wrap; gap: 2px 6px; font-size: 12px; }
  .only-mobile { display: initial; }
}
@media (max-width: 380px) {
  .cards { grid-template-columns: 1fr; }
}
