:root {
  --canvas: #080d18;
  --surface: #101827;
  --surface-soft: #151f30;
  --ink: #eef4ff;
  --muted: #94a4bc;
  --line: #263247;
  --brand: #4d6dff;
  --brand-dark: #3654db;
  --teal: #1bbf91;
  --violet: #a77cff;
  --amber: #e8a338;
  --danger: #ed6277;
  --sidebar: #0c1322;
  --sidebar-hover: #18243a;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }

#app { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  background: var(--sidebar);
  color: #f4f8fd;
}

.brand-lockup { display: flex; gap: 10px; align-items: center; padding: 0 8px 26px; }
.brand-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: #1681ee; color: white; font-size: 16px; font-weight: 800; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font-size: 15px; letter-spacing: 0; }
.brand-lockup span { color: #9cacc1; font-size: 11px; margin-top: 2px; }

.primary-nav { display: grid; gap: 4px; }
.nav-link { min-height: 40px; width: 100%; display: flex; align-items: center; gap: 11px; padding: 0 10px; color: #b7c4d5; background: transparent; border: 0; border-radius: 6px; font-weight: 650; text-align: left; }
.nav-link:hover, .nav-link.active { background: var(--sidebar-hover); color: #fff; }
.nav-link .nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; background: #2d8cff; border-radius: 999px; color: #fff; font-size: 11px; }
.sidebar-bottom { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(205, 222, 240, 0.15); }
.connection-line { display: flex; gap: 8px; align-items: center; color: #aab8c8; font-size: 12px; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #93a1b2; }
.connection-dot.online { background: #22c58b; box-shadow: 0 0 0 3px rgba(34, 197, 139, 0.15); }
.connection-dot.offline { background: #e36a78; }
.quiet-button { width: 100%; min-height: 34px; margin-top: 14px; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: #c4d0df; font-size: 12px; }
.quiet-button:hover { color: #fff; }

.workspace { min-width: 0; padding: 28px 30px 40px; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 4px; color: #7a8797; font-size: 11px; font-weight: 750; letter-spacing: 0.08em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 26px; letter-spacing: 0; }
h2 { margin-bottom: 4px; font-size: 16px; }
h3 { margin-bottom: 6px; font-size: 14px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.workspace-switch { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: #7b899c; }
.workspace-switch select { width: min(175px, 24vw); height: 30px; padding: 0; border: 0; background: transparent; color: inherit; font-size: 12px; font-weight: 700; }
.workspace-switch select:focus { box-shadow: none; }

.primary-action, .secondary-action, .icon-control, .text-button, .send-button { border: 0; border-radius: 6px; }
.primary-action { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; background: var(--brand); color: #fff; font-weight: 700; }
.primary-action:hover { background: var(--brand-dark); }
.secondary-action { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; background: #fff; color: #334155; border: 1px solid var(--line); font-weight: 650; }
.secondary-action:hover { border-color: #b8c4d2; background: #f8fafc; }
.icon-control { width: 38px; height: 38px; display: inline-grid; place-items: center; color: #526174; background: #fff; border: 1px solid var(--line); }
.icon-control:hover { color: var(--brand); border-color: #b8cced; }
.icon-control.small { width: 32px; height: 32px; }
.icon-control.small svg { width: 16px; height: 16px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; color: var(--brand); background: transparent; font-size: 13px; font-weight: 700; }
.text-button svg { width: 15px; height: 15px; }
.full-width { width: 100%; }

.view { display: none; }
.view.active-view { display: block; }
.surface { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.surface-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.surface-header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card { min-height: 106px; display: flex; align-items: center; gap: 13px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.metric-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 7px; }
.metric-card.blue .metric-icon { color: var(--brand); background: #eaf3ff; }
.metric-card.teal .metric-icon { color: var(--teal); background: #e5f7f3; }
.metric-card.violet .metric-icon { color: var(--violet); background: #f0edff; }
.metric-card.amber .metric-icon { color: var(--amber); background: #fff4df; }
.metric-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-card strong { display: block; margin-top: 5px; font-size: 26px; }

.overview-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr); gap: 16px; margin-bottom: 16px; }
.bottom-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.priority-surface, .pipeline-surface, .bottom-layout > .surface { padding: 18px; }
.priority-list, .compact-list { display: grid; gap: 2px; margin-top: 14px; }
.priority-row { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; padding: 11px 4px; border: 0; border-top: 1px solid #edf1f5; background: transparent; text-align: left; }
.priority-row:hover { background: #f8fbff; }
.priority-content { min-width: 0; display: grid; gap: 3px; }
.priority-content strong { font-size: 13px; }
.priority-content small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.priority-side { display: grid; justify-items: end; gap: 4px; color: var(--muted); font-size: 11px; }
.priority-side svg { width: 15px; height: 15px; }
.pipeline-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 15px; }
.pipeline-step { min-height: 88px; display: flex; flex-direction: column; justify-content: center; padding: 12px; border: 1px solid #e7edf4; border-radius: 7px; background: var(--surface-soft); }
.pipeline-step span, .pipeline-step small { color: var(--muted); font-size: 12px; }
.pipeline-step strong { margin: 5px 0 3px; font-size: 21px; }
.compact-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 11px 0; border-top: 1px solid #edf1f5; }
.compact-row:first-child { border-top: 0; }
.compact-row strong { display: block; font-size: 13px; }
.compact-row p { overflow: hidden; margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.compact-row time { color: var(--muted); font-size: 11px; text-align: right; }

.avatar, .mini-icon { display: inline-grid; flex: 0 0 auto; place-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 800; }
.avatar.large { width: 38px; height: 38px; }
.avatar.xl { width: 60px; height: 60px; font-size: 21px; }
.avatar.instagram, .mini-icon.instagram, .channel-dot.instagram { background: #f6eaf8; color: #b03898; }
.avatar.messenger, .mini-icon.messenger, .channel-dot.messenger { background: #eaf3ff; color: #2781e4; }
.avatar.whatsapp, .mini-icon.whatsapp, .channel-dot.whatsapp { background: #e5f8ed; color: #159a59; }
.avatar.facebook, .mini-icon.facebook, .channel-dot.facebook { background: #eaf1ff; color: #3569cb; }
.avatar.unknown, .mini-icon.unknown, .channel-dot.unknown { background: #edf1f5; color: #66758a; }
.mini-icon { width: 28px; height: 28px; border-radius: 7px; }
.mini-icon.blue { color: var(--brand); background: #eaf3ff; }
.mini-icon.violet { color: var(--violet); background: #f0edff; }

.inbox-view { height: min(760px, calc(100dvh - 142px)); min-height: 560px; }
.inbox-shell { height: 100%; display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(440px, 1.55fr) minmax(245px, 0.65fr); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.inbox-list-pane, .thread-pane, .context-pane { min-width: 0; min-height: 0; }
.inbox-list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.inbox-pane-heading, .thread-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 72px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.inbox-pane-heading h2 { margin: 0; font-size: 17px; }
.inbox-pane-heading span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.account-filter { display: grid; gap: 5px; padding: 12px 14px 0; color: #718096; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.account-filter select { height: 34px; padding: 0 9px; color: #334155; font-size: 12px; font-weight: 650; letter-spacing: 0; text-transform: none; }
.search-box { display: flex; align-items: center; gap: 8px; margin: 10px 14px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; color: #7b8796; background: #fff; }
.search-box input { width: 100%; height: 36px; border: 0; outline: 0; color: var(--ink); }
.search-box svg { width: 16px; height: 16px; }
.channel-tabs { display: flex; gap: 5px; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
.channel-tab { min-width: 31px; height: 30px; display: inline-grid; place-items: center; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #6e7d90; font-size: 12px; font-weight: 700; }
.channel-tab:hover, .channel-tab.active { background: #edf5ff; color: var(--brand); border-color: #d6e7fb; }
.channel-tab.instagram { color: #bf3e92; }
.channel-tab.messenger { color: #1681ee; }
.channel-tab.whatsapp { color: #159a59; }
.channel-tab.comments { color: #8b5b21; }
.channel-tab.active { color: #165aab; }
.brand-glyph { display: grid; width: 16px; height: 16px; place-items: center; border-radius: 50%; background: currentColor; color: #fff; font-family: Arial, sans-serif; font-size: 13px; font-weight: 800; line-height: 1; }
.channel-tab svg { width: 15px; height: 15px; }
.inbox-list { flex: 1; overflow: auto; padding: 4px 7px 10px; }
.conversation-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 11px 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; }
.conversation-row:hover { background: #f5f8fb; }
.conversation-row.selected { background: #eaf3ff; }
.conversation-copy { min-width: 0; }
.row-name { display: flex; justify-content: space-between; gap: 7px; }
.row-name strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.row-name time { color: #8a97a7; font-size: 10px; white-space: nowrap; }
.row-snippet { display: block; overflow: hidden; margin-top: 4px; color: #758295; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.row-source { display: block; overflow: hidden; margin-top: 4px; color: #9a6a2b; font-size: 10px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.channel-dot { width: 23px; height: 23px; display: inline-grid; place-items: center; border-radius: 50%; }
.channel-dot svg { width: 12px; height: 12px; }

.thread-pane { display: flex; flex-direction: column; background: #fbfcfe; }
.thread-header { background: #fff; }
.mobile-back { display: none; }
.empty-thread { justify-content: center; color: var(--muted); font-size: 13px; }
.thread-person { display: flex; align-items: center; gap: 10px; }
.thread-person strong, .thread-person span { display: block; }
.thread-person strong { font-size: 14px; }
.thread-person span:not(.avatar) { display: flex; align-items: center; gap: 4px; margin-top: 3px; color: var(--muted); font-size: 12px; }
.thread-person span:not(.avatar) svg { width: 13px; height: 13px; }
.thread-actions { display: flex; gap: 6px; }
.message-thread { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 9px; padding: 20px clamp(16px, 4vw, 42px); }
.bubble { max-width: min(78%, 510px); padding: 10px 12px; border-radius: 8px; box-shadow: 0 1px 1px rgba(35, 47, 60, 0.06); }
.bubble p { margin: 0; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.bubble small { display: block; margin-top: 6px; color: #7d8998; font-size: 10px; }
.bubble.outgoing { align-self: flex-end; border-bottom-right-radius: 2px; background: #ddecff; color: #173f70; }
.bubble.incoming { align-self: flex-start; border-bottom-left-radius: 2px; background: #fff; border: 1px solid #ebeff4; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding: 12px 16px 8px; border-top: 1px solid var(--line); background: #fff; }
.composer textarea { min-height: 39px; max-height: 120px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; outline: 0; resize: vertical; }
.composer textarea:focus { border-color: #8abcf4; box-shadow: 0 0 0 3px #edf6ff; }
.send-button { width: 39px; height: 39px; display: grid; place-items: center; background: var(--brand); color: #fff; }
.send-button:hover { background: var(--brand-dark); }
.composer-hint { min-height: 28px; margin: 0; padding: 0 16px 10px; color: #7c8998; background: #fff; font-size: 11px; }

.context-pane { overflow: auto; padding: 20px 16px; border-left: 1px solid var(--line); background: #fff; }
.empty-context { margin-top: 42px; color: var(--muted); font-size: 13px; text-align: center; }
.context-profile { display: grid; justify-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); text-align: center; }
.context-profile h2 { margin: 11px 0 4px; font-size: 16px; }
.context-channel { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font-size: 12px; }
.context-channel svg { width: 14px; height: 14px; }
.context-section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.context-label { display: block; margin-bottom: 10px; color: #8491a2; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.status-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.status-button { min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #6b7889; font-size: 12px; font-weight: 700; }
.status-button.active { color: var(--brand); background: #edf6ff; border-color: #b9d9fa; }
.context-action { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid #d6e8fb; border-radius: 6px; color: #265b99; background: #f4f9ff; font-size: 12px; font-weight: 700; }
.context-action svg { width: 16px; height: 16px; }
.details dl { display: grid; gap: 9px; margin: 0; }
.details dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; color: #3b4858; font-weight: 700; text-transform: capitalize; }
.context-pane > .secondary-action { margin-top: 17px; }

.knowledge-layout { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(300px, 0.8fr); gap: 16px; margin-bottom: 16px; }
.knowledge-editor, .document-upload, .knowledge-library, .order-entry, .order-board-wrap, .followup-surface, .settings-surface { padding: 20px; }
.simple-form, .settings-form { display: grid; gap: 14px; margin-top: 18px; }
label { display: grid; gap: 7px; color: #566477; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fff; color: var(--ink); padding: 9px 10px; }
input:focus, select:focus, textarea:focus { border-color: #8bbcf2; box-shadow: 0 0 0 3px #eff7ff; }
textarea { resize: vertical; line-height: 1.45; }
.optional { color: #99a4b2; font-weight: 500; }
.form-row { display: flex; justify-content: flex-end; gap: 10px; }
.drop-zone { min-height: 142px; place-items: center; align-content: center; gap: 7px; padding: 16px; border: 1px dashed #aebfd1; border-radius: 7px; color: #657487; background: #fbfdff; text-align: center; cursor: pointer; }
.drop-zone:hover { border-color: var(--brand); color: var(--brand); background: #f4f9ff; }
.drop-zone svg { width: 30px; height: 30px; }
.drop-zone strong { color: #3b4b5e; font-size: 13px; }
.drop-zone span { font-size: 11px; }
.drop-zone input { display: none; }
.selected-file { min-height: 38px; display: flex; align-items: center; margin: 10px 0; color: var(--muted); font-size: 12px; }
.document-list { display: grid; gap: 3px; margin-top: 17px; }
.document-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 8px 0; color: inherit; text-decoration: none; border-top: 1px solid #edf1f5; }
.document-row strong, .document-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-row strong { font-size: 12px; }
.document-row small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.document-count { min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 4px; color: #64748b; background: #eef2f6; font-size: 10px; font-weight: 700; }
.document-empty { margin-top: 17px; color: var(--muted); font-size: 12px; }
.knowledge-library { margin-top: 0; }
.knowledge-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 16px; }
.knowledge-card { display: flex; justify-content: space-between; gap: 12px; min-width: 0; padding: 15px; border: 1px solid #e3eaf1; border-radius: 7px; background: #fff; }
.knowledge-card h3 { margin: 8px 0 7px; font-size: 14px; }
.knowledge-card p { margin: 0; color: #657386; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.source-chip { display: inline-flex; align-items: center; min-height: 19px; padding: 0 6px; border-radius: 4px; color: #5c45b2; background: #f0edff; font-size: 10px; font-weight: 750; text-transform: capitalize; }
.tag-line { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag-line span { padding: 3px 5px; border-radius: 4px; color: #718096; background: #f2f5f8; font-size: 10px; }
.card-actions { display: flex; gap: 5px; align-self: flex-start; }

.orders-layout { display: grid; grid-template-columns: minmax(290px, 0.58fr) minmax(0, 1.42fr); gap: 16px; margin-bottom: 16px; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.orders-board { display: grid; grid-template-columns: repeat(4, minmax(155px, 1fr)); gap: 10px; overflow: auto; margin-top: 16px; }
.order-column { min-height: 280px; padding: 10px; border: 1px solid #e7edf3; border-radius: 7px; background: #f8fafc; }
.order-column header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: #536274; font-size: 12px; font-weight: 750; }
.order-column header b { min-width: 21px; height: 21px; display: grid; place-items: center; border-radius: 4px; color: #637386; background: #e7edf4; font-size: 10px; }
.order-column > div { display: grid; gap: 8px; }
.order-card { display: grid; gap: 8px; padding: 10px; border: 1px solid #e0e7ef; border-radius: 6px; background: #fff; box-shadow: 0 2px 5px rgba(30, 45, 62, 0.03); }
.order-card strong, .order-card span { display: block; }
.order-card strong { font-size: 12px; }
.order-card span { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.order-card b { color: #245d9b; font-size: 13px; }
.order-stage-select { min-height: 31px; padding: 5px 7px; font-size: 11px; }
.empty-column { margin: 20px 0; color: #9aa6b3; font-size: 11px; text-align: center; }
.followup-surface { margin-top: 0; }
.followup-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin-top: 15px; }

.settings-surface { max-width: 880px; }
.settings-form { max-width: 720px; }
.empty-row { padding: 20px 8px; color: #8b98a7; font-size: 13px; text-align: center; }
.empty-state { margin: auto; display: grid; justify-items: center; gap: 11px; color: #8d99a8; text-align: center; }
.empty-state svg { width: 31px; height: 31px; color: #a4b1c0; }
.empty-state p { margin: 0; font-size: 13px; }

.toast { position: fixed; right: 22px; bottom: 20px; z-index: 20; max-width: min(360px, calc(100vw - 44px)); padding: 12px 14px; border-radius: 7px; color: #fff; background: #223047; box-shadow: 0 14px 30px rgba(15, 28, 44, 0.2); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: 160ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b83d52; }
.toast.warning { background: #a96913; }

.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: #edf3f8; }
.login-shell { width: min(100%, 420px); }
.login-panel { padding: 34px; border: 1px solid #d9e2ec; border-radius: 8px; background: #fff; box-shadow: 0 18px 42px rgba(31, 53, 77, .12); }
.login-brand { display: flex; align-items: center; gap: 10px; color: #1e2d42; }
.login-brand span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: #1681ee; color: #fff; font-size: 16px; font-weight: 800; }
.login-brand strong { font-size: 16px; }
.login-kicker { margin: 30px 0 7px; color: #6b7b8e; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.login-panel h1 { margin-bottom: 8px; font-size: 28px; }
.login-copy { margin: 0; color: #66758a; font-size: 14px; line-height: 1.45; }
.login-form { display: grid; gap: 15px; margin-top: 25px; }
.login-form label { gap: 7px; }
.login-form input { min-height: 42px; }
.login-error { min-height: 18px; margin: -4px 0 0; color: #bd3048; font-size: 12px; font-weight: 650; }

/* Dark operational workspace: dense enough for an inbox, without losing scanability. */
.workspace { background: var(--canvas); }
.workspace-header { padding: 0 2px; }
.eyebrow { color: #8799b6; }
.app-sidebar { border-right: 1px solid #202d42; background: #0b1220; }
.brand-symbol { background: #5b65f6; }
.nav-link { color: #a7b5cb; }
.nav-link:hover, .nav-link.active { background: #232a7b; color: #fff; }
.nav-link .nav-count { background: #5865f2; }
.sidebar-bottom { border-color: #263247; }
.quiet-button { color: #a7b5cb; }
.quiet-button:hover { color: #fff; background: #18243a; border-radius: 6px; }
.surface, .metric-card, .inbox-shell { border-color: #263247; background: #101827; box-shadow: var(--shadow); }
.surface-header p, .pipeline-step span, .pipeline-step small, .metric-card span { color: #96a6bf; }
.metric-card { background: #111a2b; }
.metric-card.blue .metric-icon { color: #76a5ff; background: #172a4a; }
.metric-card.teal .metric-icon { color: #50d7af; background: #123a36; }
.metric-card.violet .metric-icon { color: #c4a5ff; background: #2a2148; }
.metric-card.amber .metric-icon { color: #f3bc63; background: #3a2b16; }
.priority-row, .compact-row { border-color: #233046; color: var(--ink); }
.priority-row:hover, .conversation-row:hover { background: #17233a; }
.pipeline-step, .order-column { border-color: #29364b; background: #121d2e; }
.primary-action, .send-button { background: #4d5fe8; }
.primary-action:hover, .send-button:hover { background: #3d4dcc; }
.secondary-action, .icon-control, .status-button { border-color: #344158; background: #141e2e; color: #d7e2f3; }
.icon-control:hover, .secondary-action:hover { border-color: #6878fb; background: #1a2740; color: #fff; }
.text-button { color: #91a5ff; }
.inbox-shell { background: #0f1726; }
.inbox-list-pane { background: #101827; border-color: #263247; }
.thread-pane { background: #0c1422; }
.thread-header, .composer, .composer-hint { border-color: #263247; background: #101827; }
.context-pane { border-color: #263247; background: #101827; }
.account-filter { color: #8fa2be; }
.workspace-switch { border-color: #344158; background: #101827; color: #dce7f7; }
.account-filter select, .search-box, input, select, textarea { border-color: #344158; background: #0d1524; color: #edf4ff; }
.search-box { color: #9fb0c8; }
.search-box input::placeholder, textarea::placeholder { color: #708198; }
input:focus, select:focus, textarea:focus, .composer textarea:focus { border-color: #7081ff; box-shadow: 0 0 0 3px rgba(92, 111, 255, .18); }
.channel-tabs { border-color: #263247; }
.channel-tab { color: #9baac0; }
.channel-tab:hover, .channel-tab.active { background: #1b2860; border-color: #3c4eb4; color: #fff; }
.conversation-row.selected { background: #202b68; box-shadow: inset 3px 0 0 #6c7dff; }
.row-snippet, .row-source { color: #9aabc2; }
.row-source { color: #bc9bff; }
.message-thread { background: #0d1523; }
.bubble.incoming { border-color: #263247; background: #182233; color: #eff5ff; }
.bubble.outgoing { background: #384ecf; color: #fff; }
.bubble small { color: #aab9cc; }
.bubble.outgoing small { color: #dce3ff; }
.context-profile, .context-section { border-color: #263247; }
.context-label { color: #8fa2be; }
.context-action { border-color: #345f56; color: #7ae0bc; background: #12342f; }
.details dd { color: #e4edfb; }
.status-button.active { border-color: #6577ff; color: #fff; background: #27347e; }
.knowledge-card, .order-card, .drop-zone { border-color: #2b3850; background: #121c2d; }
.knowledge-card p, .document-row small, .order-card span { color: #95a7bf; }
.document-row { border-color: #263247; }
.document-count { background: #26344b; color: #d8e4f5; }
.drop-zone:hover { border-color: #6d7fff; background: #182647; }
.toast { background: #1d2b42; }
.login-body { background: #080d18; }
.login-panel { border-color: #2a3850; background: #101827; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.login-brand, .login-panel h1 { color: #f2f6ff; }
.login-copy { color: #9eafc5; }
.login-kicker { color: #899bb6; }
.login-error { color: #ff8a9b; }

@media (max-width: 1220px) {
  .inbox-shell { grid-template-columns: minmax(250px, 0.75fr) minmax(400px, 1.35fr); }
  .context-pane { display: none; }
  .knowledge-layout, .orders-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  #app { grid-template-columns: 1fr; }
  .app-sidebar { position: sticky; z-index: 5; width: 100%; height: auto; padding: 10px 14px; }
  .brand-lockup, .sidebar-bottom { display: none; }
  .primary-nav { display: flex; overflow: auto; }
  .nav-link { width: auto; flex: 0 0 auto; padding: 0 10px; }
  .workspace { padding: 20px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-layout, .bottom-layout { grid-template-columns: 1fr; }
  .inbox-view { height: min(720px, calc(100dvh - 130px)); min-height: 530px; }
  .inbox-shell { height: 100%; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.45fr); }
  .knowledge-list, .followup-list { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .workspace { padding: 16px; }
  .workspace-header { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .header-actions { width: 100%; justify-content: space-between; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 86px; padding: 12px; gap: 9px; }
  .metric-icon { width: 32px; height: 32px; }
  .metric-card strong { font-size: 21px; }
  .metric-card span { font-size: 10px; }
  .inbox-view { height: calc(100dvh - 152px); min-height: 500px; }
  .inbox-shell { height: 100%; display: grid; grid-template-columns: 1fr; overflow: hidden; }
  .inbox-list-pane { height: auto; border-right: 0; }
  .thread-pane { min-height: 0; }
  .inbox-shell[data-mobile-view="list"] .thread-pane { display: none; }
  .inbox-shell[data-mobile-view="thread"] .inbox-list-pane { display: none; }
  .mobile-back { display: inline-grid; }
  .thread-header { min-height: 64px; padding: 10px 12px; }
  .thread-person { min-width: 0; }
  .thread-person > div { min-width: 0; }
  .thread-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .thread-actions { margin-left: auto; }
  .message-thread { min-height: 0; padding: 14px; }
  .composer { padding: 10px 12px 6px; }
  .composer-hint { min-height: 23px; padding: 0 12px 8px; }
  .message-thread { padding: 16px; }
  .bubble { max-width: 87%; }
  .knowledge-layout, .orders-layout { gap: 12px; }
  .knowledge-editor, .document-upload, .knowledge-library, .order-entry, .order-board-wrap, .followup-surface, .settings-surface { padding: 16px; }
  .two-fields { grid-template-columns: 1fr; }
  .orders-board { grid-template-columns: repeat(4, minmax(145px, 1fr)); }
  .pipeline-summary { grid-template-columns: 1fr 1fr; }
}
