:root {
  --gold: #C9A55C;
  --gold-hi: #E2C381;
  --gold-lo: #8C7140;
  --gold-soft: rgba(201, 165, 92, .12);
  --gold-line: rgba(201, 165, 92, .32);

  --bg: #100F0D;
  --bg-2: #161512;
  --surface: #1B1A16;
  --surface-2: #22201C;
  --surface-3: #2A2823;
  --line: #2C2A25;
  --line-2: #3A3731;
  --text: #EDE8DE;
  --text-2: #B9B2A4;
  --muted: #847D70;

  --ok: #7FA886;
  --ok-soft: rgba(127, 168, 134, .13);
  --soon: var(--gold);
  --urgent: #E08A3C;
  --urgent-soft: rgba(224, 138, 60, .14);
  --bad: #D9604F;
  --bad-soft: rgba(217, 96, 79, .14);

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .7);
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Manrope', -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sidebar: 232px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F4F0E8;
  --bg-2: #EEE9DF;
  --surface: #FBF9F5;
  --surface-2: #F3EFE7;
  --surface-3: #E9E3D8;
  --line: #E2DBCE;
  --line-2: #D3CAB9;
  --text: #1F1C17;
  --text-2: #4E483E;
  --muted: #8A8273;
  --gold: #A9853E;
  --gold-hi: #8C6B2C;
  --gold-soft: rgba(169, 133, 62, .11);
  --gold-line: rgba(169, 133, 62, .35);
  --shadow: 0 18px 50px -20px rgba(60, 45, 20, .3);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body::before {
  /* тонкая сетка как у канваса n8n */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .5;
  mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
}
a { color: inherit; text-decoration: none; }
img { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--gold-soft); color: var(--gold-hi); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 3px solid var(--bg); }

/* ---------- layout ---------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(8px); padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--gold-line); background: linear-gradient(145deg, var(--gold-soft), transparent);
  color: var(--gold); font: 700 19px/1 var(--serif);
}
.brand-name { font: 600 21px/1 var(--serif); letter-spacing: .02em; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; transition: background .15s, color .15s; position: relative;
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--gold-soft); color: var(--gold-hi); }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--gold); }
.nav a.active svg { opacity: 1; }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: center; gap: 8px; }
.sidebar-foot .who { flex: 1; min-width: 0; font-size: 12.5px; }
.sidebar-foot .who b { display: block; font-weight: 600; }
.sidebar-foot .who span { color: var(--muted); font-size: 11.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; min-height: 68px;
  padding: 14px 32px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px);
}
.topbar h1 { margin: 0; font: 600 28px/1.1 var(--serif); letter-spacing: .01em; }
.topbar .crumbs { color: var(--muted); font-size: 12.5px; }
.topbar .crumbs a:hover { color: var(--gold); }
.topbar .spacer { flex: 1; }
.page { padding: 26px 32px 60px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s, transform .05s;
}
.btn:hover { border-color: var(--gold-line); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); border-color: var(--gold); color: #1A1508; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.gold { background: var(--gold-soft); color: var(--gold-hi); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.urgent { background: var(--urgent-soft); color: var(--urgent); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px;
  border: 1px solid var(--line-2); font-size: 12px; color: var(--text-2); cursor: pointer; user-select: none;
  transition: all .15s; background: transparent;
}
.chip:hover { border-color: var(--gold-line); color: var(--text); }
.chip.on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-hi); }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .93em; letter-spacing: -.01em; }
.serif { font-family: var(--serif); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .serif { font-size: 22px; color: var(--text-2); display: block; margin-bottom: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hr { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--bg-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23847D70' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.input::placeholder { color: var(--muted); opacity: .7; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search .input { padding-left: 34px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 2px; background: var(--bg-2); }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 5px; cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.toggle { position: relative; width: 36px; height: 20px; flex: none; }
.toggle input { opacity: 0; position: absolute; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 20px; background: var(--surface-3); transition: .2s; }
.toggle span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: .2s; }
.toggle input:checked + span { background: var(--gold); }
.toggle input:checked + span::after { transform: translateX(16px); background: #1A1508; }

/* ---------- avatar ---------- */
.ava {
  --s: 40px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-3); color: var(--gold);
  font: 600 calc(var(--s) * .4)/1 var(--serif); border: 1px solid var(--line-2);
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava-upload { position: relative; cursor: pointer; }
.ava-upload::after {
  content: 'Фото'; position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.55); color: #fff; font: 600 12px var(--sans); opacity: 0; transition: .15s;
}
.ava-upload:hover::after { opacity: 1; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .label { display: block; margin-bottom: 10px; }
.kpi .val { font: 600 34px/1 var(--serif); letter-spacing: .01em; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 8px; }
.kpi.accent { border-color: var(--gold-line); background: linear-gradient(160deg, var(--gold-soft), var(--surface) 60%); }
.kpi.accent .val { color: var(--gold-hi); }
.kpi .bar { position: absolute; left: 0; bottom: 0; height: 2px; }
.dash { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .s { font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .b i { width: 100%; max-width: 46px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); min-height: 2px; position: relative; }
.bars .b i::after { content: attr(data-v); position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font: 10.5px var(--mono); color: var(--text-2); white-space: nowrap; }
.bars .b span { font-size: 11px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: 160px 1fr 34px; align-items: center; gap: 10px; font-size: 12.5px; padding: 4px 0; }
.hbar .track { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--gold); border-radius: 6px; }
.hbar .n { text-align: right; font-family: var(--mono); color: var(--text-2); }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }

/* ---------- countdown ---------- */
.cd { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 92px; }
.cd .d { font: 500 13px var(--mono); white-space: nowrap; }
.cd .d b { font-size: 17px; font-weight: 500; }
.cd .track { width: 92px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.cd .track i { display: block; height: 100%; border-radius: 3px; }
.st-ok { color: var(--ok); } .st-ok .track i { background: var(--ok); }
.st-soon { color: var(--gold); } .st-soon .track i { background: var(--gold); }
.st-urgent { color: var(--urgent); } .st-urgent .track i { background: var(--urgent); }
.st-overdue { color: var(--bad); } .st-overdue .track i { background: var(--bad); }
.st-none { color: var(--muted); }

/* ---------- members ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .search { width: 300px; }
.toolbar select.input { width: auto; min-width: 150px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.mcard {
  padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; position: relative;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.mcard:hover { border-color: var(--gold-line); transform: translateY(-2px); box-shadow: var(--shadow); }
.mcard .top { display: flex; gap: 12px; align-items: center; }
.mcard .nm { font-weight: 700; line-height: 1.25; }
.mcard .co { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line); }
.mcard .niche { font-size: 12px; color: var(--text-2); }
.mcard .niche b { color: var(--gold); font-weight: 600; }
.status-flag { position: absolute; top: 12px; right: 12px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.tbl-wrap { overflow: auto; }

/* profile */
.profile { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.p-head { padding: 26px 22px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; overflow: hidden; }
.p-head::before { content: ''; position: absolute; inset: 0 0 auto; height: 86px; background: linear-gradient(180deg, var(--gold-soft), transparent); border-bottom: 1px solid var(--line); }
.p-head .ava { position: relative; border: 2px solid var(--gold-line); box-shadow: 0 0 0 5px var(--surface); }
.p-head h2 { margin: 6px 0 0; font: 600 26px/1.15 var(--serif); }
.p-contacts { padding: 6px 0; }
.p-contacts a, .p-contacts div.c { display: flex; align-items: center; gap: 12px; padding: 9px 20px; color: var(--text-2); transition: .12s; word-break: break-all; }
.p-contacts a:hover { background: var(--surface-2); color: var(--gold-hi); }
.p-contacts svg { width: 16px; height: 16px; flex: none; color: var(--gold); }
.big-cd { padding: 20px 22px; display: flex; align-items: center; gap: 20px; }
.big-cd .ring { width: 112px; height: 112px; flex: none; position: relative; }
.big-cd .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.big-cd .ring .v { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.big-cd .ring .v b { font: 400 36px/1 var(--display); }
.big-cd .ring .v small { display: block; font: 600 8.5px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }
.desc { white-space: pre-wrap; color: var(--text-2); line-height: 1.65; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* links editor */
.links-ed .lrow { display: grid; grid-template-columns: 150px 1fr 34px; gap: 8px; margin-bottom: 8px; }

/* group */
.groups-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.g-item { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: .12s; }
.g-item:last-child { border-bottom: 0; }
.g-item:hover { background: var(--surface-2); }
.g-item.on { background: var(--gold-soft); }
.g-item .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.picker { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.picker label { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.picker label:last-child { border-bottom: 0; }
.picker label:hover { background: var(--surface-2); }
.picker input { accent-color: var(--gold); width: 15px; height: 15px; }

/* calendar */
.cal-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cal-head h3 { margin: 0 8px; font: 600 24px/1 var(--serif); text-transform: capitalize; min-width: 200px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal .dow { padding: 8px 10px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 108px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; display: flex; flex-direction: column; gap: 4px; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day:hover { background: var(--surface-2); }
.cal .day .n { font: 500 12px var(--mono); color: var(--text-2); padding: 2px 4px; align-self: flex-start; border-radius: 5px; }
.cal .day.out .n { color: var(--muted); opacity: .45; }
.cal .day.today .n { background: var(--gold); color: #1A1508; }
.cal .ev { font-size: 11.5px; padding: 3px 6px; border-radius: 5px; background: var(--gold-soft); color: var(--gold-hi); border-left: 2px solid var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.past { opacity: .5; }
.ev-card { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: .12s; }
.ev-card:hover { background: var(--surface-2); }
.ev-card:last-child { border-bottom: 0; }
.ev-date { width: 50px; flex: none; text-align: center; border: 1px solid var(--gold-line); border-radius: 8px; padding: 6px 0; height: fit-content; }
.ev-date b { display: block; font: 600 22px/1 var(--serif); color: var(--gold-hi); }
.ev-date span { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ev-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.drop {
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 18px; text-align: center; color: var(--muted);
  cursor: pointer; transition: .15s; font-size: 13px; position: relative; overflow: hidden; background: var(--bg-2);
}
.drop:hover, .drop.over { border-color: var(--gold); color: var(--gold-hi); }
.drop img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 5px; }

/* mailing preview — как сообщение в Telegram */
.tg-prev { background: #0E1621; border-radius: 12px; padding: 14px; }
[data-theme="light"] .tg-prev { background: #D5E4CE; }
.tg-msg { max-width: 360px; background: #182533; border-radius: 12px 12px 12px 4px; overflow: hidden; color: #E9EEF2; font-size: 13.5px; }
[data-theme="light"] .tg-msg { background: #fff; color: #111; }
.tg-msg img { width: 100%; max-height: 220px; object-fit: cover; }
.tg-msg .tx { padding: 8px 12px 6px; white-space: pre-wrap; line-height: 1.45; }
.tg-msg .tm { text-align: right; font-size: 11px; opacity: .5; padding: 0 10px 6px; }

/* tree */
.tree .node { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.tree .node.sub { padding-left: 44px; background: var(--bg-2); }
.tree .node.sub::before { content: ''; width: 10px; height: 1px; background: var(--line-2); margin-left: -18px; }
.tree .node .nm { flex: 1; }
.tree .node .acts { opacity: 0; transition: .12s; display: flex; gap: 4px; }
.tree .node:hover .acts { opacity: 1; }
.tree .node input.input { height: 30px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--gold-hi); border-color: var(--gold); }

/* ---------- modal / drawer ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(5, 4, 3, .62); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 6vh 16px; overflow: auto; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); animation: pop .2s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { max-width: 860px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font: 600 24px/1.1 var(--serif); flex: 1; }
.modal-b { padding: 20px 22px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--bg-2); border-radius: 0 0 14px 14px; }
.modal-f .left { margin-right: auto; }
.section-t { font: 600 12px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: 4px 0 12px; display: flex; align-items: center; gap: 10px; }
.section-t::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.callout { border: 1px solid var(--gold-line); background: var(--gold-soft); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; color: var(--text-2); }
.callout b { color: var(--gold-hi); }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 16px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--line-2); border-left: 3px solid var(--gold); box-shadow: var(--shadow); font-size: 13px; animation: pop .2s ease; max-width: 360px; }
.toast.err { border-left-color: var(--bad); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; position: relative; z-index: 1; padding: 20px; }
.login { width: 380px; padding: 34px 32px; text-align: center; }
.login .brand-mark { width: 54px; height: 54px; font-size: 28px; margin: 0 auto 18px; }
.login h1 { margin: 0; font: 600 34px/1.1 var(--serif); }
.login p { color: var(--muted); margin: 6px 0 24px; font-size: 13px; }
.login form { display: flex; flex-direction: column; gap: 12px; text-align: left; }

@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .dash, .cal-layout, .profile { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .sidebar .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label, .sidebar-foot, .brand-sub { display: none; }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .kpis, .grid-2, .grid-3, .groups-layout { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .toolbar .search { width: 100%; }
}

/* отчисленные */
.blocked { opacity: .55; filter: grayscale(.8); }
.blocked:hover { opacity: .85; }
.blocked-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-soft); border-radius: var(--radius);
}
.blocked-banner > svg { width: 22px; height: 22px; color: var(--bad); flex: none; }
.blocked-banner b { color: var(--bad); }
.blocked-banner .muted { font-size: 12px; max-width: 280px; text-align: right; }
.profile.is-blocked .p-head .ava { filter: grayscale(1); }

.persona { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.persona .label { margin-bottom: 4px; display: block; }
.nav-badge { margin-left: auto; height: 18px; padding: 0 6px; font-size: 10.5px; }

/* ---------- сводка ---------- */
.mono-val { font: 500 24px/1.1 var(--mono) !important; letter-spacing: -.02em; }
.legend { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.bars2 { display: flex; align-items: flex-end; gap: 4px; height: 170px; }
.bars2 .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars2 .pair { flex: 1; width: 100%; max-width: 40px; display: flex; align-items: flex-end; gap: 2px; }
.bars2 .pair i { flex: 1; border-radius: 3px 3px 1px 1px; min-height: 1px; }
.bars2 .inc { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); }
.bars2 .exp { background: color-mix(in srgb, var(--bad) 75%, transparent); }
.bars2 .b span { font-size: 10.5px; color: var(--muted); }
.cat-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 4px 18px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.cat-split .hbar { grid-template-columns: 1fr 70px auto; }
.dot-pr { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); flex: none; }
.dot-pr.bad { background: var(--bad); }
.wallet-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.wallet-strip .wl { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.wallet-strip .wl b { font-size: 19px; font-weight: 500; }
.wallet-strip .wl.accent { border-color: var(--gold-line); background: linear-gradient(160deg, var(--gold-soft), var(--surface) 70%); }
.wallet-strip .wl.accent b { color: var(--gold-hi); }

/* ---------- календарь: раскрытый день ---------- */
.cal-layout { grid-template-columns: 1fr 380px; }
.cal .day.sel { background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-line); }
.cal .ev.board { background: color-mix(in srgb, #C77B6E 16%, transparent); color: #E1A699; border-left-color: #C77B6E; }
.cal .more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.bk-dots { display: flex; align-items: center; gap: 3px; margin-top: auto; padding: 0 2px; }
.bk-dots i { width: 6px; height: 6px; border-radius: 50%; }
.bk-dots span { font-size: 10.5px; color: var(--muted); margin-left: 3px; }
.day-panel { position: sticky; top: 86px; max-height: calc(100vh - 110px); overflow: auto; }
.timeline { position: relative; margin: 10px 12px 16px 6px; }
.tl-hour { position: absolute; left: 0; right: 0; height: 52px; border-top: 1px solid var(--line); cursor: copy; }
.tl-hour span { position: absolute; top: -8px; left: 0; width: 50px; text-align: right; font: 10.5px var(--mono); color: var(--muted); background: var(--surface); padding-right: 6px; }
.tl-now { position: absolute; left: 58px; right: 0; height: 2px; background: var(--bad); z-index: 3; }
.tl-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.tl-item { position: absolute; z-index: 2; border-radius: 6px; padding: 5px 8px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; transition: transform .1s, box-shadow .1s; border: 1px solid transparent; }
.tl-item:hover { transform: translateY(-1px); box-shadow: var(--shadow); z-index: 4; }
.tl-item b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-item span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-item.ev { background: color-mix(in srgb, var(--gold) 20%, var(--surface)); border-color: var(--gold-line); border-left: 3px solid var(--gold); }
.tl-item.ev.board { background: color-mix(in srgb, #C77B6E 20%, var(--surface)); border-color: color-mix(in srgb, #C77B6E 40%, transparent); border-left-color: #C77B6E; }
.tl-item.bk { background: color-mix(in srgb, var(--c) 12%, var(--surface)); border-left: 3px solid var(--c); border-style: dashed; border-left-style: solid; border-color: color-mix(in srgb, var(--c) 35%, transparent); }
.tl-allday { padding: 6px 10px; border-radius: 6px; background: var(--gold-soft); color: var(--gold-hi); font-size: 12.5px; cursor: pointer; margin-bottom: 4px; }
.seg.vis-seg label, .seg.kind-seg label { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 5px; cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.seg.vis-seg label.on, .seg.kind-seg label.on { background: var(--surface-3); color: var(--text); }
.seg.kind-seg label.on.k-income { color: var(--ok); }
.seg.kind-seg label.on.k-expense { color: var(--bad); }
.seg.kind-seg { align-self: flex-start; }
.tg-btn { margin: 0 8px 8px; padding: 7px; text-align: center; border-radius: 8px; background: rgba(255,255,255,.08); color: #6AB3F3; font-weight: 600; font-size: 13px; }
.reg-stat { display: flex; flex-direction: column; padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; min-width: 110px; }
.reg-stat b { font: 600 26px/1 var(--serif); color: var(--gold-hi); }
.reg-stat span { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ---------- бронирование ---------- */
.sched-wrap { overflow: auto; }
.sched { display: grid; min-width: 600px; }
.sh-corner, .sh-res { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.sh-res { display: flex; gap: 10px; align-items: center; padding: 12px; border-left: 1px solid var(--line); }
.sh-res .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sh-res b { display: block; font-size: 13px; }
.sh-res span { font-size: 11.5px; color: var(--muted); }
.sh-times { position: relative; }
.sh-times span { position: absolute; right: 8px; transform: translateY(-50%); font: 10.5px var(--mono); color: var(--muted); }
.sh-times span:first-child { transform: none; }
.sh-col { position: relative; border-left: 1px solid var(--line); }
.sh-slot { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); cursor: copy; transition: background .1s; }
.sh-slot.half { border-top-style: dashed; border-top-color: color-mix(in srgb, var(--line) 60%, transparent); }
.sh-slot:hover { background: var(--gold-soft); }
.sh-bk { position: absolute; left: 4px; right: 4px; z-index: 2; border-radius: 6px; padding: 5px 8px; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; font-size: 11.5px;
  background: color-mix(in srgb, var(--c) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-left: 3px solid var(--c); }
.sh-bk:hover { box-shadow: var(--shadow); z-index: 4; }
.sh-bk.pending { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, var(--surface)) 0 8px, var(--surface) 8px 14px); }
.sh-bk.is-event { border-style: solid; }
.sh-bk b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.sh-bk span { color: var(--text-2); }
.color-in { width: 34px; height: 30px; border: 1px solid var(--line-2); border-radius: 6px; background: none; padding: 2px; cursor: pointer; }

/* ---------- ДДС ---------- */
.tbl.dds td, .tbl.dds th { padding: 7px 10px; font-size: 12.5px; }
.tbl.dds .rname { white-space: nowrap; min-width: 220px; }
.tbl.dds .sec td { background: var(--bg-2); font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.tbl.dds .sum td { font-weight: 700; background: var(--surface-2); }
.tbl.dds .net td { border-top: 1px solid var(--gold-line); }
.tbl.dds .cur { background: color-mix(in srgb, var(--gold) 6%, transparent); }
.tbl.dds .tot { font-weight: 700; color: var(--gold-hi); }

/* ---------- канбан ---------- */
.seg.pipes { flex-wrap: wrap; }
.seg.pipes a { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 5px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.seg.pipes a.on { background: var(--surface-3); color: var(--text); }
.seg.pipes .sw { width: 8px; height: 8px; border-radius: 50%; }
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: 60vh; }
.kb-col { flex: 0 0 272px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px); transition: border-color .15s, background .15s; }
.kb-col.over { border-color: var(--gold); background: var(--gold-soft); }
.kb-col.won .kb-h { box-shadow: inset 0 2px 0 var(--ok); }
.kb-col.lost .kb-h { box-shadow: inset 0 2px 0 var(--bad); }
.kb-col.open .kb-h { box-shadow: inset 0 2px 0 var(--gold-lo); }
.kb-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.kb-h b { font-size: 13px; }
.kb-list { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 40px; }
.kb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; cursor: grab; font-size: 12.5px; transition: border-color .12s, box-shadow .12s; }
.kb-card:hover { border-color: var(--gold-line); box-shadow: var(--shadow); }
.kb-card.drag { opacity: .4; }
.kb-card b { font-size: 13px; line-height: 1.3; }
.kb-card > span { color: var(--muted); }
.kb-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.kb-meta .ava { font-size: 9px; }
.kb-add { margin: 0 8px 8px; height: 32px; border: 1px dashed var(--line-2); border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; }
.kb-add svg { width: 13px; height: 13px; }
.kb-add:hover { border-color: var(--gold); color: var(--gold-hi); }
.tasks-board .kb-col { flex: 1 1 300px; }
.kb-card.task.done b, .list-row.task.done .t { text-decoration: line-through; color: var(--muted); }
.t-check { accent-color: var(--gold); width: 15px; height: 15px; margin-top: 2px; flex: none; cursor: pointer; }

/* ---------- инвентарь ---------- */
.inv-thumb { width: 36px; height: 36px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); }
.inv-thumb.ph { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.inv-thumb.ph svg { width: 16px; height: 16px; }

@media (max-width: 1200px) { .cal-layout { grid-template-columns: 1fr; } .day-panel { position: static; max-height: none; } .cat-split, .persona { grid-template-columns: 1fr; } }
.badge[hidden] { display: none; }
.seg button { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

/* ================= Контракты (Todoist) ================= */
.td-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 22px; align-items: start; }
.td-nav { padding: 10px 8px; position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto; }
.td-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 3px; color: var(--text-2); font-size: 13.5px; }
.td-link:hover { background: var(--surface-2); color: var(--text); }
.td-link.on { background: var(--gold-soft); color: var(--gold-hi); }
.td-link svg { width: 16px; height: 16px; flex: none; }
.td-link .n { font: 11.5px var(--mono); color: var(--muted); }
.td-sec { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-lo); padding: 16px 10px 4px; }
.td-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 3px; }
.td-at { width: 16px; text-align: center; color: var(--gold); font-weight: 700; }
.td-ico-today { width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 3px; font: 700 8.5px/13px var(--sans); text-align: center; flex: none; }
.flag { width: 16px; text-align: center; font-size: 13px; }
.td-main { min-width: 0; max-width: 880px; }
.td-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.td-head h2 { margin: 0; font-size: 30px; letter-spacing: .06em; }
.td-group { margin-bottom: 22px; }
.td-gh { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); margin-bottom: 2px; font-size: 13px; }
.td-gh b { font-weight: 700; text-transform: capitalize; }
.td-gh.sec b { text-transform: none; font-size: 14px; }
.td-list { min-height: 4px; border-radius: 4px; transition: background .12s; }
.td-list.over { background: var(--gold-soft); }
.td-sub { margin-left: 30px; }

.tk { display: flex; align-items: flex-start; gap: 8px; padding: 9px 4px 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; transition: background .12s, opacity .25s, transform .25s; }
.tk:hover { background: linear-gradient(90deg, var(--surface-2), transparent); }
.tk.drag { opacity: .35; }
.tk.completing { opacity: 0; transform: translateX(10px); }
.tk.done .tk-title { text-decoration: line-through; color: var(--muted); }
.tk-tog, .tk-tog-sp { width: 18px; flex: none; }
.tk-tog { height: 22px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; display: grid; place-items: center; }
.tk-tog svg { width: 13px; height: 13px; transition: transform .15s; }
.tk-tog.open svg { transform: rotate(90deg); }
.tk-check { --c: var(--muted); width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); flex: none; margin-top: 1px; cursor: pointer; padding: 2px; color: transparent; display: grid; place-items: center; transition: .15s; }
.tk-check svg { width: 12px; height: 12px; }
.tk-check:hover { color: var(--c); }
.tk-check.p1 { --c: #E5484D; border-width: 2px; } .tk-check.p2 { --c: #E8A23A; border-width: 2px; } .tk-check.p3 { --c: #5B8DEF; border-width: 2px; }
.tk.done .tk-check, .tk-check.on { background: var(--c); color: #fff; }
.tk-check.p4.on, .tk.done .tk-check.p4 { background: var(--muted); }
.tk-check.big { width: 24px; height: 24px; margin-top: 6px; }
.tk-body { flex: 1; min-width: 0; }
.tk-title { font-size: 14px; line-height: 1.4; word-break: break-word; }
.tk-desc { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.tk-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.tk-meta:empty { display: none; }
.tk-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.tk-due { gap: 4px; }
.tk-due.over { color: #E5484D; } .tk-due.today { color: #4CB782; } .tk-due.tmrw { color: #E8A23A; } .tk-due.week { color: #A688E8; } .tk-due.later { color: var(--muted); }
.tk-label { color: var(--gold); } .tk-label:hover { text-decoration: underline; }
.tk-proj { gap: 6px; } .tk-proj i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tk-acts { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.tk:hover .tk-acts { opacity: 1; }
.tk.card-tk { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 10px; }
.tk.card-tk .tk-tog-sp { display: none; }
.tk.card-tk .tk-acts { position: absolute; right: 4px; top: 4px; background: var(--surface); }
.td-board .kb-col { flex: 0 0 290px; }
.td-board .kb-list { gap: 6px; }
.td-board .td-composer { padding: 0 8px 8px; }

.td-composer { margin-top: 4px; }
.td-add-btn { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px 0 8px 26px; font-size: 13.5px; text-align: left; }
.td-add-btn svg { width: 16px; height: 16px; color: var(--gold); border-radius: 50%; }
.td-add-btn:hover { color: var(--gold-hi); }
.td-add-btn:hover svg { background: var(--gold); color: #1A1206; }
.td-composer.compact .td-add-btn { padding-left: 26px; }
.td-form { border: 1px solid var(--line-2); border-radius: 4px; padding: 10px 12px 8px; background: var(--bg-2); margin: 6px 0; }
.td-form:focus-within { border-color: var(--gold-line); }
.td-q, .td-desc { width: 100%; border: 0; background: none; outline: none; font-size: 14px; color: var(--text); resize: none; padding: 2px 0; }
.td-q { font-weight: 600; }
.td-desc { font-size: 12.5px; color: var(--text-2); }
.td-tokens { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; min-height: 0; }
.td-tok { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 3px; font-size: 11.5px; color: var(--text-2); }
.td-tok.date { color: #4CB782; border-color: color-mix(in srgb, #4CB782 40%, transparent); }
.td-tok i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.td-form-f { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.td-addsec { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 10px 0; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; }
.td-addsec::before, .td-addsec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.td-addsec:hover { color: var(--gold); }
.td-addsec svg { width: 14px; height: 14px; }
.td-week { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; position: sticky; top: 78px; z-index: 3; background: var(--bg); padding: 6px 0; }
.td-day { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 3px; padding: 6px 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-2); position: relative; }
.td-day span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.td-day b { font: 400 20px/1 var(--display); }
.td-day i { position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.td-day.today { border-color: var(--gold); color: var(--gold-hi); }
.td-day:hover { border-color: var(--gold-line); }
.td-dayblock { scroll-margin-top: 150px; }
.td-empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.td-empty-ico { width: 74px; height: 74px; margin: 0 auto 14px; opacity: .85; }
.td-empty-ico svg { width: 100%; height: 100%; }
.toast.undo { display: flex; align-items: center; gap: 12px; }
.toast.undo .btn { color: var(--gold-hi); }

/* карточка контракта */
.tdd { display: grid; grid-template-columns: 1fr 260px; gap: 22px; }
.tdd-title-row { display: flex; gap: 12px; align-items: flex-start; }
.tdd-title { flex: 1; border: 0; background: none; outline: none; resize: none; font: 600 20px/1.35 var(--sans); color: var(--text); padding: 4px 0; }
.tdd-desc { width: 100%; border: 0; background: none; outline: none; resize: none; font-size: 13.5px; color: var(--text-2); padding: 4px 0 4px 36px; min-height: 40px; line-height: 1.6; }
.tdd-desc:focus, .tdd-title:focus { background: var(--bg-2); border-radius: 3px; }
.tdd-sec { margin-top: 18px; padding-left: 36px; }
.tdd-sec .label { display: block; margin-bottom: 6px; }
.tdd-subs .tk-tog-sp { display: none; }
.tdd-c { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.tdd-side { border-left: 1px solid var(--line); padding-left: 18px; display: flex; flex-direction: column; gap: 12px; }
.tdd-side .input { height: 34px; }
.prio-pick { display: flex; gap: 4px; }
.prio-pick button { flex: 1; height: 32px; border: 1px solid var(--line-2); background: var(--bg-2); border-radius: 3px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 3px; }
.prio-pick button span { font-size: 10.5px; color: var(--text-2); font-weight: 700; }
.prio-pick button.on { border-color: currentColor; background: color-mix(in srgb, currentColor 14%, transparent); }
.tk-link { display: inline-flex; align-items: center; gap: 6px; color: var(--gold-hi); }
@media (max-width: 1000px) { .td-wrap, .tdd { grid-template-columns: 1fr; } .td-nav { position: static; } .tdd-side { border: 0; padding: 0; } }

/* ================= Расписание (iPhone) ================= */
.ical { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.ical-side { padding: 14px 12px; position: sticky; top: 90px; }
.ical-main { min-width: 0; overflow: hidden; }
.ical-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ical-title { margin: 0 6px; font: 400 24px/1 var(--display); letter-spacing: .06em; min-width: 220px; }
.ical-sec { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-lo); padding: 16px 2px 6px; }
.ical-cal { display: flex; align-items: center; gap: 10px; padding: 5px 2px; font-size: 13px; cursor: pointer; border-radius: 3px; }
.ical-cal:hover { background: var(--surface-2); }
.ical-cal input { display: none; }
.ical-cal .box { width: 15px; height: 15px; border-radius: 4px; border: 2px solid var(--c); flex: none; position: relative; }
.ical-cal input:checked + .box { background: var(--c); }
.ical-cal input:checked + .box::after { content: ''; position: absolute; left: 3px; top: 0; width: 4px; height: 8px; border: solid #111; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ical-cal .box.hatch { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--c) 2px 3px); }
.ical-cal .btn { opacity: 0; }
.ical-cal:hover .btn { opacity: 1; }
/* мини-месяц */
.mini-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mini-h b { font: 400 15px var(--display); letter-spacing: .08em; text-transform: uppercase; }
.mini-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-dow { text-align: center; font-size: 10px; color: var(--muted); padding: 3px 0; }
.mini-d { aspect-ratio: 1; border: 0; background: none; border-radius: 50%; font: 12px var(--sans); color: var(--text-2); cursor: pointer; position: relative; padding: 0; }
.mini-d:hover { background: var(--surface-3); }
.mini-d.out { color: var(--muted); opacity: .45; }
.mini-d.busy::after { content: ''; position: absolute; bottom: 2px; left: 50%; width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%; background: var(--gold); }
.mini-d.sel { background: var(--surface-3); color: var(--text); font-weight: 700; }
.mini-d.today { background: var(--gold); color: #1A1206; font-weight: 700; }
.mini-d.today.busy::after { background: #1A1206; }
/* месяц */
.mgrid-h { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.mgrid-h div { padding: 8px 10px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-lo); text-align: right; }
.mgrid-h .we, .mcell.we .mnum { color: var(--muted); }
.mgrid2 { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(118px, 1fr); }
.mcell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: default; transition: background .1s; }
.mcell:nth-child(7n) { border-right: 0; }
.mcell.we { background: rgba(0,0,0,.12); }
.mcell.out { opacity: .5; }
.mcell.sel { background: var(--gold-soft); }
.mnum { align-self: flex-end; border: 0; background: none; color: var(--text-2); font: 500 12.5px var(--sans); padding: 3px 7px; border-radius: 12px; cursor: pointer; }
.mnum:hover { background: var(--surface-3); }
.mcell.today .mnum { background: var(--gold); color: #1A1206; font-weight: 700; }
.mchip { display: flex; align-items: center; gap: 5px; font-size: 11.5px; line-height: 1.25; padding: 2px 5px; border-radius: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; color: var(--text); }
.mchip:hover { background: color-mix(in srgb, var(--c) 18%, transparent); }
.mchip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.mchip .t { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.mchip .rc { color: var(--muted); }
.mchip.bar { background: color-mix(in srgb, var(--c) 30%, var(--surface)); border-left: 3px solid var(--c); font-weight: 600; }
.mchip.bar.cont { border-left-color: transparent; border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -5px; padding-left: 9px; }
.mchip.bar.more-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -5px; }
.mchip.past { opacity: .55; }
.mchip.board { box-shadow: inset 0 0 0 1px color-mix(in srgb, #C77B6E 60%, transparent); }
.mmore { border: 0; background: none; color: var(--muted); font-size: 11px; text-align: left; padding: 1px 5px; cursor: pointer; }
.mmore:hover { color: var(--gold-hi); }
.mbk { display: flex; align-items: center; gap: 3px; margin-top: auto; padding: 0 3px; }
.mbk i { width: 6px; height: 6px; border-radius: 50%; }
.mbk span { font-size: 10px; color: var(--muted); margin-left: 2px; }
/* неделя / день */
.wk-head, .wk-allday, .wk-grid { display: grid; }
.wk-head { border-bottom: 1px solid var(--line); }
.wk-day { border: 0; background: none; color: var(--text-2); padding: 8px 4px; cursor: pointer; display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.wk-day span { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.wk-day b { font: 400 22px/1 var(--display); }
.wk-day.today b { background: var(--gold); color: #1A1206; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; font-size: 18px; }
.wk-day.we { opacity: .75; }
.wk-allday { border-bottom: 1px solid var(--line-2); min-height: 30px; }
.wk-ad-l { font-size: 9.5px; color: var(--muted); text-align: right; padding: 8px 6px 0 0; letter-spacing: .06em; }
.wk-ad { border-left: 1px solid var(--line); padding: 3px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wk-scroll { height: calc(100vh - 290px); min-height: 420px; overflow-y: auto; position: relative; }
.wk-grid { position: relative; }
.wk-times { position: relative; }
.wk-times span { position: absolute; right: 8px; transform: translateY(-50%); font: 10.5px var(--mono); color: var(--muted); }
.wk-col { position: relative; border-left: 1px solid var(--line); cursor: copy; }
.wk-col.we { background: rgba(0,0,0,.10); }
.wk-col.today { background: linear-gradient(180deg, rgba(201,162,78,.05), transparent); }
.wk-hr { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); height: 48px; pointer-events: none; }
.wk-hr::after { content: ''; position: absolute; left: 0; right: 0; top: 24px; border-top: 1px dashed color-mix(in srgb, var(--line) 55%, transparent); }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: #E5484D; z-index: 5; pointer-events: none; }
.wk-now i { position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #E5484D; }
.wk-ev { position: absolute; z-index: 2; padding: 3px 6px; border-radius: 4px; overflow: hidden; cursor: grab; font-size: 11.5px; line-height: 1.3; display: flex; flex-direction: column; user-select: none;
  background: color-mix(in srgb, var(--c) 26%, var(--surface)); border-left: 3px solid var(--c); color: var(--text); box-shadow: 0 0 0 1px var(--bg); transition: box-shadow .12s; }
.wk-ev:hover { z-index: 4; box-shadow: 0 6px 18px -6px rgba(0,0,0,.6), 0 0 0 1px var(--c); }
.wk-ev b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-ev span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-ev.past { opacity: .6; }
.wk-ev.board { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 26%, var(--surface)) 0 10px, color-mix(in srgb, var(--c) 18%, var(--surface)) 10px 20px); }
.wk-ev.dragging { opacity: .85; z-index: 6; cursor: grabbing; box-shadow: 0 14px 30px -8px #000, 0 0 0 1px var(--gold); }
.wk-ev.bk { cursor: pointer; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, var(--surface)) 0 6px, var(--surface) 6px 12px); border-left-style: dashed; }
.wk-rs { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.wk-rs::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 18px; height: 2px; margin-left: -9px; border-radius: 2px; background: var(--c); opacity: 0; }
.wk-ev:hover .wk-rs::after { opacity: .8; }
.wk-ghost { position: absolute; left: 2px; right: 2px; z-index: 3; border-radius: 4px; background: var(--gold-soft); border: 1px dashed var(--gold); color: var(--gold-hi); font: 11px var(--mono); padding: 3px 6px; pointer-events: none; }
.ical-body.v-day .wk-ev { font-size: 12.5px; }
/* год */
.ygrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 22px; padding: 18px; }
.ymh { border: 0; background: none; color: var(--gold); font: 400 17px var(--display); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; padding: 0 0 6px; }
.ymh.cur { color: var(--gold-hi); text-decoration: underline; text-underline-offset: 4px; }
/* список */
.lday { display: grid; grid-template-columns: 110px 1fr; border-bottom: 1px solid var(--line); }
.lday.past { opacity: .6; }
.lday-h { padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; border-right: 1px solid var(--line); }
.lday-h b { font: 400 30px/1 var(--display); color: var(--gold-hi); }
.lday-h span { font-size: 11px; color: var(--muted); line-height: 1.4; }
.lday.today .lday-h b { color: var(--gold); }
.lrow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.lrow:last-child { border-bottom: 0; }
.lrow:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 12%, transparent), transparent); }
.lrow > i { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); }
.lrow .lt { width: 64px; font: 11.5px/1.35 var(--mono); color: var(--text-2); }
/* поповер */
.ev-pop { position: fixed; z-index: 60; width: 330px; background: var(--surface); border: 1px solid var(--gold-line); border-radius: 6px; padding: 14px; box-shadow: 0 24px 60px -16px #000; animation: pop .16s ease; }
.ev-pop-h { display: flex; gap: 10px; align-items: flex-start; }
.ev-pop-h > i { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); }
.ev-pop-h b { font: 400 19px/1.2 var(--display); letter-spacing: .02em; }
.ev-pop-h .muted { font-size: 12px; margin-top: 3px; }
.ev-pop-img { width: 100%; height: 120px; object-fit: cover; border-radius: 4px; margin-top: 10px; border: 1px solid var(--line); }
/* форма события */
.ef-title { font-size: 16px; font-weight: 600; height: 42px; }
.ef-when { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-2); }
.ef-when .row { gap: 8px; }
.ef-when .ef-l { width: 60px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ef-when .input[type=date] { flex: 1; }
.ef-when .ef-t { width: 120px; }
@media (max-width: 1100px) { .ical { grid-template-columns: 1fr; } .ical-side { position: static; } .ygrid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- pro: консьерж, массовые действия, вербовка ---------- */
.cg-open { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 6px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg-2); color: var(--muted); cursor: pointer; font-size: 13px; }
.cg-open:hover { border-color: var(--gold-line); color: var(--text); }
.cg-open svg { width: 15px; height: 15px; }
kbd { font: 10.5px var(--mono); padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; color: var(--text-2); background: var(--surface); }
.concierge { align-items: flex-start; padding-top: 12vh; }
.cg-box { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--gold-line); border-radius: 6px; box-shadow: 0 40px 100px -20px #000; overflow: hidden; animation: pop .16s ease; }
.cg-in { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cg-in svg { width: 26px; height: 26px; flex: none; }
.cg-in input { flex: 1; border: 0; background: none; outline: none; font-size: 16px; color: var(--text); }
.cg-list { max-height: 52vh; overflow: auto; padding: 6px; }
.cg-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 4px; cursor: pointer; }
.cg-item.on { background: var(--gold-soft); }
.cg-item .t { font-weight: 600; font-size: 13.5px; }
.cg-item .s { font-size: 12px; color: var(--muted); }
.cg-ic { width: 30px; height: 30px; border-radius: 4px; display: grid; place-items: center; background: var(--surface-2); color: var(--gold); flex: none; }
.cg-ic svg { width: 15px; height: 15px; }
.cg-type { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cg-f { display: flex; gap: 14px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); background: var(--bg-2); }
.cg-f .serif { color: var(--gold); font-size: 14px; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 10px; border: 1px solid var(--gold-line); border-radius: 3px; background: var(--gold-soft); position: sticky; top: 76px; z-index: 4; }
.bulk-bar b { color: var(--gold-hi); font-size: 16px; }
.fn-stats { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.fn-stats b { color: var(--text); font-size: 14px; margin-right: 3px; }
.kb-card.cold { border-color: color-mix(in srgb, var(--urgent) 45%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--urgent) 6%, var(--surface)), var(--surface)); }
.sh-bk { cursor: grab; user-select: none; }
.sh-bk.dragging { opacity: .85; z-index: 6; cursor: grabbing; box-shadow: 0 14px 30px -8px #000, 0 0 0 1px var(--gold); }
.sh-col { cursor: copy; }
.sh-col .wk-ghost { left: 4px; right: 4px; }
.sh-bk .wk-rs { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }

/* монеты в досье — строки вместо узкой таблицы */
.pay-list { display: flex; flex-direction: column; }
.pay-row { display: grid; grid-template-columns: 82px minmax(0, 1fr) 96px auto; gap: 12px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.pay-row:last-child { border-bottom: 0; }
.pay-row:hover { background: linear-gradient(90deg, var(--gold-soft), transparent); }
.pay-date { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.pay-main { min-width: 0; }
.pay-top { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
.pay-top b { font-weight: 600; font-size: 13.5px; }
.pay-top .badge { font-size: 10.5px; padding: 1px 7px; }
.pay-period { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
/* вторая строка: кошелёк · комментарий · кто и когда — одной строкой, лишнее обрезается */
.pay-sub { display: flex; align-items: center; gap: 0 10px; margin-top: 2px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; line-height: 1.4; }
.pay-sub > span { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.pay-sub > span:first-child { flex: none; }
.pay-sub > span:not(:first-child)::before, .pay-sub .meta-line > span::before { content: '·'; margin-right: 10px; color: var(--line-2); }
.pay-sub b { color: var(--text-2); font-weight: 600; }
.pay-sub [data-pmeta], .pay-sub .meta-line { display: contents; }
.pay-sub .meta-line > span { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; }
.pay-sum { text-align: right; font-size: 14px; white-space: nowrap; }
.pay-sum.neg { color: var(--bad); }
.pay-acts { display: flex; gap: 0; opacity: .55; transition: opacity .12s; }
.pay-row:hover .pay-acts { opacity: 1; }
@media (max-width: 640px) { .pay-row { grid-template-columns: 1fr auto; } .pay-date { grid-column: 1 / -1; } .pay-acts { grid-column: 1 / -1; justify-content: flex-end; } }

/* ---------- Реестр ---------- */
.au-list { padding: 4px 0; }
.au-day { padding: 14px 18px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-lo); }
.au-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.au-row.fin { box-shadow: inset 2px 0 0 var(--gold); }
.au-time { font-size: 11.5px; color: var(--muted); width: 40px; padding-top: 5px; }
.au-h { font-size: 13px; line-height: 1.6; }
.au-h .badge { height: 19px; vertical-align: 1px; }
.au-diff { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 2px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 3px; }
.au-f { display: grid; grid-template-columns: 150px auto auto 1fr; gap: 8px; align-items: baseline; font-size: 12.5px; }
.au-f .k { color: var(--muted); }
.au-f .old { color: var(--text-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.au-f .new { color: var(--text); }
.au-f .arr { color: var(--gold); }
.au-f.money .k { color: var(--gold); font-weight: 600; }
.au-meta { font: 10.5px var(--mono); color: var(--muted); margin-top: 3px; }
.modal .au-list .au-row { padding-left: 0; padding-right: 0; }
.roles-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.roles-layout .g-item { cursor: pointer; align-items: flex-start; }
.perm-tbl td, .perm-tbl th { padding: 9px 14px; }
@media (max-width: 900px) { .roles-layout { grid-template-columns: 1fr; } .au-f { grid-template-columns: 1fr; } }
.tbl td input.input[data-k=name] { min-width: 200px; }
.tbl .toggle input:disabled + span { opacity: .45; }

/* поля при создании контракта */
.td-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.tf { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--surface); color: var(--muted); font-size: 12px; cursor: pointer; }
.tf:focus-within, .tf:hover { border-color: var(--gold-line); color: var(--text-2); }
.tf svg { width: 13px; height: 13px; flex: none; }
.tf input, .tf select { border: 0; background: none; outline: none; color: var(--text); font: 12.5px var(--sans); height: 28px; padding: 0; max-width: 170px; color-scheme: dark; }
[data-theme="light"] .tf input, [data-theme="light"] .tf select { color-scheme: light; }
.tf select { cursor: pointer; appearance: none; padding-right: 2px; }
.tf select option { background: var(--surface); color: var(--text); }
.tf-time input { width: 78px; }
.tf-wide input { width: 130px; }
.tf .flag { font-size: 13px; }
.tf-quick { display: inline-flex; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.tf-quick button { border: 0; border-right: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: 11.5px; padding: 0 9px; height: 30px; cursor: pointer; }
.tf-quick button:last-child { border-right: 0; }
.tf-quick button:hover { background: var(--gold-soft); color: var(--gold-hi); }
.td-composer.quick .td-fields { gap: 8px; }
.td-form .td-tokens { display: none; }
.td-add-btn[hidden], .td-form[hidden] { display: none !important; }

/* ---------- планирование средств ---------- */
.fc-chart { width: 100%; height: 150px; display: block; }
.fc-chart .zero { stroke: var(--line-2); stroke-dasharray: 4 4; }
.fc-chart .line { fill: none; stroke: var(--gold); stroke-width: 2; vector-effect: non-scaling-stroke; }
.fc-chart .area { fill: var(--gold-soft); }
.fc-chart circle.neg { fill: var(--bad); } .fc-chart circle.pos { fill: var(--ok); }
.fc-axis { display: flex; justify-content: space-between; font: 10.5px var(--mono); color: var(--muted); margin-top: 4px; }
.pl-day { display: flex; border-bottom: 1px solid var(--line); }
.pl-day.past { opacity: .75; }
.pl-day.today { background: var(--gold-soft); }
.pl-dh { width: 86px; flex: none; display: flex; gap: 8px; padding: 12px 14px; border-right: 1px solid var(--line); }
.pl-dh b { font: 400 28px/1 var(--display); color: var(--gold-hi); }
.pl-dh span { font-size: 11px; color: var(--muted); line-height: 1.35; }
.pl-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pl-row:last-child { border-bottom: 0; }
.pl-row.st-posted, .pl-row.st-skipped { opacity: .6; }
.pl-row.st-skipped b { text-decoration: line-through; }
.pl-kind { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; }
.pl-kind.income { background: var(--ok-soft); color: var(--ok); } .pl-kind.expense { background: var(--bad-soft); color: var(--bad); }
.pl-sum { min-width: 110px; text-align: right; } .pl-sum.income { color: var(--ok); } .pl-sum.expense { color: var(--bad); }
.pl-acts { display: flex; gap: 4px; min-width: 190px; justify-content: flex-end; }
tr.off { opacity: .5; }
.bud td { padding: 8px 14px; }
.bud tr.dim { opacity: .55; }
.bud-in { height: 30px; width: 120px; text-align: right; margin-left: auto; }
.bud-bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-bottom: 3px; }
.bud-bar i { display: block; height: 100%; border-radius: 6px; }

/* обычный режим: без подписей «обычным языком» — названия и так обычные */
[data-mode="plain"] .sub-plain, [data-mode="plain"] .login .motto { display: none !important; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-opt { border: 1px solid var(--line-2); border-radius: 6px; padding: 14px; cursor: pointer; background: var(--bg-2); display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, background .15s; }
.mode-opt:hover { border-color: var(--gold-line); }
.mode-opt.on { border-color: var(--gold); background: var(--gold-soft); }
.mode-opt b { font-size: 14px; }
.mode-opt .mp-prev { height: 70px; border-radius: 4px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 12px; }
.mode-opt .mp-prev.jw { background: radial-gradient(ellipse at 50% 0%, #2a2212, #0b0a08); color: #EBCB7E; font-family: 'Forum', serif; letter-spacing: .2em; text-transform: uppercase; border: 1px solid rgba(201,162,78,.35); }
.mode-opt .mp-prev.plain { background: radial-gradient(ellipse at 50% 0%, #2a2212, #0b0a08); color: #EDE8DE; border: 1px solid rgba(201,162,78,.35); font-family: var(--sans); letter-spacing: .04em; }
.mode-opt .mp-prev svg { width: 30px; height: 30px; }

/* история внутри записи */
.hist { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.card-b > .hist:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.hist summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.hist summary::-webkit-details-marker { display: none; }
.hist summary::before { content: '▸'; color: var(--gold); font-size: 11px; transition: transform .15s; }
.hist[open] summary::before { transform: rotate(90deg); }
.hist .hist-body { max-height: 420px; overflow: auto; }
.hist .au-row { padding: 8px 0; }
.hist .au-day { padding: 10px 0 4px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.meta-line span { display: inline-flex; align-items: center; gap: 4px; }
.meta-line svg { opacity: .7; }
.mmeta .meta-line { justify-content: center; }

.au-inline { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: 4px; font-size: 12px; color: var(--text-2); }
.au-inline i { font-style: normal; color: var(--muted); }
.au-inline.delete span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }

/* история: аккуратная вёрстка */
.au-row { gap: 10px; align-items: flex-start; }
.au-row.fin { box-shadow: none; position: relative; }
.au-row.fin::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--gold); }
.au-time { width: 44px; flex: none; padding-top: 3px; padding-left: 10px; font-size: 11px; }
.au-ava { flex: none; margin-top: 1px; }
.au-h { font-size: 13px; line-height: 1.45; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.au-h b { font-weight: 600; }
.au-h .badge { height: 18px; font-size: 10.5px; padding: 0 6px; }
.au-inline { font-size: 12px; line-height: 1.55; gap: 2px 12px; margin-top: 3px; }
.au-inline.delete { opacity: .55; }
.au-inline.delete span { text-decoration: none; }
.au-diff { padding: 6px 10px; margin: 5px 0 0; }
.au-f { grid-template-columns: 130px auto auto 1fr; font-size: 12px; }
.au-restore { flex: none; height: 26px; padding: 0 9px; font-size: 10px; align-self: flex-start; color: var(--gold-hi); }
.au-restore svg { width: 12px; height: 12px; }
.hist .au-row { padding: 9px 0; border-bottom: 1px solid var(--line); }
.hist .au-row:last-child { border-bottom: 0; }
.hist .au-day { padding: 12px 0 2px 10px; }
.hist summary .label { letter-spacing: .12em; }

/* Telegram */
.tg-bot-head { display: flex; align-items: center; gap: 12px; }
.tg-bot-head svg { width: 40px; height: 40px; flex: none; }
.tg-link-row { font-size: 13px; border-top: 1px solid var(--line); }
.tg-link-row .btn { flex: none; }
.inbox { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.inbox-list { max-height: calc(100vh - 230px); overflow: auto; }
.inbox-item { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.on { background: var(--gold-soft); }
.inbox-chat { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 420px; }
.ib-msgs { flex: 1; overflow: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.ib-msg { max-width: 72%; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; }
.ib-msg.in { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.ib-msg.out { align-self: flex-end; background: var(--gold-soft); border: 1px solid var(--gold-line); border-bottom-right-radius: 3px; }
.ib-msg .tx { white-space: pre-wrap; word-break: break-word; }
.ib-msg .tm { font-size: 10.5px; color: var(--muted); margin-top: 3px; text-align: right; }
.ib-reply { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.ib-reply textarea { min-height: 44px; resize: vertical; }
@media (max-width: 900px) { .inbox { grid-template-columns: 1fr; } }

/* поручитель: поиск участника от 3 символов */
.mpick { position: relative; }
.mpick .mpick-q { padding-right: 34px; }
.mpick .mpick-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.mpick .mpick-x[hidden] { display: none !important; }
.mpick-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface-2); border: 1px solid var(--gold-line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px; max-height: 280px; overflow: auto; }
.mpick-list[hidden] { display: none; }
.mpick-i { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 4px; cursor: pointer; }
.mpick-i.on, .mpick-i:hover { background: var(--gold-soft); }
.mpick-i .t { font-weight: 600; font-size: 13.5px; }
.mpick-i .s { color: var(--muted); font-size: 12px; }
.mpick-empty { padding: 10px; color: var(--muted); font-size: 13px; }
/* документы досье: отметки */
.doc-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }
.doc-check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.doc-marks { display: flex; flex-direction: column; gap: 3px; }
.doc-marks span { color: var(--muted); }
.doc-marks span.on { color: var(--ok); }
/* импорт досье */
.imp-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px; border: 1px dashed var(--gold-line); border-radius: var(--radius); cursor: pointer; text-align: center; transition: .15s; }
.imp-drop:hover, .imp-drop.on { background: var(--gold-soft); border-color: var(--gold); }
.imp-drop svg { color: var(--gold); width: 22px; height: 22px; }
.imp-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.imp-map label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.imp-sum > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.imp-sum b { font: 600 22px/1.1 var(--serif); color: var(--gold-hi); }
.imp-sum b.warn { color: var(--urgent); }
.imp-sum span { color: var(--muted); font-size: 12px; }
.imp-issues { max-height: 180px; overflow: auto; font-size: 13px; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.imp-prev { max-height: 300px; overflow: auto; }
@media (max-width: 640px) { .imp-sum { grid-template-columns: repeat(2, 1fr); } }
.imp-prev td.mono { white-space: nowrap; }
.imp-mode { display: flex; align-items: center; gap: 8px; }
.imp-pays { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; white-space: nowrap; }
.imp-pays i { color: var(--muted); font-style: normal; }
