/* CRM кредитки — спокойный рабочий интерфейс: плотные таблицы, один акцент (зелёный «баланс») */
:root {
  /* AdForge: тёмный navy, серебро, оранжевый «раскалённый металл» */
  --bg: #0a1020; --panel: #111a2d; --fg: #e8ebf1; --muted: #8e99ad; --line: #1f2b42;
  --accent: #f5821f; --accent-fg: #160c02; --warn-bg: #2a1c0e; --warn: #f7a457;
  --err: #ff6b6b; --ok: #4cc38a; --head: #172238; --code: #1a2640; --we: #241a12;
  --silver: #c9ced8; --glow: 0 0 18px rgba(245, 130, 31, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(1200px 600px at 50% -200px, #16233f 0%, var(--bg) 60%) fixed, var(--bg); color: var(--fg); font: 14px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 12px; text-wrap: balance; }
h2 { font-size: 15px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
main.wrap { padding-block: 20px 48px; }
header { background: rgba(10,16,32,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); text-decoration: none !important; }
.brand img { filter: drop-shadow(0 0 6px rgba(245,130,31,.45)); }
.brand span { display: flex; align-items: baseline; gap: 6px; }
.brand b { font-size: 17px; letter-spacing: -.01em; color: var(--silver); }
.brand i { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--accent); }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav a { padding: 4px 10px; border-radius: 6px; color: var(--fg); }
nav a.on { background: var(--head); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
nav a.vault { color: var(--accent); font-weight: 600; }
.me { display: flex; gap: 12px; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.narrow { max-width: 460px; }
.login { max-width: 380px; margin: 10vh auto 0; }
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-logo img { filter: drop-shadow(0 0 12px rgba(245,130,31,.5)); }
.login-logo b { display: block; font-size: 28px; color: var(--silver); letter-spacing: -.01em; }
.login-logo span { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 8px 12px; margin-bottom: 16px; }
.notice a { color: inherit; text-decoration: underline; }
.muted { color: var(--muted); }
.err { color: var(--err); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.warn { color: var(--warn); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: var(--fg);
  display: flex; justify-content: space-between; align-items: baseline; }
.tile b { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--accent); text-shadow: var(--glow); }
.tile:hover { border-color: #3a2a1a; text-decoration: none; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid2 > * { min-width: 0; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.docs { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.card .scroll { border: 0; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--head); font-weight: 600; white-space: nowrap; }
td .pre { max-width: 360px; }
td.act { white-space: nowrap; text-align: right; }
tr.off td { color: var(--muted); }
.pre { white-space: pre-wrap; word-break: break-word; }
.doc { max-width: 72ch; line-height: 1.65; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 12px; }
dt { color: var(--muted); }
dd { margin: 0; min-width: 0; word-break: break-word; }
@media (max-width: 560px) { dl { grid-template-columns: 1fr; } dd { margin-bottom: 8px; } }
form { margin: 0; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .btn { display: inline-block; font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: 6px; padding: 8px 16px; cursor: pointer; margin-top: 14px; box-shadow: var(--glow); }
.btn:hover { text-decoration: none; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); padding: 5px 10px; margin: 0; }
button.link { background: none; color: var(--muted); padding: 0; margin: 0; font-weight: 400; }
button.danger { background: var(--err); color: #fff; }
button:disabled { opacity: .4; cursor: default; }
.inline { display: inline-flex; gap: 6px; align-items: center; }
.inline select { width: auto; padding: 4px 6px; }
.search { display: flex; gap: 8px; margin: 8px 0 14px; max-width: 480px; }
.search button { margin: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; align-items: end; }
.actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 4px; }
.del { display: flex; gap: 10px; align-items: center; }
.del label { font-weight: 400; margin: 14px 0 0; display: flex; gap: 6px; align-items: center; }
.secret { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
code { font-family: var(--mono); background: var(--code); padding: 2px 6px; border-radius: 4px; font-size: 15px; color: var(--fg); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 700px) {
  .bar { gap: 8px; }
  .brand { flex: 1; }
  nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  nav a { white-space: nowrap; }
}
/* график */
.weeknav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 14px; }
.ghostbtn { border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; background: var(--panel); }
table.sched th, table.sched td { text-align: center; }
table.sched th[scope=row] { text-align: left; background: var(--panel); font-weight: 600; white-space: nowrap; }
table.sched thead th small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
table.sched .we, table.sched thead th.we { background: var(--we); }
table.sched thead th.today { box-shadow: inset 0 -3px 0 var(--accent); }
table.sched td.c input { width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; }
table.sched tr.tot th, table.sched tr.tot td { color: var(--muted); font-weight: 600; }
table.sched td.zero { color: var(--err); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sched-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sched-actions .ghost { margin-top: 14px; padding: 8px 14px; }
.tile.duty b { font-size: 14px; text-align: right; }
table.sched td.paid { color: var(--ok); font-weight: 600; white-space: nowrap; }
table.sched td.redo { color: var(--warn); white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0 4px; }
button.link, button.ghost { box-shadow: none; }
.card table:has(td.num) th:not(:first-child) { text-align: right; }
/* метрики */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 4px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; color: var(--silver); }
.kpi small { color: var(--muted); font-size: 12px; }
.neg { color: var(--err) !important; }
.chart { width: 100%; height: auto; max-width: 860px; display: block; margin: 6px 0 14px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .val { fill: var(--fg); font-size: 11px; font-weight: 600; font-family: var(--font); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
tr.totrow td { font-weight: 700; border-top: 1px solid var(--line); }
.head .ghostbtn { margin-left: auto; }
/* очередь */
.subtabs { display: flex; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subtabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a.on { color: var(--fg); border-color: var(--accent); font-weight: 600; }
.subtabs a:hover { text-decoration: none; color: var(--fg); }
.narrow2 { max-width: 560px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.static { padding: 8px 0; color: var(--silver); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filters select { width: auto; }
.filters button { margin: 0; }
table.queue td { vertical-align: middle; }
.qform { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.qform select { width: auto; padding: 5px 8px; }
.qform input[type=number] { width: 64px; padding: 5px 8px; }
.qform input[name=note] { width: 200px; padding: 5px 8px; }
.qform button { padding: 5px 10px; }
.det { color: var(--muted); font-size: 12px; white-space: pre-wrap; margin-top: 4px; max-width: 520px; }
select.st-done, .pill.st-done { color: var(--ok); }
select.st-no, .pill.st-no { color: var(--err); }
select.st-part, .pill.st-part { color: var(--warn); }
select.st-sent, .pill.st-sent { color: #7fb0ff; }
.pill { font-weight: 600; }
/* Claude */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow-y: auto; padding: 4px 2px 10px; margin-bottom: 12px; }
.msg { max-width: 78ch; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); line-height: 1.55; }
.msg.me { align-self: flex-end; background: var(--head); }
.msg.bot { align-self: flex-start; background: var(--panel); border-color: #3a2a1a; }
.empty { color: var(--muted); }
.empty .ex { display: inline-block; margin: 4px 6px 0 0; }
.empty .ex button { margin: 0; }
.ask { display: grid; gap: 8px; max-width: 900px; }
.ask button { justify-self: start; margin: 0; }
.parse textarea { margin-bottom: 0; }
.parse button { margin-top: 10px; }
/* плавающая кнопка Claude */
.fab { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 20; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ff9d45, var(--accent) 60%, #c95f0a); color: #1a0d02;
  box-shadow: 0 0 0 4px rgba(245,130,31,.15), 0 6px 22px rgba(245,130,31,.45); transition: transform .15s ease; }
.fab:hover { transform: translateY(-2px) scale(1.05); text-decoration: none; }
.fab span { position: absolute; right: 70px; white-space: nowrap; background: var(--panel); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity .15s ease; }
.fab:hover span, .fab:focus-visible span { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .fab { transition: none; } }
