:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #98a2b3;
  --brand: #4f46e5;
  --brand-2: #eef2ff;
  --brand-dark: #3730a3;
  --green: #12b76a;
  --green-bg: #ecfdf3;
  --green-text: #027a48;
  --amber: #f79009;
  --amber-bg: #fffaeb;
  --amber-text: #b54708;
  --red: #f04438;
  --red-bg: #fef3f2;
  --red-text: #b42318;
  --blue-bg: #eff8ff;
  --blue-text: #175cd3;
  --gray-bg: #f2f4f7;
  --gray-text: #344054;
  --purple-bg: #f4f3ff;
  --purple-text: #5925dc;
  --sidebar: #0f1222;
  --sidebar-2: #1a1e33;
  --sidebar-text: #a5abc3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, .12), 0 4px 8px -4px rgba(16, 24, 40, .06);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; line-height: 1.55; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; }
.sidebar .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #6366f1, #22d3ee); display: grid; place-items: center; font-size: 13px; }
.sidebar .brand small { display: block; font-weight: 500; font-size: 11px; color: var(--sidebar-text); }
.bot-state { margin: 0 14px 10px; padding: 10px 12px; border-radius: 8px; background: var(--sidebar-2); display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.bot-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 6px; box-shadow: 0 0 0 3px rgba(18,183,106,.2); }
.bot-state.paused .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(247,144,9,.2); }
.bot-state button { background: transparent; border: 1px solid #333a5c; color: #fff; border-radius: 6px; padding: 3px 8px; font-size: 11px; cursor: pointer; }
.nav-group { padding: 6px 10px; }
.nav-group .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6b7194; padding: 10px 10px 6px; }
.nav-group a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--sidebar-text); font-size: 13.5px; }
.nav-group a:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.nav-group a.active { background: #262b4a; color: #fff; }
.nav-group a .ico { width: 18px; text-align: center; opacity: .85; }
.nav-group a .count { margin-left: auto; background: #333a5c; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; line-height: 18px; }
.nav-group a .count.warn { background: var(--amber); color: #1d1d1d; }
.nav-group a .count.danger { background: var(--red); }
.sidebar .foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid #22263d; font-size: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #3b4170; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 5; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); font-size: 13px; }
.topbar .search::before { content: "⌕"; position: absolute; left: 12px; top: 6px; color: var(--text-3); font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar .chip { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); }
.topbar .icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); display: grid; place-items: center; cursor: pointer; position: relative; }
.topbar .icon-btn .pip { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; }

.content { padding: 24px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 4px; font-size: 13px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.crumbs a { color: var(--text-2); }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.split-r { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.pos { color: var(--green-text); } .neg { color: var(--red-text); }

/* ---------- Cards ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-h .sub { font-size: 12px; color: var(--text-2); font-weight: 400; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.card-f { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); }

.stat { padding: 16px; }
.stat .k { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; }
.stat .v { font-size: 24px; font-weight: 650; margin-top: 6px; letter-spacing: -.02em; }
.stat .d { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 550; white-space: nowrap; background: var(--gray-bg); color: var(--gray-text); line-height: 18px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-bg); color: var(--green-text); }
.badge.amber { background: var(--amber-bg); color: var(--amber-text); }
.badge.red { background: var(--red-bg); color: var(--red-text); }
.badge.blue { background: var(--blue-bg); color: var(--blue-text); }
.badge.purple { background: var(--purple-bg); color: var(--purple-text); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; background: var(--gray-bg); color: var(--gray-text); border: 1px solid var(--border); margin: 1px 2px 1px 0; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text); font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); font-family: inherit; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--red-text); border-color: #fda29b; }
.btn.warn { color: var(--amber-text); border-color: #fec84b; background: var(--amber-bg); }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

label.f { display: block; font-size: 12.5px; font-weight: 550; color: var(--gray-text); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.field .inherit { font-size: 11.5px; color: var(--blue-text); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; background: #fff; color: var(--text); font-family: inherit;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); border-color: var(--brand); }
.input-group { display: flex; }
.input-group > span { padding: 8px 10px; border: 1px solid var(--border-strong); background: var(--panel-2); font-size: 13px; color: var(--text-2); }
.input-group > span:first-child { border-radius: 8px 0 0 8px; border-right: 0; }
.input-group > span:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.input-group > input { border-radius: 0; }
.input-group > input:first-child { border-radius: 8px 0 0 8px; }
.input-group > input:last-child { border-radius: 0 8px 8px 0; }

.switch { position: relative; width: 36px; height: 20px; display: inline-block; flex: none; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #d0d5dd; border-radius: 20px; cursor: pointer; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
.toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .t { font-weight: 550; }
.toggle-row .d { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filters input[type=text], .filters select { width: auto; min-width: 140px; padding: 6px 10px; font-size: 12.5px; }
.filters .search-in { min-width: 240px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; font-size: 13px; color: var(--text-2); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-family: inherit; font-weight: 550; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { background: var(--gray-bg); border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.card .tabs { padding: 0 12px; margin-bottom: 0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.seg { display: inline-flex; background: var(--gray-bg); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-size: 12.5px; cursor: pointer; color: var(--text-2); font-family: inherit; font-weight: 550; }
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fcfcfd; }
table.t td .s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
table.t.compact td, table.t.compact th { padding: 8px 12px; }
table.t tr.sub-row td { background: var(--panel-2); }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }

/* ---------- Key/Value ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 12px; font-size: 13px; align-content: start; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.metric-grid > div { background: #fff; padding: 12px; }
.metric-grid .k { font-size: 11.5px; color: var(--text-2); }
.metric-grid .v { font-size: 18px; font-weight: 650; margin-top: 2px; }
.metric-grid .v.unknown { color: var(--text-3); font-weight: 500; font-size: 14px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 550; }
.list .d { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.ico-c { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--gray-bg); font-size: 14px; }
.ico-c.amber { background: var(--amber-bg); } .ico-c.red { background: var(--red-bg); } .ico-c.green { background: var(--green-bg); } .ico-c.blue { background: var(--blue-bg); } .ico-c.purple { background: var(--purple-bg); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--border-strong); }
.timeline li.done::before { background: var(--green); border-color: var(--green); }
.timeline li.now::before { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-2); }
.timeline li.bad::before { background: var(--red); border-color: var(--red); }
.timeline .t { font-weight: 550; font-size: 13px; }
.timeline .d { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ---------- Progress / steps ---------- */
.bar { height: 6px; background: var(--gray-bg); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar.green > i { background: var(--green); } .bar.amber > i { background: var(--amber); }
.steps { display: flex; gap: 4px; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--gray-bg); }
.steps span.done { background: var(--green); } .steps span.now { background: var(--brand); } .steps span.bad { background: var(--red); } .steps span.wait { background: var(--amber); }

/* ---------- Callouts ---------- */
.callout { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.callout.amber { background: var(--amber-bg); border-color: #fedf89; color: #7a2e0e; }
.callout.red { background: var(--red-bg); border-color: #fecdca; color: #7a271a; }
.callout.blue { background: var(--blue-bg); border-color: #b2ddff; color: #194185; }
.callout.green { background: var(--green-bg); border-color: #a6f4c5; color: #054f31; }
.callout .grow { flex: 1; }

/* ---------- Messages (email / chat) ---------- */
.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.msg .mh { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.msg .mh .who { font-weight: 600; font-size: 13px; }
.msg .mb { padding: 14px; font-size: 13.5px; line-height: 1.6; white-space: pre-line; }
.msg.bot { border-color: #c7d2fe; }
.msg.bot .mh { background: var(--brand-2); border-radius: 10px 10px 0 0; }
.msg.owner { border-color: #fedf89; }
.msg.owner .mh { background: var(--amber-bg); border-radius: 10px 10px 0 0; }
.msg.note { background: #fffdf5; border-style: dashed; }
.attach { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; margin: 0 6px 6px 0; background: var(--panel-2); }
.composer { border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; }
.composer textarea { border: 0; border-radius: 10px 10px 0 0; min-height: 110px; }
.composer .bar-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--border); background: var(--panel-2); border-radius: 0 0 10px 10px; }

.inbox-layout { display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - 60px - 48px - 70px); min-height: 560px; }
.inbox-list { border-right: 1px solid var(--border); overflow-y: auto; }
.inbox-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); cursor: pointer; }
.inbox-item:hover { background: var(--panel-2); text-decoration: none; }
.inbox-item.active { background: var(--brand-2); box-shadow: inset 3px 0 0 var(--brand); }
.inbox-item .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.inbox-item .top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item .subj { font-size: 13px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item .prev { font-size: 12px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item .meta { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
.inbox-item.unread .subj { font-weight: 600; }
.inbox-pane { overflow-y: auto; display: flex; flex-direction: column; }

/* WhatsApp */
.wa { background: #efeae2; background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 14px 14px; border-radius: 0; padding: 20px; display: flex; flex-direction: column; gap: 8px; height: 100%; overflow-y: auto; }
.wa .b { max-width: 72%; padding: 8px 11px 6px; border-radius: 9px; font-size: 13.5px; line-height: 1.5; box-shadow: 0 1px 1px rgba(0,0,0,.08); white-space: pre-line; position: relative; }
.wa .b .tm { display: block; text-align: right; font-size: 10.5px; color: #667781; margin-top: 2px; }
.wa .in { background: #fff; align-self: flex-start; border-top-left-radius: 0; }
.wa .out { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 0; }
.wa .day { align-self: center; background: #fff; padding: 4px 10px; border-radius: 7px; font-size: 11.5px; color: #54656f; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.wa .card-in { background: #f7f8fa; border-radius: 6px; padding: 8px; margin: 6px 0 2px; border-left: 3px solid #25d366; font-size: 12.5px; }
.wa .q { background: rgba(0,0,0,.05); border-left: 3px solid #06cf9c; border-radius: 5px; padding: 5px 8px; margin-bottom: 5px; font-size: 12.5px; color: #54656f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa .q b { display: block; color: #06cf9c; font-size: 12px; }
.wa .att { background: rgba(0,0,0,.05); border-radius: 6px; padding: 9px 10px; margin-bottom: 5px; font-size: 13px; white-space: nowrap; }
.wa .att.img { height: 90px; display: grid; place-items: center; background: #cfd8dc; color: #455a64; }
.wa .b .react { position: absolute; bottom: -12px; left: 10px; background: #fff; border-radius: 12px; padding: 1px 7px; font-size: 11px; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.wa .b:has(.react) { margin-bottom: 12px; }
.wa .att.voice { color: #54656f; letter-spacing: -1px; }
.wa-head { background: #f0f2f5; padding: 10px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #e0e0e0; }
.wa-input { background: #f0f2f5; padding: 10px 14px; display: flex; gap: 10px; align-items: center; }
.wa-input input { border-radius: 20px; border: 0; padding: 10px 14px; }

/* Misc */
.empty { padding: 30px; text-align: center; color: var(--text-3); }
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-nav a { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--border); background: #fff; font-size: 12.5px; color: var(--text-2); }
.pill-nav a.active { background: var(--text); color: #fff; border-color: var(--text); }
.pill-nav a:hover { text-decoration: none; }
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.settings-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 8px 12px; border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 550; }
.settings-nav a:hover { background: #fff; text-decoration: none; }
.settings-nav a.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.section-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; margin: 4px 0 10px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .col i { display: block; width: 100%; background: linear-gradient(180deg, #818cf8, #4f46e5); border-radius: 4px 4px 0 0; }
.chart .col i.exp { background: repeating-linear-gradient(45deg, #c7d2fe, #c7d2fe 4px, #e0e7ff 4px, #e0e7ff 8px); }
.chart .col span { font-size: 11px; color: var(--text-3); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.diff-old { text-decoration: line-through; color: var(--text-3); margin-right: 6px; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 28px; text-align: center; color: var(--text-2); background: var(--panel-2); }
.conn { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-bottom: 1px solid var(--border); }
.conn:last-child { border-bottom: 0; }
.conn .logo { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 13px; }
.conn .grow { flex: 1; min-width: 0; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.5); display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); }
.modal .card-h { padding: 16px 18px; }
.modal .card-b { padding: 18px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: .2s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.mock-note { font-size: 11.5px; color: var(--text-3); text-align: center; padding: 20px 0 30px; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .l { background: var(--sidebar); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .r { display: grid; place-items: center; padding: 40px; }
.auth form { width: 100%; max-width: 360px; }

@media (max-width: 1100px) {
  .g4, .g6 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
  .split, .split-r { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .inbox-layout { grid-template-columns: 1fr; height: auto; }
  .settings-layout, .auth { grid-template-columns: 1fr; }
  .auth .l { display: none; }
}

/* ---------- App additions ---------- */
.flash { margin-bottom: 16px; }
.field .error, .error-text { font-size: 12px; color: var(--red-text); margin-top: 5px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #fda29b; }
form.inline { display: inline; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-2); }
.empty-state h3 { margin-bottom: 6px; color: var(--text); }
.check-row { display: flex; gap: 14px; flex-wrap: wrap; }
.check-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.sortable a { color: inherit; }
.bot-state form { margin: 0; }
.nav-group a .count:empty { display: none; }
.coming { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--text-2); background: var(--panel); }
.nav-group a .count.soon { background: transparent; border: 1px solid #333a5c; color: #8b91b0; font-size: 10px; }
