:root {
  --ink: #18253a; --muted: #5f6d81; --brand: #2549bb; --brand-bg: #eaf0ff;
  --line: #e1e7f0; --background: #f5f7fb; --paper: #fff; --nav: #142440;
  --shadow: 0 12px 34px #1d31680b; --radius: 16px;
  font-family: "Inter", "SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink); background: var(--background); font-size: 15px; line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #7197ff; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.55rem); letter-spacing: -.055em; line-height: 1.14; }
h2 { font-size: 1.2rem; letter-spacing: -.025em; line-height: 1.27; }
h3 { font-size: .98rem; }
small { font-size: .79rem; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { background: var(--nav); color: white; padding: 30px 22px 22px; position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 35px; }
.brand { display: flex; gap: 11px; align-items: center; font-weight: 720; letter-spacing: -.02em; line-height: 1.26; }
.mark { height: 34px; width: 34px; display: grid; place-items: center; border-radius: 10px; background: #91a9ff; color: #142440; flex: none; font-size: .84rem; font-weight: 850; }
.brand small { color: #a9b9d7; font-weight: 450; display: block; margin-top: 3px; }
.nav { display: grid; gap: 5px; }
.nav a { color: #bac9e4; text-decoration: none; padding: 9px 11px; border-radius: 8px; display: flex; align-items: center; gap: 9px; }
.nav a:hover { background: #203552; color: white; }
.nav a[aria-current] { background: #2b4370; color: white; font-weight: 620; }
.nav .nav-count { margin-left: auto; font-size: .75rem; color: #d2ddff; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #314563; padding-top: 15px; display: grid; gap: 8px; }
.sidebar-footer button, .sidebar-footer a { color: #b9c8e2; background: none; border: 0; padding: 3px 0; text-decoration: none; text-align: left; font-size: .87rem; }
.sidebar-footer button:hover, .sidebar-footer a:hover { color: white; }
.workspace { padding: 37px clamp(20px, 4vw, 58px) 54px; width: 100%; max-width: 1570px; margin-inline: auto; }
.page-head, .section-head, .inline { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head { margin-bottom: 25px; }
.subtitle, .muted { color: var(--muted); }
.subtitle { margin-top: 7px; max-width: 720px; }
.button { appearance: none; border: 1px solid var(--line); background: white; border-radius: 9px; color: var(--ink); padding: 9px 13px; font-weight: 640; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.button:hover { background: #f3f6fc; border-color: #cbd8ee; }
.button.primary { color: white; background: var(--brand); border-color: var(--brand); }
.button.primary:hover { background: #1f3da2; }
.button.sm { font-size: .84rem; padding: 5px 9px; }
.button.linklike { border: 0; color: var(--brand); background: none; padding: 0; min-height: 26px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 21px; }
.card, .panel { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card { display: block; text-decoration: none; color: var(--ink); padding: 18px; }
.card:hover { border-color: #94a9db; }
.card .count { font-size: 2.3rem; font-weight: 720; letter-spacing: -.07em; margin: 5px 0; line-height: 1; }
.card .label { color: var(--muted); font-size: .87rem; font-weight: 610; }
.card .hint { color: var(--muted); font-size: .78rem; }
.panel { padding: 20px; }
.panel.flat { padding: 0; overflow: hidden; }
.panel + .panel { margin-top: 15px; }
.panel .section-head { margin-bottom: 15px; }
.two-cols { display: grid; grid-template-columns: 1fr minmax(260px, .75fr); gap: 15px; align-items: start; }
.two-cols .panel { margin-top: 0; }
.queue { margin: 0; padding: 0; list-style: none; }
.queue li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf0f6; }
.queue li:last-child { border-bottom: 0; padding-bottom: 0; }
.queue li .person-col { flex: 1; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; background: #eaf0ff; color: #3552a0; border-radius: 50%; font-weight: 760; font-size: .74rem; flex-shrink: 0; }
.person { color: var(--ink); font-weight: 690; border: 0; background: none; padding: 0; text-align: left; }
.person:hover { color: var(--brand); text-decoration: underline; }
.metric { padding: 11px 0; }
.metric-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 630; }
.metric-top strong { font-size: 1.03rem; }
progress { appearance: none; border: 0; width: 100%; height: 7px; background: #ecf0f9; border-radius: 20px; overflow: hidden; }
progress::-webkit-progress-bar { background: #ecf0f9; border-radius: 20px; }
progress::-webkit-progress-value { background: #6485ea; border-radius: 20px; }
progress::-moz-progress-bar { background: #6485ea; border-radius: 20px; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.filters label { flex: 1 1 150px; }
.filters label.search { flex: 2 1 245px; }
label, .field { display: grid; gap: 5px; font-weight: 610; color: #4b5b74; font-size: .86rem; }
input, select, textarea { width: 100%; max-width: 100%; border: 1px solid #cfd9e9; color: var(--ink); border-radius: 8px; background: #fff; padding: 8px 10px; }
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: #738199; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { border-bottom: 1px solid #edf0f6; padding: 11px 16px; vertical-align: middle; }
th { background: #f9fbff; color: #596a82; font-weight: 690; font-size: .76rem; white-space: nowrap; }
td { font-size: .86rem; }
td:first-child { min-width: 166px; }
td small { color: var(--muted); display: block; }
td.market { min-width: 148px; max-width: 250px; }
tbody tr:hover { background: #fbfcff; }
.pill { display: inline-flex; align-items: center; min-height: 22px; border-radius: 20px; padding: 3px 9px; color: #53657d; background: #eef2f7; font-size: .72rem; font-weight: 690; white-space: nowrap; }
.pill.dm_ready, .pill.connected, .pill.replied { color: #17614e; background: #e1f4ed; }
.pill.reopen_review, .pill.hold, .pill.blocked { color: #805718; background: #fcf3dc; }
.pill.dm_sent, .pill.pending, .pill.to_invite { color: #3154a3; background: #e6edfd; }
.pill.excluded { color: #8c414b; background: #fbeaed; }
.table-foot { padding: 12px 16px; justify-content: space-between; min-height: 58px; }
.empty { padding: 24px; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { color: #4b5b74; padding: 6px 12px; border-radius: 9px; text-decoration: none; font-weight: 650; font-size: .88rem; }
.tabs a[aria-current], .tabs a:hover { background: var(--brand-bg); color: #22479f; }
.entry { margin: 0 0 10px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; overflow-wrap: anywhere; }
.entry[open] { background: #fbfcff; }
.entry summary { font-weight: 680; color: #2f435f; }
.entry p { margin-top: 6px; }
.entry .text, .draft { white-space: pre-wrap; overflow-wrap: anywhere; }
.entry .source { display: inline-block; margin-top: 5px; }
.details-list { display: grid; grid-template-columns: minmax(105px,.4fr) 1fr; gap: 8px 13px; margin: 12px 0; }
.details-list dt { color: var(--muted); font-size: .8rem; font-weight: 660; }
.details-list dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
dialog { padding: 0; max-height: calc(100dvh - 28px); border: 1px solid var(--line); border-radius: 16px; width: min(740px, calc(100vw - 24px)); box-shadow: 0 18px 80px #10224444; color: var(--ink); }
dialog::backdrop { background: #13233a73; }
.dialog-head { position: sticky; top: 0; z-index: 1; background: white; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 18px 20px 23px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.full { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 13px; }
.form-footer { margin-top: 14px; }
.form-error { color: #a42431; margin-top: 4px; }
.draft { background: #f3f6fd; border: 1px solid #e1e8f7; padding: 12px 13px; border-radius: 9px; margin: 8px 0 10px; }
.detail-section { margin-top: 21px; }
#toast { position: fixed; z-index: 10; bottom: 22px; right: 22px; border-radius: 10px; color: white; background: #152844; padding: 10px 15px; box-shadow: var(--shadow); }
#toast:empty { display: none; }
.loading-shell, .login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); padding: 28px; }
.login-card .brand { margin-bottom: 21px; }
.login-card h1 { font-size: 1.85rem; }
.login-card .subtitle { margin-bottom: 21px; }
.history-row { padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.history-row:last-child { border-bottom: 0; }
.history-row p { white-space: pre-wrap; }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 174px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .workspace { padding-inline: 22px; }
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .layout, .two-cols { display: block; }
  .sidebar { position: static; height: auto; padding: 13px 14px; gap: 12px; }
  .sidebar-footer { display: flex; justify-content: space-between; border-top: 0; padding-top: 0; }
  .nav { display: flex; overflow: auto; gap: 3px; }
  .nav a { white-space: nowrap; padding: 6px 9px; font-size: .86rem; }
  .workspace { padding: 20px 13px 38px; }
  .two-cols .panel + .panel { margin-top: 12px; }
  .card { padding: 13px; }
  .cards { gap: 8px; }
  .panel { padding: 14px; }
  .panel.flat { padding: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .desktop-only { display: none; }
  dialog { border-radius: 12px; }
}
